diff options
author | Xi Ruoyao <xry111@xry111.site> | 2023-10-01 11:14:29 +0800 |
---|---|---|
committer | Xi Ruoyao <xry111@xry111.site> | 2023-10-23 15:30:19 +0800 |
commit | 83e24e8c1e5eb3366e35d5b8494a4cd9a2395b59 (patch) | |
tree | 6b73e1ce098ba5ca2d38656d00dfa9c1e89c2cbb /gcc/tree-vect-loop-manip.cc | |
parent | 95db62f4ad4cfce30b7683a7e3e9f06330e84878 (diff) | |
download | gcc-83e24e8c1e5eb3366e35d5b8494a4cd9a2395b59.zip gcc-83e24e8c1e5eb3366e35d5b8494a4cd9a2395b59.tar.gz gcc-83e24e8c1e5eb3366e35d5b8494a4cd9a2395b59.tar.bz2 |
LoongArch: Use explicit relocs for addresses only used for one load or store with -mexplicit-relocs=auto and -mcmodel={normal,medium}
In these cases, if we use explicit relocs, we end up with 2
instructions:
pcalau12i t0, %pc_hi20(x)
ld.d t0, t0, %pc_lo12(x)
If we use la.local pseudo-op, in the best scenario (x is in +/- 2MiB
range) we still have 2 instructions:
pcaddi t0, %pcrel_20(x)
ld.d t0, t0, 0
If x is out of the range we'll have 3 instructions. So for these cases
just emit machine instructions with explicit relocs.
gcc/ChangeLog:
* config/loongarch/predicates.md (symbolic_pcrel_operand): New
predicate.
* config/loongarch/loongarch.md (define_peephole2): Optimize
la.local + ld/st to pcalau12i + ld/st if the address is only used
once if -mexplicit-relocs=auto and -mcmodel=normal or medium.
gcc/testsuite/ChangeLog:
* gcc.target/loongarch/explicit-relocs-auto-single-load-store.c:
New test.
* gcc.target/loongarch/explicit-relocs-auto-single-load-store-no-anchor.c:
New test.
Diffstat (limited to 'gcc/tree-vect-loop-manip.cc')
0 files changed, 0 insertions, 0 deletions