1 ; This file checks support for comparing vector values with the fcmp
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
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) {
18 %res.trunc = fcmp oeq <4 x float> %a, %b
19 %res = sext <4 x i1> %res.trunc to <4 x i32>
21 ; CHECK-LABEL: sextElimination:
26 define <4 x i32> @fcmpFalseVector(<4 x float> %a, <4 x float> %b) {
28 %res.trunc = fcmp false <4 x float> %a, %b
29 %res = sext <4 x i1> %res.trunc to <4 x i32>
31 ; CHECK-LABEL: fcmpFalseVector:
35 define <4 x i32> @fcmpOeqVector(<4 x float> %a, <4 x float> %b) {
37 %res.trunc = fcmp oeq <4 x float> %a, %b
38 %res = sext <4 x i1> %res.trunc to <4 x i32>
40 ; CHECK-LABEL: fcmpOeqVector:
44 define <4 x i32> @fcmpOgeVector(<4 x float> %a, <4 x float> %b) {
46 %res.trunc = fcmp oge <4 x float> %a, %b
47 %res = sext <4 x i1> %res.trunc to <4 x i32>
49 ; CHECK-LABEL: fcmpOgeVector:
53 define <4 x i32> @fcmpOgtVector(<4 x float> %a, <4 x float> %b) {
55 %res.trunc = fcmp ogt <4 x float> %a, %b
56 %res = sext <4 x i1> %res.trunc to <4 x i32>
58 ; CHECK-LABEL: fcmpOgtVector:
62 define <4 x i32> @fcmpOleVector(<4 x float> %a, <4 x float> %b) {
64 %res.trunc = fcmp ole <4 x float> %a, %b
65 %res = sext <4 x i1> %res.trunc to <4 x i32>
67 ; CHECK-LABEL: fcmpOleVector:
71 define <4 x i32> @fcmpOltVector(<4 x float> %a, <4 x float> %b) {
73 %res.trunc = fcmp olt <4 x float> %a, %b
74 %res = sext <4 x i1> %res.trunc to <4 x i32>
76 ; CHECK-LABEL: fcmpOltVector:
80 define <4 x i32> @fcmpOneVector(<4 x float> %a, <4 x float> %b) {
82 %res.trunc = fcmp one <4 x float> %a, %b
83 %res = sext <4 x i1> %res.trunc to <4 x i32>
85 ; CHECK-LABEL: fcmpOneVector:
91 define <4 x i32> @fcmpOrdVector(<4 x float> %a, <4 x float> %b) {
93 %res.trunc = fcmp ord <4 x float> %a, %b
94 %res = sext <4 x i1> %res.trunc to <4 x i32>
96 ; CHECK-LABEL: fcmpOrdVector:
100 define <4 x i32> @fcmpTrueVector(<4 x float> %a, <4 x float> %b) {
102 %res.trunc = fcmp true <4 x float> %a, %b
103 %res = sext <4 x i1> %res.trunc to <4 x i32>
105 ; CHECK-LABEL: fcmpTrueVector:
109 define <4 x i32> @fcmpUeqVector(<4 x float> %a, <4 x float> %b) {
111 %res.trunc = fcmp ueq <4 x float> %a, %b
112 %res = sext <4 x i1> %res.trunc to <4 x i32>
114 ; CHECK-LABEL: fcmpUeqVector:
120 define <4 x i32> @fcmpUgeVector(<4 x float> %a, <4 x float> %b) {
122 %res.trunc = fcmp uge <4 x float> %a, %b
123 %res = sext <4 x i1> %res.trunc to <4 x i32>
125 ; CHECK-LABEL: fcmpUgeVector:
129 define <4 x i32> @fcmpUgtVector(<4 x float> %a, <4 x float> %b) {
131 %res.trunc = fcmp ugt <4 x float> %a, %b
132 %res = sext <4 x i1> %res.trunc to <4 x i32>
134 ; CHECK-LABEL: fcmpUgtVector:
138 define <4 x i32> @fcmpUleVector(<4 x float> %a, <4 x float> %b) {
140 %res.trunc = fcmp ule <4 x float> %a, %b
141 %res = sext <4 x i1> %res.trunc to <4 x i32>
143 ; CHECK-LABEL: fcmpUleVector:
147 define <4 x i32> @fcmpUltVector(<4 x float> %a, <4 x float> %b) {
149 %res.trunc = fcmp ult <4 x float> %a, %b
150 %res = sext <4 x i1> %res.trunc to <4 x i32>
152 ; CHECK-LABEL: fcmpUltVector:
156 define <4 x i32> @fcmpUneVector(<4 x float> %a, <4 x float> %b) {
158 %res.trunc = fcmp une <4 x float> %a, %b
159 %res = sext <4 x i1> %res.trunc to <4 x i32>
161 ; CHECK-LABEL: fcmpUneVector:
165 define <4 x i32> @fcmpUnoVector(<4 x float> %a, <4 x float> %b) {
167 %res.trunc = fcmp uno <4 x float> %a, %b
168 %res = sext <4 x i1> %res.trunc to <4 x i32>
170 ; CHECK-LABEL: fcmpUnoVector:
174 ; ERRORS-NOT: ICE translation error