Re: [Ping]Re: [PR63762][4.9] Backport the patch which fixes "GCC generates UNPREDICTABLE STR with Rn = Rt for arm"
On 2014-12-01 12:24 PM, Renlin Li wrote: On 01/12/14 15:58, H.J. Lu wrote: On Thu, Nov 27, 2014 at 8:38 AM, Renlin Li wrote: On 27/11/14 15:37, H.J. Lu wrote: On Thu, Nov 27, 2014 at 7:32 AM, Renlin Li wrote: On 26/11/14 18:12, H.J. Lu wrote: On Wed, Nov 26, 2014 at 10:09 AM, Renlin Li wrote: On 26/11/14 12:16, H.J. Lu wrote: On Wed, Nov 26, 2014 at 4:07 AM, Renlin Li wrote: On 20/11/14 16:17, Renlin Li wrote: Hi all, This is a backport for gcc-4_9-branch of the patch "[PR63762]GCC generates UNPREDICTABLE STR with Rn = Rt for arm" posted in: https://gcc.gnu.org/ml/gcc-patches/2014-11/msg02253.html arm-none-eabi has been test on the model, no new issues. bootstrapping and regression tested on x86, no new issues. Is it Okay for gcc-4_9-branch? gcc/ChangeLog: 2014-11-20 Renlin Li PR middle-end/63762 * ira.c (ira): Update preferred class. gcc/testsuite/ChangeLog: 2014-11-20 Renlin Li PR middle-end/63762 * gcc.dg/pr63762.c: New. Ping for it. Please verify if it is the real fix for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63661 If yes, please add a testcase for PR 63661 and mention it in your ChangeLog entry. Thanks. Hi H.J. Yes, I have verified that, this patch additionally fixes PR 63661. I observed the same behaviour as I saw on arm backend. It will be great if you can double check they are caused by exactly the same reason. I will ask our people to take a look. A new testcase has been added, ChangeLog has been updated to reflect the change. Updated patch has bee attached. Okay for gcc-4_9-branch? Regards, Renlin Li gcc/ChangeLog: 2014-11-26 Renlin Li PR middle-end/63762 PR middle-end/63661 * ira.c (ira): Update preferred class. gcc/testsuite/ChangeLog: 2014-11-26 Renlin Li PR middle-end/63661 PR middle-end/63762 * testsuite/gcc.dg/pr63661.c: New. * testsuite/gcc.dg/pr63762.c: New. pr63661.c should be moved to gcc.target/i386 and run it on PIC target. Thanks. Hi H.J. The patch has been adjusted according to your suggestion. gcc/ChangeLog: 2014-11-27 Renlin Li PR middle-end/63762 PR target/63661 * ira.c (ira): Update preferred class. gcc/testsuite/ChangeLog: 2014-11-27 Renlin Li PR middle-end/63762 PR target/63661 * testsuite/gcc.dg/pr63762.c: New. * testsuite/gcc.target/i386/pr63661.c: New. ^^^ No testsuite/ Hi H.J. gcc.target/i386/pr63661.c should be checked into trunk first. A separate patch is sent to mailing list for this. ChangeLog has been corrected. Regards, Renlin Li gcc/ChangeLog: 2014-11-27 Renlin Li PR middle-end/63762 PR target/63661 * ira.c (ira): Update preferred class. gcc/testsuite/ChangeLog: 2014-11-27 Renlin Li PR middle-end/63762 PR target/63661 * gcc.dg/pr63762.c: New. * gcc.target/i386/pr63661.c: New. You need to update gcc.target/i386/pr63661.c from trunk. Update the test case for pr63661 from trunk. Okay for gcc-4_9-branch? Yes. Thanks for working on this, Renlin.
Re: [Ping]Re: [PR63762][4.9] Backport the patch which fixes "GCC generates UNPREDICTABLE STR with Rn = Rt for arm"
CCing release maintainers as well as they need to approve this backport if Vlad is happy with it. Vlad - is this ok to go back as it fixes a bug for ARM in the 4.9 tree that came up in building bits of debian. Ramana On Mon, Dec 1, 2014 at 5:24 PM, Renlin Li wrote: > On 01/12/14 15:58, H.J. Lu wrote: >> >> On Thu, Nov 27, 2014 at 8:38 AM, Renlin Li wrote: >>> >>> On 27/11/14 15:37, H.J. Lu wrote: On Thu, Nov 27, 2014 at 7:32 AM, Renlin Li wrote: > > On 26/11/14 18:12, H.J. Lu wrote: >> >> On Wed, Nov 26, 2014 at 10:09 AM, Renlin Li wrote: >>> >>> On 26/11/14 12:16, H.J. Lu wrote: On Wed, Nov 26, 2014 at 4:07 AM, Renlin Li wrote: > > On 20/11/14 16:17, Renlin Li wrote: >> >> Hi all, >> >> This is a backport for gcc-4_9-branch of the patch "[PR63762]GCC >> generates >> UNPREDICTABLE STR with Rn = Rt for arm" posted in: >> https://gcc.gnu.org/ml/gcc-patches/2014-11/msg02253.html >> >> arm-none-eabi has been test on the model, no new issues. >> bootstrapping >> and >> regression tested on x86, no new issues. >> >> Is it Okay for gcc-4_9-branch? >> >> gcc/ChangeLog: >> >> 2014-11-20 Renlin Li >> >> PR middle-end/63762 >> * ira.c (ira): Update preferred class. >> >> gcc/testsuite/ChangeLog: >> >> 2014-11-20 Renlin Li >> >> PR middle-end/63762 >> * gcc.dg/pr63762.c: New. > > Ping for it. > Please verify if it is the real fix for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63661 If yes, please add a testcase for PR 63661 and mention it in your ChangeLog entry. Thanks. >>> Hi H.J. >>> >>> Yes, I have verified that, this patch additionally fixes PR 63661. >>> >>> I observed the same behaviour as I saw on arm backend. It will be >>> great >>> if >>> you can double check they are caused by exactly the same reason. >> >> I will ask our people to take a look. >> >>> A new testcase has been added, ChangeLog has been updated to reflect >>> the >>> change. Updated patch has bee attached. >>> Okay for gcc-4_9-branch? >>> >>> Regards, >>> Renlin Li >>> >>> >>> gcc/ChangeLog: >>> >>> 2014-11-26 Renlin Li >>> >>>PR middle-end/63762 >>>PR middle-end/63661 >>>* ira.c (ira): Update preferred class. >>> >>> gcc/testsuite/ChangeLog: >>> >>> 2014-11-26 Renlin Li >>> >>>PR middle-end/63661 >>>PR middle-end/63762 >>>* testsuite/gcc.dg/pr63661.c: New. >>>* testsuite/gcc.dg/pr63762.c: New. >>> >>> >> pr63661.c should be moved to gcc.target/i386 and run it >> on PIC target. >> >> Thanks. >> > Hi H.J. > > The patch has been adjusted according to your suggestion. > > > gcc/ChangeLog: > > 2014-11-27 Renlin Li > > PR middle-end/63762 > PR target/63661 > * ira.c (ira): Update preferred class. > > gcc/testsuite/ChangeLog: > > 2014-11-27 Renlin Li > > PR middle-end/63762 > PR target/63661 > * testsuite/gcc.dg/pr63762.c: New. > * testsuite/gcc.target/i386/pr63661.c: New. ^^^ No testsuite/ >>> >>> >>> Hi H.J. gcc.target/i386/pr63661.c should be checked into trunk first. >>> A separate patch is sent to mailing list for this. >>> >>> >>> ChangeLog has been corrected. >>> >>> Regards, >>> Renlin Li >>> >>> gcc/ChangeLog: >>> >>> 2014-11-27 Renlin Li >>> >>> PR middle-end/63762 >>> PR target/63661 >>> * ira.c (ira): Update preferred class. >>> >>> gcc/testsuite/ChangeLog: >>> >>> 2014-11-27 Renlin Li >>> >>> PR middle-end/63762 >>> PR target/63661 >>> * gcc.dg/pr63762.c: New. >>> * gcc.target/i386/pr63661.c: New. >>> >>> >> You need to update gcc.target/i386/pr63661.c from trunk. >> >> > > Update the test case for pr63661 from trunk. > > Okay for gcc-4_9-branch? > > gcc/ChangeLog: > > 2014-12-01 Renlin Li > > PR middle-end/63762 > PR target/63661 > * ira.c (ira): Update preferred class. > > gcc/testsuite/ChangeLog: > > 2014-12-01 Renlin Li > H.J Lu > > > PR middle-end/63762 > PR target/63661 > * gcc.dg/pr63762.c: New. > * gcc.target/i386/pr63661.c: New.
Re: [Ping]Re: [PR63762][4.9] Backport the patch which fixes "GCC generates UNPREDICTABLE STR with Rn = Rt for arm"
On 01/12/14 15:58, H.J. Lu wrote: On Thu, Nov 27, 2014 at 8:38 AM, Renlin Li wrote: On 27/11/14 15:37, H.J. Lu wrote: On Thu, Nov 27, 2014 at 7:32 AM, Renlin Li wrote: On 26/11/14 18:12, H.J. Lu wrote: On Wed, Nov 26, 2014 at 10:09 AM, Renlin Li wrote: On 26/11/14 12:16, H.J. Lu wrote: On Wed, Nov 26, 2014 at 4:07 AM, Renlin Li wrote: On 20/11/14 16:17, Renlin Li wrote: Hi all, This is a backport for gcc-4_9-branch of the patch "[PR63762]GCC generates UNPREDICTABLE STR with Rn = Rt for arm" posted in: https://gcc.gnu.org/ml/gcc-patches/2014-11/msg02253.html arm-none-eabi has been test on the model, no new issues. bootstrapping and regression tested on x86, no new issues. Is it Okay for gcc-4_9-branch? gcc/ChangeLog: 2014-11-20 Renlin Li PR middle-end/63762 * ira.c (ira): Update preferred class. gcc/testsuite/ChangeLog: 2014-11-20 Renlin Li PR middle-end/63762 * gcc.dg/pr63762.c: New. Ping for it. Please verify if it is the real fix for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63661 If yes, please add a testcase for PR 63661 and mention it in your ChangeLog entry. Thanks. Hi H.J. Yes, I have verified that, this patch additionally fixes PR 63661. I observed the same behaviour as I saw on arm backend. It will be great if you can double check they are caused by exactly the same reason. I will ask our people to take a look. A new testcase has been added, ChangeLog has been updated to reflect the change. Updated patch has bee attached. Okay for gcc-4_9-branch? Regards, Renlin Li gcc/ChangeLog: 2014-11-26 Renlin Li PR middle-end/63762 PR middle-end/63661 * ira.c (ira): Update preferred class. gcc/testsuite/ChangeLog: 2014-11-26 Renlin Li PR middle-end/63661 PR middle-end/63762 * testsuite/gcc.dg/pr63661.c: New. * testsuite/gcc.dg/pr63762.c: New. pr63661.c should be moved to gcc.target/i386 and run it on PIC target. Thanks. Hi H.J. The patch has been adjusted according to your suggestion. gcc/ChangeLog: 2014-11-27 Renlin Li PR middle-end/63762 PR target/63661 * ira.c (ira): Update preferred class. gcc/testsuite/ChangeLog: 2014-11-27 Renlin Li PR middle-end/63762 PR target/63661 * testsuite/gcc.dg/pr63762.c: New. * testsuite/gcc.target/i386/pr63661.c: New. ^^^ No testsuite/ Hi H.J. gcc.target/i386/pr63661.c should be checked into trunk first. A separate patch is sent to mailing list for this. ChangeLog has been corrected. Regards, Renlin Li gcc/ChangeLog: 2014-11-27 Renlin Li PR middle-end/63762 PR target/63661 * ira.c (ira): Update preferred class. gcc/testsuite/ChangeLog: 2014-11-27 Renlin Li PR middle-end/63762 PR target/63661 * gcc.dg/pr63762.c: New. * gcc.target/i386/pr63661.c: New. You need to update gcc.target/i386/pr63661.c from trunk. Update the test case for pr63661 from trunk. Okay for gcc-4_9-branch? gcc/ChangeLog: 2014-12-01 Renlin Li PR middle-end/63762 PR target/63661 * ira.c (ira): Update preferred class. gcc/testsuite/ChangeLog: 2014-12-01 Renlin Li H.J Lu PR middle-end/63762 PR target/63661 * gcc.dg/pr63762.c: New. * gcc.target/i386/pr63661.c: New.diff --git a/gcc/ira.c b/gcc/ira.c index 4d91d21..0c703c5 100644 --- a/gcc/ira.c +++ b/gcc/ira.c @@ -5347,7 +5347,18 @@ ira (FILE *f) ira_allocno_iterator ai; FOR_EACH_ALLOCNO (a, ai) - ALLOCNO_REGNO (a) = REGNO (ALLOCNO_EMIT_DATA (a)->reg); + { + int old_regno = ALLOCNO_REGNO (a); + int new_regno = REGNO (ALLOCNO_EMIT_DATA (a)->reg); + + ALLOCNO_REGNO (a) = new_regno; + + if (old_regno != new_regno) + setup_reg_classes (new_regno, reg_preferred_class (old_regno), + reg_alternate_class (old_regno), + reg_allocno_class (old_regno)); + } + } else { diff --git a/gcc/testsuite/gcc.dg/pr63762.c b/gcc/testsuite/gcc.dg/pr63762.c new file mode 100644 index 000..df11067 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr63762.c @@ -0,0 +1,77 @@ +/* PR middle-end/63762 */ +/* { dg-do assemble } */ +/* { dg-options "-O2" } */ + +#include + +void *astFree (); +void *astMalloc (); +void astNegate (void *); +int astGetNegated (void *); +void astGetRegionBounds (void *, double *, double *); +int astResampleF (void *, ...); + +extern int astOK; + +int +MaskF (int inside, int ndim, const int lbnd[], const int ubnd[], + float in[], float val) +{ + + void *used_region; + float *c, *d, *out, *tmp_out; + double *lbndgd, *ubndgd; + int *lbndg, *ubndg, idim, ipix, nax, nin, nout, npix, npixg, result = 0; + if (!astOK) return result; + lbndg = astMalloc (sizeof (int)*(size_t) ndim); + ubndg = astMalloc (sizeof (int)*(size_t) ndim); + lbndgd = astMalloc (sizeof (double)*(size_t) ndim); + ubndgd =
Re: [Ping]Re: [PR63762][4.9] Backport the patch which fixes "GCC generates UNPREDICTABLE STR with Rn = Rt for arm"
On Thu, Nov 27, 2014 at 8:38 AM, Renlin Li wrote: > On 27/11/14 15:37, H.J. Lu wrote: >> >> On Thu, Nov 27, 2014 at 7:32 AM, Renlin Li wrote: >>> >>> On 26/11/14 18:12, H.J. Lu wrote: On Wed, Nov 26, 2014 at 10:09 AM, Renlin Li wrote: > > On 26/11/14 12:16, H.J. Lu wrote: >> >> On Wed, Nov 26, 2014 at 4:07 AM, Renlin Li wrote: >>> >>> On 20/11/14 16:17, Renlin Li wrote: Hi all, This is a backport for gcc-4_9-branch of the patch "[PR63762]GCC generates UNPREDICTABLE STR with Rn = Rt for arm" posted in: https://gcc.gnu.org/ml/gcc-patches/2014-11/msg02253.html arm-none-eabi has been test on the model, no new issues. bootstrapping and regression tested on x86, no new issues. Is it Okay for gcc-4_9-branch? gcc/ChangeLog: 2014-11-20 Renlin Li PR middle-end/63762 * ira.c (ira): Update preferred class. gcc/testsuite/ChangeLog: 2014-11-20 Renlin Li PR middle-end/63762 * gcc.dg/pr63762.c: New. >>> >>> Ping for it. >>> >> Please verify if it is the real fix for >> >> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63661 >> >> If yes, please add a testcase for PR 63661 and mention it in >> your ChangeLog entry. >> >> Thanks. >> >> > Hi H.J. > > Yes, I have verified that, this patch additionally fixes PR 63661. > > I observed the same behaviour as I saw on arm backend. It will be great > if > you can double check they are caused by exactly the same reason. I will ask our people to take a look. > A new testcase has been added, ChangeLog has been updated to reflect > the > change. Updated patch has bee attached. > Okay for gcc-4_9-branch? > > Regards, > Renlin Li > > > gcc/ChangeLog: > > 2014-11-26 Renlin Li > > PR middle-end/63762 > PR middle-end/63661 > * ira.c (ira): Update preferred class. > > gcc/testsuite/ChangeLog: > > 2014-11-26 Renlin Li > > PR middle-end/63661 > PR middle-end/63762 > * testsuite/gcc.dg/pr63661.c: New. > * testsuite/gcc.dg/pr63762.c: New. > > pr63661.c should be moved to gcc.target/i386 and run it on PIC target. Thanks. >>> Hi H.J. >>> >>> The patch has been adjusted according to your suggestion. >>> >>> >>> gcc/ChangeLog: >>> >>> 2014-11-27 Renlin Li >>> >>> PR middle-end/63762 >>> PR target/63661 >>> * ira.c (ira): Update preferred class. >>> >>> gcc/testsuite/ChangeLog: >>> >>> 2014-11-27 Renlin Li >>> >>> PR middle-end/63762 >>> PR target/63661 >>> * testsuite/gcc.dg/pr63762.c: New. >>> * testsuite/gcc.target/i386/pr63661.c: New. >> >> ^^^ No testsuite/ > > > Hi H.J. >> >> gcc.target/i386/pr63661.c should be checked into trunk first. >> > > A separate patch is sent to mailing list for this. > > > ChangeLog has been corrected. > > Regards, > Renlin Li > > gcc/ChangeLog: > > 2014-11-27 Renlin Li > > PR middle-end/63762 > PR target/63661 > * ira.c (ira): Update preferred class. > > gcc/testsuite/ChangeLog: > > 2014-11-27 Renlin Li > > PR middle-end/63762 > PR target/63661 > * gcc.dg/pr63762.c: New. > * gcc.target/i386/pr63661.c: New. > > You need to update gcc.target/i386/pr63661.c from trunk. -- H.J.
Re: [Ping]Re: [PR63762][4.9] Backport the patch which fixes "GCC generates UNPREDICTABLE STR with Rn = Rt for arm"
On 27/11/14 15:37, H.J. Lu wrote: On Thu, Nov 27, 2014 at 7:32 AM, Renlin Li wrote: On 26/11/14 18:12, H.J. Lu wrote: On Wed, Nov 26, 2014 at 10:09 AM, Renlin Li wrote: On 26/11/14 12:16, H.J. Lu wrote: On Wed, Nov 26, 2014 at 4:07 AM, Renlin Li wrote: On 20/11/14 16:17, Renlin Li wrote: Hi all, This is a backport for gcc-4_9-branch of the patch "[PR63762]GCC generates UNPREDICTABLE STR with Rn = Rt for arm" posted in: https://gcc.gnu.org/ml/gcc-patches/2014-11/msg02253.html arm-none-eabi has been test on the model, no new issues. bootstrapping and regression tested on x86, no new issues. Is it Okay for gcc-4_9-branch? gcc/ChangeLog: 2014-11-20 Renlin Li PR middle-end/63762 * ira.c (ira): Update preferred class. gcc/testsuite/ChangeLog: 2014-11-20 Renlin Li PR middle-end/63762 * gcc.dg/pr63762.c: New. Ping for it. Please verify if it is the real fix for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63661 If yes, please add a testcase for PR 63661 and mention it in your ChangeLog entry. Thanks. Hi H.J. Yes, I have verified that, this patch additionally fixes PR 63661. I observed the same behaviour as I saw on arm backend. It will be great if you can double check they are caused by exactly the same reason. I will ask our people to take a look. A new testcase has been added, ChangeLog has been updated to reflect the change. Updated patch has bee attached. Okay for gcc-4_9-branch? Regards, Renlin Li gcc/ChangeLog: 2014-11-26 Renlin Li PR middle-end/63762 PR middle-end/63661 * ira.c (ira): Update preferred class. gcc/testsuite/ChangeLog: 2014-11-26 Renlin Li PR middle-end/63661 PR middle-end/63762 * testsuite/gcc.dg/pr63661.c: New. * testsuite/gcc.dg/pr63762.c: New. pr63661.c should be moved to gcc.target/i386 and run it on PIC target. Thanks. Hi H.J. The patch has been adjusted according to your suggestion. gcc/ChangeLog: 2014-11-27 Renlin Li PR middle-end/63762 PR target/63661 * ira.c (ira): Update preferred class. gcc/testsuite/ChangeLog: 2014-11-27 Renlin Li PR middle-end/63762 PR target/63661 * testsuite/gcc.dg/pr63762.c: New. * testsuite/gcc.target/i386/pr63661.c: New. ^^^ No testsuite/ Hi H.J. gcc.target/i386/pr63661.c should be checked into trunk first. A separate patch is sent to mailing list for this. ChangeLog has been corrected. Regards, Renlin Li gcc/ChangeLog: 2014-11-27 Renlin Li PR middle-end/63762 PR target/63661 * ira.c (ira): Update preferred class. gcc/testsuite/ChangeLog: 2014-11-27 Renlin Li PR middle-end/63762 PR target/63661 * gcc.dg/pr63762.c: New. * gcc.target/i386/pr63661.c: New. diff --git a/gcc/ira.c b/gcc/ira.c index 4d91d21..0c703c5 100644 --- a/gcc/ira.c +++ b/gcc/ira.c @@ -5347,7 +5347,18 @@ ira (FILE *f) ira_allocno_iterator ai; FOR_EACH_ALLOCNO (a, ai) - ALLOCNO_REGNO (a) = REGNO (ALLOCNO_EMIT_DATA (a)->reg); + { + int old_regno = ALLOCNO_REGNO (a); + int new_regno = REGNO (ALLOCNO_EMIT_DATA (a)->reg); + + ALLOCNO_REGNO (a) = new_regno; + + if (old_regno != new_regno) + setup_reg_classes (new_regno, reg_preferred_class (old_regno), + reg_alternate_class (old_regno), + reg_allocno_class (old_regno)); + } + } else { diff --git a/gcc/testsuite/gcc.dg/pr63762.c b/gcc/testsuite/gcc.dg/pr63762.c new file mode 100644 index 000..df11067 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr63762.c @@ -0,0 +1,77 @@ +/* PR middle-end/63762 */ +/* { dg-do assemble } */ +/* { dg-options "-O2" } */ + +#include + +void *astFree (); +void *astMalloc (); +void astNegate (void *); +int astGetNegated (void *); +void astGetRegionBounds (void *, double *, double *); +int astResampleF (void *, ...); + +extern int astOK; + +int +MaskF (int inside, int ndim, const int lbnd[], const int ubnd[], + float in[], float val) +{ + + void *used_region; + float *c, *d, *out, *tmp_out; + double *lbndgd, *ubndgd; + int *lbndg, *ubndg, idim, ipix, nax, nin, nout, npix, npixg, result = 0; + if (!astOK) return result; + lbndg = astMalloc (sizeof (int)*(size_t) ndim); + ubndg = astMalloc (sizeof (int)*(size_t) ndim); + lbndgd = astMalloc (sizeof (double)*(size_t) ndim); + ubndgd = astMalloc (sizeof (double)*(size_t) ndim); + if (astOK) +{ + astGetRegionBounds (used_region, lbndgd, ubndgd); + npix = 1; + npixg = 1; + for (idim = 0; idim < ndim; idim++) +{ + lbndg[ idim ] = lbnd[ idim ]; + ubndg[ idim ] = ubnd[ idim ]; + npix *= (ubnd[ idim ] - lbnd[ idim ] + 1); + if (npixg >= 0) npixg *= (ubndg[ idim ] - lbndg[ idim ] + 1); +} + if (npixg <= 0 && astOK) +{ + if ((inside != 0) == (astGetNegated( used_region ) != 0)) +{ + c = in; +
Re: [Ping]Re: [PR63762][4.9] Backport the patch which fixes "GCC generates UNPREDICTABLE STR with Rn = Rt for arm"
On Thu, Nov 27, 2014 at 7:32 AM, Renlin Li wrote: > On 26/11/14 18:12, H.J. Lu wrote: >> >> On Wed, Nov 26, 2014 at 10:09 AM, Renlin Li wrote: >>> >>> On 26/11/14 12:16, H.J. Lu wrote: On Wed, Nov 26, 2014 at 4:07 AM, Renlin Li wrote: > > On 20/11/14 16:17, Renlin Li wrote: >> >> Hi all, >> >> This is a backport for gcc-4_9-branch of the patch "[PR63762]GCC >> generates >> UNPREDICTABLE STR with Rn = Rt for arm" posted in: >> https://gcc.gnu.org/ml/gcc-patches/2014-11/msg02253.html >> >> arm-none-eabi has been test on the model, no new issues. bootstrapping >> and >> regression tested on x86, no new issues. >> >> Is it Okay for gcc-4_9-branch? >> >> gcc/ChangeLog: >> >> 2014-11-20 Renlin Li >> >> PR middle-end/63762 >> * ira.c (ira): Update preferred class. >> >> gcc/testsuite/ChangeLog: >> >> 2014-11-20 Renlin Li >> >> PR middle-end/63762 >> * gcc.dg/pr63762.c: New. > > Ping for it. > Please verify if it is the real fix for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63661 If yes, please add a testcase for PR 63661 and mention it in your ChangeLog entry. Thanks. >>> Hi H.J. >>> >>> Yes, I have verified that, this patch additionally fixes PR 63661. >>> >>> I observed the same behaviour as I saw on arm backend. It will be great >>> if >>> you can double check they are caused by exactly the same reason. >> >> I will ask our people to take a look. >> >>> >>> A new testcase has been added, ChangeLog has been updated to reflect the >>> change. Updated patch has bee attached. >>> Okay for gcc-4_9-branch? >>> >>> Regards, >>> Renlin Li >>> >>> >>> gcc/ChangeLog: >>> >>> 2014-11-26 Renlin Li >>> >>> PR middle-end/63762 >>> PR middle-end/63661 >>> * ira.c (ira): Update preferred class. >>> >>> gcc/testsuite/ChangeLog: >>> >>> 2014-11-26 Renlin Li >>> >>> PR middle-end/63661 >>> PR middle-end/63762 >>> * testsuite/gcc.dg/pr63661.c: New. >>> * testsuite/gcc.dg/pr63762.c: New. >>> >>> >> pr63661.c should be moved to gcc.target/i386 and run it >> on PIC target. >> >> Thanks. >> > Hi H.J. > > The patch has been adjusted according to your suggestion. > > > gcc/ChangeLog: > > 2014-11-27 Renlin Li > > PR middle-end/63762 > PR target/63661 > * ira.c (ira): Update preferred class. > > gcc/testsuite/ChangeLog: > > 2014-11-27 Renlin Li > > PR middle-end/63762 > PR target/63661 > * testsuite/gcc.dg/pr63762.c: New. > * testsuite/gcc.target/i386/pr63661.c: New. ^^^ No testsuite/ > gcc.target/i386/pr63661.c should be checked into trunk first. -- H.J.
Re: [Ping]Re: [PR63762][4.9] Backport the patch which fixes "GCC generates UNPREDICTABLE STR with Rn = Rt for arm"
On 26/11/14 18:12, H.J. Lu wrote: On Wed, Nov 26, 2014 at 10:09 AM, Renlin Li wrote: On 26/11/14 12:16, H.J. Lu wrote: On Wed, Nov 26, 2014 at 4:07 AM, Renlin Li wrote: On 20/11/14 16:17, Renlin Li wrote: Hi all, This is a backport for gcc-4_9-branch of the patch "[PR63762]GCC generates UNPREDICTABLE STR with Rn = Rt for arm" posted in: https://gcc.gnu.org/ml/gcc-patches/2014-11/msg02253.html arm-none-eabi has been test on the model, no new issues. bootstrapping and regression tested on x86, no new issues. Is it Okay for gcc-4_9-branch? gcc/ChangeLog: 2014-11-20 Renlin Li PR middle-end/63762 * ira.c (ira): Update preferred class. gcc/testsuite/ChangeLog: 2014-11-20 Renlin Li PR middle-end/63762 * gcc.dg/pr63762.c: New. Ping for it. Please verify if it is the real fix for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63661 If yes, please add a testcase for PR 63661 and mention it in your ChangeLog entry. Thanks. Hi H.J. Yes, I have verified that, this patch additionally fixes PR 63661. I observed the same behaviour as I saw on arm backend. It will be great if you can double check they are caused by exactly the same reason. I will ask our people to take a look. A new testcase has been added, ChangeLog has been updated to reflect the change. Updated patch has bee attached. Okay for gcc-4_9-branch? Regards, Renlin Li gcc/ChangeLog: 2014-11-26 Renlin Li PR middle-end/63762 PR middle-end/63661 * ira.c (ira): Update preferred class. gcc/testsuite/ChangeLog: 2014-11-26 Renlin Li PR middle-end/63661 PR middle-end/63762 * testsuite/gcc.dg/pr63661.c: New. * testsuite/gcc.dg/pr63762.c: New. pr63661.c should be moved to gcc.target/i386 and run it on PIC target. Thanks. Hi H.J. The patch has been adjusted according to your suggestion. gcc/ChangeLog: 2014-11-27 Renlin Li PR middle-end/63762 PR target/63661 * ira.c (ira): Update preferred class. gcc/testsuite/ChangeLog: 2014-11-27 Renlin Li PR middle-end/63762 PR target/63661 * testsuite/gcc.dg/pr63762.c: New. * testsuite/gcc.target/i386/pr63661.c: New. diff --git a/gcc/ira.c b/gcc/ira.c index 4d91d21..0c703c5 100644 --- a/gcc/ira.c +++ b/gcc/ira.c @@ -5347,7 +5347,18 @@ ira (FILE *f) ira_allocno_iterator ai; FOR_EACH_ALLOCNO (a, ai) - ALLOCNO_REGNO (a) = REGNO (ALLOCNO_EMIT_DATA (a)->reg); + { + int old_regno = ALLOCNO_REGNO (a); + int new_regno = REGNO (ALLOCNO_EMIT_DATA (a)->reg); + + ALLOCNO_REGNO (a) = new_regno; + + if (old_regno != new_regno) + setup_reg_classes (new_regno, reg_preferred_class (old_regno), + reg_alternate_class (old_regno), + reg_allocno_class (old_regno)); + } + } else { diff --git a/gcc/testsuite/gcc.dg/pr63762.c b/gcc/testsuite/gcc.dg/pr63762.c new file mode 100644 index 000..df11067 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr63762.c @@ -0,0 +1,77 @@ +/* PR middle-end/63762 */ +/* { dg-do assemble } */ +/* { dg-options "-O2" } */ + +#include + +void *astFree (); +void *astMalloc (); +void astNegate (void *); +int astGetNegated (void *); +void astGetRegionBounds (void *, double *, double *); +int astResampleF (void *, ...); + +extern int astOK; + +int +MaskF (int inside, int ndim, const int lbnd[], const int ubnd[], + float in[], float val) +{ + + void *used_region; + float *c, *d, *out, *tmp_out; + double *lbndgd, *ubndgd; + int *lbndg, *ubndg, idim, ipix, nax, nin, nout, npix, npixg, result = 0; + if (!astOK) return result; + lbndg = astMalloc (sizeof (int)*(size_t) ndim); + ubndg = astMalloc (sizeof (int)*(size_t) ndim); + lbndgd = astMalloc (sizeof (double)*(size_t) ndim); + ubndgd = astMalloc (sizeof (double)*(size_t) ndim); + if (astOK) +{ + astGetRegionBounds (used_region, lbndgd, ubndgd); + npix = 1; + npixg = 1; + for (idim = 0; idim < ndim; idim++) +{ + lbndg[ idim ] = lbnd[ idim ]; + ubndg[ idim ] = ubnd[ idim ]; + npix *= (ubnd[ idim ] - lbnd[ idim ] + 1); + if (npixg >= 0) npixg *= (ubndg[ idim ] - lbndg[ idim ] + 1); +} + if (npixg <= 0 && astOK) +{ + if ((inside != 0) == (astGetNegated( used_region ) != 0)) +{ + c = in; + for (ipix = 0; ipix < npix; ipix++) *(c++) = val; + result = npix; +} +} + else if (npixg > 0 && astOK) +{ + if ((inside != 0) == (astGetNegated (used_region) != 0)) +{ + tmp_out = astMalloc (sizeof (float)*(size_t) npix); + if (tmp_out) +{ + c = tmp_out; + for (ipix = 0; ipix < npix; ipix++) *(c++) = val; + result = npix - npixg; +} + out = tmp_out; +} + else +{ + tmp_out
Re: [Ping]Re: [PR63762][4.9] Backport the patch which fixes "GCC generates UNPREDICTABLE STR with Rn = Rt for arm"
On Wed, Nov 26, 2014 at 10:09 AM, Renlin Li wrote: > On 26/11/14 12:16, H.J. Lu wrote: >> >> On Wed, Nov 26, 2014 at 4:07 AM, Renlin Li wrote: >>> >>> On 20/11/14 16:17, Renlin Li wrote: Hi all, This is a backport for gcc-4_9-branch of the patch "[PR63762]GCC generates UNPREDICTABLE STR with Rn = Rt for arm" posted in: https://gcc.gnu.org/ml/gcc-patches/2014-11/msg02253.html arm-none-eabi has been test on the model, no new issues. bootstrapping and regression tested on x86, no new issues. Is it Okay for gcc-4_9-branch? gcc/ChangeLog: 2014-11-20 Renlin Li PR middle-end/63762 * ira.c (ira): Update preferred class. gcc/testsuite/ChangeLog: 2014-11-20 Renlin Li PR middle-end/63762 * gcc.dg/pr63762.c: New. >>> >>> Ping for it. >>> >> Please verify if it is the real fix for >> >> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63661 >> >> If yes, please add a testcase for PR 63661 and mention it in >> your ChangeLog entry. >> >> Thanks. >> >> > Hi H.J. > > Yes, I have verified that, this patch additionally fixes PR 63661. > > I observed the same behaviour as I saw on arm backend. It will be great if > you can double check they are caused by exactly the same reason. I will ask our people to take a look. > > > A new testcase has been added, ChangeLog has been updated to reflect the > change. Updated patch has bee attached. > Okay for gcc-4_9-branch? > > Regards, > Renlin Li > > > gcc/ChangeLog: > > 2014-11-26 Renlin Li > > PR middle-end/63762 > PR middle-end/63661 > * ira.c (ira): Update preferred class. > > gcc/testsuite/ChangeLog: > > 2014-11-26 Renlin Li > > PR middle-end/63661 > PR middle-end/63762 > * testsuite/gcc.dg/pr63661.c: New. > * testsuite/gcc.dg/pr63762.c: New. > > pr63661.c should be moved to gcc.target/i386 and run it on PIC target. Thanks. -- H.J.
Re: [Ping]Re: [PR63762][4.9] Backport the patch which fixes "GCC generates UNPREDICTABLE STR with Rn = Rt for arm"
On 26/11/14 12:16, H.J. Lu wrote: On Wed, Nov 26, 2014 at 4:07 AM, Renlin Li wrote: On 20/11/14 16:17, Renlin Li wrote: Hi all, This is a backport for gcc-4_9-branch of the patch "[PR63762]GCC generates UNPREDICTABLE STR with Rn = Rt for arm" posted in: https://gcc.gnu.org/ml/gcc-patches/2014-11/msg02253.html arm-none-eabi has been test on the model, no new issues. bootstrapping and regression tested on x86, no new issues. Is it Okay for gcc-4_9-branch? gcc/ChangeLog: 2014-11-20 Renlin Li PR middle-end/63762 * ira.c (ira): Update preferred class. gcc/testsuite/ChangeLog: 2014-11-20 Renlin Li PR middle-end/63762 * gcc.dg/pr63762.c: New. Ping for it. Please verify if it is the real fix for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63661 If yes, please add a testcase for PR 63661 and mention it in your ChangeLog entry. Thanks. Hi H.J. Yes, I have verified that, this patch additionally fixes PR 63661. I observed the same behaviour as I saw on arm backend. It will be great if you can double check they are caused by exactly the same reason. A new testcase has been added, ChangeLog has been updated to reflect the change. Updated patch has bee attached. Okay for gcc-4_9-branch? Regards, Renlin Li gcc/ChangeLog: 2014-11-26 Renlin Li PR middle-end/63762 PR middle-end/63661 * ira.c (ira): Update preferred class. gcc/testsuite/ChangeLog: 2014-11-26 Renlin Li PR middle-end/63661 PR middle-end/63762 * testsuite/gcc.dg/pr63661.c: New. * testsuite/gcc.dg/pr63762.c: New. diff --git a/gcc/ira.c b/gcc/ira.c index 4d91d21..0c703c5 100644 --- a/gcc/ira.c +++ b/gcc/ira.c @@ -5347,7 +5347,18 @@ ira (FILE *f) ira_allocno_iterator ai; FOR_EACH_ALLOCNO (a, ai) - ALLOCNO_REGNO (a) = REGNO (ALLOCNO_EMIT_DATA (a)->reg); + { + int old_regno = ALLOCNO_REGNO (a); + int new_regno = REGNO (ALLOCNO_EMIT_DATA (a)->reg); + + ALLOCNO_REGNO (a) = new_regno; + + if (old_regno != new_regno) + setup_reg_classes (new_regno, reg_preferred_class (old_regno), + reg_alternate_class (old_regno), + reg_allocno_class (old_regno)); + } + } else { diff --git a/gcc/testsuite/gcc.dg/pr63661.c b/gcc/testsuite/gcc.dg/pr63661.c new file mode 100644 index 000..261f616 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr63661.c @@ -0,0 +1,76 @@ +/* PR middle-end/63661 */ +/* { dg-do run { target x86_64-*-* } } */ +/* { dg-options "-mtune=nehalem -fPIC -O2" } */ + +static void __attribute__((noinline,noclone,hot)) +foo (double a, double q, double *ff, double *gx, int e, int ni) +{ + union +{ + double n; + unsigned long long o; +} punner; + + punner.n = q; + __builtin_printf("B: 0x%016llx %g\n", punner.o, q); + + if(q != 5) +__builtin_abort(); +} + +static int __attribute__((noinline,noclone,hot)) +bar (int order, double q, double c[]) +{ + int ni, nn, i, e; + double g2, x2, de, s, ratio, ff; + + nn = 0; + e = order & 1; + s = 0; + ratio = 0; + x2 = 0; + g2 = 0; + + if(q == 0.0) +return 0; + + if (order < 5) +{ + ratio = 1.0 / q; + nn = order; +} + + ni = -nn; + + while(1) +{ + de = ratio - g2 - x2; + + foo (0, q, &ff, &g2, e, ni); + + if((int)de == 0) +break; +} + + s += 2 * nn * c[nn]; + + for (i = 0; i < 1; i++) +{ + c[0] = nn; + for (; i < 10; i++) +c[i] = 0.0; + c[0] /= s; +} + + return 0; +} + +int +main () +{ + double c[1000]; + + __builtin_printf("A: 0x%016llx\n", (unsigned long long)c); + bar (1, 5.0, c); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/pr63762.c b/gcc/testsuite/gcc.dg/pr63762.c new file mode 100644 index 000..df11067 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr63762.c @@ -0,0 +1,77 @@ +/* PR middle-end/63762 */ +/* { dg-do assemble } */ +/* { dg-options "-O2" } */ + +#include + +void *astFree (); +void *astMalloc (); +void astNegate (void *); +int astGetNegated (void *); +void astGetRegionBounds (void *, double *, double *); +int astResampleF (void *, ...); + +extern int astOK; + +int +MaskF (int inside, int ndim, const int lbnd[], const int ubnd[], + float in[], float val) +{ + + void *used_region; + float *c, *d, *out, *tmp_out; + double *lbndgd, *ubndgd; + int *lbndg, *ubndg, idim, ipix, nax, nin, nout, npix, npixg, result = 0; + if (!astOK) return result; + lbndg = astMalloc (sizeof (int)*(size_t) ndim); + ubndg = astMalloc (sizeof (int)*(size_t) ndim); + lbndgd = astMalloc (sizeof (double)*(size_t) ndim); + ubndgd = astMalloc (sizeof (double)*(size_t) ndim); + if (astOK) +{ + astGetRegionBounds (used_region, lbndgd, ubndgd); + npix = 1; + npixg = 1; + for (idim = 0; idim < ndim; idim++) +{ + lbndg[ idim ] = lbnd[ idim ]; + ubndg[ idim ] = ubnd[ idim ]; + npix *= (ubnd[ idim ] - lbnd[ idim ] + 1); + if (npixg >= 0)
Re: [Ping]Re: [PR63762][4.9] Backport the patch which fixes "GCC generates UNPREDICTABLE STR with Rn = Rt for arm"
On Wed, Nov 26, 2014 at 4:07 AM, Renlin Li wrote: > On 20/11/14 16:17, Renlin Li wrote: >> >> Hi all, >> >> This is a backport for gcc-4_9-branch of the patch "[PR63762]GCC generates >> UNPREDICTABLE STR with Rn = Rt for arm" posted in: >> https://gcc.gnu.org/ml/gcc-patches/2014-11/msg02253.html >> >> arm-none-eabi has been test on the model, no new issues. bootstrapping and >> regression tested on x86, no new issues. >> >> Is it Okay for gcc-4_9-branch? >> >> gcc/ChangeLog: >> >> 2014-11-20 Renlin Li >> >> PR middle-end/63762 >> * ira.c (ira): Update preferred class. >> >> gcc/testsuite/ChangeLog: >> >> 2014-11-20 Renlin Li >> >> PR middle-end/63762 >> * gcc.dg/pr63762.c: New. > > Ping for it. > Please verify if it is the real fix for https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63661 If yes, please add a testcase for PR 63661 and mention it in your ChangeLog entry. Thanks. -- H.J.
[Ping]Re: [PR63762][4.9] Backport the patch which fixes "GCC generates UNPREDICTABLE STR with Rn = Rt for arm"
On 20/11/14 16:17, Renlin Li wrote: Hi all, This is a backport for gcc-4_9-branch of the patch "[PR63762]GCC generates UNPREDICTABLE STR with Rn = Rt for arm" posted in: https://gcc.gnu.org/ml/gcc-patches/2014-11/msg02253.html arm-none-eabi has been test on the model, no new issues. bootstrapping and regression tested on x86, no new issues. Is it Okay for gcc-4_9-branch? gcc/ChangeLog: 2014-11-20 Renlin Li PR middle-end/63762 * ira.c (ira): Update preferred class. gcc/testsuite/ChangeLog: 2014-11-20 Renlin Li PR middle-end/63762 * gcc.dg/pr63762.c: New. Ping for it. Regards, Renlin Li