Saturation arithmetic mul and div for int8/int16/int32 and div for int64 was added
This commit is contained in:
27
tests/pdivs_i16.ispc
Normal file
27
tests/pdivs_i16.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) {
|
||||
uniform int16 a_max = 32767, a_min = -32768; // max and min signed int16
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = saturating_div(a_max, (uniform int16) b);
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = saturating_div(a_min, (uniform int16) b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_div(a_min, (uniform int16) -1);
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = (uniform int16) 6553.4;
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (uniform int16) -6553.6;
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (uniform int16) 32767;
|
||||
}
|
||||
}
|
||||
27
tests/pdivs_i32.ispc
Normal file
27
tests/pdivs_i32.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) {
|
||||
uniform int32 a_max = 2147483647, a_min = -2147483648; // max and min signed int32
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = saturating_div(a_max, (uniform int32) b);
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = saturating_div(a_min, (uniform int32) b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_div(a_min, (uniform int32) -1);
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = (uniform int32) 429496729.4;
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (uniform int32) -429496729.6;
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (uniform int32) 2147483647;
|
||||
}
|
||||
}
|
||||
27
tests/pdivs_i64.ispc
Normal file
27
tests/pdivs_i64.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) {
|
||||
uniform int64 a_max = 9223372036854775807, a_min = -9223372036854775808; // max and min signed int64
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = saturating_div(a_max, (uniform int64) b);
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = saturating_div(a_min, (uniform int64) b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_div(a_min, (uniform int64) -1);
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = (uniform int64) 1844674407370955161.4;
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (uniform int64) -1844674407370955161.6;
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (uniform int64) 9223372036854775807;
|
||||
}
|
||||
}
|
||||
27
tests/pdivs_i8.ispc
Normal file
27
tests/pdivs_i8.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) {
|
||||
uniform int8 a_max = 127, a_min = -128; // max and min signed int8
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = saturating_div(a_max, (uniform int8) b);
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = saturating_div(a_min, (uniform int8) b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_div(a_min, (uniform int8) -1);
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = (uniform int8) 25.4;
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (uniform int8) -25.6;
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (uniform int8) 127;
|
||||
}
|
||||
}
|
||||
27
tests/pdivs_vi16.ispc
Normal file
27
tests/pdivs_vi16.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 int16 a_max = 32767, a_min = -32768; // max and min signed int16
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = saturating_div(a_max, (varying int16) b);
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = saturating_div(a_min, (varying int16) b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_div(a_min, (varying int16) -1);
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = (varying int16) 6553.4;
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (varying int16) -6553.6;
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (varying int16) 32767;
|
||||
}
|
||||
}
|
||||
27
tests/pdivs_vi32.ispc
Normal file
27
tests/pdivs_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_div(a_max, (varying int32) b);
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = saturating_div(a_min, (varying int32) b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_div(a_min, (varying int32) -1);
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = (varying int32) 429496729.4;
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (varying int32) -429496729.6;
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (varying int32) 2147483647;
|
||||
}
|
||||
}
|
||||
27
tests/pdivs_vi64.ispc
Normal file
27
tests/pdivs_vi64.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 int64 a_max = 9223372036854775807, a_min = -9223372036854775808; // max and min signed int64
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = saturating_div(a_max, (varying int64) b);
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = saturating_div(a_min, (varying int64) b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_div(a_min, (varying int64) -1);
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = (varying int64) 1844674407370955161.4;
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (varying int64) -1844674407370955161.6;
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (varying int64) 9223372036854775807;
|
||||
}
|
||||
}
|
||||
27
tests/pdivs_vi8.ispc
Normal file
27
tests/pdivs_vi8.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 int8 a_max = 127, a_min = -128; // max and min signed int8
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = saturating_div(a_max, (varying int8) b);
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = saturating_div(a_min, (varying int8) b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_div(a_min, (varying int8) -1);
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = (varying int8) 25.4;
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (varying int8) -25.6;
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (varying int8) 127;
|
||||
}
|
||||
}
|
||||
21
tests/pdivus_i16.ispc
Normal file
21
tests/pdivus_i16.ispc
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
uniform unsigned int16 a_max = 65535, a_min = 0; // max and min unsigned int16
|
||||
if (programIndex % 2 == 0) {
|
||||
RET[programIndex] = saturating_div(a_min, (uniform unsigned int16) b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_div(a_max, (uniform unsigned int16) b);
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
if (programIndex % 2 == 0) {
|
||||
RET[programIndex] = (uniform unsigned int16) 0;
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (uniform unsigned int16) 13107;
|
||||
}
|
||||
}
|
||||
21
tests/pdivus_i32.ispc
Normal file
21
tests/pdivus_i32.ispc
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
uniform unsigned int32 a_max = 4294967295, a_min = 0; // max and min unsigned int32
|
||||
if (programIndex % 2 == 0) {
|
||||
RET[programIndex] = saturating_div(a_min, (uniform unsigned int32) b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_div(a_max, (uniform unsigned int32) b);
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
if (programIndex % 2 == 0) {
|
||||
RET[programIndex] = (uniform unsigned int32) 0;
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (uniform unsigned int32) 858993459;
|
||||
}
|
||||
}
|
||||
21
tests/pdivus_i64.ispc
Normal file
21
tests/pdivus_i64.ispc
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
uniform unsigned int64 a_max = 18446744073709551615, a_min = 0; // max and min unsigned int64
|
||||
if (programIndex % 2 == 0) {
|
||||
RET[programIndex] = saturating_div(a_min, (uniform unsigned int64) b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_div(a_max, (uniform unsigned int64) b);
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
if (programIndex % 2 == 0) {
|
||||
RET[programIndex] = (uniform unsigned int64) 0;
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (uniform unsigned int64) 3689348814741910323;
|
||||
}
|
||||
}
|
||||
21
tests/pdivus_i8.ispc
Normal file
21
tests/pdivus_i8.ispc
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
uniform unsigned int8 a_max = 255, a_min = 0; // max and min unsigned int8
|
||||
if (programIndex % 2 == 0) {
|
||||
RET[programIndex] = saturating_div(a_min, (uniform unsigned int8) b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_div(a_max, (uniform unsigned int8) b);
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
if (programIndex % 2 == 0) {
|
||||
RET[programIndex] = (uniform unsigned int8) 0;
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (uniform unsigned int8) 51;
|
||||
}
|
||||
}
|
||||
21
tests/pdivus_vi16.ispc
Normal file
21
tests/pdivus_vi16.ispc
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
varying unsigned int16 a_max = 65535, a_min = 0; // max and min unsigned int16
|
||||
if (programIndex % 2 == 0) {
|
||||
RET[programIndex] = saturating_div(a_min, (varying unsigned int16) b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_div(a_max, (varying unsigned int16) b);
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
if (programIndex % 2 == 0) {
|
||||
RET[programIndex] = (varying unsigned int16) 0;
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (varying unsigned int16) 13107;
|
||||
}
|
||||
}
|
||||
21
tests/pdivus_vi32.ispc
Normal file
21
tests/pdivus_vi32.ispc
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
varying unsigned int32 a_max = 4294967295, a_min = 0; // max and min unsigned int32
|
||||
if (programIndex % 2 == 0) {
|
||||
RET[programIndex] = saturating_div(a_min, (varying unsigned int32) b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_div(a_max, (varying unsigned int32) b);
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
if (programIndex % 2 == 0) {
|
||||
RET[programIndex] = (varying unsigned int32) 0;
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (varying unsigned int32) 858993459;
|
||||
}
|
||||
}
|
||||
21
tests/pdivus_vi64.ispc
Normal file
21
tests/pdivus_vi64.ispc
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
varying unsigned int64 a_max = 18446744073709551615, a_min = 0; // max and min unsigned int64
|
||||
if (programIndex % 2 == 0) {
|
||||
RET[programIndex] = saturating_div(a_min, (varying unsigned int64) b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_div(a_max, (varying unsigned int64) b);
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
if (programIndex % 2 == 0) {
|
||||
RET[programIndex] = (varying unsigned int64) 0;
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (varying unsigned int64) 3689348814741910323;
|
||||
}
|
||||
}
|
||||
21
tests/pdivus_vi8.ispc
Normal file
21
tests/pdivus_vi8.ispc
Normal file
@@ -0,0 +1,21 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
varying unsigned int8 a_max = 255, a_min = 0; // max and min unsigned int8
|
||||
if (programIndex % 2 == 0) {
|
||||
RET[programIndex] = saturating_div(a_min, (varying unsigned int8) b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_div(a_max, (varying unsigned int8) b);
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
if (programIndex % 2 == 0) {
|
||||
RET[programIndex] = (varying unsigned int8) 0;
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (varying unsigned int8) 51;
|
||||
}
|
||||
}
|
||||
28
tests/pmuls_i16.ispc
Normal file
28
tests/pmuls_i16.ispc
Normal 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 int16 a_max = 32767, a_min = -32768; // max and min signed int16
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = saturating_mul(a_max, (uniform int16) b);
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = saturating_mul(a_min, (uniform int16) b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_mul((uniform int16) b,
|
||||
(uniform int16) b);
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = (uniform int16) 32767;
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (uniform int16) -32768;
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (uniform int16) 25;
|
||||
}
|
||||
}
|
||||
28
tests/pmuls_i32.ispc
Normal file
28
tests/pmuls_i32.ispc
Normal 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;
|
||||
}
|
||||
}
|
||||
29
tests/pmuls_i8.ispc
Normal file
29
tests/pmuls_i8.ispc
Normal file
@@ -0,0 +1,29 @@
|
||||
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
uniform int8 a_max = 127, a_min = -128; // max and min signed int8
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = saturating_mul(a_max, (uniform int8) b);
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = saturating_mul(a_min, (uniform int8) b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_mul((uniform int8) b,
|
||||
(uniform int8) b);
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = (uniform int8) 127;
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (uniform int8) -128;
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (uniform int8) 25;
|
||||
}
|
||||
}
|
||||
28
tests/pmuls_vi16.ispc
Normal file
28
tests/pmuls_vi16.ispc
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
varying int16 a_max = 32767, a_min = -32768; // max and min signed int16
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = saturating_mul(a_max, (varying int16) b);
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = saturating_mul(a_min, (varying int16) b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_mul((varying int16) b,
|
||||
(varying int16) b);
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = (varying int16) 32767;
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (varying int16) -32768;
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (varying int16) 25;
|
||||
}
|
||||
}
|
||||
28
tests/pmuls_vi32.ispc
Normal file
28
tests/pmuls_vi32.ispc
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
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_mul(a_max, (varying int32) b);
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = saturating_mul(a_min, (varying int32) b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_mul((varying int32) b,
|
||||
(varying int32) 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) 25;
|
||||
}
|
||||
}
|
||||
28
tests/pmuls_vi8.ispc
Normal file
28
tests/pmuls_vi8.ispc
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
varying int8 a_max = 127, a_min = -128; // max and min signed int8
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = saturating_mul(a_max, (varying int8) b);
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = saturating_mul(a_min, (varying int8) b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_mul((varying int8) b,
|
||||
(varying int8) b);
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = (varying int8) 127;
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (varying int8) -128;
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (varying int8) 25;
|
||||
}
|
||||
}
|
||||
28
tests/pmulus_i16.ispc
Normal file
28
tests/pmulus_i16.ispc
Normal 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 unsigned int16 a_max = 65535, a_min = 0; // max and min unsigned int16
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = saturating_mul(a_max, (uniform unsigned int16) b);
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = saturating_mul(a_min, (uniform unsigned int16) -b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_mul((uniform unsigned int16) b,
|
||||
(uniform unsigned int16) b);
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = (uniform unsigned int16) 65535;
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (uniform unsigned int16) 0;
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (uniform unsigned int16) 25;
|
||||
}
|
||||
}
|
||||
28
tests/pmulus_i32.ispc
Normal file
28
tests/pmulus_i32.ispc
Normal 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 unsigned int32 a_max = 4294967295, a_min = 0; // max and min unsigned int32
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = saturating_mul(a_max, (uniform unsigned int32) b);
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = saturating_mul(a_min, (uniform unsigned int32) -b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_mul((uniform unsigned int32) b,
|
||||
(uniform unsigned int32) b);
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = (uniform unsigned int32) 4294967295;
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (uniform unsigned int32) 0;
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (uniform unsigned int32) 25;
|
||||
}
|
||||
}
|
||||
28
tests/pmulus_i8.ispc
Normal file
28
tests/pmulus_i8.ispc
Normal 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 unsigned int8 a_max = 255, a_min = 0; // max and min unsigned int8
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = saturating_mul(a_max, (uniform unsigned int8) b);
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = saturating_mul(a_min, (uniform unsigned int8) -b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_mul((uniform unsigned int8) b,
|
||||
(uniform unsigned int8) b);
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = (uniform unsigned int8) 255;
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (uniform unsigned int8) 0;
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (uniform unsigned int8) 25;
|
||||
}
|
||||
}
|
||||
28
tests/pmulus_vi16.ispc
Normal file
28
tests/pmulus_vi16.ispc
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
varying unsigned int16 a_max = 65535, a_min = 0; // max and min unsigned int16
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = saturating_mul(a_max, (varying unsigned int16) b);
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = saturating_mul(a_min, (varying unsigned int16) -b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_mul((varying unsigned int16) b,
|
||||
(varying unsigned int16) b);
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = (varying unsigned int16) 65535;
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (varying unsigned int16) 0;
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (varying unsigned int16) 25;
|
||||
}
|
||||
}
|
||||
28
tests/pmulus_vi32.ispc
Normal file
28
tests/pmulus_vi32.ispc
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
varying unsigned int32 a_max = 4294967295, a_min = 0; // max and min unsigned int32
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = saturating_mul(a_max, (varying unsigned int32) b);
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = saturating_mul(a_min, (varying unsigned int32) -b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_mul((varying unsigned int32) b,
|
||||
(varying unsigned int32) b);
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = (varying unsigned int32) 4294967295;
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (varying unsigned int32) 0;
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (varying unsigned int32) 25;
|
||||
}
|
||||
}
|
||||
28
tests/pmulus_vi8.ispc
Normal file
28
tests/pmulus_vi8.ispc
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
varying unsigned int8 a_max = 255, a_min = 0; // max and min unsigned int8
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = saturating_mul(a_max, (varying unsigned int8) b);
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = saturating_mul(a_min, (varying unsigned int8) -b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_mul((varying unsigned int8) b,
|
||||
(varying unsigned int8) b);
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = (varying unsigned int8) 255;
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (varying unsigned int8) 0;
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (varying unsigned int8) 25;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user