[Bug target/79041] aarch64 backend emits R_AARCH64_ADR_PREL_PG_HI21 relocation despite -mpc-relative-literal-loads option being used

2018-01-17 Thread wilco at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79041

--- Comment #15 from Wilco  ---
Author: wilco
Date: Wed Jan 17 16:31:42 2018
New Revision: 256800

URL: https://gcc.gnu.org/viewcvs?rev=256800&root=gcc&view=rev
Log:
[AArch64] PR82964: Fix 128-bit immediate ICEs

This fixes PR82964 which reports ICEs for some CONST_WIDE_INT immediates.
It turns out decimal floating point CONST_DOUBLE get changed into
CONST_WIDE_INT without checking the constraint on the operand, which 
results in failures.  Avoid this by only allowing SF/DF/TF mode floating
point constants in aarch64_legitimate_constant_p.  A similar issue can
occur with 128-bit immediates which may be emitted even when disallowed
in aarch64_legitimate_constant_p, and the constraints in movti_aarch64
don't match.  Fix this with a new constraint and allowing valid immediates
in aarch64_legitimate_constant_p.

Rather than allowing all 128-bit immediates and expanding in up to 8
MOV/MOVK instructions, limit them to 4 instructions and use a literal
load for other cases.  Improve a few TImode tests to use a literal and
ensure they are skipped with -fpic.

This fixes all reported failures.

gcc/
PR target/82964
* config/aarch64/aarch64.md (movti_aarch64): Use Uti constraint.
* config/aarch64/aarch64.c (aarch64_mov128_immediate): New function.
(aarch64_legitimate_constant_p): Just support CONST_DOUBLE 
SF/DF/TF mode to avoid creating illegal CONST_WIDE_INT immediates.
* config/aarch64/aarch64-protos.h (aarch64_mov128_immediate):
Add declaration.
* config/aarch64/constraints.md (aarch64_movti_operand):
Limit immediates.
* config/aarch64/predicates.md (Uti): Add new constraint.

gcc/testsuite/
PR target/79041
PR target/82964
* gcc.target/aarch64/pr79041-2.c: Improve test, disable with fpic.
* gcc.target/aarch64/pr78733.c: Improve test, disable with fpic.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/aarch64/aarch64-protos.h
trunk/gcc/config/aarch64/aarch64.c
trunk/gcc/config/aarch64/aarch64.md
trunk/gcc/config/aarch64/constraints.md
trunk/gcc/config/aarch64/predicates.md
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.target/aarch64/pr78733.c
trunk/gcc/testsuite/gcc.target/aarch64/pr79041-2.c

[Bug target/79041] aarch64 backend emits R_AARCH64_ADR_PREL_PG_HI21 relocation despite -mpc-relative-literal-loads option being used

2017-09-24 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79041

--- Comment #12 from Andrew Pinski  ---
This test also fails with -fpic.

[Bug target/79041] aarch64 backend emits R_AARCH64_ADR_PREL_PG_HI21 relocation despite -mpc-relative-literal-loads option being used

2017-09-25 Thread wilco at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79041

