On Thu, Mar 12, 2009 at 8:00 AM, Richard Guenther <richard.guent...@gmail.com> wrote: > On Thu, Mar 12, 2009 at 3:56 PM, Steven Bosscher <stevenb....@gmail.com> > wrote: >> - Show quoted text - >> On Thu, Mar 12, 2009 at 3:34 PM, Paolo Bonzini <bonz...@gnu.org> wrote: >>> >>>> Will "REGNO (operands[0]) == REGNO (operands[1])" work here? >>> >>> Yes. I wanted to be conservative in case one day subregs or who knows >>> what are allowed. I'll defer to maintainers or other people (Steven?), >>> either way is fine by me. >> >> If REGNO works now, I'd use it. If "one day" subregs are allowed, >> REGNO will trigger an rtl-checking failure anyway. > > Indeed. The patch with REGNO is pre-approved if it bootstraps/regtests. >
I tried this Index: i386.md =================================================================== --- i386.md (revision 144796) +++ i386.md (working copy) @@ -20820,7 +20820,8 @@ (parallel [(set (match_dup 0) (match_op_dup 3 [(match_dup 0) (match_dup 1)])) (clobber (reg:CC FLAGS_REG))])] - "operands[4] = replace_rtx (operands[2], operands[0], operands[1]);") + "if (REGNO (operands[0]) == REGNO (operands[1])) abort (); + operands[4] = replace_rtx (operands[2], operands[0], operands[1]);") (define_peephole2 [(set (match_operand 0 "register_operand" "") @@ -20835,7 +20836,7 @@ [(set (match_dup 0) (match_dup 2)) (set (match_dup 0) (match_op_dup 3 [(match_dup 0) (match_dup 1)]))] - "") + "if (REGNO (operands[0]) == REGNO (operands[1])) abort ();") ; Don't do logical operations with memory outputs on Linux/Intel64. There are no regressions: http://gcc.gnu.org/ml/gcc-testresults/2009-03/msg01199.html But I did get [...@gnu-33 foo]$ cat /tmp/x.f90 subroutine statin(x,y,pstratr,pconvecr,zhxy,zhxhy,ztmp) integer :: x,y real pstratr(x,y),pconvecr(x,y),zhxy(x,y) real ztmp(4) do j = 1,y do i = 1,x-2 zttotrainr = zttotrainr + (pstratr(i,j) + pconvecr(i,j))*zhxy(i,j) ztstratr = ztstratr + pstratr(i,j) ztconvecr = ztconvecr + pconvecr(i,j) ztsenf = ztsenf + zhxy(i,j) ztlatf = ztlatf + zhxy(i,j) ztcldtop = ztcldtop + zhxy(i,j) enddo enddo ztmp(1)=zttotrainr ztmp(2)=ztstratr ztmp(3)=ztconvecr ztmp(4)=ztsenf*ztlatf*ztcldtop end [...@gnu-33 foo]$ ../xgcc -B../ -S -O3 -ffast-math /tmp/x.f90 /tmp/x.f90: In function ‘statin’: /tmp/x.f90:18: internal compiler error: in gen_peephole2_2750, at config/i386/i386.md:20839 Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. I am checking: Index: i386.md =================================================================== --- i386.md (revision 144796) +++ i386.md (working copy) @@ -20813,7 +20813,7 @@ [(match_dup 0) (match_operand:SI 2 "memory_operand" "")])) (clobber (reg:CC FLAGS_REG))])] - "operands[0] != operands[1] + "REGNO (operands[0]) != REGNO (operands[1]) && GENERAL_REGNO_P (REGNO (operands[0])) && GENERAL_REGNO_P (REGNO (operands[1]))" [(set (match_dup 0) (match_dup 4)) @@ -20829,7 +20829,7 @@ (match_operator 3 "commutative_operator" [(match_dup 0) (match_operand 2 "memory_operand" "")]))] - "operands[0] != operands[1] + "REGNO (operands[0]) != REGNO (operands[1]) && ((MMX_REG_P (operands[0]) && MMX_REG_P (operands[1])) || (SSE_REG_P (operands[0]) && SSE_REG_P (operands[1])))" [(set (match_dup 0) (match_dup 2)) now. Thanks. -- H.J.