Fixes for Andes long branch and REGNO peephole
Corrects long branch sequence generation for Andes cores and ensures REGNO is used on actual registers in RISC-V peephole optimizations.
This commit addresses two issues in the RISC-V backend. First, it corrects the template for a branch-on-bit pattern in config/riscv/andes.md to use the correct forward label syntax (‘1f’) for long branch sequences, resolving an incorrect ‘f’ append. Second, it refines a peephole optimization in config/riscv/peephole.md to ensure that the REGNO instruction is only applied when its operands are actual registers, not subregisters, preventing potential issues with SUBREG objects.
In Details
This commit revises RISC-V backend code generation. The first change corrects the branch-on-bit pattern in andes.md by replacing %1f with 1f in its output template for long branch sequences. The original %1f incorrectly appended 'f' to the operand string. The second change in peephole.md modifies a condition to ensure that operands are actual REGs before REGNO is accessed, preventing incorrect handling when REGNO is applied to a SUBREG object.
- RISC-V
- An open-standard instruction set architecture (ISA) based on Reduced Instruction Set Computer principles.
- long branch sequence
- A series of instructions generated by the compiler to implement a branch that spans a distance too large for a single branch instruction. This often involves intermediate labels or jump instructions.
- peephole optimization
- A compiler optimization technique that examines a short sequence of instructions (a 'peephole') and replaces it with a more efficient equivalent sequence.
- REGNO
- An internal GCC representation referring to the number or identifier of a hardware register.
- SUBREG
- A subregister, which is a portion of a larger hardware register that can be accessed independently.
- Andes
- A company that designs and provides RISC-V processor cores.