Cranelift(aarch64): Use an existing extractor instead of a new pure constructor (#5273)
This commit is contained in:
@@ -1614,9 +1614,6 @@
|
|||||||
(decl imm12_from_u64 (Imm12) u64)
|
(decl imm12_from_u64 (Imm12) u64)
|
||||||
(extern extractor imm12_from_u64 imm12_from_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)
|
(decl u8_into_uimm5 (u8) UImm5)
|
||||||
(extern constructor u8_into_uimm5 u8_into_uimm5)
|
(extern constructor u8_into_uimm5 u8_into_uimm5)
|
||||||
|
|
||||||
@@ -3483,12 +3480,12 @@
|
|||||||
(rule (lower_icmp_const (IntCC.UnsignedGreaterThanOrEqual) a b ty)
|
(rule (lower_icmp_const (IntCC.UnsignedGreaterThanOrEqual) a b ty)
|
||||||
(if (ty_int_ref_scalar_64 ty))
|
(if (ty_int_ref_scalar_64 ty))
|
||||||
(if-let $true (u64_is_odd b))
|
(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)))
|
(flags_and_cc (cmp_imm (operand_size ty) a imm) (IntCC.UnsignedGreaterThan)))
|
||||||
(rule (lower_icmp_const (IntCC.SignedGreaterThanOrEqual) a b ty)
|
(rule (lower_icmp_const (IntCC.SignedGreaterThanOrEqual) a b ty)
|
||||||
(if (ty_int_ref_scalar_64 ty))
|
(if (ty_int_ref_scalar_64 ty))
|
||||||
(if-let $true (u64_is_odd b))
|
(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)))
|
(flags_and_cc (cmp_imm (operand_size ty) a imm) (IntCC.SignedGreaterThan)))
|
||||||
|
|
||||||
(rule -1 (lower_icmp_const cond rn (imm12_from_u64 c) ty)
|
(rule -1 (lower_icmp_const cond rn (imm12_from_u64 c) ty)
|
||||||
|
|||||||
@@ -129,10 +129,6 @@ impl Context for IsleContext<'_, '_, MInst, Flags, IsaFlags, 6> {
|
|||||||
Imm12::maybe_from_u64(n)
|
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> {
|
fn imm12_from_negated_u64(&mut self, n: u64) -> Option<Imm12> {
|
||||||
Imm12::maybe_from_u64((n as i64).wrapping_neg() as u64)
|
Imm12::maybe_from_u64((n as i64).wrapping_neg() as u64)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user