x64: Add AVX support for some more float-related instructions (#6092)

* x64: Add AVX encodings of `vcvt{ss2sd,sd2ss}`

Additionally update the instruction helpers to take an `XmmMem` argument
to allow load sinking into the instruction.

* x64: Add AVX encoding of `sqrts{s,d}`

* x64: Add AVX support for `rounds{s,d}`
This commit is contained in:
Alex Crichton
2023-03-29 13:09:49 -05:00
committed by GitHub
parent afb417920d
commit 0b0ac3ff73
8 changed files with 543 additions and 11 deletions

View File

@@ -1299,6 +1299,12 @@
Vpmovmskb
Vcvtsi2ss
Vcvtsi2sd
Vcvtss2sd
Vcvtsd2ss
Vsqrtss
Vsqrtsd
Vroundss
Vroundsd
))
(type Avx512Opcode extern
@@ -3348,11 +3354,17 @@
(decl x64_roundss (XmmMem RoundImm) Xmm)
(rule (x64_roundss src1 round)
(xmm_unary_rm_r_imm (SseOpcode.Roundss) src1 (encode_round_imm round)))
(rule 1 (x64_roundss src1 round)
(if-let $true (use_avx_simd))
(xmm_unary_rm_r_imm_vex (AvxOpcode.Vroundss) src1 (encode_round_imm round)))
;; Helper for creating `roundsd` instructions.
(decl x64_roundsd (XmmMem RoundImm) Xmm)
(rule (x64_roundsd src1 round)
(xmm_unary_rm_r_imm (SseOpcode.Roundsd) src1 (encode_round_imm round)))
(rule 1 (x64_roundsd src1 round)
(if-let $true (use_avx_simd))
(xmm_unary_rm_r_imm_vex (AvxOpcode.Vroundsd) src1 (encode_round_imm round)))
;; Helper for creating `roundps` instructions.
(decl x64_roundps (XmmMem RoundImm) Xmm)
@@ -3985,10 +3997,16 @@
;; Helper for creating `sqrtss` instructions.
(decl x64_sqrtss (XmmMem) Xmm)
(rule (x64_sqrtss x) (xmm_unary_rm_r_unaligned (SseOpcode.Sqrtss) x))
(rule 1 (x64_sqrtss x)
(if-let $true (use_avx_simd))
(xmm_unary_rm_r_vex (AvxOpcode.Vsqrtss) x))
;; Helper for creating `sqrtsd` instructions.
(decl x64_sqrtsd (XmmMem) Xmm)
(rule (x64_sqrtsd x) (xmm_unary_rm_r_unaligned (SseOpcode.Sqrtsd) x))
(rule 1 (x64_sqrtsd x)
(if-let $true (use_avx_simd))
(xmm_unary_rm_r_vex (AvxOpcode.Vsqrtsd) x))
;; Helper for creating `sqrtps` instructions.
(decl x64_sqrtps (XmmMem) Xmm)
@@ -4005,12 +4023,18 @@
(xmm_unary_rm_r_vex (AvxOpcode.Vsqrtpd) x))
;; Helper for creating `cvtss2sd` instructions.
(decl x64_cvtss2sd (Xmm) Xmm)
(rule (x64_cvtss2sd x) (xmm_unary_rm_r (SseOpcode.Cvtss2sd) x))
(decl x64_cvtss2sd (XmmMem) Xmm)
(rule (x64_cvtss2sd x) (xmm_unary_rm_r_unaligned (SseOpcode.Cvtss2sd) x))
(rule 1 (x64_cvtss2sd x)
(if-let $true (use_avx_simd))
(xmm_unary_rm_r_vex (AvxOpcode.Vcvtss2sd) x))
;; Helper for creating `cvtsd2ss` instructions.
(decl x64_cvtsd2ss (Xmm) Xmm)
(rule (x64_cvtsd2ss x) (xmm_unary_rm_r (SseOpcode.Cvtsd2ss) x))
(decl x64_cvtsd2ss (XmmMem) Xmm)
(rule (x64_cvtsd2ss x) (xmm_unary_rm_r_unaligned (SseOpcode.Cvtsd2ss) x))
(rule 1 (x64_cvtsd2ss x)
(if-let $true (use_avx_simd))
(xmm_unary_rm_r_vex (AvxOpcode.Vcvtsd2ss) x))
;; Helper for creating `cvtdq2ps` instructions.
(decl x64_cvtdq2ps (XmmMem) Xmm)