diff mbox

[COMMITED,AArch64] Fix PR79041

Message ID DB6PR0801MB2053A9A8671AA794B9FC4E9283B80@DB6PR0801MB2053.eurprd08.prod.outlook.com
State New
Headers show

Commit Message

Wilco Dijkstra July 25, 2017, 12:13 p.m. UTC
James Greenhalgh wrote:
>
> OK. Either like this, or with the conditions swapped around as Yvan
> suggested to make backporting easier.

I swapped the conditions around, not sure whether it helps...
Also I needed an additional scan-assembler, this was committed to
trunk and GCC7:

Comments

Ramana Radhakrishnan July 25, 2017, 12:52 p.m. UTC | #1
On Tue, Jul 25, 2017 at 1:13 PM, Wilco Dijkstra <Wilco.Dijkstra@arm.com> wrote:
> James Greenhalgh wrote:
>>
>> OK. Either like this, or with the conditions swapped around as Yvan
>> suggested to make backporting easier.
>
> I swapped the conditions around, not sure whether it helps...
> Also I needed an additional scan-assembler, this was committed to
> trunk and GCC7:


BZ suggests that this affects GCC 6 but GCC 7 is fixed ? Should there
be a backport to GCC 6 as well ?

Can you please keep BZ up to date please ?


Ramana
>
> diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
> index d7fab3775c06477365217e357b5754026d09752b..7713d543af788d47dcdf8ea89482a2d4f66a1344 100644
> --- a/gcc/config/aarch64/aarch64.c
> +++ b/gcc/config/aarch64/aarch64.c
> @@ -10181,7 +10181,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 (!aarch64_pcrelative_literal_loads && CONSTANT_POOL_ADDRESS_P (x))
>             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 0000000000000000000000000000000000000000..cd34fbab85a92d00cba7091d4146deaaf3a862a9
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/aarch64/pr79041-2.c
> @@ -0,0 +1,11 @@
> +/* { dg-do compile } */
> +/* { dg-options "-O2 -mcmodel=large -mpc-relative-literal-loads" } */
> +
> +__int128
> +t (void)
> +{
> +  return (__int128)1 << 80;
> +}
> +
> +/* { dg-final { scan-assembler "adr" } } */
> +/* { dg-final { scan-assembler-not "adrp" } } */
Wilco Dijkstra July 25, 2017, 1:14 p.m. UTC | #2
Ramana Radhakrishnan <ramana.gcc@googlemail.com>
>
> BZ suggests that this affects GCC 6 but GCC 7 is fixed ? Should there
> be a backport to GCC 6 as well ?
>
> Can you please keep BZ up to date please ?

GCC7 was affected as well, the example in PR79041 didn't trigger in GCC7,
my patch has a better example that does show the issue.

GCC6 requires a backport of multiple patches. The patch is 
https://gcc.gnu.org/ml/gcc-patches/2017-06/msg01708.html
which is still waiting for review.

Wilco
Andreas Schwab July 25, 2017, 2:15 p.m. UTC | #3
On Jul 25 2017, Wilco Dijkstra <Wilco.Dijkstra@arm.com> wrote:

> 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 0000000000000000000000000000000000000000..cd34fbab85a92d00cba7091d4146deaaf3a862a9
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/aarch64/pr79041-2.c
> @@ -0,0 +1,11 @@
> +/* { dg-do compile } */
> +/* { dg-options "-O2 -mcmodel=large -mpc-relative-literal-loads" } */
> +
> +__int128
> +t (void)
> +{
> +  return (__int128)1 << 80;
> +}
> +
> +/* { dg-final { scan-assembler "adr" } } */
> +/* { dg-final { scan-assembler-not "adrp" } } */

That fails in ILP32 mode.

Andreas.
Wilco Dijkstra July 26, 2017, 12:03 p.m. UTC | #4
Andreas Schwab wrote:

> That fails in ILP32 mode.

Well -mabi-ilp32 and -mcmodel=large make no sense at all,
that should really give an error... I've committed a patch to 
trunk and GCC7 to disable this test with ILP32.

Wilco
diff mbox

Patch

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index d7fab3775c06477365217e357b5754026d09752b..7713d543af788d47dcdf8ea89482a2d4f66a1344 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -10181,7 +10181,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 (!aarch64_pcrelative_literal_loads && CONSTANT_POOL_ADDRESS_P (x))
 	    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 0000000000000000000000000000000000000000..cd34fbab85a92d00cba7091d4146deaaf3a862a9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/pr79041-2.c
@@ -0,0 +1,11 @@ 
+/* { dg-do compile } */
+/* { dg-options "-O2 -mcmodel=large -mpc-relative-literal-loads" } */
+
+__int128
+t (void)
+{
+  return (__int128)1 << 80;
+}
+
+/* { dg-final { scan-assembler "adr" } } */
+/* { dg-final { scan-assembler-not "adrp" } } */