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]

Re: RFA: another simd bug fix (Was: Re: RFA: improved generic simd operations)


On Wed, 03 Jul 2002, Joern Rennecke wrote:

> Wed Jul  3 13:24:03 2002  J"orn Rennecke <joern.rennecke@superh.com>
> 
> gcc:
> 	* simplify-rtx.c (simplify_subreg): Reduce problem of finding
> 	vector mode subregs of constants to finding integer mode
> 	subregs of constants.
> 	* cse.c (cse_insn): Use simplify_gen_subreg.
> 	* convert.c (convert_to_integer): Don't strip a NOP_EXPR
> 	From a vector mode expression of different size than the
> 	target mode.
> 
> gcc/testsuite:
> 	* gcc.c-torture/compile/simd-3.c: New test.
> 
Joern,

This patch has been causing a regression on SPEC95's m88ksim
since Jul05.  The problem seems to be this hunk:

> Index: cse.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/cse.c,v
> retrieving revision 1.229
> diff -p -r1.229 cse.c
> *** cse.c	10 Jun 2002 22:07:43 -0000	1.229
> --- cse.c	3 Jul 2002 12:23:34 -0000
> *************** cse_insn (insn, libcall_insn)
> *** 6202,6210 ****
>   		    && ! exp_equiv_p (elt->exp, elt->exp, 1, 0))
>   		  continue;
>   
> ! 		new_src = gen_lowpart_if_possible (new_mode, elt->exp);
> ! 		if (new_src == 0)
> ! 		  new_src = gen_rtx_SUBREG (new_mode, elt->exp, 0);
>   
>   		src_hash = HASH (new_src, new_mode);
>   		src_elt = lookup (new_src, src_hash, new_mode);
> --- 6202,6209 ----
>   		    && ! exp_equiv_p (elt->exp, elt->exp, 1, 0))
>   		  continue;
>   
> ! 		new_src
> ! 		  = simplify_gen_subreg (new_mode, elt->exp, elt->mode, 0);
>   
>   		src_hash = HASH (new_src, new_mode);
>   		src_elt = lookup (new_src, src_hash, new_mode);

The call to simplify_gen_subreg is returning NULL for an elt->exp
of the form:

(gdb) pr elt->exp
(expr_list (use (mem:BLK (scratch) [0 A8]))
    (expr_list (symbol_ref:SI ("atof"))
        (expr_list (reg/v/f:SI 59)
            (nil))))

In this case elt->exp has mode VOIDmode.  This causes
simplify_gen_subreg to return NULL_RTX.  I'm wondering if we
shouldn't be checking for NULL like we used to:

Index: cse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cse.c,v
retrieving revision 1.230
diff -d -u -p -r1.230 cse.c
--- cse.c       4 Jul 2002 06:38:54 -0000       1.230
+++ cse.c       9 Jul 2002 16:22:00 -0000
@@ -6204,6 +6204,8 @@ cse_insn (insn, libcall_insn)
 
                new_src
                  = simplify_gen_subreg (new_mode, elt->exp, elt->mode, 0);
+               if (new_src == 0)
+                 new_src = gen_rtx_SUBREG (new_mode, elt->exp, 0);
 
                src_hash = HASH (new_src, new_mode);
                src_elt = lookup (new_src, src_hash, new_mode);


The following test case reproduces the same failure that I'm
getting on SPEC95.  OK to add this to c-torture/compile?

2002-07-09  Diego Novillo  <dnovillo@redhat.com>

	* gcc.c-torture/compile/20020709-1.c: New test.

Index: gcc.c-torture/compile/20020709-1.c
===================================================================
RCS file: gcc.c-torture/compile/20020709-1.c
diff -N gcc.c-torture/compile/20020709-1.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gcc.c-torture/compile/20020709-1.c	9 Jul 2002 16:30:53 -0000
@@ -0,0 +1,7 @@
+extern double atof (__const char *__nptr) __attribute__ ((__pure__));
+
+void bar (char *s)
+{
+  union {double val; unsigned int a, b;} u;
+  u.val = atof (s);
+}


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