7182e1f72acea65299ff3724378c35c05ae7b565
[oota-llvm.git] / test / Transforms / Reassociate / otherops.ll
1 ; Reassociation should apply to Add, Mul, And, Or, & Xor
2 ;
3 ; RUN: if as < %s | opt -reassociate -constprop -instcombine -die | dis | grep 12
4 ; RUN: then exit 1
5 ; RUN: else exit 0
6 ; RUN: fi
7
8 int "test_mul"(int %arg) {
9         %tmp1 = mul int 12, %arg
10         %tmp2 = mul int %tmp1, 12
11         ret int %tmp2
12 }
13
14 int "test_and"(int %arg) {
15         %tmp1 = and int 14, %arg
16         %tmp2 = and int %tmp1, 14
17         ret int %tmp2
18 }
19
20 int "test_or"(int %arg) {
21         %tmp1 = or int 14, %arg
22         %tmp2 = or int %tmp1, 14
23         ret int %tmp2
24 }
25
26 int "test_xor"(int %arg) {
27         %tmp1 = xor int 12, %arg
28         %tmp2 = xor int %tmp1, 12
29         ret int %tmp2
30 }
31