Implement SaddSat and SsubSat for the interpreter
Implemented `SaddSat` and `SsubSat` to add and subtract signed vector values, saturating at the type boundaries rather than overflowing. Changed the parser to allow signed `i8` immediates in vectors as part of this work; fixes #3276. Copyright (c) 2021, Arm Limited.
This commit is contained in:
@@ -503,7 +503,13 @@ where
|
||||
Value::add_sat,
|
||||
true,
|
||||
)?),
|
||||
Opcode::SaddSat => unimplemented!("SaddSat"),
|
||||
Opcode::SaddSat => assign(binary_arith(
|
||||
arg(0)?,
|
||||
arg(1)?,
|
||||
ctrl_ty,
|
||||
Value::add_sat,
|
||||
false,
|
||||
)?),
|
||||
Opcode::Isub => binary(Value::sub, arg(0)?, arg(1)?)?,
|
||||
Opcode::UsubSat => assign(binary_arith(
|
||||
arg(0)?,
|
||||
@@ -512,7 +518,13 @@ where
|
||||
Value::sub_sat,
|
||||
true,
|
||||
)?),
|
||||
Opcode::SsubSat => unimplemented!("SsubSat"),
|
||||
Opcode::SsubSat => assign(binary_arith(
|
||||
arg(0)?,
|
||||
arg(1)?,
|
||||
ctrl_ty,
|
||||
Value::sub_sat,
|
||||
false,
|
||||
)?),
|
||||
Opcode::Ineg => binary(Value::sub, Value::int(0, ctrl_ty)?, arg(0)?)?,
|
||||
Opcode::Iabs => unimplemented!("Iabs"),
|
||||
Opcode::Imul => binary(Value::mul, arg(0)?, arg(1)?)?,
|
||||
|
||||
Reference in New Issue
Block a user