xref: /llvm-project/llvm/test/Transforms/Reassociate/shifttest.ll (revision 97b12df2cc27e1ef376692a0c5b62e1f2e793970)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2; RUN: opt < %s -passes=reassociate,instcombine -S | FileCheck %s
3
4; With shl->mul reassociation, we can see that this is (shl A, 9) * A
5define i32 @test(i32 %A) {
6; CHECK-LABEL: define i32 @test(
7; CHECK-SAME: i32 [[A:%.*]]) {
8; CHECK-NEXT:    [[Y:%.*]] = shl i32 [[A]], 9
9; CHECK-NEXT:    [[Z:%.*]] = mul i32 [[Y]], [[A]]
10; CHECK-NEXT:    ret i32 [[Z]]
11;
12  %X = shl i32 %A, 5		; <i32> [#uses=1]
13  %Y = shl i32 %A, 4		; <i32> [#uses=1]
14  %Z = mul i32 %Y, %X		; <i32> [#uses=1]
15  ret i32 %Z
16}
17
18