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:

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" } } */

Reply via email to