Improve Z flag handling on H8
authorJeff Law <jeffreyalaw@gmail.com>
Sat, 1 Oct 2022 04:42:15 +0000 (00:42 -0400)
committerJeff Law <jeffreyalaw@gmail.com>
Sat, 1 Oct 2022 04:49:55 +0000 (00:49 -0400)
commit2555071c954aa5796eb3432c15739dcaae457bc3
tree7727cc058c0692134cc2038dd0aa602e7e74bebe
parentdd9c8f644f0f1ac2000108ac369b991664946304
Improve Z flag handling on H8

This patch improves handling of the Z bit in the status register in a
variety of ways to improve either the code size or code speed on various
H8 subtargets.

For example, we can test the zero/nonzero status of the upper byte of a
16 bit register using mov.b, we can move the Z or an inverted Z into a
QImode register profitably on some subtargets.  We can move Z or an
inverted Z into the sign bit on the H8/SX profitably, etc.

gcc/

* config/h8300/h8300.md (HSI2): New iterator.
(eqne_invert): Similarly.
* config/h8300/testcompare.md (testhi_upper_z): New pattern.
(cmpqi_z, cmphi_z, cmpsi_z): Likewise.
(store_z_qi, store_z_i_qi, store_z_hi, store_z_hi_sb): New
define_insn_and_splits and/or define_insns.
(store_z_hi_neg, store_z_hi_and, store_z_<mode>): Likewise.
(store_z_<mode>_neg, store_z_<mode>_and, store_z): Likewise.
gcc/config/h8300/h8300.md
gcc/config/h8300/testcompare.md