More i8 legalizations (#1253)

* Legalize stack_{load,store}.i8, fixes #433
* Legalize select.i8, cc: #466
* Legalize brz.i8 and brnz.i8, cc: #1117
This commit is contained in:
bjorn3
2019-12-04 18:16:22 +01:00
committed by Andrew Brown
parent b342cbdd64
commit 4cc0241f37
5 changed files with 116 additions and 0 deletions

View File

@@ -139,6 +139,7 @@ pub(crate) fn define(insts: &InstructionGroup, imm: &Immediates) -> TransformGro
expand.custom_legalize(trapnz, "expand_cond_trap");
expand.custom_legalize(br_table, "expand_br_table");
expand.custom_legalize(select, "expand_select");
widen.custom_legalize(select, "expand_select"); // small ints
// Custom expansions for floating point constants.
// These expansions require bit-casting or creating constant pool entries.
@@ -149,6 +150,10 @@ pub(crate) fn define(insts: &InstructionGroup, imm: &Immediates) -> TransformGro
expand.custom_legalize(insts.by_name("stack_load"), "expand_stack_load");
expand.custom_legalize(insts.by_name("stack_store"), "expand_stack_store");
// Custom expansions for small stack memory acccess.
widen.custom_legalize(insts.by_name("stack_load"), "expand_stack_load");
widen.custom_legalize(insts.by_name("stack_store"), "expand_stack_store");
// List of variables to reuse in patterns.
let x = var("x");
let y = var("y");
@@ -612,6 +617,18 @@ pub(crate) fn define(insts: &InstructionGroup, imm: &Immediates) -> TransformGro
}
}
for &ty in &[I8, I16] {
widen.legalize(
def!(brz.ty(x, ebb, vararg)),
vec![def!(a = uextend.I32(x)), def!(brz(a, ebb, vararg))],
);
widen.legalize(
def!(brnz.ty(x, ebb, vararg)),
vec![def!(a = uextend.I32(x)), def!(brnz(a, ebb, vararg))],
);
}
// Expand integer operations with carry for RISC architectures that don't have
// the flags.
let intcc_ult = Literal::enumerator_for(&imm.intcc, "ult");