]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[ARC] Use TARGET_CANNOT_SUBSTITUTE_MEM_EQUIV.
authorClaudiu Zissulescu <claziss@synopsys.com>
Thu, 30 Nov 2017 14:41:49 +0000 (15:41 +0100)
committerClaudiu Zissulescu <claziss@gcc.gnu.org>
Thu, 30 Nov 2017 14:41:49 +0000 (15:41 +0100)
Sometimes the memory equivalent is not valid due to a large offset.
For example replacing the ap register with its fp/sp-equivalent during
LRA step. To solve this we introduced TARGET_CANNOT_SUBSTITUTE_MEM_EQUIV.

gcc/
2017-08-08  Claudiu Zissulescu  <claziss@synopsys.com>

* config/arc/arc.c (arc_cannot_substitute_mem_equiv_p): New function.
(TARGET_CANNOT_SUBSTITUTE_MEM_EQUIV_P): Define.

gcc/testsuite
2017-08-08  Claudiu Zissulescu  <claziss@synopsys.com>

* gcc.target/arc/lra-1.c: New test.

From-SVN: r255273

gcc/ChangeLog
gcc/config/arc/arc.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/arc/lra-1.c [new file with mode: 0644]

index 776508a1bdce28cfbf58ac95eaee9feee2a1047d..ddcd9832f524e2ef00903033978a13a0bdddf062 100644 (file)
@@ -1,3 +1,9 @@
+2017-11-30  Claudiu Zissulescu  <claziss@synopsys.com>
+
+       * config/arc/arc.c (arc_cannot_substitue_mem_equiv_p): New
+       function.
+       (TARGET_CANNOT_SUBSTITUTE_MEM_EQUIV_P): Define.
+
 2017-11-30  Jakub Jelinek  <jakub@redhat.com>
 
        PR target/83210
index 55265cb61465cbc26f31c5ca138291552fb30019..e739d60a64af0a74ce0532b287df5d6f58260dda 100644 (file)
@@ -10805,12 +10805,24 @@ arc_use_anchors_for_symbol_p (const_rtx symbol)
   return default_use_anchors_for_symbol_p (symbol);
 }
 
+/* Return true if SUBST can't safely replace its equivalent during RA.  */
+static bool
+arc_cannot_substitute_mem_equiv_p (rtx)
+{
+  /* If SUBST is mem[base+index], the address may not fit ISA,
+     thus return true.  */
+  return true;
+}
+
 #undef TARGET_USE_ANCHORS_FOR_SYMBOL_P
 #define TARGET_USE_ANCHORS_FOR_SYMBOL_P arc_use_anchors_for_symbol_p
 
 #undef TARGET_CONSTANT_ALIGNMENT
 #define TARGET_CONSTANT_ALIGNMENT constant_alignment_word_strings
 
+#undef TARGET_CANNOT_SUBSTITUTE_MEM_EQUIV_P
+#define TARGET_CANNOT_SUBSTITUTE_MEM_EQUIV_P arc_cannot_substitute_mem_equiv_p
+
 struct gcc_target targetm = TARGET_INITIALIZER;
 
 #include "gt-arc.h"
index d1425a5bcf56bf5d4be0c5c6efb812d02373f5ed..f12d075a1e615fa8dd09f8b9d843b9b37f9809ed 100644 (file)
@@ -1,3 +1,7 @@
+2017-11-30  Claudiu Zissulescu  <claziss@synopsys.com>
+
+       * gcc.target/arc/lra-1.c: New test.
+
 2017-11-30  Will Schmidt  <will_schmidt@vnet.ibm.com>
 
        * gcc.target/powerpc/fold-vec-abs-char-fwrapv.c: Add xxspltib insn
diff --git a/gcc/testsuite/gcc.target/arc/lra-1.c b/gcc/testsuite/gcc.target/arc/lra-1.c
new file mode 100644 (file)
index 0000000..27336d1
--- /dev/null
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+/* { dg-options "-Os -w -mlra" } */
+
+/* ap is replaced with an address like base+offset by lra,
+   where offset is larger than s9, resulting into an ICE.  */
+
+typedef struct { char a[500] } b;
+c;
+struct d {
+  short e;
+  b f
+} g(int h, int i, int j, int k, char l, int m, int n, char *p) {
+again:;
+  struct d o;
+  *p = c = ({ q(o); });
+  goto again;
+}