Landing: a33f26607eb4

Project / Subsystem

gcc / gcc

Date

2026-07-19

Author

Jeff Law

Commit

a33f26607eb4f3e3d68e575a0395401c940cf1c7

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
gcc
patch_id
commit_hash
a33f26607eb4f3e3d68e575a0395401c940cf1c7
source_type
github
headline
Improve select across A/A OP C where C is 2^n
tldr
GCC opts for a more specialized instruction sequence for conditional adds on loongarch.
author
Jeff Law
outcome
committed
performance_win
true
breaking_change
false
series_id
series_parts
[]
tags
  • optimization
  • loongarch
  • compiler
discussion_id_link
bugzilla_pr
date
2026-07-19T00:00:00.000Z

This commit enhances GCC’s ability to generate conditional zero-based sequences for operations where one operand is a constant power of two. This often results in better code than generalized conditional moves. The change specifically addresses a regression on loongarch by favoring a specialized instruction sequence for conditional adds, ensuring better performance characteristics for that architecture. The optimization is applicable to various arithmetic and logical operations where zero is a neutral operand.