Re: [PATCH][AArch64] Fix PR79041
On Fri, Jul 21, 2017 at 12:22:00PM +0100, Wilco Dijkstra wrote: > > > ping > > > As described in PR79041, -mcmodel=large -mpc-relative-literal-loads > may be used to avoid generating ADRP/ADD or ADRP/LDR. However both > trunk and GCC7 may still emit ADRP for some constant pool literals. > Fix this by adding a aarch64_pcrelative_literal_loads check. > > OK for trunk/GCC7 backport? OK. Either like this, or with the conditions swapped around as Yvan suggested to make backporting easier. Thanks, James > > ChangeLog: > 2017-06-27 Wilco Dijkstra> > PR target/79041 > * config/aarch64/aarch64.c (aarch64_classify_symbol): > Avoid SYMBOL_SMALL_ABSOLUTE . > * testsuite/gcc.target/aarch64/pr79041-2.c: New test. > -- > diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c > index > 060cd8476d2954119daac495ecb059c9be73edbe..329d244e9cf16dbdf849e5dd02b3999caf0cd5a7 > 100644 > --- a/gcc/config/aarch64/aarch64.c > +++ b/gcc/config/aarch64/aarch64.c > @@ -10042,7 +10042,7 @@ aarch64_classify_symbol (rtx x, rtx offset) > /* This is alright even in PIC code as the constant > pool reference is always PC relative and within > the same translation unit. */ > - if (CONSTANT_POOL_ADDRESS_P (x)) > + if (CONSTANT_POOL_ADDRESS_P (x) && > !aarch64_pcrelative_literal_loads) > return SYMBOL_SMALL_ABSOLUTE; > else > return SYMBOL_FORCE_TO_MEM; > diff --git a/gcc/testsuite/gcc.target/aarch64/pr79041-2.c > b/gcc/testsuite/gcc.target/aarch64/pr79041-2.c > new file mode 100644 > index > ..e7899725bad2b770f8488a07f99792113275bdf2 > --- /dev/null > +++ b/gcc/testsuite/gcc.target/aarch64/pr79041-2.c > @@ -0,0 +1,10 @@ > +/* { dg-do compile } */ > +/* { dg-options "-O2 -mcmodel=large -mpc-relative-literal-loads" } */ > + > +__int128 > +t (void) > +{ > + return (__int128)1 << 80; > +} > + > +/* { dg-final { scan-assembler "adr" } } */ >
Re: [PATCH][AArch64] Fix PR79041
ping As described in PR79041, -mcmodel=large -mpc-relative-literal-loads may be used to avoid generating ADRP/ADD or ADRP/LDR. However both trunk and GCC7 may still emit ADRP for some constant pool literals. Fix this by adding a aarch64_pcrelative_literal_loads check. OK for trunk/GCC7 backport? ChangeLog: 2017-06-27 Wilco DijkstraPR target/79041 * config/aarch64/aarch64.c (aarch64_classify_symbol): Avoid SYMBOL_SMALL_ABSOLUTE . * testsuite/gcc.target/aarch64/pr79041-2.c: New test. -- diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 060cd8476d2954119daac495ecb059c9be73edbe..329d244e9cf16dbdf849e5dd02b3999caf0cd5a7 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -10042,7 +10042,7 @@ aarch64_classify_symbol (rtx x, rtx offset) /* This is alright even in PIC code as the constant pool reference is always PC relative and within the same translation unit. */ - if (CONSTANT_POOL_ADDRESS_P (x)) + if (CONSTANT_POOL_ADDRESS_P (x) && !aarch64_pcrelative_literal_loads) return SYMBOL_SMALL_ABSOLUTE; else return SYMBOL_FORCE_TO_MEM; diff --git a/gcc/testsuite/gcc.target/aarch64/pr79041-2.c b/gcc/testsuite/gcc.target/aarch64/pr79041-2.c new file mode 100644 index ..e7899725bad2b770f8488a07f99792113275bdf2 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr79041-2.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mcmodel=large -mpc-relative-literal-loads" } */ + +__int128 +t (void) +{ + return (__int128)1 << 80; +} + +/* { dg-final { scan-assembler "adr" } } */
Re: [PATCH][AArch64] Fix PR79041
ping As described in PR79041, -mcmodel=large -mpc-relative-literal-loads may be used to avoid generating ADRP/ADD or ADRP/LDR. However both trunk and GCC7 may still emit ADRP for some constant pool literals. Fix this by adding a aarch64_pcrelative_literal_loads check. OK for trunk/GCC7 backport? ChangeLog: 2017-06-27 Wilco DijkstraPR target/79041 * config/aarch64/aarch64.c (aarch64_classify_symbol): Avoid SYMBOL_SMALL_ABSOLUTE . * testsuite/gcc.target/aarch64/pr79041-2.c: New test. -- diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 060cd8476d2954119daac495ecb059c9be73edbe..329d244e9cf16dbdf849e5dd02b3999caf0cd5a7 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -10042,7 +10042,7 @@ aarch64_classify_symbol (rtx x, rtx offset) /* This is alright even in PIC code as the constant pool reference is always PC relative and within the same translation unit. */ - if (CONSTANT_POOL_ADDRESS_P (x)) + if (CONSTANT_POOL_ADDRESS_P (x) && !aarch64_pcrelative_literal_loads) return SYMBOL_SMALL_ABSOLUTE; else return SYMBOL_FORCE_TO_MEM; diff --git a/gcc/testsuite/gcc.target/aarch64/pr79041-2.c b/gcc/testsuite/gcc.target/aarch64/pr79041-2.c new file mode 100644 index ..e7899725bad2b770f8488a07f99792113275bdf2 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr79041-2.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mcmodel=large -mpc-relative-literal-loads" } */ + +__int128 +t (void) +{ + return (__int128)1 << 80; +} + +/* { dg-final { scan-assembler "adr" } } */
Re: [PATCH][AArch64] Fix PR79041
On 27 June 2017 at 16:55, Yvan Rouxwrote: > Hi > > On 27 June 2017 at 16:49, Wilco Dijkstra wrote: >> As described in PR79041, -mcmodel=large -mpc-relative-literal-loads >> may be used to avoid generating ADRP/ADD or ADRP/LDR. However both >> trunk and GCC7 may still emit ADRP for some constant pool literals. >> Fix this by adding a aarch64_pcrelative_literal_loads check. >> >> OK for trunk/GCC7 backport? > > I can't approve it, but the patch is ok for me, I've built and > regtested the very same patch for aarch64-linux-gnu, > aarch64-none-elf and aarch64_be-none-elf targets :) > > Yvan > >> ChangeLog: >> 2017-06-27 Wilco Dijkstra >> >> PR target/79041 >> * config/aarch64/aarch64.c (aarch64_classify_symbol): >> Avoid SYMBOL_SMALL_ABSOLUTE . >> * testsuite/gcc.target/aarch64/pr79041-2.c: New test. >> -- >> diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c >> index >> 060cd8476d2954119daac495ecb059c9be73edbe..329d244e9cf16dbdf849e5dd02b3999caf0cd5a7 >> 100644 >> --- a/gcc/config/aarch64/aarch64.c >> +++ b/gcc/config/aarch64/aarch64.c >> @@ -10042,7 +10042,7 @@ aarch64_classify_symbol (rtx x, rtx offset) >> /* This is alright even in PIC code as the constant >> pool reference is always PC relative and within >> the same translation unit. */ >> - if (CONSTANT_POOL_ADDRESS_P (x)) >> + if (CONSTANT_POOL_ADDRESS_P (x) && >> !aarch64_pcrelative_literal_loads) maybe just a small note here, in my backport patch on gcc-6-branch a kept the existing order in the condition: - if (nopcrelative_literal_loads + if (!aarch64_pcrelative_literal_loads && CONSTANT_POOL_ADDRESS_P (x)) Can we keep it, or maybe I should wait for your patch to be committed on trunk, and include its backport in my patch for GCC 6. >> return SYMBOL_SMALL_ABSOLUTE; >> else >> return SYMBOL_FORCE_TO_MEM; >> diff --git a/gcc/testsuite/gcc.target/aarch64/pr79041-2.c >> b/gcc/testsuite/gcc.target/aarch64/pr79041-2.c >> new file mode 100644 >> index >> ..e7899725bad2b770f8488a07f99792113275bdf2 >> --- /dev/null >> +++ b/gcc/testsuite/gcc.target/aarch64/pr79041-2.c >> @@ -0,0 +1,10 @@ >> +/* { dg-do compile } */ >> +/* { dg-options "-O2 -mcmodel=large -mpc-relative-literal-loads" } */ >> + >> +__int128 >> +t (void) >> +{ >> + return (__int128)1 << 80; >> +} >> + >> +/* { dg-final { scan-assembler "adr" } } */
Re: [PATCH][AArch64] Fix PR79041
Hi On 27 June 2017 at 16:49, Wilco Dijkstrawrote: > As described in PR79041, -mcmodel=large -mpc-relative-literal-loads > may be used to avoid generating ADRP/ADD or ADRP/LDR. However both > trunk and GCC7 may still emit ADRP for some constant pool literals. > Fix this by adding a aarch64_pcrelative_literal_loads check. > > OK for trunk/GCC7 backport? I can't approve it, but the patch is ok for me, I've built and regtested the very same patch for aarch64-linux-gnu, aarch64-none-elf and aarch64_be-none-elf targets :) Yvan > ChangeLog: > 2017-06-27 Wilco Dijkstra > > PR target/79041 > * config/aarch64/aarch64.c (aarch64_classify_symbol): > Avoid SYMBOL_SMALL_ABSOLUTE . > * testsuite/gcc.target/aarch64/pr79041-2.c: New test. > -- > diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c > index > 060cd8476d2954119daac495ecb059c9be73edbe..329d244e9cf16dbdf849e5dd02b3999caf0cd5a7 > 100644 > --- a/gcc/config/aarch64/aarch64.c > +++ b/gcc/config/aarch64/aarch64.c > @@ -10042,7 +10042,7 @@ aarch64_classify_symbol (rtx x, rtx offset) > /* This is alright even in PIC code as the constant > pool reference is always PC relative and within > the same translation unit. */ > - if (CONSTANT_POOL_ADDRESS_P (x)) > + if (CONSTANT_POOL_ADDRESS_P (x) && > !aarch64_pcrelative_literal_loads) > return SYMBOL_SMALL_ABSOLUTE; > else > return SYMBOL_FORCE_TO_MEM; > diff --git a/gcc/testsuite/gcc.target/aarch64/pr79041-2.c > b/gcc/testsuite/gcc.target/aarch64/pr79041-2.c > new file mode 100644 > index > ..e7899725bad2b770f8488a07f99792113275bdf2 > --- /dev/null > +++ b/gcc/testsuite/gcc.target/aarch64/pr79041-2.c > @@ -0,0 +1,10 @@ > +/* { dg-do compile } */ > +/* { dg-options "-O2 -mcmodel=large -mpc-relative-literal-loads" } */ > + > +__int128 > +t (void) > +{ > + return (__int128)1 << 80; > +} > + > +/* { dg-final { scan-assembler "adr" } } */
[PATCH][AArch64] Fix PR79041
As described in PR79041, -mcmodel=large -mpc-relative-literal-loads may be used to avoid generating ADRP/ADD or ADRP/LDR. However both trunk and GCC7 may still emit ADRP for some constant pool literals. Fix this by adding a aarch64_pcrelative_literal_loads check. OK for trunk/GCC7 backport? ChangeLog: 2017-06-27 Wilco DijkstraPR target/79041 * config/aarch64/aarch64.c (aarch64_classify_symbol): Avoid SYMBOL_SMALL_ABSOLUTE . * testsuite/gcc.target/aarch64/pr79041-2.c: New test. -- diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c index 060cd8476d2954119daac495ecb059c9be73edbe..329d244e9cf16dbdf849e5dd02b3999caf0cd5a7 100644 --- a/gcc/config/aarch64/aarch64.c +++ b/gcc/config/aarch64/aarch64.c @@ -10042,7 +10042,7 @@ aarch64_classify_symbol (rtx x, rtx offset) /* This is alright even in PIC code as the constant pool reference is always PC relative and within the same translation unit. */ - if (CONSTANT_POOL_ADDRESS_P (x)) + if (CONSTANT_POOL_ADDRESS_P (x) && !aarch64_pcrelative_literal_loads) return SYMBOL_SMALL_ABSOLUTE; else return SYMBOL_FORCE_TO_MEM; diff --git a/gcc/testsuite/gcc.target/aarch64/pr79041-2.c b/gcc/testsuite/gcc.target/aarch64/pr79041-2.c new file mode 100644 index ..e7899725bad2b770f8488a07f99792113275bdf2 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/pr79041-2.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mcmodel=large -mpc-relative-literal-loads" } */ + +__int128 +t (void) +{ + return (__int128)1 << 80; +} + +/* { dg-final { scan-assembler "adr" } } */