diff options
author | Roger Sayle <roger@nextmovesoftware.com> | 2024-01-09 10:21:39 +0000 |
---|---|---|
committer | Roger Sayle <roger@nextmovesoftware.com> | 2024-01-09 10:23:50 +0000 |
commit | 468cec536322f98f2d473adbd6a8e88c625cfcdb (patch) | |
tree | c458e5cfc21a0eae8bdf67f2ceb848a0467a784f /gcc/tree-vect-loop-manip.cc | |
parent | db584633e600840619bfb821d8293094ef26a668 (diff) | |
download | gcc-468cec536322f98f2d473adbd6a8e88c625cfcdb.zip gcc-468cec536322f98f2d473adbd6a8e88c625cfcdb.tar.gz gcc-468cec536322f98f2d473adbd6a8e88c625cfcdb.tar.bz2 |
ARC: Table-driven ashlsi implementation for better code/rtx_costs.
One of the cool features of the H8 backend is its use of tables to select
optimal shift implementations for different CPU variants. This patch
borrows (plagiarizes) that idiom for SImode left shifts in the ARC backend
(for CPUs without a barrel-shifter). This provides a convenient mechanism
for both selecting the best implementation strategy (for speed vs. size),
and providing accurate rtx_costs [without duplicating a lot of logic].
Left shift RTX costs are especially important for use in synth_mult.
An example improvement is:
int foo(int x) { return 32768*x; }
which is now generated with -O2 -mcpu=em -mswap as:
foo: bmsk_s r0,r0,16
swap r0,r0
j_s.d [blink]
ror r0,r0
where previously the ARC backend would generate a loop:
foo: mov lp_count,15
lp 2f
add r0,r0,r0
nop
2: # end single insn loop
j_s [blink]
2024-01-09 Roger Sayle <roger@nextmovesoftware.com>
gcc/ChangeLog
* config/arc/arc.cc (arc_shift_alg): New enumerated type for
left shift implementation strategies.
(arc_shift_info): Type for each entry of the shift strategy table.
(arc_shift_context_idx): Return a integer value for each code
generation context, used as an index
(arc_ashl_alg): Table indexed by context and shifted bit count.
(arc_split_ashl): Use the arc_ashl_alg table to select SImode
left shift implementation.
(arc_rtx_costs) <case ASHIFT>: Use the arc_ashl_alg table to
provide accurate costs, when optimizing for speed or size.
Diffstat (limited to 'gcc/tree-vect-loop-manip.cc')
0 files changed, 0 insertions, 0 deletions