[Bug middle-end/42233] [4.3/4.4/4.5 regression] c++ builtin_expect code generation regression
jakub at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Thu Feb 18 12:30:00 GMT 2010
------- Comment #7 from jakub at gcc dot gnu dot org 2010-02-18 12:30 -------
On the 4.4 branch actually cc1 behaves differently from cc1plus.
In any case, I believe the two setne's plus testb code is actually the worst
of the options, and e.g. with -Os it is even much larger.
Just compile the testcase on 4.5 with -Os and -Os -D'__builtin_expect(a,b)=(a)'
In the former case (i.e. with __builtin_expect) if generates:
cmpq %rcx, %rdx
sete %dl
xorl %eax, %eax
cmpq %rsi, %rdi
movzbl %dl, %edx
sete %al
testl %eax, %edx
je .L2
xorl %eax, %eax
jmp likely
.L2:
xorl %eax, %eax
jmp unlikely
while in the latter case generates:
cmpq %rcx, %rdx
jne .L2
cmpq %rsi, %rdi
jne .L2
xorl %eax, %eax
jmp likely
.L2:
xorl %eax, %eax
jmp unlikely
(what would be actually the best code for -O2 when __builtin_expect is used and
tells that likely () is likely).
--
jakub at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bonzini at gnu dot org
Known to work|4.1.2 4.5.0 |4.1.2
Summary|[4.3/4.4 regression] c++ |[4.3/4.4/4.5 regression] c++
|builtin_expect code |builtin_expect code
|generation regression |generation regression
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42233
More information about the Gcc-bugs
mailing list