--- Comment #13 from Wilco  ---
(In reply to Andrew Pinski from comment #12)
> This test also fails with -fpic.

It doesn't run in the testsuite with -fpic, so is it a problem?

[Bug target/79041] aarch64 backend emits R_AARCH64_ADR_PREL_PG_HI21 relocation despite -mpc-relative-literal-loads option being used

2017-09-25 Thread pinskia at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79041

--- Comment #14 from Andrew Pinski  ---
(In reply to Wilco from comment #13)
> It doesn't run in the testsuite with -fpic, so is it a problem?

I run the testsuite with RUNTESTFLAGS='--target_board=unix/\{,-fpic\}' and this
testcase fails in the -fpic is selected.  Note this is done as we don't have
enough coverage for -fpic code in the normal testsuite run; running the
testsuite this way has allowed me to file PIC related bugs in the past.

[Bug target/79041] aarch64 backend emits R_AARCH64_ADR_PREL_PG_HI21 relocation despite -mpc-relative-literal-loads option being used

2017-07-24 Thread wilco at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79041

--- Comment #7 from Wilco  ---
Author: wilco
Date: Mon Jul 24 18:06:37 2017
New Revision: 250478

URL: https://gcc.gnu.org/viewcvs?rev=250478&root=gcc&view=rev
Log:
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.

gcc/
PR target/79041
* config/aarch64/aarch64.c (aarch64_classify_symbol):
Avoid SYMBOL_SMALL_ABSOLUTE for literals with pc-relative literals
gcc/testsuite/
* gcc.target/aarch64/pr79041-2.c: New test.

Added:
trunk/gcc/testsuite/gcc.target/aarch64/pr79041-2.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/aarch64/aarch64.c
trunk/gcc/testsuite/ChangeLog

[Bug target/79041] aarch64 backend emits R_AARCH64_ADR_PREL_PG_HI21 relocation despite -mpc-relative-literal-loads option being used

2017-07-25 Thread wilco at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79041

--- Comment #8 from Wilco  ---
Author: wilco
Date: Tue Jul 25 12:08:59 2017
New Revision: 250514

URL: https://gcc.gnu.org/viewcvs?rev=250514&root=gcc&view=rev
Log:
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.

gcc/
PR target/79041
* config/aarch64/aarch64.c (aarch64_classify_symbol):
Avoid SYMBOL_SMALL_ABSOLUTE for literals with pc-relative literals.
gcc/testsuite/
* gcc.target/aarch64/pr79041-2.c: New test.

Added:
branches/gcc-7-branch/gcc/testsuite/gcc.target/aarch64/pr79041-2.c
Modified:
branches/gcc-7-branch/gcc/ChangeLog
branches/gcc-7-branch/gcc/config/aarch64/aarch64.c
branches/gcc-7-branch/gcc/testsuite/ChangeLog

[Bug target/79041] aarch64 backend emits R_AARCH64_ADR_PREL_PG_HI21 relocation despite -mpc-relative-literal-loads option being used

2017-07-25 Thread wilco at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79041

Wilco  changed:

   What|Removed |Added

 CC||wilco at gcc dot gnu.org

--- Comment #9 from Wilco  ---
Fixed in GCC7 and trunk. GCC6 requires
https://gcc.gnu.org/ml/gcc-patches/2017-06/msg01708.html.

[Bug target/79041] aarch64 backend emits R_AARCH64_ADR_PREL_PG_HI21 relocation despite -mpc-relative-literal-loads option being used

2017-07-26 Thread wilco at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79041

--- Comment #10 from Wilco  ---
Author: wilco
Date: Wed Jul 26 11:55:03 2017
New Revision: 250567

URL: https://gcc.gnu.org/viewcvs?rev=250567&root=gcc&view=rev
Log:
Disable pr79041-2.c with -mabi=ilp32.

gcc/testsuite/
PR target/79041
* gcc.target/aarch64/pr79041-2.c: Don't run in ILP32.

Modified:
trunk/gcc/testsuite/ChangeLog
trunk/gcc/testsuite/gcc.target/aarch64/pr79041-2.c

[Bug target/79041] aarch64 backend emits R_AARCH64_ADR_PREL_PG_HI21 relocation despite -mpc-relative-literal-loads option being used

2017-07-26 Thread wilco at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79041

--- Comment #11 from Wilco  ---
Author: wilco
Date: Wed Jul 26 11:57:57 2017
New Revision: 250569

URL: https://gcc.gnu.org/viewcvs?rev=250569&root=gcc&view=rev
Log:
Disable pr79041-2.c with -mabi=ilp32.

gcc/testsuite/
PR target/79041
* gcc.target/aarch64/pr79041-2.c: Don't run in ILP32.

Modified:
branches/gcc-7-branch/gcc/testsuite/ChangeLog
branches/gcc-7-branch/gcc/testsuite/gcc.target/aarch64/pr79041-2.c

[Bug target/79041] aarch64 backend emits R_AARCH64_ADR_PREL_PG_HI21 relocation despite -mpc-relative-literal-loads option being used

2017-01-10 Thread ktkachov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79041

ktkachov at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-01-10
 CC||ktkachov at gcc dot gnu.org
  Known to work||7.0
 Ever confirmed|0   |1
  Known to fail||6.3.1

--- Comment #1 from ktkachov at gcc dot gnu.org ---
Confirmed on GCC 6.3.1
This doesn't appear on trunk. Trunk generates a pc-relative load.

aarch64-none-elf-objdump -r t.o

reloc.o: file format elf64-littleaarch64

RELOCATION RECORDS FOR [.text]:
OFFSET   TYPE  VALUE 
0018 R_AARCH64_CALL26  strcmp
0038 R_AARCH64_ABS64   .rodata.str1.8
0040 R_AARCH64_ABS64   .rodata.str1.8+0x0008

[Bug target/79041] aarch64 backend emits R_AARCH64_ADR_PREL_PG_HI21 relocation despite -mpc-relative-literal-loads option being used

2017-01-10 Thread ktkachov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79041

ktkachov at gcc dot gnu.org changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |ktkachov at gcc dot 
gnu.org

--- Comment #2 from ktkachov at gcc dot gnu.org ---
This was fixed by a trunk patch that has been only partially backported to GCC
6.
Testing a patch to fix it.

[Bug target/79041] aarch64 backend emits R_AARCH64_ADR_PREL_PG_HI21 relocation despite -mpc-relative-literal-loads option being used

2017-01-10 Thread rschiele at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79041

--- Comment #3 from Robert Schiele  ---
If you point me to the specific patch that you have in mind I can in parallel
already test whether besides the test case I provided it also fixes the
original problem this was detected with.

[Bug target/79041] aarch64 backend emits R_AARCH64_ADR_PREL_PG_HI21 relocation despite -mpc-relative-literal-loads option being used

2017-01-11 Thread ktkachov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79041

--- Comment #4 from ktkachov at gcc dot gnu.org ---
(In reply to Robert Schiele from comment #3)
> If you point me to the specific patch that you have in mind I can in
> parallel already test whether besides the test case I provided it also fixes
> the original problem this was detected with.

I've posted a patch for review at:
https://gcc.gnu.org/ml/gcc-patches/2017-01/msg00736.html
It should apply to a GCC 6-based tree (but not GCC 7 trunk which doesn't
exhibit this bug)

[Bug target/79041] aarch64 backend emits R_AARCH64_ADR_PREL_PG_HI21 relocation despite -mpc-relative-literal-loads option being used

2017-01-11 Thread rschiele at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79041

--- Comment #5 from Robert Schiele  ---
Thanks! I can confirm that this also fixes the original problem for all cases
we observed so far.

[Bug target/79041] aarch64 backend emits R_AARCH64_ADR_PREL_PG_HI21 relocation despite -mpc-relative-literal-loads option being used

2017-01-12 Thread ktkachov at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79041

--- Comment #6 from ktkachov at gcc dot gnu.org ---
thanks for testing this out

[Bug target/79041] aarch64 backend emits R_AARCH64_ADR_PREL_PG_HI21 relocation despite -mpc-relative-literal-loads option being used

2018-11-19 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79041

Martin Liška  changed:

   What|Removed |Added

 CC||marxin at gcc dot gnu.org

--- Comment #16 from Martin Liška  ---
Wilco: Can the bug be marked as resolved?

[Bug target/79041] aarch64 backend emits R_AARCH64_ADR_PREL_PG_HI21 relocation despite -mpc-relative-literal-loads option being used

2018-11-19 Thread wilco at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79041

Wilco  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #17 from Wilco  ---
(In reply to Martin Liška from comment #16)
> Wilco: Can the bug be marked as resolved?

Yes it is fixed on all active branches.