--- Comment #8 from pinskia at gmail dot com 2010-08-25 12:43 ---
Subject: Re: __builtin_expect and -Os generates stupid code
On Aug 25, 2010, at 5:23 AM, "socketpair at gmail dot com"
wrote:
>
>
> --- Comment #7 from socketpair at gmail dot com 2010-08-25
> 12:23 ---
>
On Aug 25, 2010, at 5:23 AM, "socketpair at gmail dot com" > wrote:
--- Comment #7 from socketpair at gmail dot com 2010-08-25
12:23 ---
Well, I understand that problem is not in __builtin_expect.
Should I open new, separate bug about block reordering and
generating "jmp to
--- Comment #7 from socketpair at gmail dot com 2010-08-25 12:23 ---
Well, I understand that problem is not in __builtin_expect.
Should I open new, separate bug about block reordering and generating "jmp to
next line" ?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45340
--- Comment #6 from pinskia at gcc dot gnu dot org 2010-08-25 11:24 ---
Change:
__asm__ volatile ("":::"memory");
To:
__asm__ volatile ("#clobber mem":::"memory");
And you will see there is an instruction which GCC thinks is there.
Again this has nothing to do with __builtin_expect exc
--- Comment #5 from socketpair at gmail dot com 2010-08-24 03:35 ---
> There is nothing the compiler can do really.
Why ?
I compared assembler listings with likely() swapped with unlikely(). As I
suggest, it helps to choose between je and jne in each case, and other
circumstances are not
--- Comment #4 from pinskia at gcc dot gnu dot org 2010-08-23 19:12 ---
jne .L6
jmp .L7
.L8:
#APP
# 18 "t.c" 1
#mem
# 0 "" 2
#NO_APP
.L6:
--- CUT ---
I added #mem inside the inline-asm which is empty and got the above code.
Which means that the inline-
--- Comment #3 from socketpair at gmail dot com 2010-08-19 14:28 ---
Created an attachment (id=21521)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21521&action=view)
without buggy jmp
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45340
--- Comment #2 from socketpair at gmail dot com 2010-08-19 14:28 ---
Created an attachment (id=21520)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21520&action=view)
with stupid jmp
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45340
--- Comment #1 from socketpair at gmail dot com 2010-08-19 14:17 ---
Created an attachment (id=21519)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=21519&action=view)
C souce file
1. gcc-Os --save-temps -fomit-frame-pointer -fno-stack-protector main.c
2. gcc -DCOOL -Os --s