This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFA: another simd bug fix (Was: Re: RFA: improved generic simd operations)
- From: Diego Novillo <dnovillo at redhat dot com>
- To: Joern Rennecke <joern dot rennecke at superh dot com>
- Cc: Falk Hueffner <falk dot hueffner at student dot uni-tuebingen dot de>, Richard Henderson <rth at redhat dot com>, gcc-patches at gcc dot gnu dot org
- Date: Tue, 9 Jul 2002 12:32:03 -0400
- Subject: Re: RFA: another simd bug fix (Was: Re: RFA: improved generic simd operations)
- Organization: Red Hat Canada
- References: <3D16E422.ECBACCB9@superh.com> <3D1A4A4D.70828E1B@superh.com> <m2fzz9imq5.fsf@culebra.cygnus.com> <3D1B1E4C.6D16F6F6@superh.com> <3D1B5017.7D1FA5@superh.com> <3D22063E.70DB750B@superh.com> <87r8ilbt6e.fsf@student.uni-tuebingen.de> <3D22F082.B3DFAB35@superh.com>
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);
+}