Saturating multiplication for int64 was added.
This commit is contained in:
28
tests/pmuls_i64.ispc
Normal file
28
tests/pmuls_i64.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 int64 a_max = 0x7FFFFFFFFFFFFFFF, a_min = -0x8000000000000000; // max and min signed int64
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = saturating_mul(a_max, (uniform int64) b);
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = saturating_mul(a_min, (uniform int64) b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_mul((uniform int64) b,
|
||||
(uniform int64) 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) 25;
|
||||
}
|
||||
}
|
||||
28
tests/pmuls_vi64.ispc
Normal file
28
tests/pmuls_vi64.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 int64 a_max = 0x7FFFFFFFFFFFFFFF, a_min = -0x8000000000000000; // max and min signed int64
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = saturating_mul(a_max, (varying int64) b);
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = saturating_mul(a_min, (varying int64) b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_mul((varying int64) b,
|
||||
(varying int64) 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) 25;
|
||||
}
|
||||
}
|
||||
28
tests/pmulus_i64.ispc
Normal file
28
tests/pmulus_i64.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 int64 a_max = 0xFFFFFFFFFFFFFFFF, a_min = 0; // max and min unsigned int64
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = saturating_mul(a_max, (uniform unsigned int64) b);
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = saturating_mul(a_min, (uniform unsigned int64) -b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_mul((uniform unsigned int64) b,
|
||||
(uniform unsigned int64) b);
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = (uniform unsigned int64) 0xFFFFFFFFFFFFFFFF; // max unsigned int64
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (uniform unsigned int64) 0; // min unsigned int64
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (uniform unsigned int64) 25;
|
||||
}
|
||||
}
|
||||
28
tests/pmulus_vi64.ispc
Normal file
28
tests/pmulus_vi64.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 int64 a_max = 0xFFFFFFFFFFFFFFFF, a_min = 0; // max and min unsigned int64
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = saturating_mul(a_max, (varying unsigned int64) b);
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = saturating_mul(a_min, (varying unsigned int64) -b);
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = saturating_mul((varying unsigned int64) b,
|
||||
(varying unsigned int64) b);
|
||||
}
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
if (programIndex % 3 == 0) {
|
||||
RET[programIndex] = (varying unsigned int64) 0xFFFFFFFFFFFFFFFF; // max unsigned int64
|
||||
}
|
||||
else if (programIndex % 3 == 1) {
|
||||
RET[programIndex] = (varying unsigned int64) 0; // min unsigned int64
|
||||
}
|
||||
else {
|
||||
RET[programIndex] = (varying unsigned int64) 25;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user