diff options
| author | Lei Huang <lei@ca.ibm.com> | 2018-07-05 07:46:01 +0000 |
|---|---|---|
| committer | Lei Huang <lei@ca.ibm.com> | 2018-07-05 07:46:01 +0000 |
| commit | 66e22c21c316cadb6023268273d29534d148a54d (patch) | |
| tree | 1bb80f45a5d059fdd14b52862fb5684fb2663d4e /llvm/test/CodeGen/PowerPC | |
| parent | 350c5f1881a8387119545a90daced0e6cce1165d (diff) | |
| download | bcm5719-llvm-66e22c21c316cadb6023268273d29534d148a54d.tar.gz bcm5719-llvm-66e22c21c316cadb6023268273d29534d148a54d.zip | |
[Power9] Optimize codgen for conversions of int to float128
Optimize code sequences for integer conversion to fp128 when the integer is a result of:
* float->int
* float->long
* double->int
* double->long
Differential Revision: https://reviews.llvm.org/D48429
llvm-svn: 336316
Diffstat (limited to 'llvm/test/CodeGen/PowerPC')
| -rw-r--r-- | llvm/test/CodeGen/PowerPC/f128-conv.ll | 126 | ||||
| -rw-r--r-- | llvm/test/CodeGen/PowerPC/f128-passByValue.ll | 20 |
2 files changed, 136 insertions, 10 deletions
diff --git a/llvm/test/CodeGen/PowerPC/f128-conv.ll b/llvm/test/CodeGen/PowerPC/f128-conv.ll index d330bd777bd..42949685e3c 100644 --- a/llvm/test/CodeGen/PowerPC/f128-conv.ll +++ b/llvm/test/CodeGen/PowerPC/f128-conv.ll @@ -714,3 +714,129 @@ entry: store fp128 %conv, fp128* %res, align 16 ret void } + +; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py + +; Function Attrs: norecurse nounwind +define void @cvdp2sw2qp(double %val, fp128* nocapture %res) { +; CHECK-LABEL: cvdp2sw2qp: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: xscvdpsxws 2, 1 +; CHECK-NEXT: vextsw2d 2, 2 +; CHECK-NEXT: xscvsdqp 2, 2 +; CHECK-NEXT: stxv 2, 0(4) +; CHECK-NEXT: blr +entry: + %conv = fptosi double %val to i32 + %conv1 = sitofp i32 %conv to fp128 + store fp128 %conv1, fp128* %res, align 16 + ret void +} + +; Function Attrs: norecurse nounwind +define void @cvdp2sdw2qp(double %val, fp128* nocapture %res) { +; CHECK-LABEL: cvdp2sdw2qp: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: xscvdpsxds 2, 1 +; CHECK-NEXT: xscvsdqp 2, 2 +; CHECK-NEXT: stxv 2, 0(4) +; CHECK-NEXT: blr +entry: + %conv = fptosi double %val to i64 + %conv1 = sitofp i64 %conv to fp128 + store fp128 %conv1, fp128* %res, align 16 + ret void +} + +; Function Attrs: norecurse nounwind +define void @cvsp2sw2qp(float %val, fp128* nocapture %res) { +; CHECK-LABEL: cvsp2sw2qp: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: xscvdpsxws 2, 1 +; CHECK-NEXT: vextsw2d 2, 2 +; CHECK-NEXT: xscvsdqp 2, 2 +; CHECK-NEXT: stxv 2, 0(4) +; CHECK-NEXT: blr +entry: + %conv = fptosi float %val to i32 + %conv1 = sitofp i32 %conv to fp128 + store fp128 %conv1, fp128* %res, align 16 + ret void +} + +; Function Attrs: norecurse nounwind +define void @cvsp2sdw2qp(float %val, fp128* nocapture %res) { +; CHECK-LABEL: cvsp2sdw2qp: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: xscvdpsxds 2, 1 +; CHECK-NEXT: xscvsdqp 2, 2 +; CHECK-NEXT: stxv 2, 0(4) +; CHECK-NEXT: blr +entry: + %conv = fptosi float %val to i64 + %conv1 = sitofp i64 %conv to fp128 + store fp128 %conv1, fp128* %res, align 16 + ret void +} + +; Function Attrs: norecurse nounwind +define void @cvdp2uw2qp(double %val, fp128* nocapture %res) { +; CHECK-LABEL: cvdp2uw2qp: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: xscvdpuxws 0, 1 +; CHECK-NEXT: xxextractuw 2, 0, 8 +; CHECK-NEXT: xscvudqp 2, 2 +; CHECK-NEXT: stxv 2, 0(4) +; CHECK-NEXT: blr +entry: + %conv = fptoui double %val to i32 + %conv1 = uitofp i32 %conv to fp128 + store fp128 %conv1, fp128* %res, align 16 + ret void +} + +; Function Attrs: norecurse nounwind +define void @cvdp2udw2qp(double %val, fp128* nocapture %res) { +; CHECK-LABEL: cvdp2udw2qp: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: xscvdpuxds 2, 1 +; CHECK-NEXT: xscvudqp 2, 2 +; CHECK-NEXT: stxv 2, 0(4) +; CHECK-NEXT: blr +entry: + %conv = fptoui double %val to i64 + %conv1 = uitofp i64 %conv to fp128 + store fp128 %conv1, fp128* %res, align 16 + ret void +} + +; Function Attrs: norecurse nounwind +define void @cvsp2uw2qp(float %val, fp128* nocapture %res) { +; CHECK-LABEL: cvsp2uw2qp: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: xscvdpuxws 0, 1 +; CHECK-NEXT: xxextractuw 2, 0, 8 +; CHECK-NEXT: xscvudqp 2, 2 +; CHECK-NEXT: stxv 2, 0(4) +; CHECK-NEXT: blr +entry: + %conv = fptoui float %val to i32 + %conv1 = uitofp i32 %conv to fp128 + store fp128 %conv1, fp128* %res, align 16 + ret void +} + +; Function Attrs: norecurse nounwind +define void @cvsp2udw2qp(float %val, fp128* nocapture %res) { +; CHECK-LABEL: cvsp2udw2qp: +; CHECK: # %bb.0: # %entry +; CHECK-NEXT: xscvdpuxds 2, 1 +; CHECK-NEXT: xscvudqp 2, 2 +; CHECK-NEXT: stxv 2, 0(4) +; CHECK-NEXT: blr +entry: + %conv = fptoui float %val to i64 + %conv1 = uitofp i64 %conv to fp128 + store fp128 %conv1, fp128* %res, align 16 + ret void +} diff --git a/llvm/test/CodeGen/PowerPC/f128-passByValue.ll b/llvm/test/CodeGen/PowerPC/f128-passByValue.ll index a495b5b48a9..ed5edc1acd8 100644 --- a/llvm/test/CodeGen/PowerPC/f128-passByValue.ll +++ b/llvm/test/CodeGen/PowerPC/f128-passByValue.ll @@ -218,12 +218,12 @@ entry: define void @mixParam_03(fp128 %f1, double* nocapture %d1, <4 x i32> %vec1, ; CHECK-LABEL: mixParam_03: ; CHECK: # %bb.0: # %entry -; CHECK-NEXT: ld 3, 104(1) -; CHECK-NEXT: mtvsrwa [[REG2:[0-9]+]], 10 -; CHECK-NEXT: stxv [[REG0:[0-9]+]], 0(9) -; CHECK-NEXT: stxvx [[REG1:[0-9]+]], 0, 3 -; CHECK-NEXT: lxv [[REG0]], 0(9) -; CHECK-NEXT: xscvsdqp [[REG1]], [[REG2]] +; CHECK-DAG: ld 3, 104(1) +; CHECK-DAG: mtvsrwa [[REG2:[0-9]+]], 10 +; CHECK-DAG: stxv 2, 0(9) +; CHECK-DAG: xscvsdqp [[REG1:[0-9]+]], [[REG2]] +; CHECK: stxvx 3, 0, 3 +; CHECK-NEXT: lxv 2, 0(9) ; CHECK-NEXT: xsaddqp 2, 2, [[REG1]] ; CHECK-NEXT: xscvqpdp 2, 2 ; CHECK-NEXT: stxsd 2, 0(5) @@ -249,10 +249,10 @@ define fastcc void @mixParam_03f(fp128 %f1, double* nocapture %d1, <4 x i32> %ve ; CHECK-NEXT: stxv [[REG1:[0-9]+]], 0(4) ; CHECK-NEXT: stxv [[REG2:[0-9]+]], 0(7) ; CHECK-NEXT: lxv [[REG1]], 0(4) -; CHECK-NEXT: xscvsdqp [[REG2]], [[REG0]] -; CHECK-NEXT: xsaddqp [[REG1]], [[REG1]], [[REG2]] -; CHECK-NEXT: xscvqpdp [[REG1]], [[REG1]] -; CHECK-NEXT: stxsd [[REG1]], 0(3) +; CHECK-NEXT: xscvsdqp [[REG3:[0-9]+]], [[REG0]] +; CHECK-NEXT: xsaddqp [[REG4:[0-9]+]], [[REG1]], [[REG3]] +; CHECK-NEXT: xscvqpdp 2, [[REG4]] +; CHECK-NEXT: stxsd 2, 0(3) ; CHECK-NEXT: blr fp128* nocapture %f2, i32 signext %i1, i8 zeroext %c1, <4 x i32>* nocapture %vec2) { |

