Landing: 50adb5bb87d4

Project / Subsystem

gcc / gcc

Date

2026-05-08

Author

Jeff Law

Commit

50adb5bb87d434467cf8d41b561a649db2473543

Source

github

Perf win

Yes

Breaking

No

All attributes

project
gcc
subsystem
gcc
patch_id
commit_hash
50adb5bb87d434467cf8d41b561a649db2473543
source_type
github
headline
Simplify-rtx: Handle (X & C) | ((X^Y) & ~C) -> X ^ (Y & ~C) transformation.
tldr
Extends simplify-rtx to handle the expression `(X & C) | ((X^Y) & ~C)` and simplify it to `X ^ (Y & ~C)`, resulting in optimized code.
author
Jeff Law
outcome
committed
performance_win
true
breaking_change
false
series_id
series_parts
[]
tags
  • optimization
  • rtl
  • risc-v
discussion_id_link
bugzilla_pr
date
2026-05-08T00:00:00.000Z

This commit generalizes existing code in simplify-rtx.cc to handle the expression (X & C) | ((X^Y) & ~C) and simplify it to X ^ (Y & ~C). This transformation improves code generation by replacing a sequence of logical operations with a single XOR operation, particularly on RISC-V. A new test case validates the optimization.