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
This commit is contained in:
maya 2018-04-02 17:45:23 +00:00
parent b18e9232b7
commit 3f6bdae5df
2 changed files with 19 additions and 6 deletions

View File

@ -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))])]

View File

@ -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))")))))