Move immediate value retrieval to imm

Copyright (c) 2021, Arm Limited
This commit is contained in:
dheaton-arm
2021-09-10 12:36:33 +01:00
parent bca3cb32ef
commit 4a4f940fac

View File

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