Merge remote-tracking branch 'upstream/master' into nvptx
This commit is contained in:
49
tests/chkstk.ispc
Normal file
49
tests/chkstk.ispc
Normal file
@@ -0,0 +1,49 @@
|
||||
//test for 17631 bug in LLVM.
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
struct s_temp
|
||||
{
|
||||
float temp[64];
|
||||
};
|
||||
|
||||
int CompressBlockBC7(int A, uniform float b)
|
||||
{
|
||||
// This declaration caused problem because LLVM inserted
|
||||
// _chkstk after declaration and vzeroupper before it's call.
|
||||
// A will be in ymm at avx, so we lose a half of it.
|
||||
s_temp _state;
|
||||
// These two loops are here to prevent elimination of declaration
|
||||
for (int i=0; i<64; i++) {
|
||||
float ii = i;
|
||||
_state.temp[i] = b + sin(ii);
|
||||
}
|
||||
float r = 0;
|
||||
for (int j=0; j<64; j+=9) {
|
||||
r += _state.temp[j] + j;
|
||||
}
|
||||
|
||||
// Here upper bits of A in ymm can be zeros. This will crash the test.
|
||||
int B;
|
||||
if (A!=0) {
|
||||
B = 20;
|
||||
}
|
||||
else {
|
||||
B = 30;
|
||||
}
|
||||
if(A == 1) {
|
||||
B = r;
|
||||
}
|
||||
return B;
|
||||
}
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
int A = programIndex;
|
||||
RET[programIndex] = CompressBlockBC7(A, b);
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
RET[programIndex] = 20;
|
||||
RET[0] = 30;
|
||||
RET[1] = 292;
|
||||
}
|
||||
14
tests/shift-1.ispc
Normal file
14
tests/shift-1.ispc
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
int a = aFOO[programIndex];
|
||||
int rot = shift(a, -1);
|
||||
RET[programIndex] = rot;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
varying int val = programIndex;
|
||||
if (val < 0) val = 0;
|
||||
RET[programIndex] = val;
|
||||
}
|
||||
15
tests/shift-2.ispc
Normal file
15
tests/shift-2.ispc
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
int a = aFOO[programIndex];
|
||||
uniform int delta = b - 6; // -1
|
||||
int rot = shift(a, delta);
|
||||
RET[programIndex] = rot;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
varying int val = programIndex;
|
||||
if (val < 0) val = 0;
|
||||
RET[programIndex] = val;
|
||||
}
|
||||
14
tests/shift-3.ispc
Normal file
14
tests/shift-3.ispc
Normal file
@@ -0,0 +1,14 @@
|
||||
|
||||
export uniform int width() { return programCount; }
|
||||
|
||||
export void f_fu(uniform float RET[], uniform float aFOO[], uniform float b) {
|
||||
int a = aFOO[programIndex];
|
||||
int rot = shift(a, 1);
|
||||
RET[programIndex] = rot;
|
||||
}
|
||||
|
||||
export void result(uniform float RET[]) {
|
||||
varying int val = 2 + programIndex;
|
||||
if (val > programCount) val = 0;
|
||||
RET[programIndex] = val;
|
||||
}
|
||||
Reference in New Issue
Block a user