Landing: 7f02676a414e

Project / Subsystem

gcc / match-sat-alu.pd

Date

2026-09-14

Author

Kyrylo Tkachov

Commit

7f02676a414e4a96c498c0b3e58487aca3c45185

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
match-sat-alu.pd
patch_id
—
commit_hash
7f02676a414e4a96c498c0b3e58487aca3c45185
source_type
github
headline
match-sat-alu.pd: Recognize signed constant-clamp truncation
tldr
GCC can now optimize signed saturating truncation that results from clamping a value to the bounds of a narrower signed type.
author
Kyrylo Tkachov
outcome
committed
performance_win
true
breaking_change
false
series_id
—
series_parts
[]
tags
  • • optimization
  • • gcc
  • • aarch64
discussion_id_link
—
bugzilla_pr
—
date
2026-09-14T00:00:00.000Z

GCC’s match-sat-alu.pd pattern matcher now recognizes signed saturating truncation that occurs when a value is clamped to the bounds of a narrower signed integer type. This optimization handles both orders of MIN and MAX operations used for clamping, enabling more efficient code generation. An AArch64 example shows a significant reduction from multiple instructions to a single sqxtn instruction.