From 3f6bdae5df37fbc0a9ad11fafd514371bbec4e39 Mon Sep 17 00:00:00 2001 From: maya Date: Mon, 2 Apr 2018 17:45:23 +0000 Subject: [PATCH] Add new predicate volatile_mem_operand and use it for jbbssi 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 --- external/gpl3/gcc/dist/gcc/config/vax/builtins.md | 12 ++++++------ external/gpl3/gcc/dist/gcc/config/vax/predicates.md | 13 +++++++++++++ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/external/gpl3/gcc/dist/gcc/config/vax/builtins.md b/external/gpl3/gcc/dist/gcc/config/vax/builtins.md index 7be11792025a..5fb6da6fafe9 100644 --- a/external/gpl3/gcc/dist/gcc/config/vax/builtins.md +++ b/external/gpl3/gcc/dist/gcc/config/vax/builtins.md @@ -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))])] diff --git a/external/gpl3/gcc/dist/gcc/config/vax/predicates.md b/external/gpl3/gcc/dist/gcc/config/vax/predicates.md index 7344192db92c..f68c3f44be46 100644 --- a/external/gpl3/gcc/dist/gcc/config/vax/predicates.md +++ b/external/gpl3/gcc/dist/gcc/config/vax/predicates.md @@ -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))")))))