[Bug c/106138] New: Inefficient code generation for cases when results can be deduced at compile time
pavel.morozkin at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Jun 29 13:28:57 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106138
Bug ID: 106138
Summary: Inefficient code generation for cases when results can
be deduced at compile time
Product: gcc
Version: 12.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: pavel.morozkin at gmail dot com
Target Milestone: ---
_Bool f(char x)
{
_Bool b1 = x == 4;
_Bool b2 = x & 0x3;
return b1 && b2;
}
Invocation: gcc -O3
Actual generated code:
f:
test dil, 3
setne al
cmp dil, 4
sete dl
and eax, edx
ret
Expected generated code:
f:
xor eax, eax
ret
The Summary needs to be adjusted perhaps.
More information about the Gcc-bugs
mailing list