GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
sparc

SPARC: Skip empty instructions at errata branch targets

SPARC code generation now correctly handles errata workarounds at branch targets by skipping empty instructions.

A workaround for a SPARC erratum (GR712RC) has been improved to correctly handle cases where a floating-point operation follows an integer branch. Previously, if the epilogue started immediately at the branch target and contained zero-length frame blockages, the compiler might not insert a necessary NOP before the floating-point instruction. This commit modifies the sparc_do_work_around_errata function to use next_active_non_empty_insn() to find the true instruction at the branch target, ensuring correct instruction sequencing and fixing issues seen in ceilf() and floorf().

In Details

The GR712RC erratum workaround in sparc.cc aims to prevent incorrect execution when floating-point operations follow integer branches, especially within function epilogues. The original implementation failed to account for zero-length frame blockages (often represented by 'empty insns') that could effectively hide the instruction immediately following the branch label. By switching to next_active_non_empty_insn(), the code now correctly identifies the first *actual* instruction, allowing for proper NOP insertion when needed to satisfy the errata's requirements. This also affects the UT700…

For Context
SPARC
A RISC instruction set architecture developed by Sun Microsystems.
errata
A list of known bugs or design flaws in hardware or software specifications.
NOP
No Operation. An instruction that does nothing but advance the program counter.
instruction
A single operation or command that a computer's CPU can execute.
Filed Under: sparchardware erratacode generation