Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pulley: Refactor and reuse imm for floats #9872

Merged
merged 1 commit into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions cranelift/codegen/src/isa/pulley_shared/inst.isle
Original file line number Diff line number Diff line change
Expand Up @@ -389,18 +389,8 @@
(rule 0 (imm $I64 x) (pulley_xconst64 (u64_as_i64 x)))

;; Base cases for floats.
(rule 0 (imm $F32 c) (gen_bitcast (imm $I32 c) $I32 $F32))
(rule 0 (imm $F64 c) (gen_bitcast (imm $I64 c) $I64 $F64))

;;;; Bitcasts ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Bitcast from the first type, into the second type.
(decl gen_bitcast (Reg Type Type) Reg)
(rule (gen_bitcast r $F32 $I32) (pulley_bitcast_float_from_int_32 r))
(rule (gen_bitcast r $F64 $I64) (pulley_bitcast_float_from_int_64 r))
(rule (gen_bitcast r $I32 $F32) (pulley_bitcast_int_from_float_32 r))
(rule (gen_bitcast r $I64 $F64) (pulley_bitcast_int_from_float_64 r))
(rule -1 (gen_bitcast r ty ty) r)
(rule 0 (imm $F32 (u64_as_u32 c)) (pulley_fconst32 c))
(rule 0 (imm $F64 c) (pulley_fconst64 c))

;;;; Instruction Constructors ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Expand Down
6 changes: 2 additions & 4 deletions cranelift/codegen/src/isa/pulley_shared/lower.isle
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,11 @@

;;;; Rules for `f32const`;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(rule (lower (f32const (u32_from_ieee32 x)))
(pulley_fconst32 x))
(rule (lower (f32const (u32_from_ieee32 x))) (imm $F32 x))

;;;; Rules for `f64const`;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(rule (lower (f64const (u64_from_ieee64 x)))
(pulley_fconst64 x))
(rule (lower (f64const (u64_from_ieee64 x))) (imm $F64 x))

;;;; Rules for `iadd` ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Expand Down
Loading