1 ; Test an i64 0/-1 SELECTCCC for every floating-point condition.
3 ; RUN: llc < %s -mtriple=s390x-linux-gnu | FileCheck %s
6 define i64 @f1(float %a, float %b) {
8 ; CHECK: ipm [[REG:%r[0-5]]]
9 ; CHECK-NEXT: afi [[REG]], -268435456
10 ; CHECK-NEXT: sllg [[REG]], [[REG]], 32
11 ; CHECK-NEXT: srag %r2, [[REG]], 63
13 %cond = fcmp oeq float %a, %b
14 %res = select i1 %cond, i64 -1, i64 0
19 define i64 @f2(float %a, float %b) {
21 ; CHECK: ipm [[REG:%r[0-5]]]
22 ; CHECK-NEXT: xilf [[REG]], 268435456
23 ; CHECK-NEXT: afi [[REG]], -268435456
24 ; CHECK-NEXT: sllg [[REG]], [[REG]], 32
25 ; CHECK-NEXT: srag %r2, [[REG]], 63
27 %cond = fcmp olt float %a, %b
28 %res = select i1 %cond, i64 -1, i64 0
33 define i64 @f3(float %a, float %b) {
35 ; CHECK: ipm [[REG:%r[0-5]]]
36 ; CHECK-NEXT: afi [[REG]], -536870912
37 ; CHECK-NEXT: sllg [[REG]], [[REG]], 32
38 ; CHECK-NEXT: srag %r2, [[REG]], 63
40 %cond = fcmp ole float %a, %b
41 %res = select i1 %cond, i64 -1, i64 0
46 define i64 @f4(float %a, float %b) {
48 ; CHECK: ipm [[REG:%r[0-5]]]
49 ; CHECK-NEXT: xilf [[REG]], 268435456
50 ; CHECK-NEXT: afi [[REG]], 1342177280
51 ; CHECK-NEXT: sllg [[REG]], [[REG]], 32
52 ; CHECK-NEXT: srag %r2, [[REG]], 63
54 %cond = fcmp ogt float %a, %b
55 %res = select i1 %cond, i64 -1, i64 0
60 define i64 @f5(float %a, float %b) {
62 ; CHECK: ipm [[REG:%r[0-5]]]
63 ; CHECK-NEXT: xilf [[REG]], 4294967295
64 ; CHECK-NEXT: sllg [[REG]], [[REG]], 35
65 ; CHECK-NEXT: srag %r2, [[REG]], 63
67 %cond = fcmp oge float %a, %b
68 %res = select i1 %cond, i64 -1, i64 0
73 define i64 @f6(float %a, float %b) {
75 ; CHECK: ipm [[REG:%r[0-5]]]
76 ; CHECK-NEXT: afi [[REG]], 268435456
77 ; CHECK-NEXT: sllg [[REG]], [[REG]], 34
78 ; CHECK-NEXT: srag %r2, [[REG]], 63
80 %cond = fcmp one float %a, %b
81 %res = select i1 %cond, i64 -1, i64 0
85 ; Test CC in { 0, 1, 2 }
86 define i64 @f7(float %a, float %b) {
88 ; CHECK: ipm [[REG:%r[0-5]]]
89 ; CHECK-NEXT: afi [[REG]], -805306368
90 ; CHECK-NEXT: sllg [[REG]], [[REG]], 32
91 ; CHECK-NEXT: srag %r2, [[REG]], 63
93 %cond = fcmp ord float %a, %b
94 %res = select i1 %cond, i64 -1, i64 0
99 define i64 @f8(float %a, float %b) {
101 ; CHECK: ipm [[REG:%r[0-5]]]
102 ; CHECK-NEXT: afi [[REG]], 1342177280
103 ; CHECK-NEXT: sllg [[REG]], [[REG]], 32
104 ; CHECK-NEXT: srag %r2, [[REG]], 63
106 %cond = fcmp uno float %a, %b
107 %res = select i1 %cond, i64 -1, i64 0
111 ; Test CC in { 0, 3 }
112 define i64 @f9(float %a, float %b) {
114 ; CHECK: ipm [[REG:%r[0-5]]]
115 ; CHECK-NEXT: afi [[REG]], -268435456
116 ; CHECK-NEXT: sllg [[REG]], [[REG]], 34
117 ; CHECK-NEXT: srag %r2, [[REG]], 63
119 %cond = fcmp ueq float %a, %b
120 %res = select i1 %cond, i64 -1, i64 0
124 ; Test CC in { 1, 3 }
125 define i64 @f10(float %a, float %b) {
127 ; CHECK: ipm [[REG:%r[0-5]]]
128 ; CHECK-NEXT: sllg [[REG]], [[REG]], 35
129 ; CHECK-NEXT: srag %r2, [[REG]], 63
131 %cond = fcmp ult float %a, %b
132 %res = select i1 %cond, i64 -1, i64 0
136 ; Test CC in { 0, 1, 3 }
137 define i64 @f11(float %a, float %b) {
139 ; CHECK: ipm [[REG:%r[0-5]]]
140 ; CHECK-NEXT: xilf [[REG]], 268435456
141 ; CHECK-NEXT: afi [[REG]], -805306368
142 ; CHECK-NEXT: sllg [[REG]], [[REG]], 32
143 ; CHECK-NEXT: srag %r2, [[REG]], 63
145 %cond = fcmp ule float %a, %b
146 %res = select i1 %cond, i64 -1, i64 0
150 ; Test CC in { 2, 3 }
151 define i64 @f12(float %a, float %b) {
153 ; CHECK: ipm [[REG:%r[0-5]]]
154 ; CHECK-NEXT: sllg [[REG]], [[REG]], 34
155 ; CHECK-NEXT: srag %r2, [[REG]], 63
157 %cond = fcmp ugt float %a, %b
158 %res = select i1 %cond, i64 -1, i64 0
162 ; Test CC in { 0, 2, 3 }
163 define i64 @f13(float %a, float %b) {
165 ; CHECK: ipm [[REG:%r[0-5]]]
166 ; CHECK-NEXT: xilf [[REG]], 268435456
167 ; CHECK-NEXT: afi [[REG]], 1879048192
168 ; CHECK-NEXT: sllg [[REG]], [[REG]], 32
169 ; CHECK-NEXT: srag %r2, [[REG]], 63
171 %cond = fcmp uge float %a, %b
172 %res = select i1 %cond, i64 -1, i64 0
176 ; Test CC in { 1, 2, 3 }
177 define i64 @f14(float %a, float %b) {
179 ; CHECK: ipm [[REG:%r[0-5]]]
180 ; CHECK-NEXT: afi [[REG]], 1879048192
181 ; CHECK-NEXT: sllg [[REG]], [[REG]], 32
182 ; CHECK-NEXT: srag %r2, [[REG]], 63
184 %cond = fcmp une float %a, %b
185 %res = select i1 %cond, i64 -1, i64 0