[ARC] Fix millicode wrong blink restore.
authorClaudiu Zissulescu <claziss@synopsys.com>
Fri, 14 Dec 2018 10:42:44 +0000 (11:42 +0100)
committerClaudiu Zissulescu <claziss@gcc.gnu.org>
Fri, 14 Dec 2018 10:42:44 +0000 (11:42 +0100)
The blink is restored wrongly when using millicode and regular load
instructions.

gcc/
xxxx-xx-xx  Claudiu Zissulescu  <claziss@synopsys.com>

* config/arc/arc.c (arc_restore_callee_milli) Don't clobber off
variable.

testsuite/
xxxx-xx-xx  Claudiu Zissulescu  <claziss@synopsys.com>

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

From-SVN: r267129

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

index a585e254ce32035157c0dfd3aba37f5ab3e11818..f97c40106dbeac4dff3b0d1dddd23a1f089ab864 100644 (file)
@@ -1,3 +1,8 @@
+2018-12-14  Claudiu Zissulescu  <claziss@synopsys.com>
+
+       * config/arc/arc.c (arc_restore_callee_milli) Don't clobber off
+       variable.
+
 2018-12-14  Claudiu Zissulescu  <claziss@synopsys.com>
 
        * config/arc/arc.h (reg_class): Add SIBCALL_REGS.
index 55175215bfed6e166a92ae046b36487662c36dd0..5af3ee6c9e035ad8382e4697fe7a866ea66221bd 100644 (file)
@@ -3597,9 +3597,7 @@ arc_restore_callee_milli (unsigned int gmask,
     insn = frame_insn (insn);
 
   /* Add DWARF info.  */
-  for (regno = start_reg, off = 0;
-       regno <= end_reg;
-       regno++, off += UNITS_PER_WORD)
+  for (regno = start_reg; regno <= end_reg; regno++)
     {
       reg = gen_rtx_REG (SImode, regno);
       add_reg_note (insn, REG_CFA_RESTORE, reg);
index 8128ea99969adbf6399a63ab933d9c95468957ab..3cfdfaec305e983d06f1e8ebd416645015af8182 100644 (file)
@@ -1,3 +1,7 @@
+2018-12-14  Claudiu Zissulescu  <claziss@synopsys.com>
+
+       * gcc.target/arc/milli-1.c: New test.
+
 2018-12-13  Michael Ploujnikov  <michael.ploujnikov@oracle.com>
 
        * gcc.dg/lto/pr88297_0.c: New test.
diff --git a/gcc/testsuite/gcc.target/arc/milli-1.c b/gcc/testsuite/gcc.target/arc/milli-1.c
new file mode 100644 (file)
index 0000000..b501b39
--- /dev/null
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-Os" } */
+
+/* Test if we restore correctly blink when using millicode.  */
+extern void bar (void);
+
+void foo (void)
+{
+  __asm__ volatile ( "" : : : "r13","r14","r15","r16","r17","r18","r20","r21");
+  bar();
+}
+
+void foo2 (void)
+{
+  bar();
+  __asm__ volatile ( "" : : : "r13","r14","r15","r16","r17","r18","r20","r21");
+}
+
+/* { dg-final { scan-assembler-not "st.*r13,\\\[sp" } } */
+/* { dg-final { scan-assembler-not "st.*r14,\\\[sp" } } */
+/* { dg-final { scan-assembler-not "st.*r15,\\\[sp" } } */
+/* { dg-final { scan-assembler "ld.*blink,\\\[sp,32" } } */
+/* { dg-final { scan-assembler "mov_s.*r12,32" } } */