Make ConstantData a container for any-size constant values

Previously, ConstantData was a type alias for `Vec<u8>` which prevented it from having an implementation; this meant that `V128Imm` and `&[u8; 16]` were used in places that otherwise could have accepted types of different byte lengths.
This commit is contained in:
Andrew Brown
2019-09-30 14:56:03 -07:00
parent 50b7d2827d
commit 1600dba634
6 changed files with 113 additions and 36 deletions

View File

@@ -1848,14 +1848,14 @@ pub(crate) fn define<'defs>(
let instruction = vconst.bind(vector(ty, sse_vector_size));
let is_zero_128bit =
InstructionPredicate::new_is_all_zeroes_128bit(f_unary_const, "constant_handle");
InstructionPredicate::new_is_all_zeroes(f_unary_const, "constant_handle");
let template = rec_vconst_optimized.nonrex().opcodes(&PXOR);
e.enc_32_64_func(instruction.clone(), template, |builder| {
builder.inst_predicate(is_zero_128bit)
});
let is_ones_128bit =
InstructionPredicate::new_is_all_ones_128bit(f_unary_const, "constant_handle");
InstructionPredicate::new_is_all_ones(f_unary_const, "constant_handle");
let template = rec_vconst_optimized.nonrex().opcodes(&PCMPEQB);
e.enc_32_64_func(instruction, template, |builder| {
builder.inst_predicate(is_ones_128bit)