This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch ping for PR target/1532


I haven't heard anything on this patch for PR target/1532:
    http://gcc.gnu.org/ml/gcc-patches/2004-01/msg02734.html

I checked tree-ssa, and although the patch is not needed there for the
test case in PR 1532, it is needed for this simpler test case:

int check(int, int);
int foo(int i,int j) {
  switch (check(i,j)) {
  case 0: return i+j;
  case 1: return i;
  case 2: return j;
  }
}

My patch causes the following diff in the assembler file generated
with -O2.  Note the elimination of the useless jump to the following
instruction, and the additional elimination of the no-longer-needed
cmpl instruction.

--- foo3.s.1	Fri Jan 30 12:32:32 2004
+++ foo3.s.2	Fri Jan 30 12:28:39 2004
@@ -25,10 +25,7 @@
 	movl	%esi, %edx
 	je	.L1
 	jle	.L8
-	cmpl	$2, %eax
 	movl	%ebx, %edx
-	je	.L1
-.L2:
 .L1:
 	movl	-8(%ebp), %ebx
 	movl	%edx, %eax
@@ -39,7 +36,7 @@
 	.p2align 4,,7
 .L8:
 	testl	%eax, %eax
-	jne	.L2
+	jne	.L1
 	leal	(%esi,%ebx), %edx
 	jmp	.L1
 .LFE2:

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]