/*********************************************************
- * Copyright (C) 2003-2020 VMware, Inc. All rights reserved.
+ * Copyright (C) 2003-2021 VMware, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* **********************************************************
*/
-#if __GNUC__ < 4
-#define FEWER_BUILTINS
-#endif
-
static INLINE int
lssb32_0(uint32 v)
{
return __builtin_ffs(value) - 1;
}
-#ifndef FEWER_BUILTINS
static INLINE int
mssb32_0(uint32 value)
{
#endif
return __builtin_ffsll(value) - 1;
}
-#endif /* !FEWER_BUILTINS */
-
-#ifdef FEWER_BUILTINS
-/* GCC 3.3.x does not like __bulitin_clz or __builtin_ffsll. */
-static INLINE int
-mssb32_0(uint32 value)
-{
- if (UNLIKELY(value == 0)) {
- return -1;
- } else {
- int pos;
- __asm__ __volatile__("bsrl %1, %0\n" : "=r" (pos) : "rm" (value) : "cc");
- return pos;
- }
-}
-
-static INLINE int
-lssb64_0(const uint64 value)
-{
- if (UNLIKELY(value == 0)) {
- return -1;
- } else {
- intptr_t pos;
-
-#ifdef VM_X86_64
- __asm__ __volatile__("bsf %1, %0\n" : "=r" (pos) : "rm" (value) : "cc");
-#else
- /* The coding was chosen to minimize conditionals and operations */
- pos = lssb32_0((uint32) value);
- if (pos == -1) {
- pos = lssb32_0((uint32) (value >> 32));
- if (pos != -1) {
- return pos + 32;
- }
- }
-#endif /* VM_X86_64 */
- return pos;
- }
-}
-#endif /* FEWER_BUILTINS */
static INLINE int
static INLINE unsigned
PopCount32(uint32 value)
{
-#if defined(__GNUC__) && !defined(FEWER_BUILTINS) && defined(__POPCNT__)
+#if defined(__GNUC__) && defined(__POPCNT__)
return __builtin_popcount(value);
#else
/*
static INLINE unsigned
PopCount64(uint64 value)
{
-#if defined(__GNUC__) && !defined(FEWER_BUILTINS) && defined(__POPCNT__)
+#if defined(__GNUC__) && defined(__POPCNT__)
#if defined(VM_X86_64)
return __builtin_popcountll(value);
#else
/*********************************************************
- * Copyright (C) 1998-2019 VMware, Inc. All rights reserved.
+ * Copyright (C) 1998-2021 VMware, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
*-----------------------------------------------------------------------------
*/
-#if defined(__GNUC__) && \
- (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) && \
- !defined(MUL64_NO_ASM)
+#if defined(__GNUC__) && !defined(MUL64_NO_ASM)
static INLINE uint64
Mul64x3264(uint64 multiplicand, uint32 multiplier, uint32 shift)
*-----------------------------------------------------------------------------
*/
-#if defined(__GNUC__) && \
- (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)) && \
- !defined(MUL64_NO_ASM)
+#if defined(__GNUC__) && !defined(MUL64_NO_ASM)
static INLINE int64
Muls64x32s64(int64 multiplicand, uint32 multiplier, uint32 shift)
/*********************************************************
- * Copyright (C) 2003-2020 VMware, Inc. All rights reserved.
+ * Copyright (C) 2003-2021 VMware, Inc. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
#ifdef __GNUC__
-#ifndef sun
-
-/*
- * A bug in __builtin_frame_address was discovered in gcc 4.1.1, and
- * fixed in 4.2.0; assume it originated in 4.0. PR 147638 and 554369.
- */
-#if !(__GNUC__ == 4 && (__GNUC_MINOR__ == 0 || __GNUC_MINOR__ == 1))
#define GetFrameAddr() __builtin_frame_address(0)
-#endif
-
-#endif // sun
#endif // __GNUC__
-/*
- * Data prefetch was added in gcc 3.1.1
- * http://www.gnu.org/software/gcc/gcc-3.1/changes.html
- */
#ifdef __GNUC__
-# if ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ > 1) || \
- (__GNUC__ == 3 && __GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ >= 1))
-# define PREFETCH_R(var) __builtin_prefetch((var), 0 /* read */, \
- 3 /* high temporal locality */)
-# define PREFETCH_W(var) __builtin_prefetch((var), 1 /* write */, \
- 3 /* high temporal locality */)
-# else
-# define PREFETCH_R(var) ((void)(var))
-# define PREFETCH_W(var) ((void)(var))
-# endif
+# define PREFETCH_R(var) __builtin_prefetch((var), 0 /* read */, \
+ 3 /* high temporal locality */)
+# define PREFETCH_W(var) __builtin_prefetch((var), 1 /* write */, \
+ 3 /* high temporal locality */)
#endif /* __GNUC__ */
// The macOS kernel SDK defines va_copy in stdarg.h.
#include <stdarg.h>
-#elif defined(__GNUC__) && (__GNUC__ < 3)
-
-/*
- * Old versions of gcc recognize __va_copy, but not va_copy.
- */
-
-#define va_copy(dest, src) __va_copy(dest, src)
-
#endif // _WIN32
#endif // va_copy
* Bug 827422 and 838523.
*/
-#if defined __GNUC__ && __GNUC__ >= 4
+#if defined __GNUC__
#define VISIBILITY_HIDDEN __attribute__((visibility("hidden")))
#else
#define VISIBILITY_HIDDEN /* nothing */
* Note that there is no annotation for "neither."
*/
-#if defined __GNUC__ && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
+#if defined __GNUC__
#define HOT __attribute__((hot))
#define COLD __attribute__((cold))
#else