diff mbox series

[cris,1/4] cris: Correct output templates in define_subst patterns.

Message ID 202007130835.06D8Z1kv030332@ignucius.se.axis.com
State New
Headers show
Series various cc0-related (and not) regression fixes | expand

Commit Message

Hans-Peter Nilsson July 13, 2020, 8:35 a.m. UTC
Whoops.  This little gem had the effect of making the output
operand (0) constraints disappear but not the input operand (1)
constraints for define_subst:ed patterns, probably because
there's another (match_dup 1) in the output template (not
investigated).

That went surprisingly unnoticed until I added a pass leaning
just a little bit harder on the define_subst:ed patterns and
then only by the libgfortran library generating assembly with
nominally incorrect syntax.  (There was a move to a special
register from a general register, and it incorrectly matched a
pattern affecting condition codes.)

gcc:
	* config/cris/cris.md ("setnz_subst", "setnz_subst", "setcc_subst"):
	Use match_dup in output template, not match_operand.
---
 gcc/config/cris/cris.md | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/gcc/config/cris/cris.md b/gcc/config/cris/cris.md
index c36a5402be3..074f5234402 100644
--- a/gcc/config/cris/cris.md
+++ b/gcc/config/cris/cris.md
@@ -275,7 +275,7 @@  (define_subst "setnz_subst"
   "reload_completed"
   [(set (reg:CC_NZ CRIS_CC0_REGNUM)
 	(compare:CC_NZ (match_dup 1) (const_int 0)))
-   (set (match_operand 0) (match_operand 1))])
+   (set (match_dup 0) (match_dup 1))])
 
 (define_subst_attr "setnzvc" "setnzvc_subst" "" "_setnzvc")
 (define_subst_attr "ccnzvc" "setnzvc_subst" "" "_enabled")
@@ -288,7 +288,7 @@  (define_subst "setnzvc_subst"
   "reload_completed"
   [(set (reg:CC_NZVC CRIS_CC0_REGNUM)
 	(compare:CC_NZVC (match_dup 1) (const_int 0)))
-   (set (match_operand 0) (match_operand 1))])
+   (set (match_dup 0) (match_dup 1))])
 
 (define_subst_attr "setcc" "setcc_subst" "" "_setcc")
 (define_subst_attr "cccc" "setcc_subst" "" "_enabled")
@@ -301,7 +301,7 @@  (define_subst "setcc_subst"
   "reload_completed"
   [(set (reg:CC CRIS_CC0_REGNUM)
 	(compare:CC (match_dup 1) (const_int 0)))
-   (set (match_operand 0) (match_operand 1))])
+   (set (match_dup 0) (match_dup 1))])
 
 ;; Operand and operator predicates.