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
> >> 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. > > -DavidThis 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>
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