aboutsummaryrefslogtreecommitdiff
path: root/libiberty/regex.c
diff options
context:
space:
mode:
authorXi Ruoyao <xry111@xry111.site>2023-12-12 04:54:21 +0800
committerXi Ruoyao <xry111@xry111.site>2023-12-29 20:07:53 +0800
commit8b61d109b130f0e6551803cc30f3c607d4fde81c (patch)
treea439e2a2aaec647d1a56f11ffca7ceac3f33294d /libiberty/regex.c
parent1e7f9abb892443719c82bb17910caa8fb5eeec15 (diff)
downloadgcc-8b61d109b130f0e6551803cc30f3c607d4fde81c.zip
gcc-8b61d109b130f0e6551803cc30f3c607d4fde81c.tar.gz
gcc-8b61d109b130f0e6551803cc30f3c607d4fde81c.tar.bz2
LoongArch: Replace -mexplicit-relocs=auto simple-used address peephole2 with combine
The problem with peephole2 is it uses a naive sliding-window algorithm and misses many cases. For example: float a[10000]; float t() { return a[0] + a[8000]; } is compiled to: la.local $r13,a la.local $r12,a+32768 fld.s $f1,$r13,0 fld.s $f0,$r12,-768 fadd.s $f0,$f1,$f0 by trunk. But as we've explained in r14-4851, the following would be better with -mexplicit-relocs=auto: pcalau12i $r13,%pc_hi20(a) pcalau12i $r12,%pc_hi20(a+32000) fld.s $f1,$r13,%pc_lo12(a) fld.s $f0,$r12,%pc_lo12(a+32000) fadd.s $f0,$f1,$f0 However the sliding-window algorithm just won't detect the pcalau12i/fld pair to be optimized. Use a define_insn_and_rewrite in combine pass will work around the issue. gcc/ChangeLog: * config/loongarch/predicates.md (symbolic_pcrel_offset_operand): New define_predicate. (mem_simple_ldst_operand): Likewise. * config/loongarch/loongarch-protos.h (loongarch_rewrite_mem_for_simple_ldst): Declare. * config/loongarch/loongarch.cc (loongarch_rewrite_mem_for_simple_ldst): Implement. * config/loongarch/loongarch.md (simple_load<mode>): New define_insn_and_rewrite. (simple_load_<su>ext<SUBDI:mode><GPR:mode>): Likewise. (simple_store<mode>): Likewise. (define_peephole2): Remove la.local/[f]ld peepholes. gcc/testsuite/ChangeLog: * gcc.target/loongarch/explicit-relocs-auto-single-load-store-2.c: New test. * gcc.target/loongarch/explicit-relocs-auto-single-load-store-3.c: New test.
Diffstat (limited to 'libiberty/regex.c')
0 files changed, 0 insertions, 0 deletions