summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorJatin Bhateja <jatin.bhateja@gmail.com>2017-09-21 09:53:21 +0000
committerJatin Bhateja <jatin.bhateja@gmail.com>2017-09-21 09:53:21 +0000
commit1a86c382d4e727d57ae8ed602569fc01a03fa71d (patch)
tree3cad991a16674f940ee73ce3f366487f757edde9 /llvm
parent3674fb6f2c061250f4f40b7f261a16b0595a3b6a (diff)
downloadbcm5719-llvm-1a86c382d4e727d57ae8ed602569fc01a03fa71d.tar.gz
bcm5719-llvm-1a86c382d4e727d57ae8ed602569fc01a03fa71d.zip
[X86] Adding a testpoint for fast-math flags propagation.
Reviewers: jbhateja Reviewed By: jbhateja Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D38127 llvm-svn: 313869
Diffstat (limited to 'llvm')
-rw-r--r--llvm/test/CodeGen/X86/fmf-flags.ll47
1 files changed, 47 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/fmf-flags.ll b/llvm/test/CodeGen/X86/fmf-flags.ll
new file mode 100644
index 00000000000..f12740a11b5
--- /dev/null
+++ b/llvm/test/CodeGen/X86/fmf-flags.ll
@@ -0,0 +1,47 @@
+; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
+; RUN: llc < %s -mtriple=x86_64-unknown | FileCheck %s -check-prefix=X64
+; RUN: llc < %s -mtriple=i686-unknown | FileCheck %s -check-prefix=X86
+
+declare float @llvm.sqrt.f32(float %x);
+
+define float @fast_recip_sqrt(float %x) {
+; X64-LABEL: fast_recip_sqrt:
+; X64: # BB#0:
+; X64-NEXT: sqrtss %xmm0, %xmm1
+; X64-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
+; X64-NEXT: divss %xmm1, %xmm0
+; X64-NEXT: retq
+;
+; X86-LABEL: fast_recip_sqrt:
+; X86: # BB#0:
+; X86-NEXT: flds {{[0-9]+}}(%esp)
+; X86-NEXT: fsqrt
+; X86-NEXT: fld1
+; X86-NEXT: fdivp %st(1)
+; X86-NEXT: retl
+ %y = call fast float @llvm.sqrt.f32(float %x)
+ %z = fdiv fast float 1.0, %y
+ ret float %z
+}
+
+declare float @llvm.fmuladd.f32(float %a, float %b, float %c);
+
+define float @fast_fmuladd_opts(float %a , float %b , float %c) {
+; X64-LABEL: fast_fmuladd_opts:
+; X64: # BB#0:
+; X64-NEXT: movaps %xmm0, %xmm1
+; X64-NEXT: addss %xmm1, %xmm1
+; X64-NEXT: addss %xmm0, %xmm1
+; X64-NEXT: movaps %xmm1, %xmm0
+; X64-NEXT: retq
+;
+; X86-LABEL: fast_fmuladd_opts:
+; X86: # BB#0:
+; X86-NEXT: flds {{[0-9]+}}(%esp)
+; X86-NEXT: fld %st(0)
+; X86-NEXT: fadd %st(1)
+; X86-NEXT: faddp %st(1)
+; X86-NEXT: retl
+ %res = call fast float @llvm.fmuladd.f32(float %a, float 2.0, float %a)
+ ret float %res
+}
OpenPOWER on IntegriCloud