fp-strict-round.ll 19.6 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64-unknown-linux \
; RUN:   -mcpu=pwr8 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr  | FileCheck \
; RUN:   --check-prefix=P8 %s
; RUN: llc -verify-machineinstrs < %s -mtriple=powerpc64le-unknown-linux \
; RUN:   -mcpu=pwr9 -ppc-asm-full-reg-names -ppc-vsr-nums-as-vr | FileCheck \
; RUN:   --check-prefix=P9 %s

; FIXME: Constrained fpext would fail if VSX feature disabled. Add no-vsx

declare float @llvm.experimental.constrained.ceil.f32(float, metadata)
declare double @llvm.experimental.constrained.ceil.f64(double, metadata)
declare <4 x float> @llvm.experimental.constrained.ceil.v4f32(<4 x float>, metadata)
declare <2 x double> @llvm.experimental.constrained.ceil.v2f64(<2 x double>, metadata)

declare float @llvm.experimental.constrained.floor.f32(float, metadata)
declare double @llvm.experimental.constrained.floor.f64(double, metadata)
declare <4 x float> @llvm.experimental.constrained.floor.v4f32(<4 x float>, metadata)
declare <2 x double> @llvm.experimental.constrained.floor.v2f64(<2 x double>, metadata)

declare double @llvm.experimental.constrained.nearbyint.f64(double, metadata, metadata)
declare <4 x float> @llvm.experimental.constrained.nearbyint.v4f32(<4 x float>, metadata, metadata)
declare <2 x double> @llvm.experimental.constrained.nearbyint.v2f64(<2 x double>, metadata, metadata)

declare <4 x double> @llvm.experimental.constrained.fpext.v4f64.v4f32(<4 x float>, metadata)
declare <2 x double> @llvm.experimental.constrained.fpext.v2f64.v2f32(<2 x float>, metadata)

declare float @llvm.experimental.constrained.fptrunc.f32.f64(double, metadata, metadata)
declare <4 x float> @llvm.experimental.constrained.fptrunc.v4f32.v4f64(<4 x double>, metadata, metadata)
declare <2 x float> @llvm.experimental.constrained.fptrunc.v2f32.v2f64(<2 x double>, metadata, metadata)

declare float @llvm.experimental.constrained.round.f32(float, metadata)
declare double @llvm.experimental.constrained.round.f64(double, metadata)
declare <4 x float> @llvm.experimental.constrained.round.v4f32(<4 x float>, metadata)
declare <2 x double> @llvm.experimental.constrained.round.v2f64(<2 x double>, metadata)

declare float @llvm.experimental.constrained.trunc.f32(float, metadata)
declare double @llvm.experimental.constrained.trunc.f64(double, metadata)
declare <4 x float> @llvm.experimental.constrained.trunc.v4f32(<4 x float>, metadata)
declare <2 x double> @llvm.experimental.constrained.trunc.v2f64(<2 x double>, metadata)

define float @ceil_f32(float %f1) {
; P8-LABEL: ceil_f32:
; P8:       # %bb.0:
; P8-NEXT:    xsrdpip f1, f1
; P8-NEXT:    blr
;
; P9-LABEL: ceil_f32:
; P9:       # %bb.0:
; P9-NEXT:    xsrdpip f1, f1
; P9-NEXT:    blr
  %res = call float @llvm.experimental.constrained.ceil.f32(
                        float %f1,
                        metadata !"fpexcept.strict")
  ret float %res
}

define double @ceil_f64(double %f1) {
; P8-LABEL: ceil_f64:
; P8:       # %bb.0:
; P8-NEXT:    xsrdpip f1, f1
; P8-NEXT:    blr
;
; P9-LABEL: ceil_f64:
; P9:       # %bb.0:
; P9-NEXT:    xsrdpip f1, f1
; P9-NEXT:    blr
  %res = call double @llvm.experimental.constrained.ceil.f64(
                        double %f1,
                        metadata !"fpexcept.strict")
  ret double %res
}

