diff options
author | Roger Sayle <roger@nextmovesoftware.com> | 2023-04-29 20:18:23 +0100 |
---|---|---|
committer | Roger Sayle <roger@nextmovesoftware.com> | 2023-04-29 20:18:23 +0100 |
commit | e2b204c31ba2b77dfe4a062b194129b7c97c81ad (patch) | |
tree | c12fb1a3df83fff7214c8c393b5a0aa63d3a2fc4 /libcpp/init.cc | |
parent | 58f3cbbd7e02c29f2abd6300c0fec053559e35b4 (diff) | |
download | gcc-e2b204c31ba2b77dfe4a062b194129b7c97c81ad.zip gcc-e2b204c31ba2b77dfe4a062b194129b7c97c81ad.tar.gz gcc-e2b204c31ba2b77dfe4a062b194129b7c97c81ad.tar.bz2 |
[xstormy16] Efficient HImode rotate left by a single bit.
This patch contains some minor tweak to xstormy16's machine description
most significantly providing a pattern for HImode rotate left by a single
bit that requires only two instructions.
unsigned short foo(unsigned short x)
{
return (x << 1) | (x >> 15);
}
currently with -O2 generates:
foo: mov r7,r2
shr r7,#15
shl r2,#1
or r2,r7
ret
with this patch, GCC now generates:
foo: shl r2,#1 | adc r2,#0
ret
Additionally neghi2 is converted to a define_insn (so that the RTL
optimizers see the negation semantics), and HImode rotations by
8-bits can now be recognized and implemented using swpb.
2023-04-29 Roger Sayle <roger@nextmovesoftware.com>
gcc/ChangeLog
* config/stormy16/stormy16.md (neghi2): Convert from a define_expand
to a define_insn.
(*rotatehi_1): New define_insn for efficient 2 insn sequence.
(*rotatehi_8, *rotaterthi_8): New define_insn to emit a swpb.
gcc/testsuite/ChangeLog
* gcc.target/xstormy16/neghi2.c: New test case.
* gcc.target/xstormy16/rotatehi-1.c: Likewise.
Diffstat (limited to 'libcpp/init.cc')
0 files changed, 0 insertions, 0 deletions