[committed] Improve H8 sequences for single bit sign extractionsventana/heads/ext-dce
commit0f9f3fc885a1f830ff09a095e8c14919c2796a9d
authorJeff Law <jlaw@ventanamicro.com>
Thu, 2 Nov 2023 13:25:39 +0000 (2 07:25 -0600)
committerJeff Law <jlaw@ventanamicro.com>
Thu, 2 Nov 2023 13:25:39 +0000 (2 07:25 -0600)
treee3e9b5f782ebf50a752dc0782f1cc8292ae1b050
parentc71028c979d55f98b7727f9387bbe2f4ffe6de13
[committed] Improve H8 sequences for single bit sign extractions

Spurred by Roger's recent work on ARC, this patch improves the code we
generation for single bit sign extractions.

The basic idea is to get the bit we want into C, the use a subx;ext.w;ext.l
sequence to sign extend it in a GPR.

For bits 0..15 we can use a bld instruction to get the bit we want into C.  For
bits 16..31, we can move the high word into the low word, then use bld.
There's a couple special cases where we can shift the bit we want from the high
word into C which is an instruction smaller.

Not surprisingly most cases seen in newlib and the test suite are extractions
from the low byte, HImode sign bit and top two bits of SImode.

Regression tested on the H8 with no regressions.  Installing on the trunk.

gcc/
* config/h8300/combiner.md: Add new patterns for single bit
sign extractions.
gcc/config/h8300/combiner.md