[LLVMdev] Handling Masked Vector Operations

Nadav Rotem nrotem at apple.com
Thu May 2 10:29:03 PDT 2013

>> 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'.    
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130502/590bb96a/attachment.html>

More information about the llvm-dev mailing list