x64: Lower stack_addr, udiv, sdiv, urem, srem, umulhi, smulhi in ISLE (#4741)
Lower stack_addr, udiv, sdiv, urem, srem, umulhi, and smulhi in ISLE. For udiv, sdiv, urem, and srem I opted to move the original lowering into an extern constructor, as the interactions with rax and rdx for the div instruction didn't seem meaningful to implement in ISLE. However, I'm happy to revisit this choice and move more of the embedding into ISLE.
This commit is contained in:
@@ -2738,7 +2738,7 @@
|
||||
(rule (mul_hi ty signed src1 src2)
|
||||
(let ((dst_lo WritableGpr (temp_writable_gpr))
|
||||
(dst_hi WritableGpr (temp_writable_gpr))
|
||||
(size OperandSize (operand_size_of_type_32_64 ty))
|
||||
(size OperandSize (raw_operand_size_of_type ty))
|
||||
(_ Unit (emit (MInst.MulHi size
|
||||
signed
|
||||
src1
|
||||
@@ -3587,6 +3587,25 @@
|
||||
(rule (bitcast_gpr_to_xmm $I64 src)
|
||||
(gpr_to_xmm (SseOpcode.Movq) src (OperandSize.Size64)))
|
||||
|
||||
;;;; Stack Addresses ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(decl stack_addr_impl (StackSlot Offset32) Gpr)
|
||||
(rule (stack_addr_impl stack_slot offset)
|
||||
(let ((dst WritableGpr (temp_writable_gpr))
|
||||
(_ Unit (emit (abi_stackslot_addr dst stack_slot offset))))
|
||||
dst))
|
||||
|
||||
;;;; Division/Remainders ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(decl emit_div_or_rem (DivOrRemKind Type WritableGpr Gpr Gpr) Unit)
|
||||
(extern constructor emit_div_or_rem emit_div_or_rem)
|
||||
|
||||
(decl div_or_rem (DivOrRemKind Value Value) Gpr)
|
||||
(rule (div_or_rem kind a @ (value_type ty) b)
|
||||
(let ((dst WritableGpr (temp_writable_gpr))
|
||||
(_ Unit (emit_div_or_rem kind ty dst a b)))
|
||||
dst))
|
||||
|
||||
;;;; Automatic conversions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(convert Gpr InstOutput output_gpr)
|
||||
|
||||
Reference in New Issue
Block a user