GCC Newspaper
JULY 29, 2026
Date
/
Architectures
Components
Topics
News & Policy
sh

SH: Pin sfunc input args to hard-regs via predicates

SH sfuncs now use predicates to pin input arguments to hard registers, resolving LRA issues with clobber patterns.

This commit modifies SH-specific sfuncs to use new predicates for pinning input arguments to hard registers. Previously, some sfuncs used hard registers as inputs but then clobbered their raw register patterns, which the Local Register Allocator (LRA) did not handle correctly. The rewrite uses match_operand and match_dup to ensure these arguments are properly constrained, resolving issues related to PR target/55212.

In Details

Several sfuncs on the SH target, particularly those for unsigned division (udivsi3* variants) and block moves, were rewritten to better interact with the LRA. New predicates like hard_reg_r0 through hard_reg_r7 are introduced in config/sh/predicates.md. The MD patterns in config/sh/sh.md and config/sh/sh-mem.cc now use match_operand with these predicates to ensure input arguments are bound to specific hard registers, and match_dup to reference them. This addresses a failure mode where LRA incorrectly processed clobber patterns on registers that were intended as inputs for thes…

Filed Under: SHregister allocationtarget specific