blob: 9e99d2c858910865d840ba6889ac8562a6fcb72b [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001; Reassociation should apply to Add, Mul, And, Or, & Xor
2;
3; RUN: llvm-upgrade < %s | llvm-as | opt -reassociate -constprop -instcombine -die | llvm-dis | not grep 12
4
5int "test_mul"(int %arg) {
6 %tmp1 = mul int 12, %arg
7 %tmp2 = mul int %tmp1, 12
8 ret int %tmp2
9}
10
11int "test_and"(int %arg) {
12 %tmp1 = and int 14, %arg
13 %tmp2 = and int %tmp1, 14
14 ret int %tmp2
15}
16
17int "test_or"(int %arg) {
18 %tmp1 = or int 14, %arg
19 %tmp2 = or int %tmp1, 14
20 ret int %tmp2
21}
22
23int "test_xor"(int %arg) {
24 %tmp1 = xor int 12, %arg
25 %tmp2 = xor int %tmp1, 12
26 ret int %tmp2
27}
28