From: James Antill <james@and.org>
To: Andi Kleen <ak@suse.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Linux 2.4.10-pre11 -- __builtin_expect
Date: 26 Sep 2001 19:54:59 -0400 [thread overview]
Message-ID: <nn3d59qzho.fsf@code.and.org> (raw)
In-Reply-To: <20010918031813.57E1062ABC@oscar.casa.dyndns.org.suse.lists.linux.kernel> <E15jBLy-0008UF-00@the-village.bc.nu.suse.lists.linux.kernel> <9o6j9l$461$1@cesium.transmeta.com.suse.lists.linux.kernel> <oup4rq0bwww.fsf_-_@pigdrop.muc.suse.de> <jeelp4rbtf.fsf@sykes.suse.de> <20010918143827.A16003@gruyere.muc.suse.de>
In-Reply-To: <20010918143827.A16003@gruyere.muc.suse.de>
Andi Kleen <ak@suse.de> writes:
> Good point. I somehow assumed that __builtin_expect would just signify
> a boolean, but if I read gcc source correctly this was wrong.
Yeh, it's a long so you'll get no cast warnings too.
> Here is an updated patch.
[snip ... ]
> --- include/linux/kernel.h-LIKELY Tue Sep 18 11:12:20 2001
> +++ include/linux/kernel.h Tue Sep 18 14:35:17 2001
> @@ -171,4 +171,14 @@
> char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */
> };
>
> +
> +/* This loses on a few early 2.96 snapshots, but hopefully nobody uses them anymore. */
> +#if __GNUC__ > 2 || (__GNUC__ == 2 && _GNUC_MINOR__ == 96)
> +#define likely(x) __builtin_expect(!!(x), 1)
> +#define unlikely(x) __builtin_expect((x), 0)
unlikely() also needs to be...
#define unlikely(x) __builtin_expect(!(x), 1)
...or...
#define unlikely(x) __builtin_expect(!!(x), 0)
> +#else
> +#define likely(x) (x)
> +#define unlikely(x) (x)
> +#endif
> +
> #endif
--
# James Antill -- james@and.org
:0:
* ^From: .*james@and\.org
/dev/null
next prev parent reply other threads:[~2001-09-26 23:55 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20010918031813.57E1062ABC@oscar.casa.dyndns.org.suse.lists.linux.kernel>
[not found] ` <E15jBLy-0008UF-00@the-village.bc.nu.suse.lists.linux.kernel>
[not found] ` <9o6j9l$461$1@cesium.transmeta.com.suse.lists.linux.kernel>
2001-09-18 10:44 ` Linux 2.4.10-pre11 -- __builtin_expect Andi Kleen
2001-09-18 11:13 ` Andreas Schwab
2001-09-18 12:38 ` Andi Kleen
2001-09-26 23:54 ` James Antill [this message]
2001-09-27 12:51 ` Andreas Schwab
2001-09-27 15:41 ` James Antill
2001-09-27 16:28 ` Andreas Schwab
2001-10-04 18:52 ` Richard Henderson
2001-10-08 6:17 ` James Antill
2001-09-18 20:11 ` Horst von Brand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=nn3d59qzho.fsf@code.and.org \
--to=james@and.org \
--cc=ak@suse.de \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.