Remove the Cranelift vselect instruction (#5918)
* Remove the Cranelift `vselect` instruction This instruction is documented as selecting lanes based on the "truthy" value of the condition lane, but the current status of the implementation of this instruction is: * x64 - uses the high bit for `f32x4` and `f64x2` and otherwise uses the high bit of each byte doing a byte-wise lane select rather than whatever the controlling type is. * AArch64 - this is the same as `bitselect` which is a bit-wise selection rather than a lane-wise selection. * s390x - this is the same as AArch64, a bit-wise selection rather than lane-wise. * interpreter - the interpreter implements the documented semantics of selecting based on "truthy" values. Coupled with the status of the implementation is the fact that this instruction is not used by WebAssembly SIMD today either. The only use of this instruction in Cranelift is the nan-canonicalization pass. By moving nan-canonicalization to `bitselect`, since that has the desired semantics, there's no longer any need for `vselect`. Given this situation this commit subsqeuently removes `vselect` and all usage of it throughout Cranelift. Closes #5917 * Review comments * Bring back vselect opts as bitselect opts * Clean up vselect usage in the interpreter * Move bitcast in nan canonicalization * Add a comment about float optimization
This commit is contained in:
@@ -1409,8 +1409,8 @@ pub(crate) fn define(
|
||||
r#"
|
||||
Conditional select.
|
||||
|
||||
This instruction selects whole values. Use `vselect` for
|
||||
lane-wise selection.
|
||||
This instruction selects whole values. Use `bitselect` to choose each
|
||||
bit according to a mask.
|
||||
"#,
|
||||
&formats.ternary,
|
||||
)
|
||||
@@ -1458,7 +1458,7 @@ pub(crate) fn define(
|
||||
|
||||
For each bit in `c`, this instruction selects the corresponding bit from `x` if the bit
|
||||
in `x` is 1 and the corresponding bit from `y` if the bit in `c` is 0. See also:
|
||||
`select`, `vselect`.
|
||||
`select`.
|
||||
"#,
|
||||
&formats.ternary,
|
||||
)
|
||||
@@ -1484,26 +1484,7 @@ pub(crate) fn define(
|
||||
.operands_out(vec![a]),
|
||||
);
|
||||
|
||||
let c = &Operand::new("c", &TxN.as_bool()).with_doc("Controlling vector");
|
||||
let x = &Operand::new("x", TxN).with_doc("Value to use where `c` is true");
|
||||
let y = &Operand::new("y", TxN).with_doc("Value to use where `c` is false");
|
||||
let a = &Operand::new("a", TxN);
|
||||
|
||||
ig.push(
|
||||
Inst::new(
|
||||
"vselect",
|
||||
r#"
|
||||
Vector lane select.
|
||||
|
||||
Select lanes from ``x`` or ``y`` controlled by the lanes of the truthy
|
||||
vector ``c``.
|
||||
"#,
|
||||
&formats.ternary,
|
||||
)
|
||||
.operands_in(vec![c, x, y])
|
||||
.operands_out(vec![a]),
|
||||
);
|
||||
|
||||
let s = &Operand::new("s", i8);
|
||||
|
||||
ig.push(
|
||||
|
||||
Reference in New Issue
Block a user