bug 20542

Tim Northover t.p.northover at gmail.com
Mon Aug 18 07:18:58 PDT 2014


Hi Norman,

On 18 August 2014 15:05, Norman Rink <nrink at broadcom.com> wrote:
> "xor (x cc y), 1" --> "(x !cc y)".
>
> In other words, the "xor ?, 1" is treated like a "not" operation, which is blatantly wrong if the argument is wider than one bit. I might be missing something too though.

But the "(x cc y)" isn't a generic operation. Assuming your target has
TLI.getBooleanContents() == ZeroOrOneBooleanContent (the other cases
are analogous[1]) its value can only be 0 or 1. In that case xor with
1 *is* "not".

Cheers.

Tim.

[1] If it's ZeroOrNegativeOne then "(x cc y)" can (unsurprisingly)
only be 0 or -1, so you need to check for "xor (x cc y), -1" to act as
a not. If it's Undefined than the high bits are meaningless and you
should be able to accept "xor (x cc y), C" where C is any constant
with the low bit set.



More information about the llvm-commits mailing list