summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2013-02-23 09:52:40 +0100
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2013-03-14 22:49:25 +0100
commitd1e51157725a4defd46c298ce1026d0f5d48da3c (patch)
tree6684eec44d1846c7eeb1ce48b383203a8058b78b
parent950fcf0f68732a9aafacb5dfd33e7a7612141722 (diff)
libc: switch several users to unlikely()
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
-rw-r--r--libc/sysdeps/linux/arm/sysdep.h2
-rw-r--r--libc/sysdeps/linux/c6x/bits/syscalls.h2
-rw-r--r--libc/sysdeps/linux/common/__rt_sigtimedwait.c4
-rw-r--r--libc/sysdeps/linux/common/sigprocmask.c8
-rw-r--r--libc/sysdeps/linux/frv/bits/syscalls.h6
-rw-r--r--libc/sysdeps/linux/ia64/bits/atomic.h6
-rw-r--r--libc/sysdeps/linux/powerpc/bits/syscalls.h2
-rw-r--r--libc/sysdeps/linux/sparc/bits/atomic.h4
8 files changed, 16 insertions, 18 deletions
diff --git a/libc/sysdeps/linux/arm/sysdep.h b/libc/sysdeps/linux/arm/sysdep.h
index 467f29135..d4a86d3b8 100644
--- a/libc/sysdeps/linux/arm/sysdep.h
+++ b/libc/sysdeps/linux/arm/sysdep.h
@@ -253,7 +253,7 @@ __local_syscall_error: \
#undef INLINE_SYSCALL
#define INLINE_SYSCALL(name, nr, args...) \
({ unsigned int _inline_sys_result = INTERNAL_SYSCALL (name, , nr, args); \
- if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_inline_sys_result, ), 0)) \
+ if (unlikely (INTERNAL_SYSCALL_ERROR_P (_inline_sys_result, ))) \
{ \
__set_errno (INTERNAL_SYSCALL_ERRNO (_inline_sys_result, )); \
_inline_sys_result = (unsigned int) -1; \
diff --git a/libc/sysdeps/linux/c6x/bits/syscalls.h b/libc/sysdeps/linux/c6x/bits/syscalls.h
index 1bebb003c..70b708d70 100644
--- a/libc/sysdeps/linux/c6x/bits/syscalls.h
+++ b/libc/sysdeps/linux/c6x/bits/syscalls.h
@@ -37,7 +37,7 @@
#undef INLINE_SYSCALL
#define INLINE_SYSCALL(name, nr, args...) \
({ unsigned int _inline_sys_result = INTERNAL_SYSCALL (name, , nr, args); \
- if (__builtin_expect (INTERNAL_SYSCALL_ERROR_P (_inline_sys_result, ), 0)) \
+ if (unlikely (INTERNAL_SYSCALL_ERROR_P (_inline_sys_result, ))) \
{ \
__set_errno (INTERNAL_SYSCALL_ERRNO (_inline_sys_result, )); \
_inline_sys_result = (unsigned int) -1; \
diff --git a/libc/sysdeps/linux/common/__rt_sigtimedwait.c b/libc/sysdeps/linux/common/__rt_sigtimedwait.c
index b45f5df1b..422a95201 100644
--- a/libc/sysdeps/linux/common/__rt_sigtimedwait.c
+++ b/libc/sysdeps/linux/common/__rt_sigtimedwait.c
@@ -28,9 +28,9 @@ int __NC(sigtimedwait)(const sigset_t *set, siginfo_t *info,
# ifdef SIGCANCEL
sigset_t tmpset;
- if (set != NULL && (__builtin_expect (__sigismember (set, SIGCANCEL), 0)
+ if (set != NULL && (unlikely (__sigismember (set, SIGCANCEL))
# ifdef SIGSETXID
- || __builtin_expect (__sigismember (set, SIGSETXID), 0)
+ || unlikely (__sigismember (set, SIGSETXID))
# endif
))
{
diff --git a/libc/sysdeps/linux/common/sigprocmask.c b/libc/sysdeps/linux/common/sigprocmask.c
index 6eaf5fb3a..efe440fde 100644
--- a/libc/sysdeps/linux/common/sigprocmask.c
+++ b/libc/sysdeps/linux/common/sigprocmask.c
@@ -35,9 +35,9 @@ int sigprocmask(int how, const sigset_t * set, sigset_t * oldset)
* The only thing we have to make sure here is that SIGCANCEL and
* SIGSETXID are not blocked.
*/
- if (set != NULL && (__builtin_expect (__sigismember (set, SIGCANCEL), 0)
+ if (set != NULL && (unlikely (__sigismember (set, SIGCANCEL))
# ifdef SIGSETXID
- || __builtin_expect (__sigismember (set, SIGSETXID), 0)
+ || unlikely (__sigismember (set, SIGSETXID))
# endif
))
{
@@ -70,9 +70,9 @@ int sigprocmask(int how, const sigset_t * set, sigset_t * oldset)
* The only thing we have to make sure here is that SIGCANCEL and
* SIGSETXID are not blocked.
*/
- if (set != NULL && (__builtin_expect (__sigismember (set, SIGCANCEL), 0)
+ if (set != NULL && (unlikely (__sigismember (set, SIGCANCEL))
# ifdef SIGSETXID
- || __builtin_expect (__sigismember (set, SIGSETXID), 0)
+ || unlikely (__sigismember (set, SIGSETXID))
# endif
))
{
diff --git a/libc/sysdeps/linux/frv/bits/syscalls.h b/libc/sysdeps/linux/frv/bits/syscalls.h
index eea3050ba..b1f532040 100644
--- a/libc/sysdeps/linux/frv/bits/syscalls.h
+++ b/libc/sysdeps/linux/frv/bits/syscalls.h
@@ -15,8 +15,7 @@
# define __syscall_return(type, res) \
do { \
unsigned long __sr2 = (res); \
- if (__builtin_expect ((unsigned long)(__sr2) \
- >= (unsigned long)(-4095), 0)) { \
+ if (unlikely ((unsigned long)(__sr2) >= (unsigned long)(-4095))) { \
extern int __syscall_error (int); \
return (type) __syscall_error (__sr2); \
} \
@@ -26,8 +25,7 @@ do { \
# define __syscall_return(type, res) \
do { \
unsigned long __sr2 = (res); \
- if (__builtin_expect ((unsigned long)(__sr2) \
- >= (unsigned long)(-4095), 0)) { \
+ if (unlikely ((unsigned long)(__sr2) >= (unsigned long)(-4095))) { \
__set_errno (-__sr2); \
__sr2 = -1; \
} \
diff --git a/libc/sysdeps/linux/ia64/bits/atomic.h b/libc/sysdeps/linux/ia64/bits/atomic.h
index d719f0eac..1b6ee2b57 100644
--- a/libc/sysdeps/linux/ia64/bits/atomic.h
+++ b/libc/sysdeps/linux/ia64/bits/atomic.h
@@ -91,12 +91,12 @@ typedef uintmax_t uatomic_max_t;
do \
{ \
__oldval = __val; \
- if (__builtin_expect (__val <= 0, 0)) \
+ if (unlikely (__val <= 0)) \
break; \
__val = atomic_compare_and_exchange_val_acq (__memp, __oldval - 1, \
__oldval); \
} \
- while (__builtin_expect (__val != __oldval, 0)); \
+ while (unlikely (__val != __oldval)); \
__oldval; })
#define atomic_bit_test_set(mem, bit) \
@@ -112,7 +112,7 @@ typedef uintmax_t uatomic_max_t;
__oldval | __mask, \
__oldval); \
} \
- while (__builtin_expect (__val != __oldval, 0)); \
+ while (unlikely (__val != __oldval)); \
__oldval & __mask; })
#define atomic_full_barrier() __sync_synchronize ()
diff --git a/libc/sysdeps/linux/powerpc/bits/syscalls.h b/libc/sysdeps/linux/powerpc/bits/syscalls.h
index 026bbf2af..c52d5dd5b 100644
--- a/libc/sysdeps/linux/powerpc/bits/syscalls.h
+++ b/libc/sysdeps/linux/powerpc/bits/syscalls.h
@@ -167,7 +167,7 @@
}) \
)
# define INTERNAL_SYSCALL_ERROR_P(val, err) \
- ((void) (val), __builtin_expect ((err) & (1 << 28), 0))
+ ((void) (val), unlikely ((err) & (1 << 28)))
# define INTERNAL_SYSCALL_ERRNO(val, err) (val)
diff --git a/libc/sysdeps/linux/sparc/bits/atomic.h b/libc/sysdeps/linux/sparc/bits/atomic.h
index 7c2cabaa4..4941c038b 100644
--- a/libc/sysdeps/linux/sparc/bits/atomic.h
+++ b/libc/sysdeps/linux/sparc/bits/atomic.h
@@ -289,11 +289,11 @@ volatile unsigned char __sparc32_atomic_locks[64]
__typeof (*(mem)) __acev_wval = (newval); \
do \
__acev_wret = *__acev_wmemp; \
- while (__builtin_expect \
+ while (unlikely \
(__v9_compare_and_exchange_val_32_acq (__acev_wmemp,\
__acev_wval, \
__acev_wret) \
- != __acev_wret, 0)); \
+ != __acev_wret)); \
} \
else \
__acev_wret = __v7_exchange_acq (mem, newval); \