[Bug target/16294] New: Missed delay slot scheduling opportunity

ebotcazou at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Wed Jun 30 11:09:00 GMT 2004


The RTL prologue/epilogue patch for SPARC:

   http://gcc.gnu.org/ml/gcc-patches/2004-06/msg01049.html

introduced a regression with regard to delay slot scheduling and branches.


For the testcase:

void f (double*a, int m)
{
  int j;

  for(j=0; j<m; j++)
    a[j]=1;
}

compiled at -O2 -mcpu=ultrasparc, the diff looks like:

@@ -12,10 +12,9 @@
 	.type	f, #function
 	.proc	04
 f:
-	!#PROLOGUE# 0
-	!#PROLOGUE# 1
 	cmp	%o1, 0
-	ble,pn	%icc, .LL5
+	ble,pn	%icc, .LL8
+	nop
 	sethi	%hi(.LLC0), %g1
 	mov	0, %o5
 	ldd	[%g1+%lo(.LLC0)], %f8
@@ -25,9 +24,9 @@
 	cmp	%o1, %o5
 	bg,pt	%icc, .LL4
 	std	%f8, [%o0+%g1]
-.LL5:
-	retl
-	nop
+.LL8:
+	jmp	%o7+8
+	 nop
 	.size	f, .-f
 	.section	".rodata"
 	.align 8


For testsuite/gcc.c-torture/compile/990517-1.c, the diff is:

@@ -7,9 +7,7 @@
 	.type	sdbm__splpage, #function
 	.proc	020
 sdbm__splpage:
-	!#PROLOGUE# 0
 	save	%sp, -1168, %sp
-	!#PROLOGUE# 1
 	add	%fp, -1056, %l6
 	mov	%i0, %o1
 	mov	1024, %o2
@@ -26,7 +24,8 @@
 	mov	1024, %o2
 	ldsh	[%fp-1056], %l4
 	cmp	%l4, 0
-	ble,pn	%icc, .LL1
+	ble,pn	%icc, .LL10
+	nop
 	mov	1024, %l3
 	add	%fp, -1064, %i5
 	add	%fp, -1072, %l7
@@ -59,8 +58,8 @@
 	cmp	%l4, 0
 	bg,pt	%icc, .LL4
 	add	%l5, 4, %l5
-.LL1:
+.LL10:
 	return	%i7+8
-	nop
+	 nop
 	.size	sdbm__splpage, .-sdbm__splpage
 	.ident	"GCC: (GNU) 3.5.0 20040620 (experimental)"

It appears that the compiler fails to realize that the value of the register
doesn't matter on the non-fallthru edge pointing to the return.

-- 
           Summary: Missed delay slot scheduling opportunity
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ebotcazou at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: sparc*-*-*
  GCC host triplet: sparc*-*-*
GCC target triplet: sparc*-*-*


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16294



More information about the Gcc-bugs mailing list