1 ; Test SETCC for every floating-point condition. The tests here assume that
2 ; RISBLG isn't available.
4 ; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s
7 define i32 @f1(float %a, float %b) {
10 ; CHECK-NEXT: afi %r2, -268435456
11 ; CHECK-NEXT: srl %r2, 31
13 %cond = fcmp oeq float %a, %b
14 %res = zext i1 %cond to i32
19 define i32 @f2(float %a, float %b) {
22 ; CHECK-NEXT: xilf %r2, 268435456
23 ; CHECK-NEXT: afi %r2, -268435456
24 ; CHECK-NEXT: srl %r2, 31
26 %cond = fcmp olt float %a, %b
27 %res = zext i1 %cond to i32
32 define i32 @f3(float %a, float %b) {
35 ; CHECK-NEXT: afi %r2, -536870912
36 ; CHECK-NEXT: srl %r2, 31
38 %cond = fcmp ole float %a, %b
39 %res = zext i1 %cond to i32
44 define i32 @f4(float %a, float %b) {
47 ; CHECK-NEXT: xilf %r2, 268435456
48 ; CHECK-NEXT: afi %r2, 1342177280
49 ; CHECK-NEXT: srl %r2, 31
51 %cond = fcmp ogt float %a, %b
52 %res = zext i1 %cond to i32
57 define i32 @f5(float %a, float %b) {
59 ; CHECK: ipm [[REG:%r[0-5]]]
60 ; CHECK-NEXT: xilf [[REG]], 4294967295
61 ; CHECK-NEXT: risbg %r2, [[REG]], 63, 191, 36
63 %cond = fcmp oge float %a, %b
64 %res = zext i1 %cond to i32
69 define i32 @f6(float %a, float %b) {
71 ; CHECK: ipm [[REG:%r[0-5]]]
72 ; CHECK-NEXT: afi [[REG]], 268435456
73 ; CHECK-NEXT: risbg %r2, [[REG]], 63, 191, 35
75 %cond = fcmp one float %a, %b
76 %res = zext i1 %cond to i32
80 ; Test CC in { 0, 1, 2 }
81 define i32 @f7(float %a, float %b) {
84 ; CHECK-NEXT: afi %r2, -805306368
85 ; CHECK-NEXT: srl %r2, 31
87 %cond = fcmp ord float %a, %b
88 %res = zext i1 %cond to i32
93 define i32 @f8(float %a, float %b) {
96 ; CHECK-NEXT: afi %r2, 1342177280
97 ; CHECK-NEXT: srl %r2, 31
99 %cond = fcmp uno float %a, %b
100 %res = zext i1 %cond to i32
104 ; Test CC in { 0, 3 }
105 define i32 @f9(float %a, float %b) {
107 ; CHECK: ipm [[REG:%r[0-5]]]
108 ; CHECK-NEXT: afi [[REG]], -268435456
109 ; CHECK-NEXT: risbg %r2, [[REG]], 63, 191, 35
111 %cond = fcmp ueq float %a, %b
112 %res = zext i1 %cond to i32
116 ; Test CC in { 1, 3 }
117 define i32 @f10(float %a, float %b) {
119 ; CHECK: ipm [[REG:%r[0-5]]]
120 ; CHECK-NEXT: risbg %r2, [[REG]], 63, 191, 36
122 %cond = fcmp ult float %a, %b
123 %res = zext i1 %cond to i32
127 ; Test CC in { 0, 1, 3 }
128 define i32 @f11(float %a, float %b) {
131 ; CHECK-NEXT: xilf %r2, 268435456
132 ; CHECK-NEXT: afi %r2, -805306368
133 ; CHECK-NEXT: srl %r2, 31
135 %cond = fcmp ule float %a, %b
136 %res = zext i1 %cond to i32
140 ; Test CC in { 2, 3 }
141 define i32 @f12(float %a, float %b) {
143 ; CHECK: ipm [[REG:%r[0-5]]]
144 ; CHECK-NEXT: risbg %r2, [[REG]], 63, 191, 35
146 %cond = fcmp ugt float %a, %b
147 %res = zext i1 %cond to i32
151 ; Test CC in { 0, 2, 3 }
152 define i32 @f13(float %a, float %b) {
155 ; CHECK-NEXT: xilf %r2, 268435456
156 ; CHECK-NEXT: afi %r2, 1879048192
157 ; CHECK-NEXT: srl %r2, 31
159 %cond = fcmp uge float %a, %b
160 %res = zext i1 %cond to i32
164 ; Test CC in { 1, 2, 3 }
165 define i32 @f14(float %a, float %b) {
168 ; CHECK-NEXT: afi %r2, 1879048192
169 ; CHECK-NEXT: srl %r2, 31
171 %cond = fcmp une float %a, %b
172 %res = zext i1 %cond to i32