Saturation arithmetic mul and div for int8/int16/int32 and div for int64 was added

This commit is contained in:
Vsevolod Livinskij
2014-02-18 02:07:13 +04:00
parent f5508db24f
commit 735e6a8ab3
29 changed files with 931 additions and 0 deletions

28
tests/pmuls_i32.ispc Normal file
View File

@@ -0,0 +1,28 @@
export uniform int width() { return programCount; }
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
uniform int32 a_max = 2147483647, a_min = -2147483648; // max and min signed int32
if (programIndex % 3 == 0) {
RET[programIndex] = saturating_mul(a_max, (uniform int32) b);
}
else if (programIndex % 3 == 1) {
RET[programIndex] = saturating_mul(a_min, (uniform int32) b);
}
else {
RET[programIndex] = saturating_mul((uniform int32) b,
(uniform int32) b);
}
}
export void result(uniform float RET[]) {
if (programIndex % 3 == 0) {
RET[programIndex] = (uniform int32) 2147483647;
}
else if (programIndex % 3 == 1) {
RET[programIndex] = (uniform int32) -2147483648;
}
else {
RET[programIndex] = (uniform int32) 25;
}
}