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