Merge pull request #3290 from dheaton-arm/implement-ssatarith

Implement `SaddSat` and `SsubSat` for the Cranelift interpreter
This commit is contained in:
Chris Fallin
2021-09-03 09:48:34 -07:00
committed by GitHub
7 changed files with 93 additions and 3 deletions

View File

@@ -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)?)?,