Fix length computation for HImode shift left by 2^n for H8/SX
Corrects H8/SX shift length calculation to avoid mispredicted branch targets.
A recent change in GCC caused a regression on the H8/SX architecture where the calculated length for HImode shift operations by powers of two was incorrect. This led to mispredicted branch targets, specifically for the pr69714.c test case. The fix adjusts the compute_a_shift_length function to prevent special length adjustments for H8/SX when using ‘shift special’ instructions, resolving the correctness issue.
In Details
The compute_a_shift_length function for the H8/SX port had a special case for computing the length of a left shift by a power of two when SHIFT_SPECIAL was used. This special case was incorrectly applied even when the H8/SX was emitting an assembly string directly rather than using its more compact shift instructions. The length computation was off by a few bytes, causing branch target mispredictions. This commit removes the incorrect special length adjustment for SHIFT_SPECIAL on H8/SX, restoring correctness.
- H8/SX
- A specific variant of the Renesas H8 microcontroller architecture, known for its compact instruction set.
- HImode
- In GCC's internal representation, a mode representing a half-integer, typically 16 bits.
- SHIFT_SPECIAL
- A flag or code indicating that a shift operation should be handled using a special, potentially architecture-specific, instruction or code sequence.