Landing: 431068af077e

Project / Subsystem

gcc / vect-patterns

Date

2026-09-02

Author

Jakub Jelinek

Commit

431068af077e13f0113f3640385b7b6cfa0a3e68

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
vect-patterns
patch_id
—
commit_hash
431068af077e13f0113f3640385b7b6cfa0a3e68
source_type
github
headline
Vector pattern matching handles non-mode precision types for popcount/clz/ctz.
tldr
Fixes vectorization pattern matching for bit integer types to correctly handle operations like popcount, clz, and ctz.
author
Jakub Jelinek
outcome
committed
performance_win
false
breaking_change
false
series_id
—
series_parts
[]
tags
  • • vectorization
  • • compiler
  • • aarch64
  • • bit-integers
discussion_id_link
—
bugzilla_pr
—
date
2026-09-02T00:00:00.000Z

This commit corrects the vectorization pattern matching for built-in functions such as popcount, clz, ctz, and ffs when used with non-standard integer types (like _BitInt). Previously, the pattern matching in vect_recog_popcount_clz_ctz_ffs_pattern did not adequately check for type_has_mode_precision_p, leading to incorrect vectorization and miscompilation on architectures like AArch64. The fix ensures that these operations are correctly matched by casting to the appropriate vector type, thus preserving padding bit behavior and resolving PR 127149.