blob: 356fe8491b010e23d53adfb184bbf0825e957090 [file] [log] [blame]
Chris Lattner74e95472002-05-06 05:43:36 +00001; This test makes sure that these instructions are properly eliminated.
2;
3
Chris Lattnerf6f95d02002-08-02 19:27:58 +00004; RUN: if as < %s | opt -instcombine | dis | grep and
Chris Lattner74e95472002-05-06 05:43:36 +00005; RUN: then exit 1
6; RUN: else exit 0
7; RUN: fi
8
9implementation
10
11int "test1"(int %A) {
12 %B = and int %A, 0 ; zero result
13 ret int %B
14}
15
16int "test2"(int %A) {
17 %B = and int %A, -1 ; noop
18 ret int %B
19}
20
21bool "test3"(bool %A) {
22 %B = and bool %A, false ; always = false
23 ret bool %B
24}
25
26bool "test4"(bool %A) {
27 %B = and bool %A, true ; noop
28 ret bool %B
29}
30
Chris Lattner6022ad02002-05-06 05:51:26 +000031int "test5"(int %A) {
32 %B = and int %A, %A
33 ret int %B
34}
35
36bool "test6"(bool %A) {
37 %B = and bool %A, %A
38 ret bool %B
39}
Chris Lattner74e95472002-05-06 05:43:36 +000040