Use the llvm-upgrade program to upgrade llvm assembly.
[oota-llvm.git] / test / Transforms / InstCombine / not.ll
1 ; This test makes sure that these instructions are properly eliminated.
2 ;
3
4 ; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep xor
5
6 implementation
7
8 int %test1(int %A) {
9         %B = xor int %A, -1
10         %C = xor int %B, -1
11         ret int %C
12 }
13
14 bool %test2(int %A, int %B) {
15         %cond = setle int %A, %B     ; Can change into setge
16         %Ret = xor bool %cond, true
17         ret bool %Ret
18 }
19
20
21 ; Test that demorgans law can be instcombined
22 int %test3(int %A, int %B) {
23         %a = xor int %A, -1
24         %b = xor int %B, -1
25         %c = and int %a, %b
26         %d = xor int %c, -1
27         ret int %d
28 }
29
30 ; Test that demorgens law can work with constants
31 int %test4(int %A, int %B) {
32         %a = xor int %A, -1
33         %c = and int %a, 5    ; 5 = ~c2
34         %d = xor int %c, -1
35         ret int %d
36 }
37
38 ; test the mirror of demorgans law...
39 int %test5(int %A, int %B) {
40         %a = xor int %A, -1
41         %b = xor int %B, -1
42         %c = or int %a, %b
43         %d = xor int %c, -1
44         ret int %d
45 }