define <4 x float> @ceil_v4f32(<4 x float> %vf1) {
; P8-LABEL: ceil_v4f32:
; P8:       # %bb.0:
; P8-NEXT:    xvrspip v2, v2
; P8-NEXT:    blr
;
; P9-LABEL: ceil_v4f32:
; P9:       # %bb.0:
; P9-NEXT:    xvrspip v2, v2
; P9-NEXT:    blr
  %res = call <4 x float> @llvm.experimental.constrained.ceil.v4f32(
                        <4 x float> %vf1,
                        metadata !"fpexcept.strict")
  ret <4 x float> %res
}

define <2 x double> @ceil_v2f64(<2 x double> %vf1) {
; P8-LABEL: ceil_v2f64:
; P8:       # %bb.0:
; P8-NEXT:    xvrdpip v2, v2
; P8-NEXT:    blr
;
; P9-LABEL: ceil_v2f64:
; P9:       # %bb.0:
; P9-NEXT:    xvrdpip v2, v2
; P9-NEXT:    blr
  %res = call <2 x double> @llvm.experimental.constrained.ceil.v2f64(
                        <2 x double> %vf1,
                        metadata !"fpexcept.strict")
  ret <2 x double> %res
}

define float @floor_f32(float %f1) {
; P8-LABEL: floor_f32:
; P8:       # %bb.0:
; P8-NEXT:    xsrdpim f1, f1
; P8-NEXT:    blr
;
; P9-LABEL: floor_f32:
; P9:       # %bb.0:
; P9-NEXT:    xsrdpim f1, f1
; P9-NEXT:    blr
  %res = call float @llvm.experimental.constrained.floor.f32(
                        float %f1,
                        metadata !"fpexcept.strict")
  ret float %res
}

define double @floor_f64(double %f1) {
; P8-LABEL: floor_f64:
; P8:       # %bb.0:
; P8-NEXT:    xsrdpim f1, f1
; P8-NEXT:    blr
;
; P9-LABEL: floor_f64:
; P9:       # %bb.0:
; P9-NEXT:    xsrdpim f1, f1
; P9-NEXT:    blr
  %res = call double @llvm.experimental.constrained.floor.f64(
                        double %f1,
                        metadata !"fpexcept.strict")
  ret double %res;
}

define <4 x float> @floor_v4f32(<4 x float> %vf1) {
; P8-LABEL: floor_v4f32:
; P8:       # %bb.0:
; P8-NEXT:    xvrspim v2, v2
; P8-NEXT:    blr
;
; P9-LABEL: floor_v4f32:
; P9:       # %bb.0:
; P9-NEXT:    xvrspim v2, v2
; P9-NEXT:    blr
  %res = call <4 x float> @llvm.experimental.constrained.floor.v4f32(
                        <4 x float> %vf1,
                        metadata !"fpexcept.strict")
  ret <4 x float> %res;
}

define <2 x double> @floor_v2f64(<2 x double> %vf1) {
; P8-LABEL: floor_v2f64:
; P8:       # %bb.0:
; P8-NEXT:    xvrdpim v2, v2
; P8-NEXT:    blr
;
; P9-LABEL: floor_v2f64:
; P9:       # %bb.0:
; P9-NEXT:    xvrdpim v2, v2
; P9-NEXT:    blr
  %res = call <2 x double> @llvm.experimental.constrained.floor.v2f64(
                        <2 x double> %vf1,
                        metadata !"fpexcept.strict")
  ret <2 x double> %res;
}

define double @nearbyint_f64(double %f1, double %f2) {
; P8-LABEL: nearbyint_f64:
; P8:       # %bb.0:
; P8-NEXT:    mflr r0
; P8-NEXT:    std r0, 16(r1)
; P8-NEXT:    stdu r1, -112(r1)
; P8-NEXT:    .cfi_def_cfa_offset 112
; P8-NEXT:    .cfi_offset lr, 16
; P8-NEXT:    bl nearbyint
; P8-NEXT:    nop
; P8-NEXT:    addi r1, r1, 112
; P8-NEXT:    ld r0, 16(r1)
; P8-NEXT:    mtlr r0
; P8-NEXT:    blr
;
; P9-LABEL: nearbyint_f64:
; P9:       # %bb.0:
; P9-NEXT:    mflr r0
; P9-NEXT:    std r0, 16(r1)
; P9-NEXT:    stdu r1, -32(r1)
; P9-NEXT:    .cfi_def_cfa_offset 32
; P9-NEXT:    .cfi_offset lr, 16
; P9-NEXT:    bl nearbyint
; P9-NEXT:    nop
; P9-NEXT:    addi r1, r1, 32
; P9-NEXT:    ld r0, 16(r1)
; P9-NEXT:    mtlr r0
; P9-NEXT:    blr
  %res = call double @llvm.experimental.constrained.nearbyint.f64(
                        double %f1,
                        metadata !"round.dynamic",
                        metadata !"fpexcept.strict")
  ret double %res
}

