GCC Newspaper
OCTOBER 6, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
s390

s390: Fix ICE with usubc5 pattern by forcing operands to registers.

An internal compiler error (ICE) on s390x involving the `usubc5` pattern is fixed by ensuring operands are in registers.

An ICE was occurring on the s390x architecture due to how the usubc5 pattern interacted with immediate operands. The pattern, intended for use with general operands, was sometimes being applied to immediate values in a way that conflicted with the xor instruction’s requirements. This fix forces the problematic operand into a register before it’s used in the xor instruction, allowing subsequent optimizations like CSE or combine to simplify it correctly.

In Details

The s390x backend experienced an ICE related to the usubc<mode>5 pattern when operands[4] was a general_operand that could resolve to a const0_rtx. This was used with an xor<mode>3 insn expecting a nonimmediate_operand. The patch modifies s390.md to force operands[4] into a register if it's an immediate other than const0_rtx, thus avoiding the pattern matching failure and allowing CSE/combine to handle it.

For Context
ICE
Internal Compiler Error. An ICE signifies a bug within the compiler itself, causing it to crash during compilation.
s390
IBM's System/360 family of mainframe instruction set architectures, and its successors (s370, s390x). GCC supports these architectures.
usubc5 pattern
A named pattern in GCC's machine description (.md file) for the s390 architecture, likely corresponding to an unsigned subtract with carry instruction variant.
general_operand
A predicate in GCC's machine description that matches a wide range of operand types, often used when a specific instruction can accept various forms of input.
const0_rtx
An RTX (representation of code) node representing the constant value zero.
nonimmediate_operand
An operand that cannot be directly encoded as an immediate value within an instruction, typically meaning it must reside in a register.
CSE
Common Subexpression Elimination. An optimization pass that identifies and replaces identical expressions with a single temporary variable.
Filed Under: s390compiler-bugbackend