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

Hal Finkel hfinkel at anl.gov
Mon Jul 7 07:14:11 PDT 2014


Bill, Uli,

Could one of you please check on what PPC does for this, and update if necessary. I just glanced at this quickly, but it looks like we also lower this in terms of PPC::ANDC.

Thanks again,
Hal

----- Original Message -----
> From: "Hal Finkel" <hfinkel at anl.gov>
> To: "Duncan Sands" <duncan.sands at gmail.com>
> Cc: llvm-commits at cs.uiuc.edu
> Sent: Monday, July 7, 2014 9:05:41 AM
> Subject: Re: [llvm] r212443 - CodeGen: it turns out that NAND is not the	same thing as BIC. At all.
> 
> ----- Original Message -----
> > From: "Duncan Sands" <duncan.sands at gmail.com>
> > To: "Hal Finkel" <hfinkel at anl.gov>
> > Cc: llvm-commits at cs.uiuc.edu
> > Sent: Monday, July 7, 2014 9:03:40 AM
> > Subject: Re: [llvm] r212443 - CodeGen: it turns out that NAND is
> > not the same thing as BIC. At all.
> > 
> > Hi Hal,
> > 
> > >>> 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
> > >
> > > Is this a problem, then, because we claim compatibility with gcc
> > > 4.2.1? I wonder if this breaks anything in the wild.
> > 
> > in my opinion this was a gcc misfeature that is better off dead, so
> > I
> > suggest
> > updating the docs to note that we deviate from gcc 4.2.1 (and
> > follow
> > gcc-4.4+)
> > in defining atomic nand to be ~(a & b).
> 
> Sounds good to me.
> 
>  -Hal
> 
> > 
> > Ciao, Duncan.
> > 
> > 
> 
> --
> Hal Finkel
> Assistant Computational Scientist
> Leadership Computing Facility
> Argonne National Laboratory
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
> 

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory



More information about the llvm-commits mailing list