define <4 x float> @nearbyint_v4f32(<4 x float> %vf1, <4 x float> %vf2) {
; P8-LABEL: nearbyint_v4f32:
; P8:       # %bb.0:
; P8-NEXT:    mflr r0
; P8-NEXT:    std r0, 16(r1)
; P8-NEXT:    stdu r1, -176(r1)
; P8-NEXT:    .cfi_def_cfa_offset 176
; P8-NEXT:    .cfi_offset lr, 16
; P8-NEXT:    .cfi_offset v30, -32
; P8-NEXT:    .cfi_offset v31, -16
; P8-NEXT:    xxsldwi vs0, v2, v2, 3
; P8-NEXT:    li r3, 144
; P8-NEXT:    stxvd2x v30, r1, r3 # 16-byte Folded Spill
; P8-NEXT:    li r3, 160
; P8-NEXT:    stxvd2x v31, r1, r3 # 16-byte Folded Spill
; P8-NEXT:    vmr v31, v2
; P8-NEXT:    xscvspdpn f1, vs0
; P8-NEXT:    bl nearbyintf
; P8-NEXT:    nop
; P8-NEXT:    xxsldwi vs0, v31, v31, 1
; P8-NEXT:    # kill: def $f1 killed $f1 def $vsl1
; P8-NEXT:    li r3, 128
; P8-NEXT:    stxvd2x vs1, r1, r3 # 16-byte Folded Spill
; P8-NEXT:    xscvspdpn f1, vs0
; P8-NEXT:    bl nearbyintf
; P8-NEXT:    nop
; P8-NEXT:    li r3, 128
; P8-NEXT:    # kill: def $f1 killed $f1 def $vsl1
; P8-NEXT:    lxvd2x vs0, r1, r3 # 16-byte Folded Reload
; P8-NEXT:    xxmrghd vs0, vs1, vs0
; P8-NEXT:    xscvspdpn f1, v31
; P8-NEXT:    xvcvdpsp v30, vs0
; P8-NEXT:    bl nearbyintf
; P8-NEXT:    nop
; P8-NEXT:    xxswapd vs0, v31
; P8-NEXT:    # kill: def $f1 killed $f1 def $vsl1
; P8-NEXT:    li r3, 128
; P8-NEXT:    stxvd2x vs1, r1, r3 # 16-byte Folded Spill
; P8-NEXT:    xscvspdpn f1, vs0
; P8-NEXT:    bl nearbyintf
; P8-NEXT:    nop
; P8-NEXT:    li r3, 128
; P8-NEXT:    # kill: def $f1 killed $f1 def $vsl1
; P8-NEXT:    lxvd2x vs0, r1, r3 # 16-byte Folded Reload
; P8-NEXT:    li r3, 160
; P8-NEXT:    lxvd2x v31, r1, r3 # 16-byte Folded Reload
; P8-NEXT:    li r3, 144
; P8-NEXT:    xxmrghd vs0, vs0, vs1
; P8-NEXT:    xvcvdpsp v2, vs0
; P8-NEXT:    vmrgew v2, v2, v30
; P8-NEXT:    lxvd2x v30, r1, r3 # 16-byte Folded Reload
; P8-NEXT:    addi r1, r1, 176
; P8-NEXT:    ld r0, 16(r1)
; P8-NEXT:    mtlr r0
; P8-NEXT:    blr
;
; P9-LABEL: nearbyint_v4f32:
; P9:       # %bb.0:
; P9-NEXT:    mflr r0
; P9-NEXT:    std r0, 16(r1)
; P9-NEXT:    stdu r1, -80(r1)
; P9-NEXT:    .cfi_def_cfa_offset 80
; P9-NEXT:    .cfi_offset lr, 16
; P9-NEXT:    .cfi_offset v30, -32
; P9-NEXT:    .cfi_offset v31, -16
; P9-NEXT:    xxsldwi vs0, v2, v2, 3
; P9-NEXT:    stxv v30, 48(r1) # 16-byte Folded Spill
; P9-NEXT:    xscvspdpn f1, vs0
; P9-NEXT:    stxv v31, 64(r1) # 16-byte Folded Spill
; P9-NEXT:    vmr v31, v2
; P9-NEXT:    bl nearbyintf
; P9-NEXT:    nop
; P9-NEXT:    xxsldwi vs0, v31, v31, 1
; P9-NEXT:    # kill: def $f1 killed $f1 def $vsl1
; P9-NEXT:    stxv vs1, 32(r1) # 16-byte Folded Spill
; P9-NEXT:    xscvspdpn f1, vs0
; P9-NEXT:    bl nearbyintf
; P9-NEXT:    nop
; P9-NEXT:    lxv vs0, 32(r1) # 16-byte Folded Reload
; P9-NEXT:    # kill: def $f1 killed $f1 def $vsl1
; P9-NEXT:    xxmrghd vs0, vs1, vs0
; P9-NEXT:    xscvspdpn f1, v31
; P9-NEXT:    xvcvdpsp v30, vs0
; P9-NEXT:    bl nearbyintf
; P9-NEXT:    nop
; P9-NEXT:    xxswapd vs0, v31
; P9-NEXT:    # kill: def $f1 killed $f1 def $vsl1
; P9-NEXT:    stxv vs1, 32(r1) # 16-byte Folded Spill
; P9-NEXT:    xscvspdpn f1, vs0
; P9-NEXT:    bl nearbyintf
; P9-NEXT:    nop
; P9-NEXT:    lxv vs0, 32(r1) # 16-byte Folded Reload
; P9-NEXT:    # kill: def $f1 killed $f1 def $vsl1
; P9-NEXT:    lxv v31, 64(r1) # 16-byte Folded Reload
; P9-NEXT:    xxmrghd vs0, vs0, vs1
; P9-NEXT:    xvcvdpsp v2, vs0
; P9-NEXT:    vmrgew v2, v2, v30
; P9-NEXT:    lxv v30, 48(r1) # 16-byte Folded Reload
; P9-NEXT:    addi r1, r1, 80
; P9-NEXT:    ld r0, 16(r1)
; P9-NEXT:    mtlr r0
; P9-NEXT:    blr
  %res = call <4 x float> @llvm.experimental.constrained.nearbyint.v4f32(
                        <4 x float> %vf1,
                        metadata !"round.dynamic",
                        metadata !"fpexcept.strict")
  ret <4 x float> %res
}

