<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><blockquote type="cite"><div>On Jul 7, 2014, at 2:35 AM, Duncan Sands <<a href="mailto:duncan.sands@gmail.com">duncan.sands@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div>Hi Tim,<br><br>On 07/07/14 11:06, Tim Northover wrote:<br><blockquote type="cite">Author: tnorthover<br>Date: Mon Jul  7 04:06:35 2014<br>New Revision: 212443<br><br>URL: <a href="http://llvm.org/viewvc/llvm-project?rev=212443&view=rev">http://llvm.org/viewvc/llvm-project?rev=212443&view=rev</a><br>Log:<br>CodeGen: it turns out that NAND is not the same thing as BIC. At all.<br><br>We've been performing the wrong operation on ARM for "atomicrmw nand" for<br>years, since "a NAND b" is "~(a & b)" rather than ARM's very tempting "a & ~b".<br>This bled over into the generic expansion pass.<br><br>So I assume no-one has ever actually tried to do an atomic nand in the real<br>world. Oh well.<br></blockquote><br>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 <a href="https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37908">https://gcc.gnu.org/bugzilla/show_bug.cgi?id=37908</a><br></div></blockquote><div><br></div><div>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.</div><div><br></div><div>-Jim</div><div><br></div><br><blockquote type="cite"><div><br>Ciao, Duncan.<br>_______________________________________________<br>llvm-commits mailing list<br><a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits<br></div></blockquote></div><br></body></html>