On Dec 11, 2013, at 12:33 PM, Tim Northover <t.p.northover at gmail.com> wrote:> On 11 December 2013 20:25, Raoux, Thomas F <thomas.f.raoux at intel.com> wrote: >> Well in IEEE-754 Nan + any value returns Nan, so doing Nan + undef -> undef is wrong. > > I see what you mean having re-read the language reference. It looks > like LLVM's "undef" has to be *some* bitpattern at any point, and that > allows IEEE room to come in and say what the result is.To generalize this, undef can be any bit pattern, but it still has to respect universal constraints of its type. This means that predicates that are true for all values of a type must also be true for undef. Because NaN + x == NaN is true for all values of x, it must also be true for undef. —Owen -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131211/3a663359/attachment.html>
On 12/11/13 12:40 PM, Owen Anderson wrote:> > On Dec 11, 2013, at 12:33 PM, Tim Northover <t.p.northover at gmail.com > <mailto:t.p.northover at gmail.com>> wrote: > >> On 11 December 2013 20:25, Raoux, Thomas F <thomas.f.raoux at intel.com >> <mailto:thomas.f.raoux at intel.com>> wrote: >>> Well in IEEE-754 Nan + any value returns Nan, so doing Nan + undef >>> -> undef is wrong. >> >> I see what you mean having re-read the language reference. It looks >> like LLVM's "undef" has to be *some* bitpattern at any point, and that >> allows IEEE room to come in and say what the result is. > > To generalize this, undef can be any bit pattern, but it still has to > respect universal constraints of its type. This means that predicates > that are true /for all/ /values of a type/ must also be true for > undef. Because NaN + x == NaN is true for all values of x, it must > also be true for undef.Seems like this might be another pattern to consider adding (if we don't already have it.) Just to review the patterns which we've discussed so far: NaN + any == NaN undef + any == NaN (since undef can be NaN) or undef + any (since undef could be zero) Philip -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131212/f120776b/attachment.html>
On Dec 12, 2013, at 4:57 PM, Philip Reames <listmail at philipreames.com> wrote:> undef + any == NaN (since undef can be NaN) or undef + any (since undef could be zero)undef + non-NaN is still undef. The compiler is free to choose any value of the type it wishes when simplifying an undef expression. The important point is that it still has to be a value of that type. Hence, predicates that are true for any choice of value must still be respected. This is the case for NaN + undef == NaN: while the compiler is free to choose any value for the undef, there is no such value for which the result is not NaN. —Owen -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20131212/746c716f/attachment.html>