Landing: 0e4fe83c0679

Project / Subsystem

gcc / gcc/optabs

Date

2026-06-06

Author

Richard Sandiford

Commit

0e4fe83c0679b656123832140964dc1ecef77d1c

Source

github

Perf win

No

Breaking

No

All attributes

project
gcc
subsystem
gcc/optabs
patch_id
commit_hash
0e4fe83c0679b656123832140964dc1ecef77d1c
source_type
github
headline
Correct can_open_code_p handling of abs and neg operations
tldr
GCC's `can_open_code_p` now correctly identifies whether absolute value and negation operations can be generated as open code, resolving an inconsistency in ho…
author
Richard Sandiford
outcome
committed
performance_win
false
breaking_change
false
series_id
series_parts
[]
tags
  • optimization
  • code generation
  • bugfix
discussion_id_link
bugzilla_pr
date
2026-06-06T00:00:00.000Z

The can_open_code_p function in GCC, which determines if an operation can be implemented directly by the compiler without relying on a library call, previously used can_implement_p for abs and neg operations. This was semantically incorrect because can_implement_p checks for any implementation, including library functions, rather than strictly open code. This commit updates optabs-query.cc to ensure can_open_code_p consistently uses itself when querying for AND and XOR, matching the intended behavior for open-coded operations.