Add x86 SIMD vall_true

In order to implement SIMD's all_true (https://github.com/WebAssembly/simd/blob/master/proposals/simd/SIMD.md#all-lanes-true), we must legalize some instruction (I chose `vall_true`) to a comparison against 0 and a similar reduction as vany_true using `PTEST` and `SETNZ`. Since `icmp` only allows integers but `vall_true` could allow more vector types, `raw_bitcast` is used to convert the lane types into integers, e.g. b32x4 to i32x4. To do so without runtime type-checking, the `raw_bitcast` instruction (which emits no instruction) can now bitcast from any vector type to the same type, e.g. i32x4 to i32x4.
This commit is contained in:
Andrew Brown
2019-10-18 16:21:06 -07:00
parent 65e18df12f
commit 879ccf871a
4 changed files with 78 additions and 0 deletions

View File

@@ -1639,6 +1639,20 @@ pub(crate) fn define(
.operands_out(vec![s]),
);
ig.push(
Inst::new(
"vall_true",
r#"
Reduce a vector to a scalar boolean.
Return a scalar boolean true if all lanes in ``i`` are non-zero, false otherwise.
"#,
&formats.unary,
)
.operands_in(vec![a])
.operands_out(vec![s]),
);
let x = &operand("x", &TxN.lane_of());
ig.push(