Add x86 encoding for SIMD imul

Only i16x8 and i32x4 are encoded in this commit mainly because i8x16 and i64x2 do not have simple encodings in x86. i64x2 is not required by the SIMD spec and there is discussion (https://github.com/WebAssembly/simd/pull/98#issuecomment-530092217) about removing i8x16.
This commit is contained in:
Andrew Brown
2019-09-18 14:44:06 -07:00
parent 168ad7fda3
commit 630cb3ee62
5 changed files with 67 additions and 4 deletions

View File

@@ -1945,6 +1945,16 @@ pub(crate) fn define(
e.enc_32_64(isub, rec_fa.opcodes(*opcodes));
}
// SIMD integer multiplication: the x86 ISA does not have instructions for multiplying I8x16
// and I64x2 and these are (at the time of writing) not necessary for WASM SIMD.
for (ty, opcodes, isap) in &[
(I16, &PMULLW[..], None),
(I32, &PMULLD[..], Some(use_sse41_simd)),
] {
let imul = imul.bind_vector_from_lane(ty.clone(), sse_vector_size);
e.enc_32_64_maybe_isap(imul, rec_fa.opcodes(opcodes), *isap);
}
// SIMD icmp using PCMPEQ*
let mut pcmpeq_mapping: HashMap<u64, (&[u8], Option<SettingPredicateNumber>)> = HashMap::new();
pcmpeq_mapping.insert(8, (&PCMPEQB, None));