Implement Insertlane for the Cranelift interpreter

Implemented `Insertlane` to insert a value in the lane specified by the
immediate value, overwriting the existing value in that lane.

Added `TernaryImm8` support for the `imm_value` function.

Copyright (c) 2021, Arm Limited.
This commit is contained in:
dheaton-arm
2021-09-01 15:30:41 +01:00
parent 02ef6a02b8
commit d956d349d8
3 changed files with 39 additions and 1 deletions

View File

@@ -672,7 +672,11 @@ where
Opcode::Shuffle => unimplemented!("Shuffle"),
Opcode::Swizzle => unimplemented!("Swizzle"),
Opcode::Splat => unimplemented!("Splat"),
Opcode::Insertlane => unimplemented!("Insertlane"),
Opcode::Insertlane => {
let mut vector = extractlanes(&arg(0)?, ctrl_ty.lane_type())?;
vector[Value::into_int(imm())? as usize] = arg(1)?.into_int()?;
assign(vectorizelanes(&vector, ctrl_ty)?)
}
Opcode::Extractlane => {
let value =
extractlanes(&arg(0)?, ctrl_ty.lane_type())?[Value::into_int(imm())? as usize];