Module Name:    src
Committed By:   maya
Date:           Mon Apr  2 17:45:23 UTC 2018

Modified Files:
        src/external/gpl3/gcc/dist/gcc/config/vax: builtins.md predicates.md

Log Message:
Add new predicate volatile_mem_operand and use it for jbbssi<mode>

Fixes PR port-vax/53039: GCC/VAX hits ICE building libstdc++

GCC wants to change the label and then doesn't recognise the
new insn, it believes it doesn't satisfy the memory_operand
predicate.

It appears the memory_operand predicate doesn't accept volatile
memory accesses during the RTL generation phase.

The predicate is from rs6000 code.

from krister


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 \
    src/external/gpl3/gcc/dist/gcc/config/vax/builtins.md
cvs rdiff -u -r1.1.1.4 -r1.2 \
    src/external/gpl3/gcc/dist/gcc/config/vax/predicates.md

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/gcc/dist/gcc/config/vax/builtins.md
diff -u src/external/gpl3/gcc/dist/gcc/config/vax/builtins.md:1.7 src/external/gpl3/gcc/dist/gcc/config/vax/builtins.md:1.8
--- src/external/gpl3/gcc/dist/gcc/config/vax/builtins.md:1.7	Fri Feb  2 03:41:05 2018
+++ src/external/gpl3/gcc/dist/gcc/config/vax/builtins.md	Mon Apr  2 17:45:23 2018
@@ -77,13 +77,13 @@
   [(parallel
     [(set (pc)
 	  (if_then_else
-	    (ne (zero_extract:SI (match_operand:QI 0 "memory_operand" "g")
+	    (ne (zero_extract:SI (match_operand:QI 0 "volatile_mem_operand" "g")
 				 (const_int 1)
 				 (match_operand:SI 1 "general_operand" "nrm"))
 		(const_int 0))
 	    (label_ref (match_operand 2 "" ""))
 	    (pc)))
-     (set (zero_extract:SI (match_operand:QI 3 "memory_operand" "+0")
+     (set (zero_extract:SI (match_operand:QI 3 "volatile_mem_operand" "+0")
 			   (const_int 1)
 			   (match_dup 1))
 	  (const_int 1))])]
@@ -94,13 +94,13 @@
   [(parallel
     [(set (pc)
 	  (if_then_else
-	    (ne (zero_extract:SI (match_operand:HI 0 "memory_operand" "Q")
+	    (ne (zero_extract:SI (match_operand:HI 0 "volatile_mem_operand" "Q")
 				 (const_int 1)
 				 (match_operand:SI 1 "general_operand" "nrm"))
 		(const_int 0))
 	    (label_ref (match_operand 2 "" ""))
 	    (pc)))
-     (set (zero_extract:SI (match_operand:HI 3 "memory_operand" "+0")
+     (set (zero_extract:SI (match_operand:HI 3 "volatile_mem_operand" "+0")
 			   (const_int 1)
 			   (match_dup 1))
 	  (const_int 1))])]
@@ -111,13 +111,13 @@
   [(parallel
     [(set (pc)
 	  (if_then_else
-	    (ne (zero_extract:SI (match_operand:SI 0 "memory_operand" "Q")
+	    (ne (zero_extract:SI (match_operand:SI 0 "volatile_mem_operand" "Q")
 				 (const_int 1)
 				 (match_operand:SI 1 "general_operand" "nrm"))
 		(const_int 0))
 	    (label_ref (match_operand 2 "" ""))
 	    (pc)))
-     (set (zero_extract:SI (match_operand:SI 3 "memory_operand" "+0")
+     (set (zero_extract:SI (match_operand:SI 3 "volatile_mem_operand" "+0")
 			   (const_int 1)
 			   (match_dup 1))
 	  (const_int 1))])]

Index: src/external/gpl3/gcc/dist/gcc/config/vax/predicates.md
diff -u src/external/gpl3/gcc/dist/gcc/config/vax/predicates.md:1.1.1.4 src/external/gpl3/gcc/dist/gcc/config/vax/predicates.md:1.2
--- src/external/gpl3/gcc/dist/gcc/config/vax/predicates.md:1.1.1.4	Fri Feb  2 01:59:55 2018
+++ src/external/gpl3/gcc/dist/gcc/config/vax/predicates.md	Mon Apr  2 17:45:23 2018
@@ -109,3 +109,16 @@
    (and (match_code "const_int,const_double,subreg,reg,mem")
 	(and (match_operand:DI 0 "general_operand" "")
 	     (not (match_operand:DI 0 "illegal_addsub_di_memory_operand")))))
+
+;; Return 1 if the operand is in volatile memory.  Note that during the
+;; RTL generation phase, memory_operand does not return TRUE for volatile
+;; memory references.  So this function allows us to recognize volatile
+;; references where it's safe.
+(define_predicate "volatile_mem_operand"
+  (and (and (match_code "mem")
+	    (match_test "MEM_VOLATILE_P (op)"))
+       (if_then_else (match_test "reload_completed")
+         (match_operand 0 "memory_operand")
+         (if_then_else (match_test "reload_in_progress")
+	   (match_test "strict_memory_address_p (mode, XEXP (op, 0))")
+	   (match_test "memory_address_p (mode, XEXP (op, 0))")))))

Reply via email to