Legalize uextend and sextend to 128bit ints
This commit is contained in:
@@ -161,8 +161,16 @@ impl TypeEnvironment {
|
||||
|
||||
// Check extra conditions for InTypeset constraints.
|
||||
if let Constraint::InTypeset(tv, _) = &constraint {
|
||||
assert!(tv.base.is_none());
|
||||
assert!(tv.name.starts_with("typeof_"));
|
||||
assert!(
|
||||
tv.base.is_none(),
|
||||
"type variable is {:?}, while expecting none",
|
||||
tv
|
||||
);
|
||||
assert!(
|
||||
tv.name.starts_with("typeof_"),
|
||||
"Name \"{}\" should start with \"typeof_\"",
|
||||
tv.name
|
||||
);
|
||||
}
|
||||
|
||||
self.constraints.push(constraint);
|
||||
|
||||
@@ -207,6 +207,28 @@ pub(crate) fn define(insts: &InstructionGroup, imm: &Immediates) -> TransformGro
|
||||
// embedded as part of arguments), so use a custom legalization for now.
|
||||
narrow.custom_legalize(iconst, "narrow_iconst");
|
||||
|
||||
{
|
||||
let inst = uextend.bind(I128).bind(I64);
|
||||
narrow.legalize(
|
||||
def!(a = inst(x)),
|
||||
vec![
|
||||
def!(ah = iconst(Literal::constant(&imm.imm64, 0))),
|
||||
def!(a = iconcat(x, ah)),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
{
|
||||
let inst = sextend.bind(I128).bind(I64);
|
||||
narrow.legalize(
|
||||
def!(a = inst(x)),
|
||||
vec![
|
||||
def!(ah = sshr_imm(x, Literal::constant(&imm.imm64, 63))), // splat sign bit to whole number
|
||||
def!(a = iconcat(x, ah)),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
for &bin_op in &[band, bor, bxor, band_not, bor_not, bxor_not] {
|
||||
narrow.legalize(
|
||||
def!(a = bin_op(x, y)),
|
||||
|
||||
Reference in New Issue
Block a user