Add x86 SIMD average rounding

This commit is contained in:
Andrew Brown
2020-01-31 14:37:29 -08:00
parent 830bdd5127
commit 032e81fd6f
5 changed files with 65 additions and 1 deletions

View File

@@ -1560,6 +1560,7 @@ fn define_simd(
let formats = &shared_defs.formats;
// Shorthands for instructions.
let avg_round = shared.by_name("avg_round");
let bitcast = shared.by_name("bitcast");
let bor = shared.by_name("bor");
let bxor = shared.by_name("bxor");
@@ -1926,6 +1927,12 @@ fn define_simd(
e.enc_32_64_maybe_isap(imul, rec_fa.opcodes(opcodes), *isap);
}
// SIMD integer average with rounding.
for (ty, opcodes) in &[(I8, &PAVGB[..]), (I16, &PAVGW[..])] {
let avgr = avg_round.bind(vector(*ty, sse_vector_size));
e.enc_32_64(avgr, rec_fa.opcodes(opcodes));
}
// SIMD logical operations
let band = shared.by_name("band");
let band_not = shared.by_name("band_not");