Change CLIF shuffle to validate lane indices (#5995)
* Change CLIF `shuffle` to validate lane indices Previously the CLIF `shuffle` instruction did not perform any validation on the lane shuffle mask and specified that out-of-bounds lanes always returned 0 as the value. This behavior though is not required by WebAssembly which validates that lane indices are always in-bounds. Additionally since these are static immediates even other code generators should be able to verify that the immediates are in-bounds. As a result this commit updates the definition of the `shuffle` instruction to specify that all byte immediates must be in-bounds in the range of [0, 32). The verifier has been updated and some test cases have been removed that were testing this functionality. Closes #5989 * Only generate valid shuffle immediates in fuzzer
This commit is contained in:
@@ -339,7 +339,10 @@ fn insert_shuffle(
|
||||
let rhs = builder.use_var(fgen.get_variable_of_type(ctrl_type)?);
|
||||
|
||||
let mask = {
|
||||
let lanes = fgen.u.arbitrary::<[u8; 16]>()?;
|
||||
let mut lanes = [0u8; 16];
|
||||
for lane in lanes.iter_mut() {
|
||||
*lane = fgen.u.int_in_range(0..=31)?;
|
||||
}
|
||||
let lanes = ConstantData::from(lanes.as_ref());
|
||||
builder.func.dfg.immediates.push(lanes)
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user