cranelift: Avoid lowering VEX instructions with memory encodings (#4768)

This commit is contained in:
Afonso Bordado
2022-08-24 18:35:06 +01:00
committed by GitHub
parent d394edcefe
commit 7e3c481f4e
2 changed files with 25 additions and 4 deletions

View File

@@ -3012,22 +3012,30 @@
dst)) dst))
;; Helper for creating `vfmadd213ss` instructions. ;; Helper for creating `vfmadd213ss` instructions.
(decl x64_vfmadd213ss (Xmm Xmm XmmMem) Xmm) ; TODO: This should have the (Xmm Xmm XmmMem) signature
; but we don't support VEX memory encodings yet
(decl x64_vfmadd213ss (Xmm Xmm Xmm) Xmm)
(rule (x64_vfmadd213ss x y z) (rule (x64_vfmadd213ss x y z)
(xmm_rmr_vex (AvxOpcode.Vfmadd213ss) x y z)) (xmm_rmr_vex (AvxOpcode.Vfmadd213ss) x y z))
;; Helper for creating `vfmadd213sd` instructions. ;; Helper for creating `vfmadd213sd` instructions.
(decl x64_vfmadd213sd (Xmm Xmm XmmMem) Xmm) ; TODO: This should have the (Xmm Xmm XmmMem) signature
; but we don't support VEX memory encodings yet
(decl x64_vfmadd213sd (Xmm Xmm Xmm) Xmm)
(rule (x64_vfmadd213sd x y z) (rule (x64_vfmadd213sd x y z)
(xmm_rmr_vex (AvxOpcode.Vfmadd213sd) x y z)) (xmm_rmr_vex (AvxOpcode.Vfmadd213sd) x y z))
;; Helper for creating `vfmadd213ps` instructions. ;; Helper for creating `vfmadd213ps` instructions.
(decl x64_vfmadd213ps (Xmm Xmm XmmMem) Xmm) ; TODO: This should have the (Xmm Xmm XmmMem) signature
; but we don't support VEX memory encodings yet
(decl x64_vfmadd213ps (Xmm Xmm Xmm) Xmm)
(rule (x64_vfmadd213ps x y z) (rule (x64_vfmadd213ps x y z)
(xmm_rmr_vex (AvxOpcode.Vfmadd213ps) x y z)) (xmm_rmr_vex (AvxOpcode.Vfmadd213ps) x y z))
;; Helper for creating `vfmadd213pd` instructions. ;; Helper for creating `vfmadd213pd` instructions.
(decl x64_vfmadd213pd (Xmm Xmm XmmMem) Xmm) ; TODO: This should have the (Xmm Xmm XmmMem) signature
; but we don't support VEX memory encodings yet
(decl x64_vfmadd213pd (Xmm Xmm Xmm) Xmm)
(rule (x64_vfmadd213pd x y z) (rule (x64_vfmadd213pd x y z)
(xmm_rmr_vex (AvxOpcode.Vfmadd213pd) x y z)) (xmm_rmr_vex (AvxOpcode.Vfmadd213pd) x y z))

View File

@@ -136,3 +136,16 @@ block0(v0: f64, v1: f64, v2: f64):
; run: %fma_is_nan_f64(-NaN, 0x0.0, 0x0.0) == 1 ; run: %fma_is_nan_f64(-NaN, 0x0.0, 0x0.0) == 1
; run: %fma_is_nan_f64(0x0.0, -NaN, 0x0.0) == 1 ; run: %fma_is_nan_f64(0x0.0, -NaN, 0x0.0) == 1
; run: %fma_is_nan_f64(0x0.0, 0x0.0, -NaN) == 1 ; run: %fma_is_nan_f64(0x0.0, 0x0.0, -NaN) == 1
; This is a regression test for the native fma instruction
; Discovered by the fuzzer in: https://github.com/bytecodealliance/wasmtime/issues/4759
function %fma_load_f32(f32, f32, f32) -> f32 {
ss0 = explicit_slot 4
block0(v0: f32, v1: f32, v2: f32):
stack_store.f32 v2, ss0
v3 = stack_load.f32 ss0
v4 = fma v0, v1, v3
return v4
}
; run: %fma_load_f32(0x9.0, 0x9.0, 0x9.0) == 0x1.680000p6