define <2 x double> @nearbyint_v2f64(<2 x double> %vf1, <2 x double> %vf2) {
; P8-LABEL: nearbyint_v2f64:
; P8:       # %bb.0:
; P8-NEXT:    mflr r0
; P8-NEXT:    std r0, 16(r1)
; P8-NEXT:    stdu r1, -160(r1)
; P8-NEXT:    .cfi_def_cfa_offset 160
; P8-NEXT:    .cfi_offset lr, 16
; P8-NEXT:    .cfi_offset v31, -16
; P8-NEXT:    li r3, 144
; P8-NEXT:    stxvd2x v31, r1, r3 # 16-byte Folded Spill
; P8-NEXT:    vmr v31, v2
; P8-NEXT:    xxlor f1, v31, v31
; P8-NEXT:    bl nearbyint
; P8-NEXT:    nop
; P8-NEXT:    # kill: def $f1 killed $f1 def $vsl1
; P8-NEXT:    li r3, 128
; P8-NEXT:    stxvd2x vs1, r1, r3 # 16-byte Folded Spill
; P8-NEXT:    xxswapd vs1, v31
; P8-NEXT:    # kill: def $f1 killed $f1 killed $vsl1
; P8-NEXT:    bl nearbyint
; P8-NEXT:    nop
; P8-NEXT:    li r3, 128
; P8-NEXT:    # kill: def $f1 killed $f1 def $vsl1
; P8-NEXT:    lxvd2x vs0, r1, r3 # 16-byte Folded Reload
; P8-NEXT:    li r3, 144
; P8-NEXT:    lxvd2x v31, r1, r3 # 16-byte Folded Reload
; P8-NEXT:    xxmrghd v2, vs0, vs1
; P8-NEXT:    addi r1, r1, 160
; P8-NEXT:    ld r0, 16(r1)
; P8-NEXT:    mtlr r0
; P8-NEXT:    blr
;
; P9-LABEL: nearbyint_v2f64:
; P9:       # %bb.0:
; P9-NEXT:    mflr r0
; P9-NEXT:    std r0, 16(r1)
; P9-NEXT:    stdu r1, -64(r1)
; P9-NEXT:    .cfi_def_cfa_offset 64
; P9-NEXT:    .cfi_offset lr, 16
; P9-NEXT:    .cfi_offset v31, -16
; P9-NEXT:    stxv v31, 48(r1) # 16-byte Folded Spill
; P9-NEXT:    vmr v31, v2
; P9-NEXT:    xscpsgndp f1, v31, v31
; P9-NEXT:    bl nearbyint
; P9-NEXT:    nop
; P9-NEXT:    # kill: def $f1 killed $f1 def $vsl1
; P9-NEXT:    stxv vs1, 32(r1) # 16-byte Folded Spill
; P9-NEXT:    xxswapd vs1, v31
; P9-NEXT:    # kill: def $f1 killed $f1 killed $vsl1
; P9-NEXT:    bl nearbyint
; P9-NEXT:    nop
; P9-NEXT:    lxv vs0, 32(r1) # 16-byte Folded Reload
; P9-NEXT:    lxv v31, 48(r1) # 16-byte Folded Reload
; P9-NEXT:    # kill: def $f1 killed $f1 def $vsl1
; P9-NEXT:    xxmrghd v2, vs0, vs1
; P9-NEXT:    addi r1, r1, 64
; P9-NEXT:    ld r0, 16(r1)
; P9-NEXT:    mtlr r0
; P9-NEXT:    blr
  %res = call <2 x double> @llvm.experimental.constrained.nearbyint.v2f64(
                        <2 x double> %vf1,
                        metadata !"round.dynamic",
                        metadata !"fpexcept.strict")
  ret <2 x double> %res
}

