Landing: 01d1d20266a4

Project / Subsystem

gcc / match.pd

Date

2026-07-13

Author

Odysseas Georgoudis

Commit

01d1d20266a4c1f02457dd9df1b25a733d701466

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
match.pd
patch_id
commit_hash
01d1d20266a4c1f02457dd9df1b25a733d701466
source_type
github
headline
Recognize branchless conditional negate and absolute value idioms.
tldr
Compiler can now optimize branchless conditional negate and absolute value patterns into single instructions.
author
Odysseas Georgoudis
outcome
committed
performance_win
true
breaking_change
false
series_id
series_parts
[]
tags
  • optimization
  • compiler
discussion_id_link
bugzilla_pr
date
2026-07-13T00:00:00.000Z

The match.pd pattern matching system has been enhanced to recognize and optimize specific arithmetic idioms. It can now identify branchless conditional negate patterns (e.g., (x ^ -cmp) + cmp when cmp is 0 or 1) and fold them into a single conditional negate instruction. Additionally, it recognizes sign-test based absolute value expressions, exposing them as ABS_EXPR for further optimization.