On Linux/x86-64, revision 161604 failed to bootstrap with --with-cpu=atom. I got Premature end of .class file ../../../../src-trunk/libjava/classpath/lib/java/lang/AbstractStringBuffer.class. Revision 161569 is OK. It could be related to peephole change.
-mtune=atom miscompiled gcj.
jcf-parse.o is miscompiled.
-mtune=atom works with 32bit build.
I can reproduce this. I haven't found the problem, but it seems to go away if I remove m_ATOM from X86_TUNE_OPT_AGU. Is it possible that there's a bug related to this in i386.*?
Function get_attribute is miscompiled. The difference is -- --- /tmp/good.s 2010-06-30 14:36:46.971155015 -0700 +++ /tmp/bad.s 2010-06-30 14:38:49.211031644 -0700 @@ -3966,18 +3966,18 @@ get_attribute: jne .L499 movq 104(%rdi), %rcx movq %rax, %rdi - addq %rdx, %rax + leaq (%rax,%rdx), %rax subq 0(%rbp), %rdi + leaq 2(%rax), %rdx orl $-1, %ebx movq %rdi, 8(%rcx) - leaq 2(%rax), %rdx movq %rdx, 16(%rbp) movzbl (%rax), %eax + movl %esi, %edi sall $8, %eax movzbl -1(%rdx), %ecx orl %eax, %ecx - sall $3, %ecx - leal (%rcx,%rsi), %esi + leal (%rdi,%rcx,8), %esi cmpl %esi, %r13d jb .L381 movslq %ecx, %rcx --
Ok, thanks for investigating. I think we may need something like this: @@ -17574,6 +17574,7 @@ (define_peephole2 || GET_MODE (operands[0]) == HImode)) || GET_MODE (operands[0]) == SImode || (TARGET_64BIT && GET_MODE (operands[0]) == DImode)) + && peep2_reg_dead_p (2, operands[0]) /* We reorder load and the shift. */ && !reg_overlap_mentioned_p (operands[0], operands[4])" [(set (match_dup 5) (match_dup 4)) Testing now.
(In reply to comment #6) > Ok, thanks for investigating. I think we may need something like this: > > @@ -17574,6 +17574,7 @@ (define_peephole2 > || GET_MODE (operands[0]) == HImode)) > || GET_MODE (operands[0]) == SImode > || (TARGET_64BIT && GET_MODE (operands[0]) == DImode)) > + && peep2_reg_dead_p (2, operands[0]) > /* We reorder load and the shift. */ > && !reg_overlap_mentioned_p (operands[0], operands[4])" > [(set (match_dup 5) (match_dup 4)) > > Testing now. > The old peepgole2 pattern has /* The intermediate operand 0 must die or be same as output. */ && (rtx_equal_p (operands[0], operands[5]) || peep2_reg_dead_p (3, operands[0]))"
Created attachment 21051 [details] A patch Here is the a patch. We need rtx_equal_p (operands[0], operands[3]) Otherwise, I got FAIL: gcc.target/i386/lea.c scan-assembler leal
Subject: Bug 44727 Author: bernds Date: Thu Jul 1 09:20:40 2010 New Revision: 161656 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=161656 Log: PR target/44727 * config/i386/i386.md (peephole2 for arithmetic ops with memory): Make sure operand 0 dies. Modified: trunk/gcc/ChangeLog trunk/gcc/config/i386/i386.md
Fixed.