gnu.cfg: Add support for __glibc_likely() and __glibc_unlikely() (#2267)
Reference: https://sourceware.org/glibc/wiki/Style_and_Conventions#Branch_Prediction
This commit is contained in:
parent
4e49b14721
commit
0527b80174
|
@ -48,6 +48,8 @@
|
||||||
<define name="__builtin_signbit(value)" value="signbit(value)"/>
|
<define name="__builtin_signbit(value)" value="signbit(value)"/>
|
||||||
<define name="__extension__" value=""/>
|
<define name="__extension__" value=""/>
|
||||||
<define name="__typeof__(T)" value="typeof(T)"/>
|
<define name="__typeof__(T)" value="typeof(T)"/>
|
||||||
|
<define name="__glibc_unlikely(x)" value="(x)"/>
|
||||||
|
<define name="__glibc_likely(x)" value="(x)"/>
|
||||||
<!-- void *__builtin_alloca (size_t size) -->
|
<!-- void *__builtin_alloca (size_t size) -->
|
||||||
<!-- alloca() is often defined as __builtin_alloca() so the define above does not work always -->
|
<!-- alloca() is often defined as __builtin_alloca() so the define above does not work always -->
|
||||||
<!-- void *alloca(size_t size); -->
|
<!-- void *alloca(size_t size); -->
|
||||||
|
|
|
@ -114,6 +114,8 @@ void valid_code(int argInt1, va_list valist_arg, int * parg)
|
||||||
|
|
||||||
if (__builtin_expect(argInt1, 0)) {}
|
if (__builtin_expect(argInt1, 0)) {}
|
||||||
if (__builtin_expect_with_probability(argInt1 + 1, 2, 0.5)) {}
|
if (__builtin_expect_with_probability(argInt1 + 1, 2, 0.5)) {}
|
||||||
|
if (__glibc_unlikely(argInt1)) {}
|
||||||
|
if (__glibc_likely(parg)) {}
|
||||||
void *ax1 = __builtin_assume_aligned(parg, 16);
|
void *ax1 = __builtin_assume_aligned(parg, 16);
|
||||||
printf("%p", ax1);
|
printf("%p", ax1);
|
||||||
void *ax2 = __builtin_assume_aligned(parg, 32, 8);
|
void *ax2 = __builtin_assume_aligned(parg, 32, 8);
|
||||||
|
|
Loading…
Reference in New Issue