[PATCH] D28928: [ValueTracking] Implement SignBitMustBeZero correctly for sqrt.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 25 14:05:38 PST 2017


efriedma added a comment.

> I think as soon as we leave the fp space we can no longer play fast and loose with signed zeroes.

Agreed.

> Can`if (x == 0 && !signbit(x)) print (x);` print "-0"? He's saying yes (if the whole program is compiled with nsz), and I think I agree.

I think it depends on how exactly "signbit" is implemented; if signbit and print are both integer operations, we probably have to be conservative because we're no longer in FP space.  I think we can be more flexible with an nsz copysign, as in "if (x == 0 && copysign(1, x) == 1)".


https://reviews.llvm.org/D28928





More information about the llvm-commits mailing list