[LLVMdev] Handling Masked Vector Operations

dag at cray.com dag at cray.com
Thu May 2 10:31:31 PDT 2013


Nadav Rotem <nrotem at apple.com> writes:

>     
>         For DIV/MOD you can blend the inputs BEFORE the operation. You
>         can
>         place ones or zeros depending on the operation. 
>
>     Quick follow-up on this. What about using "undef" as the input for
>     false items:
>     
>     tv1 = select mask, v1, undef
>     tv2 = select mask, v2, undef
>     tv3 = div tv1, tv2
>     v3 = select mask, tv3, undef
>     
>     I'm always confused about the semantics of undef. Is the above
>     safe
>     code? It would simplify things a bit not to have to track which
>     input
>     values are safe based on the context of an operation.
>     
>     -David
>
> This is not a correct use of undef. I think that
> InstCombine/DagCombine will optimize tv1 into 'undef'. 

But is that really a legal transformation?  Clearly not all elements are
known to be undef.

But thanks for the feedback!  We'll avoid this route for now.

                          -David



More information about the llvm-dev mailing list