aarch64: Translate rot{r,l} to ISLE (#3614)
This commit translates the `rotl` and `rotr` lowerings already existing to ISLE. The port was relatively straightforward with the biggest changing being the instructions generated around i128 rotl/rotr primarily due to register changes.
This commit is contained in:
@@ -24,6 +24,7 @@ use crate::{
|
||||
machinst::{ty_bits, InsnOutput, LowerCtx},
|
||||
};
|
||||
use std::boxed::Box;
|
||||
use std::convert::TryFrom;
|
||||
use std::vec::Vec;
|
||||
|
||||
type BoxCallInfo = Box<CallInfo>;
|
||||
@@ -262,4 +263,20 @@ where
|
||||
fn u64_into_imm_logic(&mut self, ty: Type, val: u64) -> ImmLogic {
|
||||
ImmLogic::maybe_from_u64(val, ty).unwrap()
|
||||
}
|
||||
|
||||
fn negate_imm_shift(&mut self, ty: Type, mut imm: ImmShift) -> ImmShift {
|
||||
let size = u8::try_from(ty.bits()).unwrap();
|
||||
imm.imm = size.wrapping_sub(imm.value());
|
||||
imm.imm &= size - 1;
|
||||
imm
|
||||
}
|
||||
|
||||
fn rotr_mask(&mut self, ty: Type) -> ImmLogic {
|
||||
ImmLogic::maybe_from_u64((ty.bits() - 1) as u64, I32).unwrap()
|
||||
}
|
||||
|
||||
fn rotr_opposite_amount(&mut self, ty: Type, val: ImmShift) -> ImmShift {
|
||||
let amount = val.value() & u8::try_from(ty.bits() - 1).unwrap();
|
||||
ImmShift::maybe_from_u64(u64::from(ty.bits()) - u64::from(amount)).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user