aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraph.cc
diff options
context:
space:
mode:
authorRoger Sayle <roger@nextmovesoftware.com>2023-10-03 12:52:04 +0100
committerRoger Sayle <roger@nextmovesoftware.com>2023-10-03 12:52:04 +0100
commit09881218137f4af9b7c894c2d350cf2ff8e0ee23 (patch)
treefc819d69b4600fbc1a91bda0f7015564f15e0569 /gcc/cgraph.cc
parent3ca09d684e496240a87c0327687e2898060c2363 (diff)
downloadgcc-09881218137f4af9b7c894c2d350cf2ff8e0ee23.zip
gcc-09881218137f4af9b7c894c2d350cf2ff8e0ee23.tar.gz
gcc-09881218137f4af9b7c894c2d350cf2ff8e0ee23.tar.bz2
ARC: Use rlc r0,0 to implement scc_ltu (i.e. carry_flag ? 1 : 0)
This patch teaches the ARC backend that the contents of the carry flag can be placed in an integer register conveniently using the "rlc rX,0" instruction, which is a rotate-left-through-carry using zero as a source. This is a convenient special case for the LTU form of the scc pattern. unsigned int foo(unsigned int x, unsigned int y) { return (x+y) < x; } With -O2 -mcpu=em this is currently compiled to: foo: add.f 0,r0,r1 mov_s r0,1 ;3 j_s.d [blink] mov.hs r0,0 [which after an addition to set the carry flag, sets r0 to 1, followed by a conditional assignment of r0 to zero if the carry flag is clear]. With the new define_insn/optimization in this patch, this becomes: foo: add.f 0,r0,r1 j_s.d [blink] rlc r0,0 This define_insn is also a useful building block for implementing shifts and rotates. 2023-10-03 Roger Sayle <roger@nextmovesoftware.com> gcc/ChangeLog * config/arc/arc.md (CC_ltu): New mode iterator for CC and CC_C. (scc_ltu_<mode>): New define_insn to handle LTU form of scc_insn. (*scc_insn): Don't split to a conditional move sequence for LTU. gcc/testsuite/ChangeLog * gcc.target/arc/scc-ltu.c: New test case.
Diffstat (limited to 'gcc/cgraph.cc')
0 files changed, 0 insertions, 0 deletions