x64: Add native lowering for scalar fma (#4539)

Use `vfmadd213{ss,sd}` for these lowerings.
This commit is contained in:
Afonso Bordado
2022-08-11 23:48:16 +01:00
committed by GitHub
parent 755cd4311e
commit 3ea1813173
10 changed files with 124 additions and 6 deletions

View File

@@ -0,0 +1,33 @@
test compile precise-output
target x86_64 has_avx=false has_fma=false
function %fma_f32(f32, f32, f32) -> f32 {
block0(v0: f32, v1: f32, v2: f32):
v3 = fma v0, v1, v2
return v3
}
; pushq %rbp
; movq %rsp, %rbp
; block0:
; load_ext_name %FmaF32+0, %rax
; call *%rax
; movq %rbp, %rsp
; popq %rbp
; ret
function %fma_f64(f64, f64, f64) -> f64 {
block0(v0: f64, v1: f64, v2: f64):
v3 = fma v0, v1, v2
return v3
}
; pushq %rbp
; movq %rsp, %rbp
; block0:
; load_ext_name %FmaF64+0, %rax
; call *%rax
; movq %rbp, %rsp
; popq %rbp
; ret

View File

@@ -0,0 +1,31 @@
test compile precise-output
target x86_64 has_avx=true has_fma=true
function %fma_f32(f32, f32, f32) -> f32 {
block0(v0: f32, v1: f32, v2: f32):
v3 = fma v0, v1, v2
return v3
}
; pushq %rbp
; movq %rsp, %rbp
; block0:
; vfmadd213ss %xmm0, %xmm1, %xmm2, %xmm0
; movq %rbp, %rsp
; popq %rbp
; ret
function %fma_f64(f64, f64, f64) -> f64 {
block0(v0: f64, v1: f64, v2: f64):
v3 = fma v0, v1, v2
return v3
}
; pushq %rbp
; movq %rsp, %rbp
; block0:
; vfmadd213sd %xmm0, %xmm1, %xmm2, %xmm0
; movq %rbp, %rsp
; popq %rbp
; ret

View File

@@ -2,6 +2,7 @@ test interpret
test run
target aarch64
target s390x
target x86_64 has_avx has_fma
target x86_64 has_avx=false has_fma=false
function %fma_f32(f32, f32, f32) -> f32 {