This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[4.0 PATCH v2] Fix PR 20927
- From: Ulrich Weigand <uweigand at 53v30g15 dot boeblingen dot de dot ibm dot com>
- To: mark at codesourcery dot com (Mark Mitchell)
- Cc: uweigand at de dot ibm dot com (Ulrich Weigand), rsandifo at redhat dot com, rth at redhat dot com, gcc-patches at gcc dot gnu dot org, aj at suse dot de
- Date: Wed, 13 Apr 2005 20:02:07 +0200 (CEST)
- Subject: [4.0 PATCH v2] Fix PR 20927
Mark Mitchell wrote:
> Ulrich Weigand wrote:
> > When computing the "needed mode", choose_reload_regs now calls
> >
> > smallest_mode_for_size (128, MODE_FLOAT)
> >
> > which ICEs because the largest floating-point mode on s390x is DFmode.
>
> Unless this manifests as a regression on a primary/secondary platform,
> I'm not going to include this one in 4.0.0. It could go in 4.0.1, if
> approved by an appropriate maintainer at that point.
I have another workaround for this problem, which consists of simply
defining TFmode for s390. This prevents the above ICE and should not
have any adverse effects. (Since S/390 *does* in fact have a 128-bit
long double floating point format, which we just aren't currently
exploiting, we'd been planning on adding TFmode sooner or later anyway.)
This version of the workaround obviously affects only the s390 target.
Bootstrapped/regtested on s390-ibm-linux and s390x-ibm-linux on
4.0 and mainline.
OK for 4.0?
Bye,
Ulrich
ChangeLog:
PR target/20927
* config/s390/s390-modes.def: Define TFmode.
testsuite/ChangeLog:
PR target/20927
* gcc.dg/pr20927.c: New test.
Index: gcc/config/s390/s390-modes.def
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/s390/s390-modes.def,v
retrieving revision 1.8
diff -c -p -r1.8 s390-modes.def
*** gcc/config/s390/s390-modes.def 30 Nov 2004 15:31:09 -0000 1.8
--- gcc/config/s390/s390-modes.def 12 Apr 2005 20:50:50 -0000
*************** Software Foundation, 59 Temple Place - S
*** 23,28 ****
--- 23,31 ----
/* 256-bit integer mode is needed for STACK_SAVEAREA_MODE. */
INT_MODE (OI, 32);
+ /* Define TFmode to work around reload problem PR 20927. */
+ FLOAT_MODE (TF, 16, ieee_quad_format);
+
/* Add any extra modes needed to represent the condition code. */
/*
*** /dev/null Tue Oct 26 21:09:21 2004
--- gcc/testsuite/gcc.dg/pr20927.c Mon Apr 11 21:45:12 2005
***************
*** 0 ****
--- 1,23 ----
+ /* This caused an ICE on s390x due to a reload inheritance bug. */
+
+ /* { dg-do compile { target s390*-*-* } } */
+ /* { dg-options "-O2" } */
+
+ struct point { double x, y; };
+ extern void use (struct point);
+
+ void test (struct point *pc, struct point p1)
+ {
+ struct point p0 = *pc;
+
+ if (p0.x == p1.x && p0.y == p1.y)
+ use (p0);
+
+ asm ("" : : : "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10");
+
+ p1.y -= p0.y;
+
+ use (p0);
+ use (p1);
+ }
+
--
Dr. Ulrich Weigand
Linux on zSeries Development
Ulrich.Weigand@de.ibm.com