diff options
author | Akira Hatanaka <ahatanaka@mips.com> | 2013-06-11 22:21:44 +0000 |
---|---|---|
committer | Akira Hatanaka <ahatanaka@mips.com> | 2013-06-11 22:21:44 +0000 |
commit | 45137f954f976ea75282f7b4b2dac5777837840f (patch) | |
tree | d26cbbbd3339d9a81bfae2a53c7451eb4f784fe9 /test/CodeGen/Mips/optimize-fp-math.ll | |
parent | a11c3e25015a62c817e60ec4f955a7f3f3bb6c67 (diff) |
[mips] Add an IR transformation pass that optimizes calls to sqrt.
The pass emits a call to sqrt that has attribute "read-none". This call will be
converted to an ISD::FSQRT node during DAG construction, which will turn into
a mips native sqrt instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@183802 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/Mips/optimize-fp-math.ll')
-rw-r--r-- | test/CodeGen/Mips/optimize-fp-math.ll | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/test/CodeGen/Mips/optimize-fp-math.ll b/test/CodeGen/Mips/optimize-fp-math.ll new file mode 100644 index 00000000000..9348d3c8f12 --- /dev/null +++ b/test/CodeGen/Mips/optimize-fp-math.ll @@ -0,0 +1,32 @@ +; RUN: llc -march=mipsel < %s | FileCheck %s -check-prefix=32 +; RUN: llc -march=mips64el -mcpu=mips64 < %s | FileCheck %s -check-prefix=64 + +; 32: test_sqrtf_float_: +; 32: sqrt.s $f[[R0:[0-9]+]], $f{{[0-9]+}} +; 32: c.un.s $f[[R0]], $f[[R0]] +; 64: test_sqrtf_float_: +; 64: sqrt.s $f[[R0:[0-9]+]], $f{{[0-9]+}} +; 64: c.un.s $f[[R0]], $f[[R0]] + +define float @test_sqrtf_float_(float %a) { +entry: + %call = tail call float @sqrtf(float %a) + ret float %call +} + +declare float @sqrtf(float) + +; 32: test_sqrt_double_: +; 32: sqrt.d $f[[R0:[0-9]+]], $f{{[0-9]+}} +; 32: c.un.d $f[[R0]], $f[[R0]] +; 64: test_sqrt_double_: +; 64: sqrt.d $f[[R0:[0-9]+]], $f{{[0-9]+}} +; 64: c.un.d $f[[R0]], $f[[R0]] + +define double @test_sqrt_double_(double %a) { +entry: + %call = tail call double @sqrt(double %a) + ret double %call +} + +declare double @sqrt(double) |