diff options
author | Sanjay Patel <spatel@rotateright.com> | 2017-09-21 17:40:58 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2017-09-21 17:40:58 +0000 |
commit | 58f02afecd2d52620163ca4ffdf5943df7d35be1 (patch) | |
tree | c21bd1bfb6e9b9d224616a8f2fb87555d74715b9 | |
parent | bbe23ae675c9e601382dff6a52e015b0c4e938b0 (diff) | |
download | bcm5719-llvm-58f02afecd2d52620163ca4ffdf5943df7d35be1.tar.gz bcm5719-llvm-58f02afecd2d52620163ca4ffdf5943df7d35be1.zip |
[x86] add more tests for node-level FMF; NFC
llvm-svn: 313893
-rw-r--r-- | llvm/test/CodeGen/X86/fmf-flags.ll | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/fmf-flags.ll b/llvm/test/CodeGen/X86/fmf-flags.ll index f12740a11b5..50f34e8b814 100644 --- a/llvm/test/CodeGen/X86/fmf-flags.ll +++ b/llvm/test/CodeGen/X86/fmf-flags.ll @@ -45,3 +45,48 @@ define float @fast_fmuladd_opts(float %a , float %b , float %c) { %res = call fast float @llvm.fmuladd.f32(float %a, float 2.0, float %a) ret float %res } + +; The multiply is strict. + +define double @not_so_fast_mul_add(double %x) { +; X64-LABEL: not_so_fast_mul_add: +; X64: # BB#0: +; X64-NEXT: movsd {{.*#+}} xmm1 = mem[0],zero +; X64-NEXT: mulsd %xmm0, %xmm1 +; X64-NEXT: addsd %xmm1, %xmm0 +; X64-NEXT: retq +; +; X86-LABEL: not_so_fast_mul_add: +; X86: # BB#0: +; X86-NEXT: fldl {{[0-9]+}}(%esp) +; X86-NEXT: fld %st(0) +; X86-NEXT: fmull {{\.LCPI.*}} +; X86-NEXT: faddp %st(1) +; X86-NEXT: retl + %m = fmul double %x, 4.2 + %a = fadd fast double %m, %x + ret double %a +} + +; The sqrt is strict. + +define float @not_so_fast_recip_sqrt(float %x) { +; X64-LABEL: not_so_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: not_so_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 float @llvm.sqrt.f32(float %x) + %z = fdiv fast float 1.0, %y + ret float %z +} + |