Use add/sub/neg insns to eliminate compare/test insns on H8
authorJeff Law <law@redhat.com>
Wed, 2 Dec 2020 04:48:10 +0000 (21:48 -0700)
committerJeff Law <law@redhat.com>
Wed, 2 Dec 2020 04:49:10 +0000 (21:49 -0700)
commit7da97411b048cdd4e7941b311514f46ea53fe3a2
tree62818d588b21f5445743e65ffb0a1e456389912f
parent4bdf1e53a8111312639b3a2f140bae4206f3a8aa
Use add/sub/neg insns to eliminate compare/test insns on H8

gcc/

* config/h8300/addsub.md (addqi3_clobber_flags): Rename to
addqi3_flags and annotate with a <cczn> for define_subst.
(addhi3_h8sx_clobber_flags): Likewise.
(subqi3_clobber_flags, sub<mode>3_clobber_flags): Likewise.
(neg<mode2>_clobber_flags): Similarly.
(addsi3_clobber_flags): Similarly.  Update last argument to
output_plussi to distinguish when we need flags or do not need
flags.
(addhi3_clobber_flags): Similarly.  Twiddle code for cases
+-1, +-2 and +-4.
* config/h8300/h8300.md: Define iterators, mode attributes and
substitutions for use in compare/test elimination.
* config/h8300/jumpcall.md (branch, branch_1): Use H8cc mode
iterator to cover the different modes for the CC register.
(branch_1_false): Likewise.

gcc/testsuite
* gcc.target/h8300/add.c: New test.
* gcc.target/h8300/add-2.c: New test.
* gcc.target/h8300/add-3.c: New test.
* gcc.target/h8300/sub.c: New test.
* gcc.target/h8300/sub-2.c: New test.
* gcc.target/h8300/sub-3.c: New test.
gcc/config/h8300/addsub.md
gcc/config/h8300/h8300.md
gcc/config/h8300/jumpcall.md
gcc/testsuite/gcc.target/h8300/add-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/h8300/add-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/h8300/add.c [new file with mode: 0644]
gcc/testsuite/gcc.target/h8300/sub-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/h8300/sub-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/h8300/sub.c [new file with mode: 0644]