Here is my problem:
Logical Right-shift for one bit (>>1):
Logical right-shift always writes 0 at the new leftmost bit
Algebraic Right-shift for one bit (>>1)
Algebraic right-shift writes 0 as the leftmost bit, if the old leftmost bit was 0, and writes 1 if the old leftmost bit was 1 (this is to preserve the sign of the variable).
The GPU supports both kinds of shifts. But the Brook+ seems to always use the sign-preserving version! And that is not even mentioned anywhere in the documentation!
I've lost several days to find this out, since standard C uses the other (Logical) version of the shift.
At the end i was able to make my code to behave correctly on the GPU, but the computational cost of the workaround was too high (~2-3 times slower then the non-workaround version).
Now, I know that i can always go the GPU assembler route, but the astronomical number of lines of cryptic assembler code for my GPU kernel produced by the "kernel analyzer" app terrifies me to no end...
So, here is the question:
is it possible to switch the type of right-shift operation associated with ">>"in Brook+ from "Scalar Algebraic Shift Right"(ASHR_INT) to "Scalar Logical Shift Right" (LSHR_INT)?