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.
18 lines
536 B
Plaintext
18 lines
536 B
Plaintext
test interpret
|
|
test run
|
|
target aarch64
|
|
|
|
function %saddsat_i32x4(i32x4, i32x4) -> i32x4 {
|
|
block0(v0: i32x4, v1: i32x4):
|
|
v2 = sadd_sat v0, v1
|
|
return v2
|
|
}
|
|
; run: %saddsat_i32x4([256 -2147483000 2147483000 2147483000], [256 -1000 1000 1000]) == [512 -2147483648 2147483647 2147483647]
|
|
|
|
function %saddsat_i64x2(i64x2, i64x2) -> i64x2 {
|
|
block0(v0: i64x2, v1: i64x2):
|
|
v2 = sadd_sat v0, v1
|
|
return v2
|
|
}
|
|
; run: %saddsat_i64x2([-9223372036854775000 9223372036854775000], [-1000 1000]) == [-9223372036854775808 9223372036854775807]
|