Implement iabs for x86 SIMD
This only covers the types necessary for implementing the Wasm SIMD spec--`i8x16`, `i16x8`, `i32x4`.
This commit is contained in:
@@ -1638,6 +1638,7 @@ fn define_simd(
|
||||
let fill_nop = shared.by_name("fill_nop");
|
||||
let fmul = shared.by_name("fmul");
|
||||
let fsub = shared.by_name("fsub");
|
||||
let iabs = shared.by_name("iabs");
|
||||
let iadd = shared.by_name("iadd");
|
||||
let icmp = shared.by_name("icmp");
|
||||
let imul = shared.by_name("imul");
|
||||
@@ -2184,6 +2185,12 @@ fn define_simd(
|
||||
e.enc_both_inferred(avgr, rec_fa.opcodes(opcodes));
|
||||
}
|
||||
|
||||
// SIMD integer absolute value.
|
||||
for (ty, opcodes) in &[(I8, &PABSB[..]), (I16, &PABSW[..]), (I32, &PABSD)] {
|
||||
let iabs = iabs.bind(vector(*ty, sse_vector_size));
|
||||
e.enc_both_inferred_maybe_isap(iabs, rec_furm.opcodes(opcodes), Some(use_ssse3_simd));
|
||||
}
|
||||
|
||||
// SIMD logical operations
|
||||
let band = shared.by_name("band");
|
||||
let band_not = shared.by_name("band_not");
|
||||
|
||||
@@ -303,6 +303,17 @@ pub static OR_IMM8_SIGN_EXTEND: [u8; 1] = [0x83];
|
||||
/// Return the bitwise logical OR of packed single-precision values in xmm and x/m (SSE).
|
||||
pub static ORPS: [u8; 2] = [0x0f, 0x56];
|
||||
|
||||
/// Compute the absolute value of bytes in xmm2/m128 and store the unsigned result in xmm1 (SSSE3).
|
||||
pub static PABSB: [u8; 4] = [0x66, 0x0f, 0x38, 0x1c];
|
||||
|
||||
/// Compute the absolute value of 32-bit integers in xmm2/m128 and store the unsigned result in
|
||||
/// xmm1 (SSSE3).
|
||||
pub static PABSD: [u8; 4] = [0x66, 0x0f, 0x38, 0x1e];
|
||||
|
||||
/// Compute the absolute value of 16-bit integers in xmm2/m128 and store the unsigned result in
|
||||
/// xmm1 (SSSE3).
|
||||
pub static PABSW: [u8; 4] = [0x66, 0x0f, 0x38, 0x1d];
|
||||
|
||||
/// Converts 8 packed signed word integers from xmm1 and from xxm2/m128 into 16 packed signed byte
|
||||
/// integers in xmm1 using signed saturation (SSE2).
|
||||
pub static PACKSSWB: [u8; 3] = [0x66, 0x0f, 0x63];
|
||||
|
||||
Reference in New Issue
Block a user