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

This commit is contained in:
Nick Fitzgerald
2022-11-15 12:40:44 -08:00
committed by GitHub
parent d335dc8d5a
commit f6ae67f3f0
2 changed files with 2 additions and 9 deletions

View File

@@ -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)

View File

@@ -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)
}