diff options
author | Hal Finkel <hfinkel@anl.gov> | 2013-04-04 22:44:12 +0000 |
---|---|---|
committer | Hal Finkel <hfinkel@anl.gov> | 2013-04-04 22:44:12 +0000 |
commit | 7530a9f7d1e62b28e04d771158613c2954cc8d8c (patch) | |
tree | ac34bff1428058e16acae42c4b454961108475ab /test/CodeGen/PowerPC/recipest.ll | |
parent | 0e58d92628486aee7e4745d451c37a9b409adf7a (diff) | |
download | external_llvm-7530a9f7d1e62b28e04d771158613c2954cc8d8c.zip external_llvm-7530a9f7d1e62b28e04d771158613c2954cc8d8c.tar.gz external_llvm-7530a9f7d1e62b28e04d771158613c2954cc8d8c.tar.bz2 |
PPC: Improve code generation for mixed-precision reciprocal sqrt
The DAGCombine logic that recognized a/sqrt(b) and transformed it into
a multiplication by the reciprocal sqrt did not handle cases where the
sqrt and the division were separated by an fpext or fptrunc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@178801 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/PowerPC/recipest.ll')
-rw-r--r-- | test/CodeGen/PowerPC/recipest.ll | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/test/CodeGen/PowerPC/recipest.ll b/test/CodeGen/PowerPC/recipest.ll index cad98c5..89705fa 100644 --- a/test/CodeGen/PowerPC/recipest.ll +++ b/test/CodeGen/PowerPC/recipest.ll @@ -31,6 +31,54 @@ entry: ; CHECK-SAFE: blr } +define double @foof(double %a, float %b) nounwind { +entry: + %x = call float @llvm.sqrt.f32(float %b) + %y = fpext float %x to double + %r = fdiv double %a, %y + ret double %r + +; CHECK: @foof +; CHECK: frsqrtes +; CHECK: fnmsubs +; CHECK: fmuls +; CHECK: fmadds +; CHECK: fmuls +; CHECK: fmul +; CHECK: blr + +; CHECK-SAFE: @foof +; CHECK-SAFE: fsqrts +; CHECK-SAFE: fdiv +; CHECK-SAFE: blr +} + +define float @food(float %a, double %b) nounwind { +entry: + %x = call double @llvm.sqrt.f64(double %b) + %y = fptrunc double %x to float + %r = fdiv float %a, %y + ret float %r + +; CHECK: @foo +; CHECK: frsqrte +; CHECK: fnmsub +; CHECK: fmul +; CHECK: fmadd +; CHECK: fmul +; CHECK: fmul +; CHECK: fmadd +; CHECK: fmul +; CHECK: frsp +; CHECK: fmuls +; CHECK: blr + +; CHECK-SAFE: @foo +; CHECK-SAFE: fsqrt +; CHECK-SAFE: fdivs +; CHECK-SAFE: blr +} + define float @goo(float %a, float %b) nounwind { entry: %x = call float @llvm.sqrt.f32(float %b) |