diff options
author | Stephen Hines <srhines@google.com> | 2014-12-01 14:51:49 -0800 |
---|---|---|
committer | Stephen Hines <srhines@google.com> | 2014-12-02 16:08:10 -0800 |
commit | 37ed9c199ca639565f6ce88105f9e39e898d82d0 (patch) | |
tree | 8fb36d3910e3ee4c4e1b7422f4f017108efc52f5 /test/CodeGen/PowerPC/recipest.ll | |
parent | d2327b22152ced7bc46dc629fc908959e8a52d03 (diff) | |
download | external_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.zip external_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.tar.gz external_llvm-37ed9c199ca639565f6ce88105f9e39e898d82d0.tar.bz2 |
Update aosp/master LLVM for rebase to r222494.
Change-Id: Ic787f5e0124df789bd26f3f24680f45e678eef2d
Diffstat (limited to 'test/CodeGen/PowerPC/recipest.ll')
-rw-r--r-- | test/CodeGen/PowerPC/recipest.ll | 124 |
1 files changed, 67 insertions, 57 deletions
diff --git a/test/CodeGen/PowerPC/recipest.ll b/test/CodeGen/PowerPC/recipest.ll index 891e801..cd77548 100644 --- a/test/CodeGen/PowerPC/recipest.ll +++ b/test/CodeGen/PowerPC/recipest.ll @@ -1,5 +1,5 @@ -; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 -enable-unsafe-fp-math | FileCheck %s -; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 | FileCheck -check-prefix=CHECK-SAFE %s +; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 -enable-unsafe-fp-math -mattr=-vsx | FileCheck %s +; RUN: llc < %s -mtriple=powerpc64-unknown-linux-gnu -mcpu=pwr7 -mattr=-vsx | FileCheck -check-prefix=CHECK-SAFE %s target datalayout = "E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f128:128:128-v128:128:128-n32:64" target triple = "powerpc64-unknown-linux-gnu" @@ -8,7 +8,6 @@ declare float @llvm.sqrt.f32(float) declare <4 x float> @llvm.sqrt.v4f32(<4 x float>) define double @foo(double %a, double %b) nounwind { -entry: %x = call double @llvm.sqrt.f64(double %b) %r = fdiv double %a, %x ret double %r @@ -17,12 +16,12 @@ entry: ; CHECK-DAG: frsqrte ; CHECK-DAG: fnmsub ; CHECK: fmul -; CHECK: fmadd -; CHECK: fmul -; CHECK: fmul -; CHECK: fmadd -; CHECK: fmul -; CHECK: fmul +; CHECK-NEXT: fmadd +; CHECK-NEXT: fmul +; CHECK-NEXT: fmul +; CHECK-NEXT: fmadd +; CHECK-NEXT: fmul +; CHECK-NEXT: fmul ; CHECK: blr ; CHECK-SAFE: @foo @@ -32,7 +31,6 @@ entry: } 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 @@ -42,10 +40,10 @@ entry: ; CHECK-DAG: frsqrtes ; CHECK-DAG: fnmsubs ; CHECK: fmuls -; CHECK: fmadds -; CHECK: fmuls -; CHECK: fmul -; CHECK: blr +; CHECK-NEXT: fmadds +; CHECK-NEXT: fmuls +; CHECK-NEXT: fmul +; CHECK-NEXT: blr ; CHECK-SAFE: @foof ; CHECK-SAFE: fsqrts @@ -54,7 +52,6 @@ entry: } 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 @@ -64,14 +61,14 @@ entry: ; CHECK-DAG: frsqrte ; CHECK-DAG: fnmsub ; CHECK: fmul -; CHECK: fmadd -; CHECK: fmul -; CHECK: fmul -; CHECK: fmadd -; CHECK: fmul -; CHECK: frsp -; CHECK: fmuls -; CHECK: blr +; CHECK-NEXT: fmadd +; CHECK-NEXT: fmul +; CHECK-NEXT: fmul +; CHECK-NEXT: fmadd +; CHECK-NEXT: fmul +; CHECK-NEXT: frsp +; CHECK-NEXT: fmuls +; CHECK-NEXT: blr ; CHECK-SAFE: @foo ; CHECK-SAFE: fsqrt @@ -80,7 +77,6 @@ entry: } define float @goo(float %a, float %b) nounwind { -entry: %x = call float @llvm.sqrt.f32(float %b) %r = fdiv float %a, %x ret float %r @@ -89,10 +85,10 @@ entry: ; CHECK-DAG: frsqrtes ; CHECK-DAG: fnmsubs ; CHECK: fmuls -; CHECK: fmadds -; CHECK: fmuls -; CHECK: fmuls -; CHECK: blr +; CHECK-NEXT: fmadds +; CHECK-NEXT: fmuls +; CHECK-NEXT: fmuls +; CHECK-NEXT: blr ; CHECK-SAFE: @goo ; CHECK-SAFE: fsqrts @@ -100,8 +96,35 @@ entry: ; CHECK-SAFE: blr } +; Recognize that this is rsqrt(a) * rcp(b) * c, +; not 1 / ( 1 / sqrt(a)) * rcp(b) * c. +define float @rsqrt_fmul(float %a, float %b, float %c) { + %x = call float @llvm.sqrt.f32(float %a) + %y = fmul float %x, %b + %z = fdiv float %c, %y + ret float %z + +; CHECK: @rsqrt_fmul +; CHECK-DAG: frsqrtes +; CHECK-DAG: fres +; CHECK-DAG: fnmsubs +; CHECK-DAG: fmuls +; CHECK-DAG: fnmsubs +; CHECK-DAG: fmadds +; CHECK-DAG: fmadds +; CHECK: fmuls +; CHECK-NEXT: fmuls +; CHECK-NEXT: fmuls +; CHECK-NEXT: blr + +; CHECK-SAFE: @rsqrt_fmul +; CHECK-SAFE: fsqrts +; CHECK-SAFE: fmuls +; CHECK-SAFE: fdivs +; CHECK-SAFE: blr +} + define <4 x float> @hoo(<4 x float> %a, <4 x float> %b) nounwind { -entry: %x = call <4 x float> @llvm.sqrt.v4f32(<4 x float> %b) %r = fdiv <4 x float> %a, %x ret <4 x float> %r @@ -115,7 +138,6 @@ entry: } define double @foo2(double %a, double %b) nounwind { -entry: %r = fdiv double %a, %b ret double %r @@ -123,10 +145,10 @@ entry: ; CHECK-DAG: fre ; CHECK-DAG: fnmsub ; CHECK: fmadd -; CHECK: fnmsub -; CHECK: fmadd -; CHECK: fmul -; CHECK: blr +; CHECK-NEXT: fnmsub +; CHECK-NEXT: fmadd +; CHECK-NEXT: fmul +; CHECK-NEXT: blr ; CHECK-SAFE: @foo2 ; CHECK-SAFE: fdiv @@ -134,7 +156,6 @@ entry: } define float @goo2(float %a, float %b) nounwind { -entry: %r = fdiv float %a, %b ret float %r @@ -142,8 +163,8 @@ entry: ; CHECK-DAG: fres ; CHECK-DAG: fnmsubs ; CHECK: fmadds -; CHECK: fmuls -; CHECK: blr +; CHECK-NEXT: fmuls +; CHECK-NEXT: blr ; CHECK-SAFE: @goo2 ; CHECK-SAFE: fdivs @@ -151,7 +172,6 @@ entry: } define <4 x float> @hoo2(<4 x float> %a, <4 x float> %b) nounwind { -entry: %r = fdiv <4 x float> %a, %b ret <4 x float> %r @@ -164,7 +184,6 @@ entry: } define double @foo3(double %a) nounwind { -entry: %r = call double @llvm.sqrt.f64(double %a) ret double %r @@ -173,16 +192,12 @@ entry: ; CHECK-DAG: frsqrte ; CHECK-DAG: fnmsub ; CHECK: fmul -; CHECK: fmadd -; CHECK: fmul -; CHECK: fmul -; CHECK: fmadd -; CHECK: fmul -; CHECK: fre -; CHECK: fnmsub -; CHECK: fmadd -; CHECK: fnmsub -; CHECK: fmadd +; CHECK-NEXT: fmadd +; CHECK-NEXT: fmul +; CHECK-NEXT: fmul +; CHECK-NEXT: fmadd +; CHECK-NEXT: fmul +; CHECK-NEXT: fmul ; CHECK: blr ; CHECK-SAFE: @foo3 @@ -191,7 +206,6 @@ entry: } define float @goo3(float %a) nounwind { -entry: %r = call float @llvm.sqrt.f32(float %a) ret float %r @@ -200,11 +214,9 @@ entry: ; CHECK-DAG: frsqrtes ; CHECK-DAG: fnmsubs ; CHECK: fmuls -; CHECK: fmadds -; CHECK: fmuls -; CHECK: fres -; CHECK: fnmsubs -; CHECK: fmadds +; CHECK-NEXT: fmadds +; CHECK-NEXT: fmuls +; CHECK-NEXT: fmuls ; CHECK: blr ; CHECK-SAFE: @goo3 @@ -213,13 +225,11 @@ entry: } define <4 x float> @hoo3(<4 x float> %a) nounwind { -entry: %r = call <4 x float> @llvm.sqrt.v4f32(<4 x float> %a) ret <4 x float> %r ; CHECK: @hoo3 ; CHECK: vrsqrtefp -; CHECK-DAG: vrefp ; CHECK-DAG: vcmpeqfp ; CHECK-SAFE: @hoo3 |