From 4515dd5c89e6b3ceecfe8d9eb5bffa7a519aaac8 Mon Sep 17 00:00:00 2001 From: Evghenii Date: Sun, 2 Feb 2014 18:19:56 +0100 Subject: [PATCH] added tests for rcp/rsqrt double --- tests/test-147.ispc | 16 ++++++++++++++++ tests/test-148.ispc | 16 ++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 tests/test-147.ispc create mode 100644 tests/test-148.ispc diff --git a/tests/test-147.ispc b/tests/test-147.ispc new file mode 100644 index 00000000..4091a78d --- /dev/null +++ b/tests/test-147.ispc @@ -0,0 +1,16 @@ + +export uniform int width() { return programCount; } + + +export void f_f(uniform float RET[], uniform float aFOO[]) { + double x = aFOO[programIndex&0x3]; + double d, ix; + ix = rcp(x); + d = (ix - 1.0d0 / x); + d = (d < 0.0d0) ? -d : d; + RET[programIndex] = (d < 1d-7) ? 1.0d0 : 0.0d0; +} + +export void result(uniform float RET[]) { + RET[programIndex] = 1.0d0; +} diff --git a/tests/test-148.ispc b/tests/test-148.ispc new file mode 100644 index 00000000..f8284e1a --- /dev/null +++ b/tests/test-148.ispc @@ -0,0 +1,16 @@ + +export uniform int width() { return programCount; } + + +export void f_f(uniform float RET[], uniform float aFOO[]) { + double x = aFOO[programIndex]; + double d, invsqrt = rsqrt(x); + d = (x * (invsqrt * invsqrt)) - 1.0d0; + if (d < 0.0d0) d = -d; + RET[programIndex] = d > 1d-5; +} + + +export void result(uniform float RET[]) { + RET[programIndex] = 0; +}