aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@libertysurf.fr>2003-03-26 08:48:15 +0100
committerEric Botcazou <ebotcazou@gcc.gnu.org>2003-03-26 07:48:15 +0000
commit27e484bc572d80b8862f96bf0b9529e955afafac (patch)
tree8d96699feab644c4819e1ad2ab11cbb406364b27
parent72eb6d424130d9556d49dada6d769e32b2d49bbe (diff)
downloadgcc-27e484bc572d80b8862f96bf0b9529e955afafac.zip
gcc-27e484bc572d80b8862f96bf0b9529e955afafac.tar.gz
gcc-27e484bc572d80b8862f96bf0b9529e955afafac.tar.bz2
re PR target/7784 ([Sparc] ICE in extract_insn, at recog.c:2148)
PR target/7784 * reload.c (find_reloads_address): Handle (PLUS (PLUS (REG) (REG)) (CONST_INT)) form for all base registers. From-SVN: r64887
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/reload.c35
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/ultrasp6.c150
4 files changed, 175 insertions, 21 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0dad050..b5f15e0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2003-03-26 Eric Botcazou <ebotcazou@libertysurf.fr>
+
+ PR target/7784
+ * reload.c (find_reloads_address): Handle
+ (PLUS (PLUS (REG) (REG)) (CONST_INT)) form for
+ all base registers.
+
2003-03-25 Marcelo Abreu <mmabreu@inf.ufrgs.br>
PR other/10203
diff --git a/gcc/reload.c b/gcc/reload.c
index de1b1a9..e360e26 100644
--- a/gcc/reload.c
+++ b/gcc/reload.c
@@ -4890,25 +4890,23 @@ find_reloads_address (mode, memrefloc, ad, loc, opnum, type, ind_levels, insn)
that the index needs a reload and find_reloads_address_1 will take care
of it.
- If we decide to do something here, it must be that
- `double_reg_address_ok' is true and that this address rtl was made by
- eliminate_regs. We generate a reload of the fp/sp/ap + constant and
+ Handle all base registers here, not just fp/ap/sp, because on some
+ targets (namely Sparc) we can also get invalid addresses from preventive
+ subreg big-endian corrections made by find_reloads_toplev.
+
+ If we decide to do something, it must be that `double_reg_address_ok'
+ is true. We generate a reload of the base register + constant and
rework the sum so that the reload register will be added to the index.
This is safe because we know the address isn't shared.
- We check for fp/ap/sp as both the first and second operand of the
- innermost PLUS. */
+ We check for the base register as both the first and second operand of
+ the innermost PLUS. */
else if (GET_CODE (ad) == PLUS && GET_CODE (XEXP (ad, 1)) == CONST_INT
&& GET_CODE (XEXP (ad, 0)) == PLUS
- && (XEXP (XEXP (ad, 0), 0) == frame_pointer_rtx
-#if FRAME_POINTER_REGNUM != HARD_FRAME_POINTER_REGNUM
- || XEXP (XEXP (ad, 0), 0) == hard_frame_pointer_rtx
-#endif
-#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
- || XEXP (XEXP (ad, 0), 0) == arg_pointer_rtx
-#endif
- || XEXP (XEXP (ad, 0), 0) == stack_pointer_rtx)
+ && GET_CODE (XEXP (XEXP (ad, 0), 0)) == REG
+ && REGNO (XEXP (XEXP (ad, 0), 0)) < FIRST_PSEUDO_REGISTER
+ && REG_MODE_OK_FOR_BASE_P (XEXP (XEXP (ad, 0), 0), mode)
&& ! maybe_memory_address_p (mode, ad, &XEXP (XEXP (ad, 0), 1)))
{
*loc = ad = gen_rtx_PLUS (GET_MODE (ad),
@@ -4926,14 +4924,9 @@ find_reloads_address (mode, memrefloc, ad, loc, opnum, type, ind_levels, insn)
else if (GET_CODE (ad) == PLUS && GET_CODE (XEXP (ad, 1)) == CONST_INT
&& GET_CODE (XEXP (ad, 0)) == PLUS
- && (XEXP (XEXP (ad, 0), 1) == frame_pointer_rtx
-#if HARD_FRAME_POINTER_REGNUM != FRAME_POINTER_REGNUM
- || XEXP (XEXP (ad, 0), 1) == hard_frame_pointer_rtx
-#endif
-#if FRAME_POINTER_REGNUM != ARG_POINTER_REGNUM
- || XEXP (XEXP (ad, 0), 1) == arg_pointer_rtx
-#endif
- || XEXP (XEXP (ad, 0), 1) == stack_pointer_rtx)
+ && GET_CODE (XEXP (XEXP (ad, 0), 1)) == REG
+ && REGNO (XEXP (XEXP (ad, 0), 1)) < FIRST_PSEUDO_REGISTER
+ && REG_MODE_OK_FOR_BASE_P (XEXP (XEXP (ad, 0), 1), mode)
&& ! maybe_memory_address_p (mode, ad, &XEXP (XEXP (ad, 0), 0)))
{
*loc = ad = gen_rtx_PLUS (GET_MODE (ad),
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index cf70618..38966bb 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2003-03-26 Eric Botcazou <ebotcazou@libertysurf.fr>
+
+ * gcc.dg/ultrasp6.c: New test.
+
2003-03-25 Eric Botcazou <ebotcazou@libertysurf.fr>
* gcc.dg/i386-signbit-1.c: New test.
diff --git a/gcc/testsuite/gcc.dg/ultrasp6.c b/gcc/testsuite/gcc.dg/ultrasp6.c
new file mode 100644
index 0000000..0518086
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/ultrasp6.c
@@ -0,0 +1,150 @@
+/* PR target/7784 */
+/* Originator: Peter van Hoof <p.van-hoof@qub.ac.uk> */
+/* { dg-do compile { target sparc-*-* } } */
+/* { dg-options "-O2 -mcpu=ultrasparc" } */
+
+typedef struct
+{
+ float EnergyErg;
+ float ots;
+} EmLine;
+
+extern const int ipH_LIKE ;
+extern const int ipHYDROGEN ;
+extern const int ipH1s;
+extern const int ipH2s;
+extern const int ipH2p;
+
+extern EmLine ****EmisLines;
+
+typedef struct
+{
+ long n;
+ long s;
+ long l;
+} Elevels;
+
+extern struct t_iso
+{
+ float ***Pop2Ion;
+ long int numLevels[2][30L];
+} iso;
+
+extern struct t_LineSave
+{
+ long int nsum;
+ long int ndsum;
+ long int nComment;
+ long int npxdd;
+ long int ipass;
+ char chHoldComments[10][200];
+} LineSave;
+
+extern struct t_hydro
+{
+ int lgHydEmiss;
+ float **pestrk ;
+} hydro;
+
+extern struct t_dense
+{
+ double DensityLaw[10];
+ float frad[500];
+ float fhden[500];
+ float den0;
+ double eden;
+} dense;
+
+extern struct t_abund
+{
+ float xIonFracs[30L +3][30L +1];
+} abund;
+
+extern struct t_CaseBHS
+{
+ long int nDensity[2][8] , ntemp[2][8] , ncut[2][8] ;
+ int lgHCaseBOK[2][8];
+} CaseBHS ;
+
+extern struct t_smbeta
+{
+ float SimHBeta,
+ cn4861,
+ cn1216,
+ sv4861,
+ sv1216;
+} smbeta;
+
+extern struct t_phycon
+{
+ float te;
+} phycon;
+
+
+extern struct t_sphere
+{
+ int lgSphere;
+ float covgeo;
+} sphere;
+
+void linadd(double xInten, float wavelength, char *chLab, char chInfo);
+
+extern struct t_radiusVar
+{
+ int lgDrNeg;
+ double dVeff;
+} radius;
+
+void lines_hydro(void)
+{
+ long int i, nelem, ipHi, ipLo;
+ double hbetab, em , EmisFac, pump;
+ char chLabel[5];
+
+ linadd(abund.xIonFracs[ipHYDROGEN][1]*iso.Pop2Ion[ipH_LIKE][ipHYDROGEN][3]*hydro.pestrk[3][2]*3.025e-12, 6563,"Strk",'i');
+
+ linadd(abund.xIonFracs[ipHYDROGEN][1]*iso.Pop2Ion[ipH_LIKE][ipHYDROGEN][4]*hydro.pestrk[4][2]*4.084e-12, 4861,"Strk",'i');
+
+ linadd(abund.xIonFracs[ipHYDROGEN][1]*iso.Pop2Ion[ipH_LIKE][ipHYDROGEN][4]*hydro.pestrk[4][3]*1.059e-12, 18751,"Strk",'i');
+
+ linadd(abund.xIonFracs[ipHYDROGEN][1]*iso.Pop2Ion[ipH_LIKE][ipHYDROGEN][5]*hydro.pestrk[5][4]*4.900e-13, 40512,"Strk",'i');
+
+ ((void)((LineSave.ipass <1 || EmisLines[ipH_LIKE][ipHYDROGEN][ipH2p][ipH1s].ots>= 0.) || (__assert("LineSave.ipass <1 || EmisLines[ipH_LIKE][ipHYDROGEN][ipH2p][ipH1s].ots>= 0.", "lines_hydro.c", 118), 0)));
+
+ linadd(EmisLines[ipH_LIKE][ipHYDROGEN][3][ipH2s].ots*EmisLines[ipH_LIKE][ipHYDROGEN][3][ipH2s].EnergyErg, 6563,"Dest",'i');
+
+ linadd(EmisLines[ipH_LIKE][ipHYDROGEN][5][4].ots*EmisLines[ipH_LIKE][ipHYDROGEN][5][4].EnergyErg,40516, "Dest",'i');
+
+ smbeta.SimHBeta = smbeta.SimHBeta/(float)radius.dVeff*sphere.covgeo;
+
+ linadd(smbeta.SimHBeta,4861,"Q(H)",'i');
+
+ smbeta.SimHBeta = smbeta.SimHBeta*(float)radius.dVeff/sphere.covgeo;
+
+ for( nelem=0; nelem < 30L; nelem++ )
+ {
+ int iCase;
+ for( iCase=0; iCase<2; ++iCase )
+ {
+ char chAB[2]={'A','B'};
+ char chLab[5]="Ca ";
+
+ for( ipLo=1+iCase; ipLo<(((6)<(iso.numLevels[ipH_LIKE][nelem])) ? (6) : (5)); ++ipLo )
+ {
+ for( ipHi=ipLo+1; ipHi< (((ipLo+5)<(iso.numLevels[ipH_LIKE][nelem])) ? (ipLo+5) : (iso.numLevels[ipH_LIKE][nelem])); ++ipHi )
+ {
+ float wl;
+
+ hbetab = HSRate( ipHi,ipLo , nelem+1, phycon.te , dense.eden, chAB[iCase] );
+ if( hbetab<=0. )
+ CaseBHS.lgHCaseBOK[iCase][nelem] = 0;
+
+ if( !hydro.lgHydEmiss )
+ hbetab *= abund.xIonFracs[nelem][nelem+1]*dense.eden;
+
+ linadd(hbetab,wl,chLab,'i' );
+ }
+ }
+ }
+ }
+}