Browse Source

X64: Port fpromote to ISLE (#4230)

pull/4231/head
Johnnie Birch 2 years ago
committed by GitHub
parent
commit
3f152273d3
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      cranelift/codegen/src/isa/x64/inst.isle
  2. 4
      cranelift/codegen/src/isa/x64/lower.isle
  3. 6
      cranelift/codegen/src/isa/x64/lower.rs

7
cranelift/codegen/src/isa/x64/inst.isle

@ -2817,6 +2817,13 @@
(_ Unit (emit (MInst.XmmUnaryRmR (SseOpcode.Sqrtpd) x dst))))
dst))
;; Helper for creating `cvtss2sd` instructions.
(decl x64_cvtss2sd (Xmm) Xmm)
(rule (x64_cvtss2sd x)
(let ((dst WritableXmm (temp_writable_xmm))
(_ Unit (emit (MInst.XmmUnaryRmR (SseOpcode.Cvtss2sd) x dst))))
dst))
;; Helpers for creating `pcmpeq*` instructions.
(decl x64_pcmpeq (Type Xmm XmmMem) Xmm)
(rule (x64_pcmpeq $I8X16 x y) (x64_pcmpeqb x y))

4
cranelift/codegen/src/isa/x64/lower.isle

@ -2318,6 +2318,10 @@
(rule (lower (has_type $F64X2 (sqrt x)))
(x64_sqrtpd x))
;; Rules for `fpromote` ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(rule (lower (has_type $F64 (fpromote x)))
(x64_cvtss2sd x))
;; Rules for `fmin` ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(rule (lower (has_type $F32 (fmin x y)))

6
cranelift/codegen/src/isa/x64/lower.rs

@ -1041,11 +1041,7 @@ fn lower_insn_to_regs<C: LowerCtx<I = Inst>>(
}
Opcode::Fpromote => {
// We can't guarantee the RHS (if a load) is 128-bit aligned, so we
// must avoid merging a load here.
let src = RegMem::reg(put_input_in_reg(ctx, inputs[0]));
let dst = get_output_reg(ctx, outputs[0]).only_reg().unwrap();
ctx.emit(Inst::xmm_unary_rm_r(SseOpcode::Cvtss2sd, src, dst));
implemented_in_isle(ctx);
}
Opcode::FvpromoteLow => {

Loading…
Cancel
Save