[LLVMdev] Predicated Vector Operations

dag at cray.com dag at cray.com
Fri May 10 10:33:11 PDT 2013


Arnold Schwaighofer <aschwaighofer at apple.com> writes:

>> Ok, but where does $oldvalue come from?  That is the trickty part as far
>> as I can see and is why this isn't quite the same as handling
>> two-address instructions.
>
>
> From the semantics of your program?
>
> %tx = select %mask, %x, <0.0, 0.0, 0.0 ...>
> %ty = select %mask, %y, <0.0, 0.0, 0.0 ...>
> %sum = fadd %tx, %ty
> %newvalue = select %mask, %sum, %oldvalue << From here?

Well yes.  The issue isn't really in codegen, it's in IR generation.
I don't think it's unsolvable, just tricky.

> If you had a designated predicated instruction you would have the same
> issue. The %oldvalue has to come from somewhere (or be undefined).
>
> %oldval = ... | undef
> %newvalue = predicated_fadd %mask, %left, %right, %oldval

Certainly.  This is an SSA issue, not a predication issue, really.

                             -David



More information about the llvm-dev mailing list