define <4 x double> @fpext_v4f64_v4f32(<4 x float> %vf1) {
; P8-LABEL: fpext_v4f64_v4f32:
; P8:       # %bb.0:
; P8-NEXT:    xxsldwi vs0, v2, v2, 1
; P8-NEXT:    xxsldwi vs1, v2, v2, 3
; P8-NEXT:    xxswapd vs3, v2
; P8-NEXT:    xscvspdpn f2, v2
; P8-NEXT:    xscvspdpn f0, vs0
; P8-NEXT:    xscvspdpn f1, vs1
; P8-NEXT:    xscvspdpn f3, vs3
; P8-NEXT:    xxmrghd v2, vs2, vs0
; P8-NEXT:    xxmrghd v3, vs3, vs1
; P8-NEXT:    blr
;
; P9-LABEL: fpext_v4f64_v4f32:
; P9:       # %bb.0:
; P9-NEXT:    xxsldwi vs0, v2, v2, 3
; P9-NEXT:    xxswapd vs1, v2
; P9-NEXT:    xscvspdpn f0, vs0
; P9-NEXT:    xscvspdpn f1, vs1
; P9-NEXT:    xxsldwi vs2, v2, v2, 1
; P9-NEXT:    xscvspdpn f2, vs2
; P9-NEXT:    xxmrghd vs0, vs1, vs0
; P9-NEXT:    xscvspdpn f1, v2
; P9-NEXT:    xxmrghd v3, vs1, vs2
; P9-NEXT:    xxlor v2, vs0, vs0
; P9-NEXT:    blr
  %res = call <4 x double> @llvm.experimental.constrained.fpext.v4f64.v4f32(
                        <4 x float> %vf1,
                        metadata !"fpexcept.strict")
  ret <4 x double> %res
}

