Saturation arithmetic (sub and add) was added for int32/int64.
This commit is contained in:
27
tests/padds_vi32.ispc
Normal file
27
tests/padds_vi32.ispc
Normal file
@@ -0,0 +1,27 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
varying int32 a_max = 2147483647, a_min = -2147483648; // max and min signed int32
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = saturating_add(a_max, b);
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = saturating_add(a_min, -b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_add(a_min, b);
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = (varying int32) 2147483647;
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (varying int32) -2147483648;
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (varying int32) -2147483643;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user