Commit 5b7ada46e5eca0fa9c94def7d5fa548590fac826
1 parent
e95f5491
Only use __builtin_* with GCC >= 3.4
Fix gcc 3.3 builds, broken in revision 5465. Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@5466 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
8 additions
and
8 deletions
host-utils.h
... | ... | @@ -51,7 +51,7 @@ void mulu64(uint64_t *phigh, uint64_t *plow, uint64_t a, uint64_t b); |
51 | 51 | |
52 | 52 | static always_inline int clz32(uint32_t val) |
53 | 53 | { |
54 | -#if defined(__GNUC__) | |
54 | +#if defined(__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) | |
55 | 55 | if (val) |
56 | 56 | return __builtin_clz(val); |
57 | 57 | else |
... | ... | @@ -93,7 +93,7 @@ static always_inline int clo32(uint32_t val) |
93 | 93 | |
94 | 94 | static always_inline int clz64(uint64_t val) |
95 | 95 | { |
96 | -#if defined(__GNUC__) | |
96 | +#if defined(__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) | |
97 | 97 | if (val) |
98 | 98 | return __builtin_clzll(val); |
99 | 99 | else |
... | ... | @@ -118,7 +118,7 @@ static always_inline int clo64(uint64_t val) |
118 | 118 | |
119 | 119 | static always_inline int ctz32 (uint32_t val) |
120 | 120 | { |
121 | -#if defined(__GNUC__) | |
121 | +#if defined(__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) | |
122 | 122 | if (val) |
123 | 123 | return __builtin_ctz(val); |
124 | 124 | else |
... | ... | @@ -162,7 +162,7 @@ static always_inline int cto32 (uint32_t val) |
162 | 162 | |
163 | 163 | static always_inline int ctz64 (uint64_t val) |
164 | 164 | { |
165 | -#if defined(__GNUC__) | |
165 | +#if defined(__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) | |
166 | 166 | if (val) |
167 | 167 | return __builtin_ctz(val); |
168 | 168 | else |
... | ... | @@ -206,7 +206,7 @@ static always_inline int ctpop16 (uint16_t val) |
206 | 206 | |
207 | 207 | static always_inline int ctpop32 (uint32_t val) |
208 | 208 | { |
209 | -#if defined(__GNUC__) | |
209 | +#if defined(__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) | |
210 | 210 | return __builtin_popcount(val); |
211 | 211 | #else |
212 | 212 | val = (val & 0x55555555) + ((val >> 1) & 0x55555555); |
... | ... | @@ -221,7 +221,7 @@ static always_inline int ctpop32 (uint32_t val) |
221 | 221 | |
222 | 222 | static always_inline int ctpop64 (uint64_t val) |
223 | 223 | { |
224 | -#if defined(__GNUC__) | |
224 | +#if defined(__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) | |
225 | 225 | return __builtin_popcountll(val); |
226 | 226 | #else |
227 | 227 | val = (val & 0x5555555555555555ULL) + ((val >> 1) & 0x5555555555555555ULL); | ... | ... |
hw/apic.c
... | ... | @@ -107,7 +107,7 @@ static void apic_update_irq(APICState *s); |
107 | 107 | /* Find first bit starting from msb */ |
108 | 108 | static int fls_bit(uint32_t value) |
109 | 109 | { |
110 | -#if defined(__GNUC__) | |
110 | +#if defined(__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) | |
111 | 111 | return 31 - __builtin_clz(value); |
112 | 112 | #else |
113 | 113 | unsigned int ret = 0; |
... | ... | @@ -127,7 +127,7 @@ static int fls_bit(uint32_t value) |
127 | 127 | /* Find first bit starting from lsb */ |
128 | 128 | static int ffs_bit(uint32_t value) |
129 | 129 | { |
130 | -#if defined(__GNUC__) | |
130 | +#if defined(__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) | |
131 | 131 | return __builtin_ffs(value) - 1; |
132 | 132 | #else |
133 | 133 | unsigned int ret = 0; | ... | ... |