define <2 x double> @fpext_v2f64_v2f32(<2 x float> %vf1) {
; P8-LABEL: fpext_v2f64_v2f32:
; P8:       # %bb.0:
; P8-NEXT:    xxsldwi vs0, v2, v2, 1
; P8-NEXT:    xscvspdpn f1, v2
; P8-NEXT:    xscvspdpn f0, vs0
; P8-NEXT:    xxmrghd v2, vs1, vs0
; P8-NEXT:    blr
;
; P9-LABEL: fpext_v2f64_v2f32:
; P9:       # %bb.0:
; P9-NEXT:    xxsldwi vs0, v2, v2, 3
; P9-NEXT:    xxswapd vs1, v2
; P9-NEXT:    xscvspdpn f0, vs0
; P9-NEXT:    xscvspdpn f1, vs1
; P9-NEXT:    xxmrghd v2, vs1, vs0
; P9-NEXT:    blr
  %res = call <2 x double> @llvm.experimental.constrained.fpext.v2f64.v2f32(
                        <2 x float> %vf1,
                        metadata !"fpexcept.strict")
  ret <2 x double> %res
}

define float @fptrunc_f32_f64(double %f1) {
; P8-LABEL: fptrunc_f32_f64:
; P8:       # %bb.0:
; P8-NEXT:    xsrsp f1, f1
; P8-NEXT:    blr
;
; P9-LABEL: fptrunc_f32_f64:
; P9:       # %bb.0:
; P9-NEXT:    xsrsp f1, f1
; P9-NEXT:    blr
  %res = call float @llvm.experimental.constrained.fptrunc.f32.f64(
                        double %f1,
                        metadata !"round.dynamic",
                        metadata !"fpexcept.strict")
  ret float %res;
}

define <4 x float> @fptrunc_v4f32_v4f64(<4 x double> %vf1) {
; P8-LABEL: fptrunc_v4f32_v4f64:
; P8:       # %bb.0:
; P8-NEXT:    xxmrgld vs0, v2, v3
; P8-NEXT:    xxmrghd vs1, v2, v3
; P8-NEXT:    xvcvdpsp v2, vs0
; P8-NEXT:    xvcvdpsp v3, vs1
; P8-NEXT:    vmrgew v2, v3, v2
; P8-NEXT:    blr
;
; P9-LABEL: fptrunc_v4f32_v4f64:
; P9:       # %bb.0:
; P9-NEXT:    xxmrgld vs0, v3, v2
; P9-NEXT:    xvcvdpsp v4, vs0
; P9-NEXT:    xxmrghd vs0, v3, v2
; P9-NEXT:    xvcvdpsp v2, vs0
; P9-NEXT:    vmrgew v2, v2, v4
; P9-NEXT:    blr
  %res = call <4 x float> @llvm.experimental.constrained.fptrunc.v4f32.v4f64(
                        <4 x double> %vf1,
                        metadata !"round.dynamic",
                        metadata !"fpexcept.strict")
  ret <4 x float> %res
}

define <2 x float> @fptrunc_v2f32_v2f64(<2 x double> %vf1) {
; P8-LABEL: fptrunc_v2f32_v2f64:
; P8:       # %bb.0:
; P8-NEXT:    xxswapd vs0, v2
; P8-NEXT:    xsrsp f1, v2
; P8-NEXT:    xsrsp f0, f0
; P8-NEXT:    xscvdpspn v2, f1
; P8-NEXT:    xscvdpspn v3, f0
; P8-NEXT:    vmrghw v2, v2, v3
; P8-NEXT:    blr
;
; P9-LABEL: fptrunc_v2f32_v2f64:
; P9:       # %bb.0:
; P9-NEXT:    xsrsp f0, v2
; P9-NEXT:    xscvdpspn vs0, f0
; P9-NEXT:    xxsldwi v3, vs0, vs0, 3
; P9-NEXT:    xxswapd vs0, v2
; P9-NEXT:    xsrsp f0, f0
; P9-NEXT:    xscvdpspn vs0, f0
; P9-NEXT:    xxsldwi v2, vs0, vs0, 3
; P9-NEXT:    vmrghw v2, v3, v2
; P9-NEXT:    blr
  %res = call <2 x float> @llvm.experimental.constrained.fptrunc.v2f32.v2f64(
                        <2 x double> %vf1,
                        metadata !"round.dynamic",
                        metadata !"fpexcept.strict")
  ret <2 x float> %res
}

