CT_00_043 - Extension Elimination (GCC)
About
These are tasks carried forward from 2024 and some additional work identified in 2024
- Use Jivan's trick to expose the sign extended nature of SI/HI/QI mode return values.
- A signed comparison of a sign extended SI subreg against a constant with 0x8000000 clear can be turned into unsigned comparison in DImode
- This is a generalization of the min/max case that's currently handled in bitmanip.md.
- Investigate if we're already handling this (we may be), and if not explore the best way to fix
- Investigate Ajit's work (IBM) to exploit cases where masking can be viewed as zero-extension within REE
- In REE handle cases like (any_extend:DI (ashift:SI )) where the extension can be replaced by a SUBREG and then push the SUBREG into the operands generating word sized operations. This helps code like this:
void foo(unsigned char *data, unsigned int lo_bit) { unsigned int mask = ((1UL << 1) - 1) << lo_bit; *data = (*data & ~mask) | ((1 << lo_bit) & mask); }
One the unnecessary extension is eliminated a simple backend pattern can be used to simplify all that to a simple lb+bset+sb.
Stakeholders/Partners
RISE:
Ventana: Jeff Law
Rivos: Vineet (part time)
External:
Dependencies
Status
Updates
- New/incomplete items moved into 1H2025