Module Name:    src
Committed By:   kalvisd
Date:           Sun Sep 29 11:49:43 UTC 2024

Modified Files:
        src/external/gpl3/gcc/dist/gcc/config/vax: vax.cc

Log Message:
gcc: vax: revise the expressions that may be valid index terms on VAX

    Multiplication of a constant and a register is commutative but the
    same is not true for left shifts. Only expressions where a register
    is shifted by a constant (and that where the constant is equal to
    the word size for the operand) can be valid index terms.

    OK rin@


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/gpl3/gcc/dist/gcc/config/vax/vax.cc

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/vax.cc
diff -u src/external/gpl3/gcc/dist/gcc/config/vax/vax.cc:1.8 src/external/gpl3/gcc/dist/gcc/config/vax/vax.cc:1.9
--- src/external/gpl3/gcc/dist/gcc/config/vax/vax.cc:1.8	Sun Sep 29 11:45:31 2024
+++ src/external/gpl3/gcc/dist/gcc/config/vax/vax.cc	Sun Sep 29 11:49:43 2024
@@ -1916,7 +1916,6 @@ static bool
 index_term_p (rtx prod, machine_mode mode, bool strict)
 {
   rtx xfoo0, xfoo1;
-  bool log_p;
 
   if (GET_MODE_SIZE (mode) == 1)
     return BASE_REGISTER_P (prod, strict);
@@ -1925,18 +1924,24 @@ index_term_p (rtx prod, machine_mode mod
       || GET_MODE_SIZE (mode) > 8)
     return false;
 
-  log_p = GET_CODE (prod) == ASHIFT;
   xfoo0 = XEXP (prod, 0);
   xfoo1 = XEXP (prod, 1);
 
-  if (!log_p
+  if (GET_CODE (prod) == MULT
       && CONST_INT_P (xfoo0)
       && GET_MODE_SIZE (mode) == INTVAL (xfoo0)
       && INDEX_REGISTER_P (xfoo1, strict))
     return true;
 
-  if (CONST_INT_P (xfoo1)
-      && GET_MODE_SIZE (mode) == (log_p ? 1 << INTVAL (xfoo1) : INTVAL (xfoo1))
+  if (GET_CODE (prod) == MULT
+      && CONST_INT_P (xfoo1)
+      && GET_MODE_SIZE (mode) == INTVAL (xfoo1)
+      && INDEX_REGISTER_P (xfoo0, strict))
+    return true;
+
+  if (GET_CODE (prod) == ASHIFT
+      && CONST_INT_P (xfoo1)
+      && GET_MODE_SIZE (mode) == (1 << INTVAL (xfoo1))
       && INDEX_REGISTER_P (xfoo0, strict))
     return true;
 

Reply via email to