diff --git a/builtins/target-nvptx64.ll b/builtins/target-nvptx64.ll index 297b9779..85b5ead2 100644 --- a/builtins/target-nvptx64.ll +++ b/builtins/target-nvptx64.ll @@ -397,19 +397,19 @@ define i64 @__movmsk(<1 x i1>) nounwind readnone alwaysinline { define i1 @__any(<1 x i1>) nounwind readnone alwaysinline { %v = extractelement <1 x i1> %0, i32 0 - %cmp = icmp ne i1 %v, 0 - ret i1 %cmp +; %cmp = icmp ne i1 %v, 0 + ret i1 %v } define i1 @__all(<1 x i1>) nounwind readnone alwaysinline { %v = extractelement <1 x i1> %0, i32 0 - %cmp = icmp eq i1 %v, 1 - ret i1 %cmp +; %cmp = icmp eq i1 %v, 1 + ret i1 %v } define i1 @__none(<1 x i1>) nounwind readnone alwaysinline { %v = extractelement <1 x i1> %0, i32 0 - %cmp = icmp eq i1 %v, 0 + %cmp = xor i1 %v, 1; ;icmp eq i1 %v, 0 ret i1 %cmp } diff --git a/examples_cuda/rt/rt.cu b/examples_cuda/rt/rt.cu index 5857a873..2575662d 100644 --- a/examples_cuda/rt/rt.cu +++ b/examples_cuda/rt/rt.cu @@ -249,8 +249,6 @@ static inline bool BVHIntersect(const LinearBVHNode nodes[], if (TriIntersect(tris[primitivesOffset+i], ray)) hit = true; } - if (todoOffset == 0) - break; nodeNum = todo[--todoOffset]; } else { @@ -275,10 +273,10 @@ static inline bool BVHIntersect(const LinearBVHNode nodes[], } } else { - if (todoOffset == 0) - break; nodeNum = todo[--todoOffset]; } + if (todoOffset == 0) + break; } r.maxt = ray.maxt; r.hitId = ray.hitId; diff --git a/examples_cuda/rt/rt.ispc b/examples_cuda/rt/rt.ispc index 602c92fa..230a5288 100644 --- a/examples_cuda/rt/rt.ispc +++ b/examples_cuda/rt/rt.ispc @@ -219,6 +219,8 @@ inline inline bool BVHIntersect(const uniform LinearBVHNode nodes[], uniform int todoOffset = 0, nodeNum = 0; uniform int todo[64]; +#define FAST + while (true) { // Check ray against BVH node uniform LinearBVHNode node = nodes[nodeNum]; @@ -233,8 +235,10 @@ inline inline bool BVHIntersect(const uniform LinearBVHNode nodes[], if (TriIntersect(tris[primitivesOffset+i], ray)) hit = true; } +#ifndef FAST if (todoOffset == 0) break; +#endif nodeNum = todo[--todoOffset]; } else @@ -261,10 +265,16 @@ inline inline bool BVHIntersect(const uniform LinearBVHNode nodes[], } } else { +#ifndef FAST if (todoOffset == 0) break; +#endif nodeNum = todo[--todoOffset]; } +#ifdef FAST + if (todoOffset == 0) + break; +#endif } r.maxt = ray.maxt; r.hitId = ray.hitId;