Introduce the Cranelift IR instruction LoadSplat
It corresponds to WebAssembly's `load*_splat` operations, which were previously represented as a combination of `Load` and `Splat` instructions. However, there are architectures such as Armv8-A that have a single machine instruction equivalent to the Wasm operations. In order to generate it, it is necessary to merge the `Load` and the `Splat` in the backend, which is not possible because the load may have side effects. The new IR instruction works around this limitation. The AArch64 backend leverages the new instruction to improve code generation. Copyright (c) 2020, Arm Limited.
This commit is contained in:
@@ -680,4 +680,19 @@ impl VectorSize {
|
||||
_ => *self,
|
||||
}
|
||||
}
|
||||
|
||||
/// Return the encoding bits that are used by some SIMD instructions
|
||||
/// for a particular operand size.
|
||||
pub fn enc_size(&self) -> (u32, u32) {
|
||||
let q = self.is_128bits() as u32;
|
||||
let size = match self.lane_size() {
|
||||
ScalarSize::Size8 => 0b00,
|
||||
ScalarSize::Size16 => 0b01,
|
||||
ScalarSize::Size32 => 0b10,
|
||||
ScalarSize::Size64 => 0b11,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
(q, size)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user