diff options
author | Roger Sayle <roger@nextmovesoftware.com> | 2023-10-16 13:03:09 +0100 |
---|---|---|
committer | Roger Sayle <roger@nextmovesoftware.com> | 2023-10-16 13:03:09 +0100 |
commit | 817a701681924706a8ef035e107b9d45d21a2360 (patch) | |
tree | 3b7a2692e08b25a9b51ae8a2dfadc4ad780c90bb /gcc/tree-pass.h | |
parent | d6ebe61889732afaf2e8fbf1c1fcc4a5486a5f93 (diff) | |
download | gcc-817a701681924706a8ef035e107b9d45d21a2360.zip gcc-817a701681924706a8ef035e107b9d45d21a2360.tar.gz gcc-817a701681924706a8ef035e107b9d45d21a2360.tar.bz2 |
ARC: Split asl dst,1,src into bset dst,0,src to implement 1<<x.
This patch adds a pre-reload splitter to arc.md, to use the bset (set
specific bit instruction) to implement 1<<x (i.e. left shifts of one)
on ARC processors that don't have a barrel shifter.
Currently,
int foo(int x) {
return 1 << x;
}
when compiled with -O2 -mcpu=em is compiled as a loop:
foo: mov_s r2,1 ;3
and.f lp_count,r0, 0x1f
lpnz 2f
add r2,r2,r2
nop
2: # end single insn loop
j_s.d [blink]
mov_s r0,r2 ;4
with this patch we instead generate a single instruction:
foo: bset r0,0,r0
j_s [blink]
2023-10-16 Roger Sayle <roger@nextmovesoftware.com>
gcc/ChangeLog
* config/arc/arc.md (*ashlsi3_1): New pre-reload splitter to
use bset dst,0,src to implement 1<<x on !TARGET_BARREL_SHIFTER.
Diffstat (limited to 'gcc/tree-pass.h')
0 files changed, 0 insertions, 0 deletions