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:
dheaton-arm
2021-09-03 11:35:39 +01:00
parent dd71acd7e3
commit 8f057e0482
7 changed files with 93 additions and 3 deletions

View File

@@ -1106,7 +1106,7 @@ impl<'a> Parser<'a> {
err!(self.loc, "Expected a controlling vector type, not {}", ty)
} else {
let constant_data = match ty.lane_type() {
I8 => consume!(ty, self.match_uimm8("Expected an 8-bit unsigned integer")?),
I8 => consume!(ty, self.match_imm8("Expected an 8-bit integer")?),
I16 => consume!(ty, self.match_imm16("Expected a 16-bit integer")?),
I32 => consume!(ty, self.match_imm32("Expected a 32-bit integer")?),
I64 => consume!(ty, self.match_imm64("Expected a 64-bit integer")?),