define float @round_f32(float %f1) {
; P8-LABEL: round_f32:
; P8:       # %bb.0:
; P8-NEXT:    xsrdpi f1, f1
; P8-NEXT:    blr
;
; P9-LABEL: round_f32:
; P9:       # %bb.0:
; P9-NEXT:    xsrdpi f1, f1
; P9-NEXT:    blr
  %res = call float @llvm.experimental.constrained.round.f32(
                        float %f1,
                        metadata !"fpexcept.strict")
  ret float %res
}

define double @round_f64(double %f1) {
; P8-LABEL: round_f64:
; P8:       # %bb.0:
; P8-NEXT:    xsrdpi f1, f1
; P8-NEXT:    blr
;
; P9-LABEL: round_f64:
; P9:       # %bb.0:
; P9-NEXT:    xsrdpi f1, f1
; P9-NEXT:    blr
  %res = call double @llvm.experimental.constrained.round.f64(
                        double %f1,
                        metadata !"fpexcept.strict")
  ret double %res
}

define <4 x float> @round_v4f32(<4 x float> %vf1) {
; P8-LABEL: round_v4f32:
; P8:       # %bb.0:
; P8-NEXT:    xvrspi v2, v2
; P8-NEXT:    blr
;
; P9-LABEL: round_v4f32:
; P9:       # %bb.0:
; P9-NEXT:    xvrspi v2, v2
; P9-NEXT:    blr
  %res = call <4 x float> @llvm.experimental.constrained.round.v4f32(
                        <4 x float> %vf1,
                        metadata !"fpexcept.strict")
  ret <4 x float> %res
}

define <2 x double> @round_v2f64(<2 x double> %vf1) {
; P8-LABEL: round_v2f64:
; P8:       # %bb.0:
; P8-NEXT:    xvrdpi v2, v2
; P8-NEXT:    blr
;
; P9-LABEL: round_v2f64:
; P9:       # %bb.0:
; P9-NEXT:    xvrdpi v2, v2
; P9-NEXT:    blr
  %res = call <2 x double> @llvm.experimental.constrained.round.v2f64(
                        <2 x double> %vf1,
                        metadata !"fpexcept.strict")
  ret <2 x double> %res
}

define float @trunc_f32(float %f1) {
; P8-LABEL: trunc_f32:
; P8:       # %bb.0:
; P8-NEXT:    xsrdpiz f1, f1
; P8-NEXT:    blr
;
; P9-LABEL: trunc_f32:
; P9:       # %bb.0:
; P9-NEXT:    xsrdpiz f1, f1
; P9-NEXT:    blr
  %res = call float @llvm.experimental.constrained.trunc.f32(
                        float %f1,
                        metadata !"fpexcept.strict")
  ret float %res
}

define double @trunc_f64(double %f1) {
; P8-LABEL: trunc_f64:
; P8:       # %bb.0:
; P8-NEXT:    xsrdpiz f1, f1
; P8-NEXT:    blr
;
; P9-LABEL: trunc_f64:
; P9:       # %bb.0:
; P9-NEXT:    xsrdpiz f1, f1
; P9-NEXT:    blr
  %res = call double @llvm.experimental.constrained.trunc.f64(
                        double %f1,
                        metadata !"fpexcept.strict")
  ret double %res
}

define <4 x float> @trunc_v4f32(<4 x float> %vf1) {
; P8-LABEL: trunc_v4f32:
; P8:       # %bb.0:
; P8-NEXT:    xvrspiz v2, v2
; P8-NEXT:    blr
;
; P9-LABEL: trunc_v4f32:
; P9:       # %bb.0:
; P9-NEXT:    xvrspiz v2, v2
; P9-NEXT:    blr
  %res = call <4 x float> @llvm.experimental.constrained.trunc.v4f32(
                        <4 x float> %vf1,
                        metadata !"fpexcept.strict")
  ret <4 x float> %res
}

define <2 x double> @trunc_v2f64(<2 x double> %vf1) {
; P8-LABEL: trunc_v2f64:
; P8:       # %bb.0:
; P8-NEXT:    xvrdpiz v2, v2
; P8-NEXT:    blr
;
; P9-LABEL: trunc_v2f64:
; P9:       # %bb.0:
; P9-NEXT:    xvrdpiz v2, v2
; P9-NEXT:    blr
  %res = call <2 x double> @llvm.experimental.constrained.trunc.v2f64(
                        <2 x double> %vf1,
                        metadata !"fpexcept.strict")
  ret <2 x double> %res
}