Fix a type error in the legalizer patterns.

The carry and borrow values are boolean, so we have to convert them to
an integer type with bint(c) before we can add them to the result.

Also tweak the default legalizer action for unsupported types: Only
attempt a narrowing pattern for lane types > 32 bits.

This was found by @angusholder's new type checks in the verifier.
This commit is contained in:
Jakob Stoklund Olesen
2017-03-29 14:40:12 -07:00
parent a5d4839002
commit 62641d4553
4 changed files with 19 additions and 9 deletions

View File

@@ -84,7 +84,11 @@ pub fn lookup_enclist<OffT1, OffT2>(ctrl_typevar: Type,
{
// TODO: The choice of legalization actions here is naive. This needs to be configurable.
probe(level1_table, ctrl_typevar, ctrl_typevar.index())
.ok_or(Legalize::Narrow)
.ok_or_else(|| if ctrl_typevar.lane_type().bits() > 32 {
Legalize::Narrow
} else {
Legalize::Expand
})
.and_then(|l1idx| {
let l1ent = &level1_table[l1idx];
let l2off = l1ent.offset.into() as usize;