Landing: 02b0226f9f8a

Project / Subsystem

gcc / match-sat-alu.pd

Date

2026-09-14

Author

Kyrylo Tkachov

Commit

02b0226f9f8ac1face83c096b6e783e5c8956f6a

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
match-sat-alu.pd
patch_id
—
commit_hash
02b0226f9f8ac1face83c096b6e783e5c8956f6a
source_type
github
headline
match-sat-alu.pd: Recognize unsigned constant-clamp truncation
tldr
GCC can now optimize unsigned saturating truncation resulting from clamping a signed value to the bounds of a narrower unsigned 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 has been extended to recognize unsigned saturating truncation when a signed value is clamped to the range of a narrower unsigned type. This optimization handles nested MIN and MAX operations in either order and can replace complex sequences with a single uqxtn instruction on architectures like AArch64, as shown in an example.