Browse Source

Cranelift(aarch64): Use an existing extractor instead of a new pure constructor (#5273)

pull/5277/head
Nick Fitzgerald 2 years ago
committed by GitHub
parent
commit
f6ae67f3f0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      cranelift/codegen/src/isa/aarch64/inst.isle
  2. 4
      cranelift/codegen/src/isa/aarch64/lower/isle.rs

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

@ -1614,9 +1614,6 @@
(decl imm12_from_u64 (Imm12) u64)
(extern extractor imm12_from_u64 imm12_from_u64)
(decl pure make_imm12_from_u64 (u64) Imm12)
(extern constructor make_imm12_from_u64 make_imm12_from_u64)
(decl u8_into_uimm5 (u8) UImm5)
(extern constructor u8_into_uimm5 u8_into_uimm5)
@ -3483,12 +3480,12 @@
(rule (lower_icmp_const (IntCC.UnsignedGreaterThanOrEqual) a b ty)
(if (ty_int_ref_scalar_64 ty))
(if-let $true (u64_is_odd b))
(if-let imm (make_imm12_from_u64 (u64_sub b 1)))
(if-let (imm12_from_u64 imm) (u64_sub b 1))
(flags_and_cc (cmp_imm (operand_size ty) a imm) (IntCC.UnsignedGreaterThan)))
(rule (lower_icmp_const (IntCC.SignedGreaterThanOrEqual) a b ty)
(if (ty_int_ref_scalar_64 ty))
(if-let $true (u64_is_odd b))
(if-let imm (make_imm12_from_u64 (u64_sub b 1)))
(if-let (imm12_from_u64 imm) (u64_sub b 1))
(flags_and_cc (cmp_imm (operand_size ty) a imm) (IntCC.SignedGreaterThan)))
(rule -1 (lower_icmp_const cond rn (imm12_from_u64 c) ty)

4
cranelift/codegen/src/isa/aarch64/lower/isle.rs

@ -129,10 +129,6 @@ impl Context for IsleContext<'_, '_, MInst, Flags, IsaFlags, 6> {
Imm12::maybe_from_u64(n)
}
fn make_imm12_from_u64(&mut self, n: u64) -> Option<Imm12> {
Imm12::maybe_from_u64(n)
}
fn imm12_from_negated_u64(&mut self, n: u64) -> Option<Imm12> {
Imm12::maybe_from_u64((n as i64).wrapping_neg() as u64)
}

Loading…
Cancel
Save