[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
This commit is contained in:
Sanjay Patel 2017-09-21 17:40:58 +00:00
parent 20a3d67d3a
commit 329d53a060

View File

@ -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
}