Add testcase for reason that typesafety of power is being broken
[oota-llvm.git] / test / Transforms / InstCombine / not.ll
1 ; This test makes sure that these instructions are properly eliminated.
2 ;
3
4 ; RUN: if as < %s | opt -instcombine -die | dis | grep xor
5 ; RUN: then exit 1
6 ; RUN: else exit 0
7 ; RUN: fi
8
9 implementation
10
11 int %test1(int %A) {
12         %B = xor int %A, -1
13         %C = xor int %B, -1
14         ret int %C
15 }
16
17 bool %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 }
22
23
24 ; Test that demorgans law can be instcombined
25 int %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 }
32
33 ; Test that demorgens law can work with constants
34 int %test4(int %A, int %B) {
35         %a = xor int %A, -1
36         %c = and int %a, 5    ; 5 = ~c2
37         %d = xor int %c, -1
38         ret int %d
39 }
40
41 ; test the mirror of demorgans law...
42 int %test5(int %A, int %B) {
43         %a = xor int %A, -1
44         %b = xor int %B, -1
45         %c = or int %a, %b
46         %d = xor int %c, -1
47         ret int %d
48 }