OSDN Git Service

Subzero: Switch to AT&T asm syntax. I give up.
[android-x86/external-swiftshader.git] / tests_lit / llvm2ice_tests / vector-fcmp.ll
1 ; This file checks support for comparing vector values with the fcmp
2 ; instruction.
3
4 ; RUN: %p2i -i %s -a -O2 --verbose none \
5 ; RUN:   | llvm-mc -triple=i686-none-nacl -filetype=obj \
6 ; RUN:   | llvm-objdump -d --symbolize -x86-asm-syntax=intel - | FileCheck %s
7 ; RUN: %p2i -i %s -a -Om1 --verbose none \
8 ; RUN:   | llvm-mc -triple=i686-none-nacl -filetype=obj \
9 ; RUN:   | llvm-objdump -d --symbolize -x86-asm-syntax=intel - | FileCheck %s
10 ; RUN: %p2i -i %s -a --verbose none | FileCheck --check-prefix=ERRORS %s
11 ; RUN: %p2i -i %s --insts | %szdiff %s | FileCheck --check-prefix=DUMP %s
12
13 ; Check that sext elimination occurs when the result of the comparison
14 ; instruction is alrady sign extended.  Sign extension to 4 x i32 uses
15 ; the pslld instruction.
16 define <4 x i32> @sextElimination(<4 x float> %a, <4 x float> %b) {
17 entry:
18   %res.trunc = fcmp oeq <4 x float> %a, %b
19   %res = sext <4 x i1> %res.trunc to <4 x i32>
20   ret <4 x i32> %res
21 ; CHECK-LABEL: sextElimination:
22 ; CHECK: cmpeqps
23 ; CHECK-NOT: pslld
24 }
25
26 define <4 x i32> @fcmpFalseVector(<4 x float> %a, <4 x float> %b) {
27 entry:
28   %res.trunc = fcmp false <4 x float> %a, %b
29   %res = sext <4 x i1> %res.trunc to <4 x i32>
30   ret <4 x i32> %res
31 ; CHECK-LABEL: fcmpFalseVector:
32 ; CHECK: pxor
33 }
34
35 define <4 x i32> @fcmpOeqVector(<4 x float> %a, <4 x float> %b) {
36 entry:
37   %res.trunc = fcmp oeq <4 x float> %a, %b
38   %res = sext <4 x i1> %res.trunc to <4 x i32>
39   ret <4 x i32> %res
40 ; CHECK-LABEL: fcmpOeqVector:
41 ; CHECK: cmpeqps
42 }
43
44 define <4 x i32> @fcmpOgeVector(<4 x float> %a, <4 x float> %b) {
45 entry:
46   %res.trunc = fcmp oge <4 x float> %a, %b
47   %res = sext <4 x i1> %res.trunc to <4 x i32>
48   ret <4 x i32> %res
49 ; CHECK-LABEL: fcmpOgeVector:
50 ; CHECK: cmpleps
51 }
52
53 define <4 x i32> @fcmpOgtVector(<4 x float> %a, <4 x float> %b) {
54 entry:
55   %res.trunc = fcmp ogt <4 x float> %a, %b
56   %res = sext <4 x i1> %res.trunc to <4 x i32>
57   ret <4 x i32> %res
58 ; CHECK-LABEL: fcmpOgtVector:
59 ; CHECK: cmpltps
60 }
61
62 define <4 x i32> @fcmpOleVector(<4 x float> %a, <4 x float> %b) {
63 entry:
64   %res.trunc = fcmp ole <4 x float> %a, %b
65   %res = sext <4 x i1> %res.trunc to <4 x i32>
66   ret <4 x i32> %res
67 ; CHECK-LABEL: fcmpOleVector:
68 ; CHECK: cmpleps
69 }
70
71 define <4 x i32> @fcmpOltVector(<4 x float> %a, <4 x float> %b) {
72 entry:
73   %res.trunc = fcmp olt <4 x float> %a, %b
74   %res = sext <4 x i1> %res.trunc to <4 x i32>
75   ret <4 x i32> %res
76 ; CHECK-LABEL: fcmpOltVector:
77 ; CHECK: cmpltps
78 }
79
80 define <4 x i32> @fcmpOneVector(<4 x float> %a, <4 x float> %b) {
81 entry:
82   %res.trunc = fcmp one <4 x float> %a, %b
83   %res = sext <4 x i1> %res.trunc to <4 x i32>
84   ret <4 x i32> %res
85 ; CHECK-LABEL: fcmpOneVector:
86 ; CHECK: cmpneqps
87 ; CHECK: cmpordps
88 ; CHECK: pand
89 }
90
91 define <4 x i32> @fcmpOrdVector(<4 x float> %a, <4 x float> %b) {
92 entry:
93   %res.trunc = fcmp ord <4 x float> %a, %b
94   %res = sext <4 x i1> %res.trunc to <4 x i32>
95   ret <4 x i32> %res
96 ; CHECK-LABEL: fcmpOrdVector:
97 ; CHECK: cmpordps
98 }
99
100 define <4 x i32> @fcmpTrueVector(<4 x float> %a, <4 x float> %b) {
101 entry:
102   %res.trunc = fcmp true <4 x float> %a, %b
103   %res = sext <4 x i1> %res.trunc to <4 x i32>
104   ret <4 x i32> %res
105 ; CHECK-LABEL: fcmpTrueVector:
106 ; CHECK: pcmpeqd
107 }
108
109 define <4 x i32> @fcmpUeqVector(<4 x float> %a, <4 x float> %b) {
110 entry:
111   %res.trunc = fcmp ueq <4 x float> %a, %b
112   %res = sext <4 x i1> %res.trunc to <4 x i32>
113   ret <4 x i32> %res
114 ; CHECK-LABEL: fcmpUeqVector:
115 ; CHECK: cmpeqps
116 ; CHECK: cmpunordps
117 ; CHECK: por
118 }
119
120 define <4 x i32> @fcmpUgeVector(<4 x float> %a, <4 x float> %b) {
121 entry:
122   %res.trunc = fcmp uge <4 x float> %a, %b
123   %res = sext <4 x i1> %res.trunc to <4 x i32>
124   ret <4 x i32> %res
125 ; CHECK-LABEL: fcmpUgeVector:
126 ; CHECK: cmpnltps
127 }
128
129 define <4 x i32> @fcmpUgtVector(<4 x float> %a, <4 x float> %b) {
130 entry:
131   %res.trunc = fcmp ugt <4 x float> %a, %b
132   %res = sext <4 x i1> %res.trunc to <4 x i32>
133   ret <4 x i32> %res
134 ; CHECK-LABEL: fcmpUgtVector:
135 ; CHECK: cmpnleps
136 }
137
138 define <4 x i32> @fcmpUleVector(<4 x float> %a, <4 x float> %b) {
139 entry:
140   %res.trunc = fcmp ule <4 x float> %a, %b
141   %res = sext <4 x i1> %res.trunc to <4 x i32>
142   ret <4 x i32> %res
143 ; CHECK-LABEL: fcmpUleVector:
144 ; CHECK: cmpnltps
145 }
146
147 define <4 x i32> @fcmpUltVector(<4 x float> %a, <4 x float> %b) {
148 entry:
149   %res.trunc = fcmp ult <4 x float> %a, %b
150   %res = sext <4 x i1> %res.trunc to <4 x i32>
151   ret <4 x i32> %res
152 ; CHECK-LABEL: fcmpUltVector:
153 ; CHECK: cmpnleps
154 }
155
156 define <4 x i32> @fcmpUneVector(<4 x float> %a, <4 x float> %b) {
157 entry:
158   %res.trunc = fcmp une <4 x float> %a, %b
159   %res = sext <4 x i1> %res.trunc to <4 x i32>
160   ret <4 x i32> %res
161 ; CHECK-LABEL: fcmpUneVector:
162 ; CHECK: cmpneqps
163 }
164
165 define <4 x i32> @fcmpUnoVector(<4 x float> %a, <4 x float> %b) {
166 entry:
167   %res.trunc = fcmp uno <4 x float> %a, %b
168   %res = sext <4 x i1> %res.trunc to <4 x i32>
169   ret <4 x i32> %res
170 ; CHECK-LABEL: fcmpUnoVector:
171 ; CHECK: cmpunordps
172 }
173
174 ; ERRORS-NOT: ICE translation error
175 ; DUMP-NOT: SZ
176