Landing: 1743c12e3512

Project / Subsystem

gcc / match

Date

2026-05-19

Author

Eikansh Gupta

Commit

1743c12e3512bff3c9688dff7bba5b2ac43cd9d5

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
match
patch_id
—
commit_hash
1743c12e3512bff3c9688dff7bba5b2ac43cd9d5
source_type
github
headline
MATCH: Simplify min(clz/ctz) to clz/ctz of bitwise OR.
tldr
Simplifies min(clz(x), clz(y)) to clz(x | y) and min(ctz(x), ctz(y)) to ctz(x | y) in MATCH.
author
Eikansh Gupta
outcome
committed
performance_win
true
breaking_change
false
series_id
—
series_parts
[]
tags
  • • optimization
  • • match.pd
  • • clz
  • • ctz
discussion_id_link
—
bugzilla_pr
—
date
2026-05-19T00:00:00.000Z

This commit introduces new simplification patterns to the GCC MATCH (Machine Description) system. It allows the compiler to replace expressions like min(clz(x), clz(y)) with clz(x | y) and min(ctz(x), ctz(y)) with ctz(x | y). This optimization can lead to more efficient code by reducing the number of operations required.