1 ; Reassociation should apply to Add, Mul, And, Or, & Xor
3 ; RUN: opt < %s -reassociate -instcombine -dce -S | FileCheck %s
5 define i32 @test_mul(i32 %arg) {
6 ; CHECK-LABEL: test_mul
7 ; CHECK-NEXT: %tmp2 = mul i32 %arg, 144
8 ; CHECK-NEXT: ret i32 %tmp2
10 %tmp1 = mul i32 12, %arg
11 %tmp2 = mul i32 %tmp1, 12
15 define i32 @test_and(i32 %arg) {
16 ; CHECK-LABEL: test_and
17 ; CHECK-NEXT: %tmp2 = and i32 %arg, 14
18 ; CHECK-NEXT: ret i32 %tmp2
20 %tmp1 = and i32 14, %arg
21 %tmp2 = and i32 %tmp1, 14
25 define i32 @test_or(i32 %arg) {
26 ; CHECK-LABEL: test_or
27 ; CHECK-NEXT: %tmp2 = or i32 %arg, 14
28 ; CHECK-NEXT: ret i32 %tmp2
30 %tmp1 = or i32 14, %arg
31 %tmp2 = or i32 %tmp1, 14
35 define i32 @test_xor(i32 %arg) {
36 ; CHECK-LABEL: test_xor
37 ; CHECK-NEXT: ret i32 %arg
39 %tmp1 = xor i32 12, %arg
40 %tmp2 = xor i32 %tmp1, 12