Fix conditional branch length computation for V850 port
Corrects V850 conditional branch length calculation for older architectures.
This commit fixes an issue in the V850 compiler port where the length calculation for conditional branch instructions was incorrect for older V850 variants. Newer V850 variants (E3V5 and later) have extended the range of conditional branches. The code update to accommodate this extension incorrectly assumed the longer branch forms were always available, leading to incorrect instruction lengths being calculated for older targets. The fix ensures that the correct length is computed based on whether the extended conditional branch features are available.
In Details
This commit corrects conditional branch length computation in the V850 backend, specifically in config/v850/v850.md. The issue arose because newer V850 variants (E3V5+) support longer conditional branches (extending from 8 to 17 bits). The patterns were updated to account for this, but the length computation logic incorrectly assumed the availability of these longer forms even on older V850 targets that do not support them. This could lead to incorrect assembly or simulation if the assembler/simulator is too lenient. The fix adds a check to ensure the E3V5 variant or newer is present before…
- V850
- A family of microcontrollers and embedded processors developed by Renesas Electronics (formerly NEC).
- conditional branch
- An instruction that transfers program control to a different location based on whether a specified condition is met (e.g., if a value is zero or non-zero).
- instruction length
- The number of bytes required to encode a machine instruction. Correctly calculating this is crucial for branch prediction and code size analysis.
- GCC backend
- The part of the GCC compiler responsible for translating the compiler's intermediate representation into machine-specific assembly code for a particular target architecture.
- machine description (MD) file
- Files used by GCC to describe the instruction set, addressing modes, and other architectural details of a target processor. This information is used by the backend to generate machine code.