GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gcc

Building for SH restores after bswap related changes

GCC can now build for the SuperH architecture again after bswap changes, which previously caused compile-time failures on that target.

Recent changes in GCC led to compile-time errors for the SuperH (SH) architecture due to bswap patterns failing if no new pseudos could be created. This prevented successful builds for the SH target. The issue has been resolved by moving the can_create_pseudos_p check directly into the bswapsi2 pattern’s condition, rather than causing a hard failure. This adjustment ensures that the bswap pattern gracefully handles situations where pseudos cannot be created, restoring the ability to build GCC for the SH architecture.

In Details

The sh.md file in gcc/config/sh defines machine-dependent patterns for the SuperH (SH) architecture, which are used by the GCC backend during instruction selection. Specifically, the bswapsi2 pattern handles byte-swapping operations for 32-bit integers. A recent change globally caused bswap patterns to trigger compile errors if they FAIL during pattern matching. On SH, the bswapsi2 pattern could FAIL if can_create_pseudos_p was false. By moving the check for can_create_pseudos_p from a separate failure condition into the pattern's explicit condition, the pattern can now simp…

For Context

Compilers translate human-readable source code into machine code for specific computer architectures. GCC (the GNU Compiler Collection) supports many architectures, including SuperH (SH). Part of this translation involves selecting the most efficient machine instructions for operations like 'byte swapping' (reversing the order of bytes in a number). When making recent changes to how byte swapping instructions are handled, a strict check was introduced that would completely stop GCC from building if a particular byte-swapping pattern couldn't be used. This caused builds for the SuperH architecture to fail, because on SH, that particular pattern might not always be applicable. The fix subtly re-orders the check: instead of halting the entire build, the compiler now checks if the pattern can be used *as part of the pattern matching process itself*. If it can't, the compiler simply tries a different way to perform the byte swap, allowing GCC to successfully build for SuperH again.

Filed Under: architecture-supportcompiler-buildsuperh