1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2 ; RUN: llc -verify-machineinstrs < %s -mtriple=ppc32-- -o - | FileCheck %s 3 4 define i64 @__fixunstfdi(ppc_fp128 %a) nounwind readnone { 5 ; CHECK-LABEL: __fixunstfdi: 6 ; CHECK: # %bb.0: # %entry 7 ; CHECK-NEXT: mflr 0 8 ; CHECK-NEXT: stw 0, 4(1) 9 ; CHECK-NEXT: stwu 1, -464(1) 10 ; CHECK-NEXT: mfcr 12 11 ; CHECK-NEXT: stw 29, 412(1) # 4-byte Folded Spill 12 ; CHECK-NEXT: stw 30, 416(1) # 4-byte Folded Spill 13 ; CHECK-NEXT: lis 3, .LCPI0_0@ha 14 ; CHECK-NEXT: stw 12, 408(1) 15 ; CHECK-NEXT: stfd 27, 424(1) # 8-byte Folded Spill 16 ; CHECK-NEXT: stfd 28, 432(1) # 8-byte Folded Spill 17 ; CHECK-NEXT: stfd 29, 440(1) # 8-byte Folded Spill 18 ; CHECK-NEXT: stfd 30, 448(1) # 8-byte Folded Spill 19 ; CHECK-NEXT: stfd 31, 456(1) # 8-byte Folded Spill 20 ; CHECK-NEXT: stfd 2, 376(1) 21 ; CHECK-NEXT: lfs 27, .LCPI0_0@l(3) 22 ; CHECK-NEXT: stfd 1, 384(1) 23 ; CHECK-NEXT: lwz 4, 380(1) 24 ; CHECK-NEXT: fcmpu 0, 2, 27 25 ; CHECK-NEXT: fcmpu 1, 1, 27 26 ; CHECK-NEXT: crand 20, 6, 0 27 ; CHECK-NEXT: stw 4, 396(1) 28 ; CHECK-NEXT: cror 20, 4, 20 29 ; CHECK-NEXT: lwz 4, 376(1) 30 ; CHECK-NEXT: stw 4, 392(1) 31 ; CHECK-NEXT: lwz 4, 388(1) 32 ; CHECK-NEXT: stw 4, 404(1) 33 ; CHECK-NEXT: lwz 3, 384(1) 34 ; CHECK-NEXT: stw 3, 400(1) 35 ; CHECK-NEXT: bc 4, 20, .LBB0_2 36 ; CHECK-NEXT: # %bb.1: # %bb5 37 ; CHECK-NEXT: li 3, 0 38 ; CHECK-NEXT: li 4, 0 39 ; CHECK-NEXT: b .LBB0_16 40 ; CHECK-NEXT: .LBB0_2: # %bb1 41 ; CHECK-NEXT: lfd 0, 400(1) 42 ; CHECK-NEXT: lfd 1, 392(1) 43 ; CHECK-NEXT: li 29, 0 44 ; CHECK-NEXT: lis 3, 15856 45 ; CHECK-NEXT: stfd 0, 304(1) 46 ; CHECK-NEXT: stfd 1, 296(1) 47 ; CHECK-NEXT: stw 29, 340(1) 48 ; CHECK-NEXT: stw 3, 336(1) 49 ; CHECK-NEXT: stw 29, 332(1) 50 ; CHECK-NEXT: stw 29, 328(1) 51 ; CHECK-NEXT: lwz 3, 308(1) 52 ; CHECK-NEXT: stw 3, 324(1) 53 ; CHECK-NEXT: lwz 3, 304(1) 54 ; CHECK-NEXT: stw 3, 320(1) 55 ; CHECK-NEXT: lwz 3, 300(1) 56 ; CHECK-NEXT: stw 3, 316(1) 57 ; CHECK-NEXT: lwz 3, 296(1) 58 ; CHECK-NEXT: stw 3, 312(1) 59 ; CHECK-NEXT: lfd 31, 320(1) 60 ; CHECK-NEXT: lfd 30, 312(1) 61 ; CHECK-NEXT: lfd 3, 336(1) 62 ; CHECK-NEXT: lfd 4, 328(1) 63 ; CHECK-NEXT: fmr 1, 31 64 ; CHECK-NEXT: fmr 2, 30 65 ; CHECK-NEXT: bl __gcc_qmul@PLT 66 ; CHECK-NEXT: lis 3, 16864 67 ; CHECK-NEXT: stfd 1, 280(1) 68 ; CHECK-NEXT: fmr 29, 1 69 ; CHECK-NEXT: stfd 2, 288(1) 70 ; CHECK-NEXT: fmr 28, 2 71 ; CHECK-NEXT: stw 29, 372(1) 72 ; CHECK-NEXT: stw 3, 368(1) 73 ; CHECK-NEXT: stw 29, 364(1) 74 ; CHECK-NEXT: stw 29, 360(1) 75 ; CHECK-NEXT: lwz 3, 284(1) 76 ; CHECK-NEXT: stw 3, 356(1) 77 ; CHECK-NEXT: lwz 3, 280(1) 78 ; CHECK-NEXT: stw 3, 352(1) 79 ; CHECK-NEXT: lwz 3, 292(1) 80 ; CHECK-NEXT: stw 3, 348(1) 81 ; CHECK-NEXT: lwz 3, 288(1) 82 ; CHECK-NEXT: stw 3, 344(1) 83 ; CHECK-NEXT: lfd 3, 368(1) 84 ; CHECK-NEXT: lfd 4, 360(1) 85 ; CHECK-NEXT: lfd 1, 352(1) 86 ; CHECK-NEXT: lfd 2, 344(1) 87 ; CHECK-NEXT: bl __gcc_qsub@PLT 88 ; CHECK-NEXT: mffs 0 89 ; CHECK-NEXT: mtfsb1 31 90 ; CHECK-NEXT: lis 3, .LCPI0_1@ha 91 ; CHECK-NEXT: fcmpu 0, 28, 27 92 ; CHECK-NEXT: mtfsb0 30 93 ; CHECK-NEXT: fadd 1, 2, 1 94 ; CHECK-NEXT: mtfsf 1, 0 95 ; CHECK-NEXT: fctiwz 0, 1 96 ; CHECK-NEXT: mffs 1 97 ; CHECK-NEXT: stfd 0, 160(1) 98 ; CHECK-NEXT: mtfsb1 31 99 ; CHECK-NEXT: mtfsb0 30 100 ; CHECK-NEXT: fadd 0, 28, 29 101 ; CHECK-NEXT: mtfsf 1, 1 102 ; CHECK-NEXT: lfs 1, .LCPI0_1@l(3) 103 ; CHECK-NEXT: fctiwz 0, 0 104 ; CHECK-NEXT: stfd 0, 152(1) 105 ; CHECK-NEXT: fcmpu 1, 29, 1 106 ; CHECK-NEXT: lwz 3, 164(1) 107 ; CHECK-NEXT: lwz 4, 156(1) 108 ; CHECK-NEXT: crandc 20, 6, 0 109 ; CHECK-NEXT: cror 20, 5, 20 110 ; CHECK-NEXT: addis 3, 3, -32768 111 ; CHECK-NEXT: bc 12, 20, .LBB0_4 112 ; CHECK-NEXT: # %bb.3: # %bb1 113 ; CHECK-NEXT: ori 30, 4, 0 114 ; CHECK-NEXT: b .LBB0_5 115 ; CHECK-NEXT: .LBB0_4: # %bb1 116 ; CHECK-NEXT: addi 30, 3, 0 117 ; CHECK-NEXT: .LBB0_5: # %bb1 118 ; CHECK-NEXT: li 4, 0 119 ; CHECK-NEXT: mr 3, 30 120 ; CHECK-NEXT: bl __floatditf@PLT 121 ; CHECK-NEXT: lis 3, 17392 122 ; CHECK-NEXT: stfd 1, 208(1) 123 ; CHECK-NEXT: fmr 29, 1 124 ; CHECK-NEXT: stfd 2, 200(1) 125 ; CHECK-NEXT: fmr 28, 2 126 ; CHECK-NEXT: stw 29, 244(1) 127 ; CHECK-NEXT: stw 3, 240(1) 128 ; CHECK-NEXT: cmpwi 2, 30, 0 129 ; CHECK-NEXT: stw 29, 236(1) 130 ; CHECK-NEXT: stw 29, 232(1) 131 ; CHECK-NEXT: lwz 3, 212(1) 132 ; CHECK-NEXT: stw 3, 228(1) 133 ; CHECK-NEXT: lwz 3, 208(1) 134 ; CHECK-NEXT: stw 3, 224(1) 135 ; CHECK-NEXT: lwz 3, 204(1) 136 ; CHECK-NEXT: stw 3, 220(1) 137 ; CHECK-NEXT: lwz 3, 200(1) 138 ; CHECK-NEXT: stw 3, 216(1) 139 ; CHECK-NEXT: lfd 3, 240(1) 140 ; CHECK-NEXT: lfd 4, 232(1) 141 ; CHECK-NEXT: lfd 1, 224(1) 142 ; CHECK-NEXT: lfd 2, 216(1) 143 ; CHECK-NEXT: bl __gcc_qadd@PLT 144 ; CHECK-NEXT: blt 2, .LBB0_7 145 ; CHECK-NEXT: # %bb.6: # %bb1 146 ; CHECK-NEXT: fmr 2, 28 147 ; CHECK-NEXT: .LBB0_7: # %bb1 148 ; CHECK-NEXT: blt 2, .LBB0_9 149 ; CHECK-NEXT: # %bb.8: # %bb1 150 ; CHECK-NEXT: fmr 1, 29 151 ; CHECK-NEXT: .LBB0_9: # %bb1 152 ; CHECK-NEXT: stfd 1, 184(1) 153 ; CHECK-NEXT: fmr 1, 31 154 ; CHECK-NEXT: stfd 2, 192(1) 155 ; CHECK-NEXT: fmr 2, 30 156 ; CHECK-NEXT: lwz 3, 188(1) 157 ; CHECK-NEXT: stw 3, 260(1) 158 ; CHECK-NEXT: lwz 3, 184(1) 159 ; CHECK-NEXT: stw 3, 256(1) 160 ; CHECK-NEXT: lwz 3, 196(1) 161 ; CHECK-NEXT: stw 3, 252(1) 162 ; CHECK-NEXT: lwz 3, 192(1) 163 ; CHECK-NEXT: stw 3, 248(1) 164 ; CHECK-NEXT: lfd 3, 256(1) 165 ; CHECK-NEXT: lfd 4, 248(1) 166 ; CHECK-NEXT: bl __gcc_qsub@PLT 167 ; CHECK-NEXT: stfd 2, 176(1) 168 ; CHECK-NEXT: fcmpu 0, 2, 27 169 ; CHECK-NEXT: stfd 1, 168(1) 170 ; CHECK-NEXT: fcmpu 1, 1, 27 171 ; CHECK-NEXT: lwz 3, 180(1) 172 ; CHECK-NEXT: crandc 20, 6, 0 173 ; CHECK-NEXT: cror 21, 5, 7 174 ; CHECK-NEXT: cror 20, 21, 20 175 ; CHECK-NEXT: stw 3, 268(1) 176 ; CHECK-NEXT: lwz 3, 176(1) 177 ; CHECK-NEXT: stw 3, 264(1) 178 ; CHECK-NEXT: lwz 3, 172(1) 179 ; CHECK-NEXT: stw 3, 276(1) 180 ; CHECK-NEXT: lwz 3, 168(1) 181 ; CHECK-NEXT: stw 3, 272(1) 182 ; CHECK-NEXT: lfd 30, 264(1) 183 ; CHECK-NEXT: lfd 31, 272(1) 184 ; CHECK-NEXT: bc 12, 20, .LBB0_13 185 ; CHECK-NEXT: # %bb.10: # %bb2 186 ; CHECK-NEXT: fneg 29, 30 187 ; CHECK-NEXT: fneg 28, 31 188 ; CHECK-NEXT: li 29, 0 189 ; CHECK-NEXT: lis 3, 16864 190 ; CHECK-NEXT: stfd 28, 48(1) 191 ; CHECK-NEXT: stfd 29, 40(1) 192 ; CHECK-NEXT: stw 29, 84(1) 193 ; CHECK-NEXT: stw 3, 80(1) 194 ; CHECK-NEXT: stw 29, 76(1) 195 ; CHECK-NEXT: stw 29, 72(1) 196 ; CHECK-NEXT: lwz 3, 52(1) 197 ; CHECK-NEXT: stw 3, 68(1) 198 ; CHECK-NEXT: lwz 3, 48(1) 199 ; CHECK-NEXT: stw 3, 64(1) 200 ; CHECK-NEXT: lwz 3, 44(1) 201 ; CHECK-NEXT: stw 3, 60(1) 202 ; CHECK-NEXT: lwz 3, 40(1) 203 ; CHECK-NEXT: stw 3, 56(1) 204 ; CHECK-NEXT: lfd 3, 80(1) 205 ; CHECK-NEXT: lfd 4, 72(1) 206 ; CHECK-NEXT: lfd 1, 64(1) 207 ; CHECK-NEXT: lfd 2, 56(1) 208 ; CHECK-NEXT: bl __gcc_qsub@PLT 209 ; CHECK-NEXT: mffs 0 210 ; CHECK-NEXT: mtfsb1 31 211 ; CHECK-NEXT: lis 3, .LCPI0_2@ha 212 ; CHECK-NEXT: mtfsb0 30 213 ; CHECK-NEXT: fadd 1, 2, 1 214 ; CHECK-NEXT: mtfsf 1, 0 215 ; CHECK-NEXT: fctiwz 0, 1 216 ; CHECK-NEXT: mffs 1 217 ; CHECK-NEXT: stfd 0, 32(1) 218 ; CHECK-NEXT: mtfsb1 31 219 ; CHECK-NEXT: lfs 0, .LCPI0_2@l(3) 220 ; CHECK-NEXT: lis 3, .LCPI0_3@ha 221 ; CHECK-NEXT: mtfsb0 30 222 ; CHECK-NEXT: fadd 2, 29, 28 223 ; CHECK-NEXT: mtfsf 1, 1 224 ; CHECK-NEXT: lfs 1, .LCPI0_3@l(3) 225 ; CHECK-NEXT: fcmpu 0, 30, 0 226 ; CHECK-NEXT: fctiwz 2, 2 227 ; CHECK-NEXT: stfd 2, 24(1) 228 ; CHECK-NEXT: fcmpu 1, 31, 1 229 ; CHECK-NEXT: lwz 3, 36(1) 230 ; CHECK-NEXT: lwz 4, 28(1) 231 ; CHECK-NEXT: crandc 20, 6, 1 232 ; CHECK-NEXT: cror 20, 4, 20 233 ; CHECK-NEXT: addis 3, 3, -32768 234 ; CHECK-NEXT: bc 12, 20, .LBB0_12 235 ; CHECK-NEXT: # %bb.11: # %bb2 236 ; CHECK-NEXT: ori 3, 4, 0 237 ; CHECK-NEXT: b .LBB0_12 238 ; CHECK-NEXT: .LBB0_12: # %bb2 239 ; CHECK-NEXT: subfic 4, 3, 0 240 ; CHECK-NEXT: subfe 3, 29, 30 241 ; CHECK-NEXT: b .LBB0_16 242 ; CHECK-NEXT: .LBB0_13: # %bb3 243 ; CHECK-NEXT: li 3, 0 244 ; CHECK-NEXT: lis 4, 16864 245 ; CHECK-NEXT: stfd 31, 112(1) 246 ; CHECK-NEXT: stfd 30, 104(1) 247 ; CHECK-NEXT: stw 3, 148(1) 248 ; CHECK-NEXT: stw 4, 144(1) 249 ; CHECK-NEXT: stw 3, 140(1) 250 ; CHECK-NEXT: stw 3, 136(1) 251 ; CHECK-NEXT: lwz 3, 116(1) 252 ; CHECK-NEXT: stw 3, 132(1) 253 ; CHECK-NEXT: lwz 3, 112(1) 254 ; CHECK-NEXT: stw 3, 128(1) 255 ; CHECK-NEXT: lwz 3, 108(1) 256 ; CHECK-NEXT: stw 3, 124(1) 257 ; CHECK-NEXT: lwz 3, 104(1) 258 ; CHECK-NEXT: stw 3, 120(1) 259 ; CHECK-NEXT: lfd 3, 144(1) 260 ; CHECK-NEXT: lfd 4, 136(1) 261 ; CHECK-NEXT: lfd 1, 128(1) 262 ; CHECK-NEXT: lfd 2, 120(1) 263 ; CHECK-NEXT: bl __gcc_qsub@PLT 264 ; CHECK-NEXT: mffs 0 265 ; CHECK-NEXT: mtfsb1 31 266 ; CHECK-NEXT: lis 3, .LCPI0_0@ha 267 ; CHECK-NEXT: mtfsb0 30 268 ; CHECK-NEXT: fadd 1, 2, 1 269 ; CHECK-NEXT: mtfsf 1, 0 270 ; CHECK-NEXT: fctiwz 0, 1 271 ; CHECK-NEXT: mffs 1 272 ; CHECK-NEXT: stfd 0, 96(1) 273 ; CHECK-NEXT: mtfsb1 31 274 ; CHECK-NEXT: lfs 0, .LCPI0_0@l(3) 275 ; CHECK-NEXT: lis 3, .LCPI0_1@ha 276 ; CHECK-NEXT: mtfsb0 30 277 ; CHECK-NEXT: fadd 2, 30, 31 278 ; CHECK-NEXT: mtfsf 1, 1 279 ; CHECK-NEXT: lfs 1, .LCPI0_1@l(3) 280 ; CHECK-NEXT: fcmpu 0, 30, 0 281 ; CHECK-NEXT: fctiwz 2, 2 282 ; CHECK-NEXT: stfd 2, 88(1) 283 ; CHECK-NEXT: fcmpu 1, 31, 1 284 ; CHECK-NEXT: lwz 3, 100(1) 285 ; CHECK-NEXT: lwz 4, 92(1) 286 ; CHECK-NEXT: crandc 20, 6, 0 287 ; CHECK-NEXT: cror 20, 5, 20 288 ; CHECK-NEXT: addis 3, 3, -32768 289 ; CHECK-NEXT: bc 12, 20, .LBB0_14 290 ; CHECK-NEXT: b .LBB0_15 291 ; CHECK-NEXT: .LBB0_14: # %bb3 292 ; CHECK-NEXT: addi 4, 3, 0 293 ; CHECK-NEXT: .LBB0_15: # %bb3 294 ; CHECK-NEXT: mr 3, 30 295 ; CHECK-NEXT: .LBB0_16: # %bb5 296 ; CHECK-NEXT: lfd 31, 456(1) # 8-byte Folded Reload 297 ; CHECK-NEXT: lfd 30, 448(1) # 8-byte Folded Reload 298 ; CHECK-NEXT: lfd 29, 440(1) # 8-byte Folded Reload 299 ; CHECK-NEXT: lfd 28, 432(1) # 8-byte Folded Reload 300 ; CHECK-NEXT: lwz 12, 408(1) 301 ; CHECK-NEXT: lfd 27, 424(1) # 8-byte Folded Reload 302 ; CHECK-NEXT: lwz 30, 416(1) # 4-byte Folded Reload 303 ; CHECK-NEXT: mtcrf 32, 12 # cr2 304 ; CHECK-NEXT: lwz 29, 412(1) # 4-byte Folded Reload 305 ; CHECK-NEXT: lwz 0, 468(1) 306 ; CHECK-NEXT: addi 1, 1, 464 307 ; CHECK-NEXT: mtlr 0 308 ; CHECK-NEXT: blr 309 entry: 310 %0 = fcmp olt ppc_fp128 %a, 0xM00000000000000000000000000000000 ; <i1> [#uses=1] 311 br i1 %0, label %bb5, label %bb1 312 313 bb1: ; preds = %entry 314 %1 = fmul ppc_fp128 %a, 0xM3DF00000000000000000000000000000 ; <ppc_fp128> [#uses=1] 315 %2 = fptoui ppc_fp128 %1 to i32 ; <i32> [#uses=1] 316 %3 = zext i32 %2 to i64 ; <i64> [#uses=1] 317 %4 = shl i64 %3, 32 ; <i64> [#uses=3] 318 %5 = uitofp i64 %4 to ppc_fp128 ; <ppc_fp128> [#uses=1] 319 %6 = fsub ppc_fp128 %a, %5 ; <ppc_fp128> [#uses=3] 320 %7 = fcmp olt ppc_fp128 %6, 0xM00000000000000000000000000000000 ; <i1> [#uses=1] 321 br i1 %7, label %bb2, label %bb3 322 323 bb2: ; preds = %bb1 324 %8 = fsub ppc_fp128 0xM80000000000000000000000000000000, %6 ; <ppc_fp128> [#uses=1] 325 %9 = fptoui ppc_fp128 %8 to i32 ; <i32> [#uses=1] 326 %10 = zext i32 %9 to i64 ; <i64> [#uses=1] 327 %11 = sub i64 %4, %10 ; <i64> [#uses=1] 328 ret i64 %11 329 330 bb3: ; preds = %bb1 331 %12 = fptoui ppc_fp128 %6 to i32 ; <i32> [#uses=1] 332 %13 = zext i32 %12 to i64 ; <i64> [#uses=1] 333 %14 = or i64 %13, %4 ; <i64> [#uses=1] 334 ret i64 %14 335 336 bb5: ; preds = %entry 337 ret i64 0 338 } 339