Landing: fb21f1686938

Project / Subsystem

gcc / middle-end

Date

2026-09-07

Author

Roger Sayle

Commit

fb21f1686938d6cca13fa7efd9f94830a7a6ef04

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
middle-end
patch_id
—
commit_hash
fb21f1686938d6cca13fa7efd9f94830a7a6ef04
source_type
github
headline
Middle-end: Improve bitreverse RTL expansion with AOP
tldr
New optab improves bitwise operations by allowing backends to choose optimal instructions.
author
Roger Sayle
outcome
committed
performance_win
true
breaking_change
false
series_id
—
series_parts
[]
tags
  • • optimization
  • • middle-end
  • • RISC-V
  • • x86
  • • AVR
discussion_id_link
—
bugzilla_pr
—
date
2026-09-07T00:00:00.000Z

This patch enhances the RTL expansion for bitreverse and store_fixed_bitfield operations by introducing a new aop_optab. This aop_optab allows target backends to precisely choose between bitwise OR, XOR, or addition instructions, leading to better code generation on various architectures like x86, RISC-V, and AVR. Previously, the expansion relied on a generic PLUS or IOR that might not be optimal. This change provides finer control, yielding more efficient code, as demonstrated by an improved x86_64 expansion for a struct assignment.