Move immediate value retrieval to `imm`
Copyright (c) 2021, Arm Limited
@@ -76,6 +76,16 @@ where
.as_slice();
DataValue::V128(buffer.try_into().expect("a 16-byte data buffer"))
}
+ InstructionData::Shuffle { mask, .. } => {
+ let mask = state
+ .get_current_function()
+ .dfg
+ .immediates
+ .get(mask)
+ .unwrap()
+ .as_slice();
+ DataValue::V128(mask.try_into().expect("a 16-byte vector mask"))
+ }
_ => inst.imm_value().unwrap(),
})
};
@@ -777,14 +787,7 @@ where
ValueConversionKind::RoundNearestEven(ctrl_ty),
)?),
Opcode::Shuffle => {
- if let InstructionData::Shuffle { mask, .. } = inst {
- let mask = state
- .get_current_function()
- .dfg
- .immediates
- .get(mask)
- .unwrap()
- .as_slice();
+ let mask = imm().into_array()?;
let a = Value::into_array(&arg(0)?)?;
let b = Value::into_array(&arg(1)?)?;
let mut new = [0u8; 16];
@@ -796,9 +799,6 @@ where
} // else leave as 0.
}
assign(Value::vector(new, ctrl_ty)?)
- } else {
- unreachable!();
- }
}
Opcode::Swizzle => {
let x = Value::into_array(&arg(0)?)?;
