diff --git a/module.cpp b/module.cpp index 0e7ca875..ce5ef4a5 100644 --- a/module.cpp +++ b/module.cpp @@ -1788,6 +1788,8 @@ Module::execPreprocessor(const char* infilename, llvm::raw_string_ostream* ostre if (g->target.hasHalf) opts.addMacroDef("ISPC_TARGET_HAS_HALF"); + if (g->target.hasRand) + opts.addMacroDef("ISPC_TARGET_HAS_RAND"); if (g->target.hasTranscendentals) opts.addMacroDef("ISPC_TARGET_HAS_TRANSCENDENTALS"); if (g->opt.forceAlignedMemory) diff --git a/tests/rdrand-1.ispc b/tests/rdrand-1.ispc index 53ca6121..70f06d9a 100644 --- a/tests/rdrand-1.ispc +++ b/tests/rdrand-1.ispc @@ -2,7 +2,7 @@ export uniform int width() { return programCount; } export void f_f(uniform float RET[], uniform float aFOO[]) { -#if !defined(ISPC_TARGET_AVX11) && !defined(ISPC_TARGET_AVX2) +#ifndef ISPC_HAS_RAND RET[programIndex] = 1; #else diff --git a/tests/rdrand-2.ispc b/tests/rdrand-2.ispc index 7021a271..c689585d 100644 --- a/tests/rdrand-2.ispc +++ b/tests/rdrand-2.ispc @@ -2,7 +2,7 @@ export uniform int width() { return programCount; } export void f_f(uniform float RET[], uniform float aFOO[]) { -#if !defined(ISPC_TARGET_AVX11) && !defined(ISPC_TARGET_AVX2) +#ifndef ISPC_HAS_RAND RET[programIndex] = 1; #else diff --git a/tests/rdrand-3.ispc b/tests/rdrand-3.ispc index a9fc93a3..d76273d6 100644 --- a/tests/rdrand-3.ispc +++ b/tests/rdrand-3.ispc @@ -2,7 +2,7 @@ export uniform int width() { return programCount; } export void f_f(uniform float RET[], uniform float aFOO[]) { -#if !defined(ISPC_TARGET_AVX11) && !defined(ISPC_TARGET_AVX2) +#ifndef ISPC_HAS_RAND RET[programIndex] = 1; #else diff --git a/tests/rdrand-4.ispc b/tests/rdrand-4.ispc index 3b38b7b1..d735931a 100644 --- a/tests/rdrand-4.ispc +++ b/tests/rdrand-4.ispc @@ -2,7 +2,7 @@ export uniform int width() { return programCount; } export void f_f(uniform float RET[], uniform float aFOO[]) { -#if !defined(ISPC_TARGET_AVX11) && !defined(ISPC_TARGET_AVX2) +#ifndef ISPC_HAS_RAND RET[programIndex] = 0; #else diff --git a/tests/rdrand-5.ispc b/tests/rdrand-5.ispc index cbf59a97..9857994b 100644 --- a/tests/rdrand-5.ispc +++ b/tests/rdrand-5.ispc @@ -2,7 +2,7 @@ export uniform int width() { return programCount; } export void f_f(uniform float RET[], uniform float aFOO[]) { -#if !defined(ISPC_TARGET_AVX11) && !defined(ISPC_TARGET_AVX2) +#ifndef ISPC_HAS_RAND RET[programIndex] = 0; #else diff --git a/tests/rdrand-6.ispc b/tests/rdrand-6.ispc index 93137625..28634f07 100644 --- a/tests/rdrand-6.ispc +++ b/tests/rdrand-6.ispc @@ -2,7 +2,7 @@ export uniform int width() { return programCount; } export void f_f(uniform float RET[], uniform float aFOO[]) { -#if !defined(ISPC_TARGET_AVX11) && !defined(ISPC_TARGET_AVX2) +#ifndef ISPC_HAS_RAND RET[programIndex] = 0; #else