Files
ispc/tests/phi-opts-2.ispc
Matt Pharr 2460fa5c83 Improve gather/scatter optimization passes to handle loops better.
Specifically, now we can work through phi nodes in the IR to detect cases
where an index value is actually the same across lanes or is linear across
the lanes.  For example, this is a loop that used to require gathers but
is now turned into vector loads:

    for (int i = programIndex; i < 16; i += programCount)
        sum += a[i];

Fixes issue #107.
2011-10-13 17:01:25 -07:00

14 lines
334 B
Plaintext

export uniform int width() { return programCount; }
export void f_f(uniform float RET[], uniform float aFOO[]) {
float sum = 0;
for (int i = programIndex; i < 16; i += programCount)
sum += aFOO[i];
RET[programIndex] = reduce_add(sum);
}
export void result(uniform float RET[]) {
RET[programIndex] = 136;
}