Merge pull request #741 from Vsevolod-Livinskij/master
Saturation arithmetic.
This commit is contained in:
27
tests/padds_i32.ispc
Normal file
27
tests/padds_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 = 0x7FFFFFFF, a_min = -0x80000000; // 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] = (uniform int32) 0x7FFFFFFF; // max signed int32
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (uniform int32) -0x80000000; // min signed int32
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (uniform int32) -0x7FFFFFFB; // min + 5
|
||||
}
|
||||
}
|
||||
27
tests/padds_i64.ispc
Normal file
27
tests/padds_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 = 0x7FFFFFFFFFFFFFFF, a_min = -0x8000000000000000; // max and min signed int64
|
||||
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] = (uniform int64) 0x7FFFFFFFFFFFFFFF; // max signed int64
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (uniform int64) -0x8000000000000000; // min signed int64
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (uniform int64) -0x7FFFFFFFFFFFFFFB; // min + 5
|
||||
}
|
||||
}
|
||||
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 = 0x7FFFFFFF, a_min = -0x80000000; // 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) 0x7FFFFFFF; // max signed int32
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (varying int32) -0x80000000; // min signed int32
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (varying int32) -0x7FFFFFFB; // min + 5
|
||||
}
|
||||
}
|
||||
27
tests/padds_vi64.ispc
Normal file
27
tests/padds_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 = 0x7FFFFFFFFFFFFFFF, a_min = -0x8000000000000000; // max and min signed int64
|
||||
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 int64) 0x7FFFFFFFFFFFFFFF; // max signed int64
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (varying int64) -0x8000000000000000; // min signed int64
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (varying int64) -0x7FFFFFFFFFFFFFFB; // min + 5
|
||||
}
|
||||
}
|
||||
21
tests/paddus_i32.ispc
Normal file
21
tests/paddus_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 = 0xFFFFFFFF, a_min = 0; // max and min unsigned int32
|
||||
if (programIndex % 2 == 0) {
|
||||
RET[programIndex] = saturating_add(a_max, b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_add(a_min, b);
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
if (programIndex % 2 == 0) {
|
||||
RET[programIndex] = (uniform unsigned int32) 0xFFFFFFFF; // max unsigned int32
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (uniform unsigned int32) 5;
|
||||
}
|
||||
}
|
||||
21
tests/paddus_i64.ispc
Normal file
21
tests/paddus_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 = 0xFFFFFFFFFFFFFFFF, a_min = 0; // max and min unsigned int64
|
||||
if (programIndex % 2 == 0) {
|
||||
RET[programIndex] = saturating_add(a_max, b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_add(a_min, b);
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
if (programIndex % 2 == 0) {
|
||||
RET[programIndex] = (uniform unsigned int64) 0xFFFFFFFFFFFFFFFF; // max unsigned int64
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (uniform unsigned int64) 5;
|
||||
}
|
||||
}
|
||||
21
tests/paddus_vi32.ispc
Normal file
21
tests/paddus_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 = 0xFFFFFFFF, a_min = 0; // max and min unsigned int32
|
||||
if (programIndex % 2 == 0) {
|
||||
RET[programIndex] = saturating_add(a_max, b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_add(a_min, b);
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
if (programIndex % 2 == 0) {
|
||||
RET[programIndex] = (varying unsigned int32) 0xFFFFFFFF; // max unsigned int32
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (varying unsigned int32) 5;
|
||||
}
|
||||
}
|
||||
21
tests/paddus_vi64.ispc
Normal file
21
tests/paddus_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 = 0xFFFFFFFFFFFFFFFF, a_min = 0; // max and min unsigned int64
|
||||
if (programIndex % 2 == 0) {
|
||||
RET[programIndex] = saturating_add(a_max, b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_add(a_min, b);
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
if (programIndex % 2 == 0) {
|
||||
RET[programIndex] = (varying unsigned int64) 0xFFFFFFFFFFFFFFFF; // max unsigned int64
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (varying unsigned int64) 5;
|
||||
}
|
||||
}
|
||||
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 = 0x7FFF, a_min = -0x8000; // 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; // max / 5
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (uniform int16) -6553.6; // min / 5
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (uniform int16) 0x7FFF; // max signed int16
|
||||
}
|
||||
}
|
||||
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 = 0x7FFFFFFF, a_min = -0x80000000; // 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; // max / 5
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (uniform int32) -429496729.6; // min / 5
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (uniform int32) 0x7FFFFFFF; // max signed int32
|
||||
}
|
||||
}
|
||||
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 = 0x7FFFFFFFFFFFFFFF, a_min = -0x8000000000000000; // 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; // max / 5
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (uniform int64) -1844674407370955161.6; // min / 5
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (uniform int64) 0x7FFFFFFFFFFFFFFF; // max signed int64
|
||||
}
|
||||
}
|
||||
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 = 0x7F, a_min = -0x80; // 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; // max / 5
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (uniform int8) -25.6; // min / 5
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (uniform int8) 0x7F; // max signed int8
|
||||
}
|
||||
}
|
||||
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 = 0x7FFF, a_min = -0x8000; // 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; // max / 5
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (varying int16) -6553.6; // min / 5
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (varying int16) 0x7FFF; // max signed int16
|
||||
}
|
||||
}
|
||||
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 = 0x7FFFFFFF, a_min = -0x80000000; // 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; // max / 5
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (varying int32) -429496729.6; // min / 5
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (varying int32) 0x7FFFFFFF; // max signed int32
|
||||
}
|
||||
}
|
||||
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 = 0x7FFFFFFFFFFFFFFF, a_min = -0x8000000000000000; // 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; // max / 5
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (varying int64) -1844674407370955161.6; // min / 5
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (varying int64) 0x7FFFFFFFFFFFFFFF; // max signed int64
|
||||
}
|
||||
}
|
||||
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 = 0x7F, a_min = -0x80; // 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; // max / 5
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (varying int8) -25.6; // min / 5
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (varying int8) 0x7F; // max signed int8
|
||||
}
|
||||
}
|
||||
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 = 0xFFFF, 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; // min unsigned int16
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (uniform unsigned int16) 0x3333; // max unsigned int16 / 5
|
||||
}
|
||||
}
|
||||
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 = 0xFFFFFFFF, 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; // min unsigned int32
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (uniform unsigned int32) 0x33333333; // max unsigned int32 / 5
|
||||
}
|
||||
}
|
||||
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 = 0xFFFFFFFFFFFFFFFF, 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; // min unsigned int64
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (uniform unsigned int64) 0x3333333333333333; // max unsigned int64 / 5
|
||||
}
|
||||
}
|
||||
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 = 0xFF, 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; // min unsigned int8
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (uniform unsigned int8) 0x33; // max unsigned int8 / 5
|
||||
}
|
||||
}
|
||||
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 = 0xFFFF, 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; // min unsigned int16
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (varying unsigned int16) 0x3333; // max unsigned int16 / 5
|
||||
}
|
||||
}
|
||||
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 = 0xFFFFFFFF, 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; // min unsigned int32
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (varying unsigned int32) 0x33333333; // max unsigned int32 / 5
|
||||
}
|
||||
}
|
||||
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 = 0xFFFFFFFFFFFFFFFF, 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; // min unsigned int64
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (varying unsigned int64) 0x3333333333333333; // max unsigned int64 / 5
|
||||
}
|
||||
}
|
||||
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 = 0xFF, 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; // min unsigned int8
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (varying unsigned int8) 0x33; // max unsigned int8 / 5
|
||||
}
|
||||
}
|
||||
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 = 0x7FFF, a_min = -0x8000; // 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) 0x7FFF; // max signed int16
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (uniform int16) -0x8000; // min signed int16
|
||||
}
|
||||
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 = 0x7FFFFFFF, a_min = -0x80000000; // 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) 0x7FFFFFFF; // max signed int32
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (uniform int32) -0x80000000; // min signed int32
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (uniform int32) 25;
|
||||
}
|
||||
}
|
||||
28
tests/pmuls_i8.ispc
Normal file
28
tests/pmuls_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 int8 a_max = 0x7F, a_min = -0x80; // 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) 0x7F; // max signed int8
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (uniform int8) -0x80; // min signed int8
|
||||
}
|
||||
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 = 0x7FFF, a_min = -0x8000; // 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) 0x7FFF; // max signed int16
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (varying int16) -0x8000; // min signed int16
|
||||
}
|
||||
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 = 0x7FFFFFFF, a_min = -0x80000000; // 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) 0x7FFFFFFF; // max signed int32
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (varying int32) -0x80000000; // min signed int32
|
||||
}
|
||||
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 = 0x7F, a_min = -0x80; // 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) 0x7F; // max signed int8
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (varying int8) -0x80; // min signed int8
|
||||
}
|
||||
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 = 0xFFFF, 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) 0xFFFF; // max unsigned int16
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (uniform unsigned int16) 0; // min unsigned int16
|
||||
}
|
||||
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 = 0xFFFFFFFF, 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) 0xFFFFFFFF; // max unsigned int32
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (uniform unsigned int32) 0; // min unsigned int32
|
||||
}
|
||||
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 = 0xFF, 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) 0xFF; // max unsigned int8
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (uniform unsigned int8) 0; // min unsigned int8
|
||||
}
|
||||
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 = 0xFFFF, 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) 0xFFFF; // max unsigned int16
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (varying unsigned int16) 0; // min unsigned int16
|
||||
}
|
||||
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 = 0xFFFFFFFF, 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) 0xFFFFFFFF; // max unsigned int32
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (varying unsigned int32) 0; // min unsigned int32
|
||||
}
|
||||
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 = 0xFF, 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) 0xFF; // max unsigned int8
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (varying unsigned int8) 0; // min unsigned int8
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (varying unsigned int8) 25;
|
||||
}
|
||||
}
|
||||
27
tests/psubs_i32.ispc
Normal file
27
tests/psubs_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 = 0x7FFFFFFF, a_min = -0x80000000; // max and min int32
|
||||
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 int32) -0x80000000; // min signed int32
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (uniform int32) 0x7FFFFFFF; // max signed int32
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (uniform int32) 0x7FFFFFFA;
|
||||
}
|
||||
}
|
||||
27
tests/psubs_i64.ispc
Normal file
27
tests/psubs_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 = 0x7FFFFFFFFFFFFFFF, a_min = -0x8000000000000000; // 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) -0x8000000000000000; // min signed int64
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (uniform int64) 0x7FFFFFFFFFFFFFFF; // max signed int64
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (uniform int64) 0x7FFFFFFFFFFFFFFA;
|
||||
}
|
||||
}
|
||||
27
tests/psubs_vi32.ispc
Normal file
27
tests/psubs_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 = 0x7FFFFFFF, a_min = -0x80000000; // max and min int32
|
||||
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] = (varying int32) -0x80000000; // min signed int32
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (varying int32) 0x7FFFFFFF; // max signed int32
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (varying int32) 0x7FFFFFFA;
|
||||
}
|
||||
}
|
||||
27
tests/psubs_vi64.ispc
Normal file
27
tests/psubs_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 = 0x7FFFFFFFFFFFFFFF, a_min = -0x8000000000000000; // 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] = (varying int64) -0x8000000000000000; // min signed int64
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (varying int64) 0x7FFFFFFFFFFFFFFF; // max signed int64
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (varying int64) 0x7FFFFFFFFFFFFFFA;
|
||||
}
|
||||
}
|
||||
21
tests/psubus_i32.ispc
Normal file
21
tests/psubus_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 = 0xFFFFFFFF, a_min = 0; // max and min unsigned int32
|
||||
if (programIndex % 2 == 0) {
|
||||
RET[programIndex] = saturating_sub(a_min, b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_sub(a_max, b);
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
if (programIndex % 2 == 0) {
|
||||
RET[programIndex] = (uniform unsigned int32) 0; // min unsigned int32
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (uniform unsigned int32) 0xFFFFFFFB; // max unsigned int32 - 5
|
||||
}
|
||||
}
|
||||
21
tests/psubus_i64.ispc
Normal file
21
tests/psubus_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 = 0xFFFFFFFFFFFFFFFF, a_min = 0; // max and min unsigned int64
|
||||
if (programIndex % 2 == 0) {
|
||||
RET[programIndex] = saturating_sub(a_min, b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_sub(a_max, b);
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
if (programIndex % 2 == 0) {
|
||||
RET[programIndex] = (uniform unsigned int64) 0; // min unsigned int64
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (uniform unsigned int64) 0xFFFFFFFFFFFFFFFB; // max unsigned int64 - 5
|
||||
}
|
||||
}
|
||||
21
tests/psubus_vi32.ispc
Normal file
21
tests/psubus_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 = 0xFFFFFFFF, a_min = 0; // max and min unsigned int32
|
||||
if (programIndex % 2 == 0) {
|
||||
RET[programIndex] = saturating_sub(a_min, b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_sub(a_max, b);
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
if (programIndex % 2 == 0) {
|
||||
RET[programIndex] = (varying unsigned int32) 0; // min unsigned int32
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (varying unsigned int32) 0xFFFFFFFB; // max unsigned int32 - 5
|
||||
}
|
||||
}
|
||||
21
tests/psubus_vi64.ispc
Normal file
21
tests/psubus_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 = 0xFFFFFFFFFFFFFFFF, a_min = 0; // max and min unsigned int64
|
||||
if (programIndex % 2 == 0) {
|
||||
RET[programIndex] = saturating_sub(a_min, b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_sub(a_max, b);
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
if (programIndex % 2 == 0) {
|
||||
RET[programIndex] = (varying unsigned int64) 0; // min unsigned int64
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (varying unsigned int64) 0xFFFFFFFFFFFFFFFB; // max unsigned int64 - 5
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user