Landing: bbf1dfa9da86

Project / Subsystem

gcc / match.pd

Date

2026-07-29

Author

Kyrylo Tkachov

Commit

bbf1dfa9da862caadf97ebf9a21b877b1553dbf4

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
match.pd
patch_id
—
commit_hash
bbf1dfa9da862caadf97ebf9a21b877b1553dbf4
source_type
github
headline
Combine vector comparisons against zero
tldr
Optimizes vector comparisons by combining pairs of comparisons against zero.
author
Kyrylo Tkachov
outcome
committed
performance_win
true
breaking_change
false
series_id
—
series_parts
[]
tags
  • • optimization
  • • vectorization
  • • pattern matching
  • • SIMD
discussion_id_link
—
bugzilla_pr
—
date
2026-07-29T00:00:00.000Z

This commit introduces optimizations for vector comparisons in GCC’s match.pd pattern matching system. It combines pairs of vector comparisons against zero, leveraging the identity (A == 0) & (B == 0) <=> (A | B) == 0. This applies to both equality and inequality, and handles cases where operands differ in signedness. The optimization is demonstrated with an aarch64 example and includes a new test case.