blob: a42140be2805203a338a680e28fc553388bb7c6c [file] [log] [blame]
Chandler Carrutha5a29f92012-07-02 12:47:22 +00001; RUN: opt < %s -instcombine -S | grep "and i32 %x, %y" | count 4
2; RUN: opt < %s -instcombine -S | not grep "or"
Bill Wendling9eef4212008-11-30 13:08:13 +00003
4define i32 @func1(i32 %x, i32 %y) nounwind {
5entry:
6 %n = xor i32 %y, -1
7 %o = or i32 %n, %x
8 %a = and i32 %o, %y
9 ret i32 %a
10}
11
12define i32 @func2(i32 %x, i32 %y) nounwind {
13entry:
14 %n = xor i32 %y, -1
15 %o = or i32 %x, %n
16 %a = and i32 %o, %y
17 ret i32 %a
18}
19
20define i32 @func3(i32 %x, i32 %y) nounwind {
21entry:
22 %n = xor i32 %y, -1
23 %o = or i32 %n, %x
24 %a = and i32 %y, %o
25 ret i32 %a
26}
27
28define i32 @func4(i32 %x, i32 %y) nounwind {
29entry:
30 %n = xor i32 %y, -1
31 %o = or i32 %x, %n
32 %a = and i32 %y, %o
33 ret i32 %a
34}