blob: 57560d61d6d5bfee73ffba229ce06feae9e5839d [file] [log] [blame]
Chris Lattner679da032002-05-06 17:00:47 +00001; This test makes sure that these instructions are properly eliminated.
2;
3
Chris Lattnerf9b9af02002-08-14 17:37:04 +00004; RUN: if as < %s | opt -instcombine -die | dis | grep xor
Chris Lattner679da032002-05-06 17:00:47 +00005; RUN: then exit 1
6; RUN: else exit 0
7; RUN: fi
8
9implementation
10
Chris Lattnere9e7ab52002-08-20 17:07:02 +000011int %test1(int %A) {
12 %B = xor int %A, -1
13 %C = xor int %B, -1
Chris Lattner679da032002-05-06 17:00:47 +000014 ret int %C
15}
16
Chris Lattnerf75c3332002-08-21 17:11:18 +000017bool %test2(int %A, int %B) {
18 %cond = setle int %A, %B ; Can change into setge
19 %Ret = xor bool %cond, true
20 ret bool %Ret
21}
Chris Lattnerad1e0532002-08-23 18:31:18 +000022
23
24; Test that demorgans law can be instcombined
25int %test3(int %A, int %B) {
26 %a = xor int %A, -1
27 %b = xor int %B, -1
28 %c = and int %a, %b
29 %d = xor int %c, -1
30 ret int %d
31}