[llvm] r212443 - CodeGen: it turns out that NAND is not the same thing as BIC. At all.

Jim Grosbach grosbach at apple.com
Tue Jul 8 11:18:26 PDT 2014


> On Jul 7, 2014, at 2:35 AM, Duncan Sands <duncan.sands at gmail.com> wrote:
> 
> Hi Tim,
> 
> On 07/07/14 11:06, Tim Northover wrote:
>> Author: tnorthover
>> Date: Mon Jul  7 04:06:35 2014
>> New Revision: 212443
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=212443&view=rev
>> Log:
>> CodeGen: it turns out that NAND is not the same thing as BIC. At all.
>> 
>> We've been performing the wrong operation on ARM for "atomicrmw nand" for
>> years, since "a NAND b" is "~(a & b)" rather than ARM's very tempting "a & ~b".
>> This bled over into the generic expansion pass.
>> 
>> So I assume no-one has ever actually tried to do an atomic nand in the real
>> world. Oh well.
> 
> this may have been a feature, not a mistake: it might simply have been trying to be compatible with GCC which also did a & ~b for atomic nand for years (it was even documented to be this way).  The semantics were changed to ~(a & b) in GCC 4.4.  See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37908

Yep. I remember investigating this back when we first added this stuff for ARM and having a few *facepalm* moments. Pretty sure we do the same thing there. I agree switching the behavior to match gcc 4.4+ is the right thing to do. We should make sure 32-bit ARM does the same thing.

-Jim


> 
> Ciao, Duncan.
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140708/dd0bddc8/attachment.html>


More information about the llvm-commits mailing list