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

@@ -548,6 +548,32 @@ fn define_simd_arithmetic(
.operands_in(vec![x, y])
.operands_out(vec![a]),
);
let IxN = &TypeVar::new(
"IxN",
"A SIMD vector type containing integers",
TypeSetBuilder::new()
.ints(Interval::All)
.simd_lanes(Interval::All)
.includes_scalars(false)
.build(),
);
let a = &Operand::new("a", IxN);
let x = &Operand::new("x", IxN);
let y = &Operand::new("y", IxN);
ig.push(
Inst::new(
"avg_round",
r#"
Unsigned average with rounding: `a := (x + y + 1) // 2`
"#,
&formats.binary,
)
.operands_in(vec![x, y])
.operands_out(vec![a]),
);
}
#[allow(clippy::many_single_char_names)]
@@ -627,7 +653,6 @@ pub(crate) fn define(
.includes_scalars(false)
.build(),
);
let Any = &TypeVar::new(
"Any",
"Any integer, float, boolean, or reference scalar or vector type",