1; RUN: llc -mcpu=pwr9 -mtriple=powerpc64le-unknown-linux-gnu < %s \ 2; RUN: -stop-before=finalize-isel -verify-machineinstrs | \ 3; RUN: FileCheck -check-prefix=BEFORE-FINALIZE-ISEL %s 4; RUN: llc -mcpu=pwr9 -mtriple=powerpc64le-unknown-linux-gnu < %s \ 5; RUN: -stop-after=finalize-isel -verify-machineinstrs | \ 6; RUN: FileCheck -check-prefix=AFTER-FINALIZE-ISEL %s 7; RUN: llc -mcpu=pwr9 -mtriple=powerpc64le-unknown-linux-gnu < %s \ 8; RUN: -verify-machineinstrs | FileCheck %s 9; RUN: llc -mcpu=pwr7 -mtriple=powerpc64le-unknown-linux-gnu < %s \ 10; RUN: -verify-machineinstrs | FileCheck -check-prefix=CHECK-PWR7 %s 11 12define double @test_setrndi() { 13entry: 14 %0 = tail call double @llvm.ppc.setrnd(i32 2) 15 ret double %0 16 17; BEFORE-FINALIZE-ISEL: test_setrndi 18; BEFORE-FINALIZE-ISEL: SETRNDi 2, implicit-def dead $rm, implicit $rm 19 20; AFTER-FINALIZE-ISEL: test_setrndi 21; AFTER-FINALIZE-ISEL: MFFS implicit $rm 22; AFTER-FINALIZE-ISEL: MTFSB0 31, implicit-def $rm 23; AFTER-FINALIZE-ISEL: MTFSB1 30, implicit-def $rm 24 25; CHECK-LABEL: @test_setrndi 26; CHECK: # %bb.0: 27; CHECK-DAG: mffs 1 28; CHECK-DAG: mtfsb0 31 29; CHECK-DAG: mtfsb1 30 30; CHECK: blr 31} 32 33define double @test_setrnd(i32 signext %x) { 34entry: 35 %0 = tail call double @llvm.ppc.setrnd(i32 %x) 36 ret double %0 37 38; BEFORE-FINALIZE-ISEL: test_setrnd 39; BEFORE-FINALIZE-ISEL: SETRND killed %1, implicit-def dead $rm, implicit $rm 40 41; AFTER-FINALIZE-ISEL: test_setrnd 42; AFTER-FINALIZE-ISEL: MFFS implicit $rm 43; AFTER-FINALIZE-ISEL: MTFSF 255, %7, 0, 0, implicit-def $rm 44 45; CHECK-LABEL: @test_setrnd 46; CHECK: # %bb.0: 47; CHECK-DAG: mffs 1 48; CHECK-DAG: mffprd [[REG1:[0-9]+]], 1 49; CHECK-DAG: rldimi [[REG1]], 3, 0, 62 50; CHECK-DAG: mtfprd [[REG2:[0-9]+]], [[REG1]] 51; CHECK-DAG: mtfsf 255, [[REG2]] 52; CHECK: blr 53 54; CHECK-PWR7-LABEL: @test_setrnd 55; CHECK-PWR7: # %bb.0: 56; CHECK-PWR7-DAG: mffs 1 57; CHECK-PWR7-DAG: stfd 1, -8(1) 58; CHECK-PWR7-DAG: ld [[REG1:[0-9]+]], -8(1) 59; CHECK-PWR7-DAG: rldimi [[REG1]], 3, 0, 62 60; CHECK-PWR7-DAG: std [[REG1]], -16(1) 61; CHECK-PWR7-DAG: lfd [[REG2:[0-9]+]], -16(1) 62; CHECK-PWR7-DAG: mtfsf 255, [[REG2]] 63; CHECK-PWR7: blr 64} 65 66declare double @llvm.ppc.setrnd(i32) 67 68