This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v5, middle end]: Committed: Fix PR 37908, thinko with atomic NAND operation


Uros Bizjak wrote:
H.J. Lu wrote:

2008-11-17 Uros Bizjak <ubizjak@gmail.com>

       PR middle-end/37908
       * optabs.c (expand_sync_operation): Properly handle NAND case
       by calculating ~(t1 & val) instead of (~t1 & val).
       * builtins.c (expand_builtin_sync_operation): Warn for changed
       semantics in NAND builtins.
       * c.opt (Wsync-nand): New warning option.  Describe -Wsync-nand.

* doc/invoke.texi (Warning options): Add Wsync-nand.
* doc/extend.texi (Atomic Builtins) [__sync_fetch_and_nand]: Correct
__sync_fetch_and_nand builtin operation in the example. Add a note
about changed semantics in GCC 4.4.
[__sync_nand_and_fetch]: Correct __sync_nand_and_fetch builtin
operation in the example. Add a note about changed semantics in
GCC 4.4.



Those are failed on Linux/ia64:


+FAIL: gcc.dg/ia64-sync-1.c execution test
+FAIL: gcc.dg/ia64-sync-2.c execution test
+FAIL: gcc.dg/pr37908.c execution test
+FAIL: gcc.dg/sync-2.c execution test
+FAIL: gcc.dg/sync-3.c execution test


Yes, these target-dependant failures are expected. Insn patterns / expanders have to be updated.

Attached is an untested patch, that should fix ia64.


Uros.

Index: ia64.c
===================================================================
--- ia64.c	(revision 141951)
+++ ia64.c	(working copy)
@@ -2141,11 +2141,13 @@
   new_reg = cmp_reg;
   if (code == NOT)
     {
-      new_reg = expand_simple_unop (DImode, NOT, new_reg, NULL_RTX, true);
-      code = AND;
+      new_reg = expand_simple_binop (DImode, AND, new_reg, val, NULL_RTX,
+				     true, OPTAB_DIRECT);
+      new_reg = expand_simple_unop (DImode, code, new_reg, NULL_RTX, true);
     }
-  new_reg = expand_simple_binop (DImode, code, new_reg, val, NULL_RTX,
-				 true, OPTAB_DIRECT);
+  else
+    new_reg = expand_simple_binop (DImode, code, new_reg, val, NULL_RTX,
+				   true, OPTAB_DIRECT);
 
   if (mode != DImode)
     new_reg = gen_lowpart (mode, new_reg);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]