Use @llvm.readcyclecounter to implement stdlib clock() function.

Also added a test for the clock builtin.
This commit is contained in:
Matt Pharr
2013-07-23 17:11:01 -07:00
parent c14659c675
commit 15a3ef370a
2 changed files with 18 additions and 10 deletions

14
tests/clock.ispc Normal file
View File

@@ -0,0 +1,14 @@
export uniform int width() { return programCount; }
export void f_f(uniform float RET[], uniform float aFOO[]) {
unsigned uniform int64 a = clock();
float x = pow(sqrt(aFOO[programIndex]), 5.5);
unsigned uniform int64 b = clock();
RET[programIndex] = (b - a) > 0 ? 1 : 0;
}
export void result(uniform float RET[]) {
RET[programIndex] = 1;
}