x64: Lower fcopysign, ceil, floor, nearest, and trunc in ISLE (#4730)

https://github.com/bytecodealliance/wasmtime/pull/4730
This commit is contained in:
Trevor Elliott
2022-08-22 13:57:36 -07:00
committed by GitHub
parent bb0b6dafde
commit cee4b209f3
14 changed files with 605 additions and 111 deletions

View File

@@ -1120,6 +1120,15 @@
(decl encode_fcmp_imm (FcmpImm) u8)
(extern constructor encode_fcmp_imm encode_fcmp_imm)
(type RoundImm extern
(enum RoundNearest
RoundDown
RoundUp
RoundZero))
(decl encode_round_imm (RoundImm) u8)
(extern constructor encode_round_imm encode_round_imm)
;;;; Newtypes for Different Register Classes ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(type Gpr (primitive Gpr))
@@ -1394,6 +1403,9 @@
(decl use_fma () Type)
(extern extractor use_fma use_fma)
(decl use_sse41 () Type)
(extern extractor use_sse41 use_sse41)
;;;; Helpers for Merging and Sinking Immediates/Loads ;;;;;;;;;;;;;;;;;;;;;;;;;
;; Extract a constant `Imm8Reg.Imm8` from a value operand.
@@ -2575,6 +2587,42 @@
lane
size))
;; Helper for creating `roundss` instructions.
(decl x64_roundss (Xmm RoundImm) Xmm)
(rule (x64_roundss src1 round)
(xmm_rm_r_imm (SseOpcode.Roundss)
src1
src1
(encode_round_imm round)
(OperandSize.Size32)))
;; Helper for creating `roundsd` instructions.
(decl x64_roundsd (Xmm RoundImm) Xmm)
(rule (x64_roundsd src1 round)
(xmm_rm_r_imm (SseOpcode.Roundsd)
src1
src1
(encode_round_imm round)
(OperandSize.Size32)))
;; Helper for creating `roundps` instructions.
(decl x64_roundps (Xmm RoundImm) Xmm)
(rule (x64_roundps src1 round)
(xmm_rm_r_imm (SseOpcode.Roundps)
src1
src1
(encode_round_imm round)
(OperandSize.Size32)))
;; Helper for creating `roundpd` instructions.
(decl x64_roundpd (Xmm RoundImm) Xmm)
(rule (x64_roundpd src1 round)
(xmm_rm_r_imm (SseOpcode.Roundpd)
src1
src1
(encode_round_imm round)
(OperandSize.Size32)))
;; Helper for creating `pmaddwd` instructions.
(decl x64_pmaddwd (Xmm XmmMem) Xmm)
(rule (x64_pmaddwd src1 src2)
@@ -3659,7 +3707,18 @@
(type LibCall extern
(enum
FmaF32
FmaF64))
FmaF64
CeilF32
CeilF64
FloorF32
FloorF64
NearestF32
NearestF64
TruncF32
TruncF64))
(decl libcall_1 (LibCall Reg) Reg)
(extern constructor libcall_1 libcall_1)
(decl libcall_3 (LibCall Reg Reg Reg) Reg)
(extern constructor libcall_3 libcall_3)