Legalize uextend and sextend to 128bit ints

This commit is contained in:
bjorn3
2019-11-16 16:25:57 +01:00
committed by Andrew Brown
parent 0b7e7916bd
commit c5e74986e1
5 changed files with 100 additions and 7 deletions

View File

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