From 329d53a06013080f4a64282fb938c915a694791b Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Thu, 21 Sep 2017 17:40:58 +0000 Subject: [PATCH] [x86] add more tests for node-level FMF; NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313893 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/CodeGen/X86/fmf-flags.ll | 45 +++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/test/CodeGen/X86/fmf-flags.ll b/test/CodeGen/X86/fmf-flags.ll index f12740a11b5..50f34e8b814 100644 --- a/test/CodeGen/X86/fmf-flags.ll +++ b/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 +} + -- 2.50.0