Add ISPC_HAS_RAND definition on targets that have a HW RNG.
This lets us check for a functioning rdrand() call in the stdlib more reliably. Fixes issue #333.
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user