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] Fix another problem with SCmode on SPARC64


Hi,

The following 2 failures on SPARC 64-bit

FAIL: gcc.c-torture/execute/20010605-2.c execution,  -O2 
FAIL: gcc.c-torture/execute/20010605-2.c execution,  -Os

originate in the combiner trying to be clever in recombining several SImode, 
SFmode and DImode regs and subregs, and eventually producing a problematic 
subreg that the register allocator doesn't know to correctly handle on SPARC 
64-bit (old tricky problem).

I think we can avoid emitting all the SImode, SFmode and DImode regs and 
subregs in the first place.  They are produced by emit_group_load_1 when 
invoked on

(gdb) p debug_rtx(dst)
(parallel:SC [
        (expr_list:REG_DEP_TRUE (reg:SC 32 %f0)
            (const_int 0 [0x0]))
        (expr_list:REG_DEP_TRUE (reg:SC 8 %o0)
            (const_int 0 [0x0]))
    ])
$15 = void
(gdb) p debug_rtx(orig_src)
(concat:SC (reg/v:SF 107 [ y ])
    (reg/v:SF 108 [ y+4 ]))
(gdb) p ssize
$24 = 8

If each member of the parallel was fed to emit_move_insn separately, the 
aforementioned stuff would not be emitted because emit_move_complex would be 
invoked directly and could optimize the RTL in the first case (once my patch 
for PR middle-end/18776 is applied).  Instead emit_group_load_1 spills the 
concat to the stack and invoke extract_bit_field on the resulting MEM.

I'm therefore proposing to short-circuit the logic in emit_group_load_1 when 
it is invoked on a regular move between complex values and let 
emit_move_complex do the bulk of the work.

Bootstrapped/regtested on sparc-sun-solaris2.8, sparc64-sun-solaris2.9 and 
amd64-mandrake-linux-gnu.  It fixes the 2 failures.


2004-12-20  Eric Botcazou  <ebotcazou@libertysurf.fr>

	* expr.c (emit_group_load_1): Return the source if the move
	is a regular move between complex values.


-- 
Eric Botcazou
Index: expr.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/expr.c,v
retrieving revision 1.761
diff -u -p -r1.761 expr.c
--- expr.c	18 Dec 2004 14:38:31 -0000	1.761
+++ expr.c	19 Dec 2004 19:54:24 -0000
@@ -1650,6 +1650,11 @@ emit_group_load_1 (rtx *tmps, rtx dst, r
 	  tmps[i] = gen_reg_rtx (mode);
 	  emit_move_insn (tmps[i], adjust_address (src, mode, bytepos));
 	}
+      else if (COMPLEX_MODE_P (mode)
+	       && GET_MODE (src) == mode
+	       && bytelen == GET_MODE_SIZE (mode))
+	/* Let emit_move_complex do the bulk of the work.  */
+	tmps[i] = src;
       else if (GET_CODE (src) == CONCAT)
 	{
 	  unsigned int slen = GET_MODE_SIZE (GET_MODE (src));

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