1*f4a2713aSLionel Sambuc; Test SETCC for every floating-point condition. The tests here assume that 2*f4a2713aSLionel Sambuc; RISBLG isn't available. 3*f4a2713aSLionel Sambuc; 4*f4a2713aSLionel Sambuc; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | FileCheck %s 5*f4a2713aSLionel Sambuc 6*f4a2713aSLionel Sambuc; Test CC in { 0 } 7*f4a2713aSLionel Sambucdefine i32 @f1(float %a, float %b) { 8*f4a2713aSLionel Sambuc; CHECK-LABEL: f1: 9*f4a2713aSLionel Sambuc; CHECK: ipm %r2 10*f4a2713aSLionel Sambuc; CHECK-NEXT: afi %r2, -268435456 11*f4a2713aSLionel Sambuc; CHECK-NEXT: srl %r2, 31 12*f4a2713aSLionel Sambuc; CHECK: br %r14 13*f4a2713aSLionel Sambuc %cond = fcmp oeq float %a, %b 14*f4a2713aSLionel Sambuc %res = zext i1 %cond to i32 15*f4a2713aSLionel Sambuc ret i32 %res 16*f4a2713aSLionel Sambuc} 17*f4a2713aSLionel Sambuc 18*f4a2713aSLionel Sambuc; Test CC in { 1 } 19*f4a2713aSLionel Sambucdefine i32 @f2(float %a, float %b) { 20*f4a2713aSLionel Sambuc; CHECK-LABEL: f2: 21*f4a2713aSLionel Sambuc; CHECK: ipm %r2 22*f4a2713aSLionel Sambuc; CHECK-NEXT: xilf %r2, 268435456 23*f4a2713aSLionel Sambuc; CHECK-NEXT: afi %r2, -268435456 24*f4a2713aSLionel Sambuc; CHECK-NEXT: srl %r2, 31 25*f4a2713aSLionel Sambuc; CHECK: br %r14 26*f4a2713aSLionel Sambuc %cond = fcmp olt float %a, %b 27*f4a2713aSLionel Sambuc %res = zext i1 %cond to i32 28*f4a2713aSLionel Sambuc ret i32 %res 29*f4a2713aSLionel Sambuc} 30*f4a2713aSLionel Sambuc 31*f4a2713aSLionel Sambuc; Test CC in { 0, 1 } 32*f4a2713aSLionel Sambucdefine i32 @f3(float %a, float %b) { 33*f4a2713aSLionel Sambuc; CHECK-LABEL: f3: 34*f4a2713aSLionel Sambuc; CHECK: ipm %r2 35*f4a2713aSLionel Sambuc; CHECK-NEXT: afi %r2, -536870912 36*f4a2713aSLionel Sambuc; CHECK-NEXT: srl %r2, 31 37*f4a2713aSLionel Sambuc; CHECK: br %r14 38*f4a2713aSLionel Sambuc %cond = fcmp ole float %a, %b 39*f4a2713aSLionel Sambuc %res = zext i1 %cond to i32 40*f4a2713aSLionel Sambuc ret i32 %res 41*f4a2713aSLionel Sambuc} 42*f4a2713aSLionel Sambuc 43*f4a2713aSLionel Sambuc; Test CC in { 2 } 44*f4a2713aSLionel Sambucdefine i32 @f4(float %a, float %b) { 45*f4a2713aSLionel Sambuc; CHECK-LABEL: f4: 46*f4a2713aSLionel Sambuc; CHECK: ipm %r2 47*f4a2713aSLionel Sambuc; CHECK-NEXT: xilf %r2, 268435456 48*f4a2713aSLionel Sambuc; CHECK-NEXT: afi %r2, 1342177280 49*f4a2713aSLionel Sambuc; CHECK-NEXT: srl %r2, 31 50*f4a2713aSLionel Sambuc; CHECK: br %r14 51*f4a2713aSLionel Sambuc %cond = fcmp ogt float %a, %b 52*f4a2713aSLionel Sambuc %res = zext i1 %cond to i32 53*f4a2713aSLionel Sambuc ret i32 %res 54*f4a2713aSLionel Sambuc} 55*f4a2713aSLionel Sambuc 56*f4a2713aSLionel Sambuc; Test CC in { 0, 2 } 57*f4a2713aSLionel Sambucdefine i32 @f5(float %a, float %b) { 58*f4a2713aSLionel Sambuc; CHECK-LABEL: f5: 59*f4a2713aSLionel Sambuc; CHECK: ipm [[REG:%r[0-5]]] 60*f4a2713aSLionel Sambuc; CHECK-NEXT: xilf [[REG]], 4294967295 61*f4a2713aSLionel Sambuc; CHECK-NEXT: risbg %r2, [[REG]], 63, 191, 36 62*f4a2713aSLionel Sambuc; CHECK: br %r14 63*f4a2713aSLionel Sambuc %cond = fcmp oge float %a, %b 64*f4a2713aSLionel Sambuc %res = zext i1 %cond to i32 65*f4a2713aSLionel Sambuc ret i32 %res 66*f4a2713aSLionel Sambuc} 67*f4a2713aSLionel Sambuc 68*f4a2713aSLionel Sambuc; Test CC in { 1, 2 } 69*f4a2713aSLionel Sambucdefine i32 @f6(float %a, float %b) { 70*f4a2713aSLionel Sambuc; CHECK-LABEL: f6: 71*f4a2713aSLionel Sambuc; CHECK: ipm [[REG:%r[0-5]]] 72*f4a2713aSLionel Sambuc; CHECK-NEXT: afi [[REG]], 268435456 73*f4a2713aSLionel Sambuc; CHECK-NEXT: risbg %r2, [[REG]], 63, 191, 35 74*f4a2713aSLionel Sambuc; CHECK: br %r14 75*f4a2713aSLionel Sambuc %cond = fcmp one float %a, %b 76*f4a2713aSLionel Sambuc %res = zext i1 %cond to i32 77*f4a2713aSLionel Sambuc ret i32 %res 78*f4a2713aSLionel Sambuc} 79*f4a2713aSLionel Sambuc 80*f4a2713aSLionel Sambuc; Test CC in { 0, 1, 2 } 81*f4a2713aSLionel Sambucdefine i32 @f7(float %a, float %b) { 82*f4a2713aSLionel Sambuc; CHECK-LABEL: f7: 83*f4a2713aSLionel Sambuc; CHECK: ipm %r2 84*f4a2713aSLionel Sambuc; CHECK-NEXT: afi %r2, -805306368 85*f4a2713aSLionel Sambuc; CHECK-NEXT: srl %r2, 31 86*f4a2713aSLionel Sambuc; CHECK: br %r14 87*f4a2713aSLionel Sambuc %cond = fcmp ord float %a, %b 88*f4a2713aSLionel Sambuc %res = zext i1 %cond to i32 89*f4a2713aSLionel Sambuc ret i32 %res 90*f4a2713aSLionel Sambuc} 91*f4a2713aSLionel Sambuc 92*f4a2713aSLionel Sambuc; Test CC in { 3 } 93*f4a2713aSLionel Sambucdefine i32 @f8(float %a, float %b) { 94*f4a2713aSLionel Sambuc; CHECK-LABEL: f8: 95*f4a2713aSLionel Sambuc; CHECK: ipm %r2 96*f4a2713aSLionel Sambuc; CHECK-NEXT: afi %r2, 1342177280 97*f4a2713aSLionel Sambuc; CHECK-NEXT: srl %r2, 31 98*f4a2713aSLionel Sambuc; CHECK: br %r14 99*f4a2713aSLionel Sambuc %cond = fcmp uno float %a, %b 100*f4a2713aSLionel Sambuc %res = zext i1 %cond to i32 101*f4a2713aSLionel Sambuc ret i32 %res 102*f4a2713aSLionel Sambuc} 103*f4a2713aSLionel Sambuc 104*f4a2713aSLionel Sambuc; Test CC in { 0, 3 } 105*f4a2713aSLionel Sambucdefine i32 @f9(float %a, float %b) { 106*f4a2713aSLionel Sambuc; CHECK-LABEL: f9: 107*f4a2713aSLionel Sambuc; CHECK: ipm [[REG:%r[0-5]]] 108*f4a2713aSLionel Sambuc; CHECK-NEXT: afi [[REG]], -268435456 109*f4a2713aSLionel Sambuc; CHECK-NEXT: risbg %r2, [[REG]], 63, 191, 35 110*f4a2713aSLionel Sambuc; CHECK: br %r14 111*f4a2713aSLionel Sambuc %cond = fcmp ueq float %a, %b 112*f4a2713aSLionel Sambuc %res = zext i1 %cond to i32 113*f4a2713aSLionel Sambuc ret i32 %res 114*f4a2713aSLionel Sambuc} 115*f4a2713aSLionel Sambuc 116*f4a2713aSLionel Sambuc; Test CC in { 1, 3 } 117*f4a2713aSLionel Sambucdefine i32 @f10(float %a, float %b) { 118*f4a2713aSLionel Sambuc; CHECK-LABEL: f10: 119*f4a2713aSLionel Sambuc; CHECK: ipm [[REG:%r[0-5]]] 120*f4a2713aSLionel Sambuc; CHECK-NEXT: risbg %r2, [[REG]], 63, 191, 36 121*f4a2713aSLionel Sambuc; CHECK: br %r14 122*f4a2713aSLionel Sambuc %cond = fcmp ult float %a, %b 123*f4a2713aSLionel Sambuc %res = zext i1 %cond to i32 124*f4a2713aSLionel Sambuc ret i32 %res 125*f4a2713aSLionel Sambuc} 126*f4a2713aSLionel Sambuc 127*f4a2713aSLionel Sambuc; Test CC in { 0, 1, 3 } 128*f4a2713aSLionel Sambucdefine i32 @f11(float %a, float %b) { 129*f4a2713aSLionel Sambuc; CHECK-LABEL: f11: 130*f4a2713aSLionel Sambuc; CHECK: ipm %r2 131*f4a2713aSLionel Sambuc; CHECK-NEXT: xilf %r2, 268435456 132*f4a2713aSLionel Sambuc; CHECK-NEXT: afi %r2, -805306368 133*f4a2713aSLionel Sambuc; CHECK-NEXT: srl %r2, 31 134*f4a2713aSLionel Sambuc; CHECK: br %r14 135*f4a2713aSLionel Sambuc %cond = fcmp ule float %a, %b 136*f4a2713aSLionel Sambuc %res = zext i1 %cond to i32 137*f4a2713aSLionel Sambuc ret i32 %res 138*f4a2713aSLionel Sambuc} 139*f4a2713aSLionel Sambuc 140*f4a2713aSLionel Sambuc; Test CC in { 2, 3 } 141*f4a2713aSLionel Sambucdefine i32 @f12(float %a, float %b) { 142*f4a2713aSLionel Sambuc; CHECK-LABEL: f12: 143*f4a2713aSLionel Sambuc; CHECK: ipm [[REG:%r[0-5]]] 144*f4a2713aSLionel Sambuc; CHECK-NEXT: risbg %r2, [[REG]], 63, 191, 35 145*f4a2713aSLionel Sambuc; CHECK: br %r14 146*f4a2713aSLionel Sambuc %cond = fcmp ugt float %a, %b 147*f4a2713aSLionel Sambuc %res = zext i1 %cond to i32 148*f4a2713aSLionel Sambuc ret i32 %res 149*f4a2713aSLionel Sambuc} 150*f4a2713aSLionel Sambuc 151*f4a2713aSLionel Sambuc; Test CC in { 0, 2, 3 } 152*f4a2713aSLionel Sambucdefine i32 @f13(float %a, float %b) { 153*f4a2713aSLionel Sambuc; CHECK-LABEL: f13: 154*f4a2713aSLionel Sambuc; CHECK: ipm %r2 155*f4a2713aSLionel Sambuc; CHECK-NEXT: xilf %r2, 268435456 156*f4a2713aSLionel Sambuc; CHECK-NEXT: afi %r2, 1879048192 157*f4a2713aSLionel Sambuc; CHECK-NEXT: srl %r2, 31 158*f4a2713aSLionel Sambuc; CHECK: br %r14 159*f4a2713aSLionel Sambuc %cond = fcmp uge float %a, %b 160*f4a2713aSLionel Sambuc %res = zext i1 %cond to i32 161*f4a2713aSLionel Sambuc ret i32 %res 162*f4a2713aSLionel Sambuc} 163*f4a2713aSLionel Sambuc 164*f4a2713aSLionel Sambuc; Test CC in { 1, 2, 3 } 165*f4a2713aSLionel Sambucdefine i32 @f14(float %a, float %b) { 166*f4a2713aSLionel Sambuc; CHECK-LABEL: f14: 167*f4a2713aSLionel Sambuc; CHECK: ipm %r2 168*f4a2713aSLionel Sambuc; CHECK-NEXT: afi %r2, 1879048192 169*f4a2713aSLionel Sambuc; CHECK-NEXT: srl %r2, 31 170*f4a2713aSLionel Sambuc; CHECK: br %r14 171*f4a2713aSLionel Sambuc %cond = fcmp une float %a, %b 172*f4a2713aSLionel Sambuc %res = zext i1 %cond to i32 173*f4a2713aSLionel Sambuc ret i32 %res 174*f4a2713aSLionel Sambuc} 175