[Bug middle-end/112398] New: Suboptimal code generation for xor pattern on subword data
lis8215 at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sun Nov 5 22:02:17 GMT 2023
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112398
Bug ID: 112398
Summary: Suboptimal code generation for xor pattern on subword
data
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: lis8215 at gmail dot com
Target Milestone: ---
These minimal examples showcase the issue:
uint8_t neg8 (const uint8_t *src)
{
return ~*src;
// or return *src ^ 0xff;
}
uint16_t neg16 (const uint16_t *src)
{
return ~*src;
// or return *src ^ 0xffff;
}
GCC transforms xor here to not + zero_extend, which isn't the best choice.
I guess combiner have to try xor pattern instead of not + zero_extend as it
might be cheaper.
More information about the Gcc-bugs
mailing list