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:
@@ -7,6 +7,7 @@ use crate::ir::condcodes::FloatCC;
|
||||
use crate::ir::immediates::{Ieee32, Ieee64};
|
||||
use crate::ir::types;
|
||||
use crate::ir::{Function, Inst, InstBuilder, InstructionData, Opcode, Value};
|
||||
use crate::opts::MemFlags;
|
||||
use crate::timing;
|
||||
|
||||
// Canonical 32-bit and 64-bit NaN values.
|
||||
@@ -70,9 +71,10 @@ fn add_nan_canon_seq(pos: &mut FuncCursor, inst: Inst) {
|
||||
.select(is_nan, canon_nan, new_res);
|
||||
};
|
||||
let vector_select = |pos: &mut FuncCursor, canon_nan: Value| {
|
||||
let is_nan = pos.ins().bitcast(val_type, MemFlags::new(), is_nan);
|
||||
pos.ins()
|
||||
.with_result(val)
|
||||
.vselect(is_nan, canon_nan, new_res);
|
||||
.bitselect(is_nan, canon_nan, new_res);
|
||||
};
|
||||
|
||||
match val_type {
|
||||
|
||||
Reference in New Issue
Block a user