Fix a latent bug exposed by my truncstore patch. We compiled stfiwx-2.ll to:
[oota-llvm.git] / test / CodeGen / PowerPC / eqv-andc-orc-nor.ll
1 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | \
2 ; RUN:   grep eqv | count 3
3 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mcpu=g5 | \
4 ; RUN:   grep andc | count 3
5 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | \
6 ; RUN:   grep orc | count 2
7 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mcpu=g5 | \
8 ; RUN:   grep nor | count 3
9 ; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | \
10 ; RUN:   grep nand | count 1
11
12 int %EQV1(int %X, int %Y) {
13         %A = xor int %X, %Y
14         %B = xor int %A, -1
15         ret int %B
16 }
17
18 int %EQV2(int %X, int %Y) {
19         %A = xor int %X, -1
20         %B = xor int %A, %Y
21         ret int %B
22 }
23
24 int %EQV3(int %X, int %Y) {
25         %A = xor int %X, -1
26         %B = xor int %Y, %A
27         ret int %B
28 }
29
30 int %ANDC1(int %X, int %Y) {
31         %A = xor int %Y, -1
32         %B = and int %X, %A
33         ret int %B
34 }
35
36 int %ANDC2(int %X, int %Y) {
37         %A = xor int %X, -1
38         %B = and int %A, %Y
39         ret int %B
40 }
41
42 int %ORC1(int %X, int %Y) {
43         %A = xor int %Y, -1
44         %B = or  int %X, %A
45         ret int %B
46 }
47
48 int %ORC2(int %X, int %Y) {
49         %A = xor int %X, -1
50         %B = or  int %A, %Y
51         ret int %B
52 }
53
54 int %NOR1(int %X) {
55         %Y = xor int %X, -1
56         ret int %Y
57 }
58
59 int %NOR2(int %X, int %Y) {
60         %Z = or int %X, %Y
61         %R = xor int %Z, -1
62         ret int %R
63 }
64
65 int %NAND1(int %X, int %Y) {
66         %Z = and int %X, %Y
67         %W = xor int %Z, -1
68         ret int %W
69 }
70
71 void %VNOR(<4 x float>* %P, <4 x float>* %Q) {
72         %tmp = load <4 x float>* %P
73         %tmp = cast <4 x float> %tmp to <4 x int>
74         %tmp2 = load <4 x float>* %Q
75         %tmp2 = cast <4 x float> %tmp2 to <4 x int>
76         %tmp3 = or <4 x int> %tmp, %tmp2
77         %tmp4 = xor <4 x int> %tmp3, < int -1, int -1, int -1, int -1 >
78         %tmp4 = cast <4 x int> %tmp4 to <4 x float>
79         store <4 x float> %tmp4, <4 x float>* %P
80         ret void
81 }
82
83 void %VANDC(<4 x float>* %P, <4 x float>* %Q) {
84         %tmp = load <4 x float>* %P
85         %tmp = cast <4 x float> %tmp to <4 x int>
86         %tmp2 = load <4 x float>* %Q
87         %tmp2 = cast <4 x float> %tmp2 to <4 x int>
88         %tmp4 = xor <4 x int> %tmp2, < int -1, int -1, int -1, int -1 >
89         %tmp3 = and <4 x int> %tmp, %tmp4
90         %tmp4 = cast <4 x int> %tmp3 to <4 x float>
91         store <4 x float> %tmp4, <4 x float>* %P
92         ret void
93 }
94