New testcases so I don't forget about these algebraic simplifications
[oota-llvm.git] / test / Transforms / InstCombine / and.ll
1 ; This test makes sure that these instructions are properly eliminated.
2 ;
3
4 ; RUN: if as < %s | opt -instcombine -dce | dis | grep and
5 ; RUN: then exit 1
6 ; RUN: else exit 0
7 ; RUN: fi
8
9 implementation
10
11 int "test1"(int %A) {
12         %B = and int %A, 0     ; zero result
13         ret int %B
14 }
15
16 int "test2"(int %A) {
17         %B = and int %A, -1    ; noop
18         ret int %B
19 }
20
21 bool "test3"(bool %A) {
22         %B = and bool %A, false  ; always = false
23         ret bool %B
24 }
25
26 bool "test4"(bool %A) {
27         %B = and bool %A, true  ; noop
28         ret bool %B
29 }
30
31