Saturation arithmetic (sub and add) was added for int32/int64.

This commit is contained in:
Vsevolod Livinskij
2014-02-17 18:55:40 +04:00
parent 04fda2fcbe
commit f5508db24f
17 changed files with 512 additions and 0 deletions

27
tests/psubs_i64.ispc Normal file
View File

@@ -0,0 +1,27 @@
export uniform int width() { return programCount; }
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
uniform int64 a_max = 9223372036854775807, a_min = -9223372036854775808; // max and min int64
if (programIndex % 3 == 0) {
RET[programIndex] = saturating_sub(a_min, b);
}
else if (programIndex % 3 == 1) {
RET[programIndex] = saturating_sub(a_max, -b);
}
else {
RET[programIndex] = saturating_sub(a_max, b);
}
}
export void result(uniform float RET[]) {
if (programIndex % 3 == 0) {
RET[programIndex] = (uniform int64) -9223372036854775808;
}
else if (programIndex % 3 == 1) {
RET[programIndex] = (uniform int64) 9223372036854775807;
}
else {
RET[programIndex] = (uniform int64) 9223372036854775802;
}
}