diff mbox

sparc: fix v7 memory barrier handling

Message ID 4F1EEF0D.9080400@redhat.com
State New
Headers show

Commit Message

Richard Henderson Jan. 24, 2012, 5:49 p.m. UTC
While investigating atomic-test-and-set problems, I found
that sparc v7 wasn't matching the memory barrier as desired.

The problem turned out to be that the lack of a match_code
containing const_int meant that genpreds generated the wrong
mode test within the predicate.  Which meant that no values
matched, instead of all values.

Tested along side patches to come.  Committed.


r~
* config/sparc/predicates.md (zero_or_v7_operand): Use match_code.
diff mbox

Patch

diff --git a/gcc/config/sparc/predicates.md b/gcc/config/sparc/predicates.md
index 81e5320..308fbd6 100644
--- a/gcc/config/sparc/predicates.md
+++ b/gcc/config/sparc/predicates.md
@@ -1,5 +1,5 @@ 
 ;; Predicate definitions for SPARC.
-;; Copyright (C) 2005, 2007, 2008, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 2005, 2007, 2008, 2010, 2012 Free Software Foundation, Inc.
 ;;
 ;; This file is part of GCC.
 ;;
@@ -113,8 +113,9 @@ 
 
 ;; Return true if OP is Zero, or if the target is V7.
 (define_predicate "zero_or_v7_operand"
-  (ior (match_test "op == const0_rtx")
-       (match_test "!TARGET_V8 && !TARGET_V9")))
+  (and (match_code "const_int")
+       (ior (match_test "INTVAL (op) == 0")
+	    (match_test "!TARGET_V8 && !TARGET_V9"))))
 
 ;; Predicates for symbolic constants.