mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 21:40:08 +01:00
tree-wide: Convert all usage of defined(PIPE_(OS|ARCH|CC)_*) to DETECT_(OS|ARCH|CC)_* by use grep
From: defined[\s]*\([\s]*PIPE_(OS|ARCH|CC)_([0-9A-Z_]+)[\s]*\) To: DETECT_$1_$2 Signed-off-by: Yonggang Luo <luoyonggang@gmail.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19674>
This commit is contained in:
parent
4304177675
commit
80fac8637b
53 changed files with 156 additions and 156 deletions
|
|
@ -31,7 +31,7 @@ static inline void
|
|||
v3d_load_utile(void *cpu, uint32_t cpu_stride,
|
||||
void *gpu, uint32_t gpu_stride)
|
||||
{
|
||||
#if defined(V3D_BUILD_NEON) && defined(PIPE_ARCH_ARM)
|
||||
#if defined(V3D_BUILD_NEON) && DETECT_ARCH_ARM
|
||||
if (gpu_stride == 8) {
|
||||
__asm__ volatile (
|
||||
/* Load from the GPU in one shot, no interleave, to
|
||||
|
|
@ -80,7 +80,7 @@ v3d_load_utile(void *cpu, uint32_t cpu_stride,
|
|||
: "q0", "q1", "q2", "q3");
|
||||
return;
|
||||
}
|
||||
#elif defined (PIPE_ARCH_AARCH64)
|
||||
#elif DETECT_ARCH_AARCH64
|
||||
if (gpu_stride == 8) {
|
||||
__asm__ volatile (
|
||||
/* Load from the GPU in one shot, no interleave, to
|
||||
|
|
@ -141,7 +141,7 @@ static inline void
|
|||
v3d_store_utile(void *gpu, uint32_t gpu_stride,
|
||||
void *cpu, uint32_t cpu_stride)
|
||||
{
|
||||
#if defined(V3D_BUILD_NEON) && defined(PIPE_ARCH_ARM)
|
||||
#if defined(V3D_BUILD_NEON) && DETECT_ARCH_ARM
|
||||
if (gpu_stride == 8) {
|
||||
__asm__ volatile (
|
||||
/* Load each 8-byte line from cpu-side source,
|
||||
|
|
@ -188,7 +188,7 @@ v3d_store_utile(void *gpu, uint32_t gpu_stride,
|
|||
: "q0", "q1", "q2", "q3");
|
||||
return;
|
||||
}
|
||||
#elif defined (PIPE_ARCH_AARCH64)
|
||||
#elif DETECT_ARCH_AARCH64
|
||||
if (gpu_stride == 8) {
|
||||
__asm__ volatile (
|
||||
/* Load each 8-byte line from cpu-side source,
|
||||
|
|
|
|||
|
|
@ -38,10 +38,10 @@
|
|||
#include "util/u_string.h"
|
||||
|
||||
#include "util/detect.h"
|
||||
#if defined(PIPE_OS_UNIX)
|
||||
#if DETECT_OS_UNIX
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#elif defined(PIPE_OS_WINDOWS)
|
||||
#elif DETECT_OS_WINDOWS
|
||||
#include <direct.h>
|
||||
#include <process.h>
|
||||
#define mkdir(dir, mode) _mkdir(dir)
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@
|
|||
#include "lp_bld_arit.h"
|
||||
#include "lp_bld_flow.h"
|
||||
|
||||
#if defined(PIPE_ARCH_SSE)
|
||||
#if DETECT_ARCH_SSE
|
||||
#include <xmmintrin.h>
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ disassemble(const void* func, std::ostream &buffer)
|
|||
* XXX: This currently assumes x86
|
||||
*/
|
||||
|
||||
#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
|
||||
#if DETECT_ARCH_X86 || DETECT_ARCH_X86_64
|
||||
if (Size == 1 && bytes[pc] == 0xc3) {
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ uyvy_to_yuv_soa(struct gallivm_state *gallivm,
|
|||
* v = (uyvy >> 8) & 0xff
|
||||
*/
|
||||
|
||||
#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
|
||||
#if DETECT_ARCH_X86 || DETECT_ARCH_X86_64
|
||||
/*
|
||||
* Avoid shift with per-element count.
|
||||
* No support on x86, gets translated to roughly 5 instructions
|
||||
|
|
@ -167,7 +167,7 @@ yuyv_to_yuv_soa(struct gallivm_state *gallivm,
|
|||
* v = (yuyv) & 0xff
|
||||
*/
|
||||
|
||||
#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
|
||||
#if DETECT_ARCH_X86 || DETECT_ARCH_X86_64
|
||||
/*
|
||||
* Avoid shift with per-element count.
|
||||
* No support on x86, gets translated to roughly 5 instructions
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@
|
|||
#if GALLIVM_USE_NEW_PASS == 1
|
||||
#include <llvm-c/Transforms/PassBuilder.h>
|
||||
#elif GALLIVM_HAVE_CORO == 1
|
||||
#if LLVM_VERSION_MAJOR <= 8 && (defined(PIPE_ARCH_AARCH64) || defined (PIPE_ARCH_ARM) || defined(PIPE_ARCH_S390) || defined(PIPE_ARCH_MIPS64))
|
||||
#if LLVM_VERSION_MAJOR <= 8 && (DETECT_ARCH_AARCH64 || DETECT_ARCH_ARM || DETECT_ARCH_S390 || DETECT_ARCH_MIPS64)
|
||||
#include <llvm-c/Transforms/IPO.h>
|
||||
#endif
|
||||
#include <llvm-c/Transforms/Coroutines.h>
|
||||
|
|
@ -140,7 +140,7 @@ create_pass_manager(struct gallivm_state *gallivm)
|
|||
}
|
||||
|
||||
#if GALLIVM_HAVE_CORO == 1
|
||||
#if LLVM_VERSION_MAJOR <= 8 && (defined(PIPE_ARCH_AARCH64) || defined (PIPE_ARCH_ARM) || defined(PIPE_ARCH_S390) || defined(PIPE_ARCH_MIPS64))
|
||||
#if LLVM_VERSION_MAJOR <= 8 && (DETECT_ARCH_AARCH64 || DETECT_ARCH_ARM || DETECT_ARCH_S390 || DETECT_ARCH_MIPS64)
|
||||
LLVMAddArgumentPromotionPass(gallivm->cgpassmgr);
|
||||
LLVMAddFunctionAttrsPass(gallivm->cgpassmgr);
|
||||
#endif
|
||||
|
|
@ -355,7 +355,7 @@ init_gallivm_state(struct gallivm_state *gallivm, const char *name,
|
|||
if (!gallivm->module)
|
||||
goto fail;
|
||||
|
||||
#if defined(PIPE_ARCH_X86)
|
||||
#if DETECT_ARCH_X86
|
||||
lp_set_module_stack_alignment_override(gallivm->module, 4);
|
||||
#endif
|
||||
|
||||
|
|
@ -624,7 +624,7 @@ gallivm_compile_module(struct gallivm_state *gallivm)
|
|||
|
||||
/* Disable frame pointer omission on debug/profile builds */
|
||||
/* XXX: And workaround http://llvm.org/PR21435 */
|
||||
#if defined(DEBUG) || defined(PROFILE) || defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
|
||||
#if defined(DEBUG) || defined(PROFILE) || DETECT_ARCH_X86 || DETECT_ARCH_X86_64
|
||||
LLVMAddTargetDependentFunctionAttr(func, "no-frame-pointer-elim", "true");
|
||||
LLVMAddTargetDependentFunctionAttr(func, "no-frame-pointer-elim-non-leaf", "true");
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ lp_build_compare(struct gallivm_state *gallivm,
|
|||
assert(func > PIPE_FUNC_NEVER);
|
||||
assert(func < PIPE_FUNC_ALWAYS);
|
||||
|
||||
#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
|
||||
#if DETECT_ARCH_X86 || DETECT_ARCH_X86_64
|
||||
/*
|
||||
* There are no unsigned integer comparison instructions in SSE.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -353,7 +353,7 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
|
|||
* friends for configuring code generation options, like stack alignment.
|
||||
*/
|
||||
TargetOptions options;
|
||||
#if defined(PIPE_ARCH_X86) && LLVM_VERSION_MAJOR < 13
|
||||
#if DETECT_ARCH_X86 && LLVM_VERSION_MAJOR < 13
|
||||
options.StackAlignmentOverride = 4;
|
||||
#endif
|
||||
|
||||
|
|
@ -379,7 +379,7 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
|
|||
|
||||
llvm::SmallVector<std::string, 16> MAttrs;
|
||||
|
||||
#if defined(PIPE_ARCH_ARM)
|
||||
#if DETECT_ARCH_ARM
|
||||
/* llvm-3.3+ implements sys::getHostCPUFeatures for Arm,
|
||||
* which allows us to enable/disable code generation based
|
||||
* on the results of cpuid on these architectures.
|
||||
|
|
@ -392,7 +392,7 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
|
|||
++f) {
|
||||
MAttrs.push_back(((*f).second ? "+" : "-") + (*f).first().str());
|
||||
}
|
||||
#elif defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
|
||||
#elif DETECT_ARCH_X86 || DETECT_ARCH_X86_64
|
||||
/*
|
||||
* Because we can override cpu caps with environment variables,
|
||||
* so we do not use llvm::sys::getHostCPUFeatures to detect cpu features
|
||||
|
|
@ -424,7 +424,7 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
|
|||
MAttrs.push_back(util_get_cpu_caps()->has_avx512dq ? "+avx512dq" : "-avx512dq");
|
||||
MAttrs.push_back(util_get_cpu_caps()->has_avx512vl ? "+avx512vl" : "-avx512vl");
|
||||
#endif
|
||||
#if defined(PIPE_ARCH_ARM)
|
||||
#if DETECT_ARCH_ARM
|
||||
if (!util_get_cpu_caps()->has_neon) {
|
||||
MAttrs.push_back("-neon");
|
||||
MAttrs.push_back("-crypto");
|
||||
|
|
@ -432,7 +432,7 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(PIPE_ARCH_PPC)
|
||||
#if DETECT_ARCH_PPC
|
||||
MAttrs.push_back(util_get_cpu_caps()->has_altivec ? "+altivec" : "-altivec");
|
||||
/*
|
||||
* Bug 25503 is fixed, by the same fix that fixed
|
||||
|
|
@ -449,7 +449,7 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(PIPE_ARCH_MIPS64)
|
||||
#if DETECT_ARCH_MIPS64
|
||||
MAttrs.push_back(util_get_cpu_caps()->has_msa ? "+msa" : "-msa");
|
||||
/* MSA requires a 64-bit FPU register file */
|
||||
MAttrs.push_back("+fp64");
|
||||
|
|
@ -508,7 +508,7 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PIPE_ARCH_MIPS64)
|
||||
#if DETECT_ARCH_MIPS64
|
||||
/*
|
||||
* ls3a4000 CPU and ls2k1000 SoC is a mips64r5 compatible with MSA SIMD
|
||||
* instruction set implemented, while ls3a3000 is mips64r2 compatible
|
||||
|
|
|
|||
|
|
@ -38,10 +38,10 @@
|
|||
#ifdef PIPE_OS_WINDOWS
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#if defined(PIPE_OS_BSD)
|
||||
#if DETECT_OS_BSD
|
||||
#include <sys/types.h>
|
||||
#include <sys/sysctl.h>
|
||||
#if defined(PIPE_OS_NETBSD) || defined(PIPE_OS_OPENBSD)
|
||||
#if DETECT_OS_NETBSD || DETECT_OS_OPENBSD
|
||||
#include <sys/sched.h>
|
||||
#else
|
||||
#include <sys/resource.h>
|
||||
|
|
@ -95,12 +95,12 @@ get_cpu_stats(unsigned cpu_index, uint64_t *busy_time, uint64_t *total_time)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
#elif defined(PIPE_OS_BSD)
|
||||
#elif DETECT_OS_BSD
|
||||
|
||||
static boolean
|
||||
get_cpu_stats(unsigned cpu_index, uint64_t *busy_time, uint64_t *total_time)
|
||||
{
|
||||
#if defined(PIPE_OS_NETBSD) || defined(PIPE_OS_OPENBSD)
|
||||
#if DETECT_OS_NETBSD || DETECT_OS_OPENBSD
|
||||
uint64_t cp_time[CPUSTATES];
|
||||
#else
|
||||
long cp_time[CPUSTATES];
|
||||
|
|
@ -110,12 +110,12 @@ get_cpu_stats(unsigned cpu_index, uint64_t *busy_time, uint64_t *total_time)
|
|||
if (cpu_index == ALL_CPUS) {
|
||||
len = sizeof(cp_time);
|
||||
|
||||
#if defined(PIPE_OS_NETBSD)
|
||||
#if DETECT_OS_NETBSD
|
||||
int mib[] = { CTL_KERN, KERN_CP_TIME };
|
||||
|
||||
if (sysctl(mib, ARRAY_SIZE(mib), cp_time, &len, NULL, 0) == -1)
|
||||
return FALSE;
|
||||
#elif defined(PIPE_OS_OPENBSD)
|
||||
#elif DETECT_OS_OPENBSD
|
||||
int mib[] = { CTL_KERN, KERN_CPTIME };
|
||||
long sum_cp_time[CPUSTATES];
|
||||
|
||||
|
|
@ -130,13 +130,13 @@ get_cpu_stats(unsigned cpu_index, uint64_t *busy_time, uint64_t *total_time)
|
|||
return FALSE;
|
||||
#endif
|
||||
} else {
|
||||
#if defined(PIPE_OS_NETBSD)
|
||||
#if DETECT_OS_NETBSD
|
||||
int mib[] = { CTL_KERN, KERN_CP_TIME, cpu_index };
|
||||
|
||||
len = sizeof(cp_time);
|
||||
if (sysctl(mib, ARRAY_SIZE(mib), cp_time, &len, NULL, 0) == -1)
|
||||
return FALSE;
|
||||
#elif defined(PIPE_OS_OPENBSD)
|
||||
#elif DETECT_OS_OPENBSD
|
||||
int mib[] = { CTL_KERN, KERN_CPTIME2, cpu_index };
|
||||
|
||||
len = sizeof(cp_time);
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
#include "util/detect.h"
|
||||
|
||||
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
|
||||
#if DETECT_OS_LINUX || DETECT_OS_BSD || DETECT_OS_SOLARIS
|
||||
#include <unistd.h>
|
||||
#include <sched.h>
|
||||
#endif
|
||||
|
|
@ -979,7 +979,7 @@ fenced_bufmgr_destroy(struct pb_manager *mgr)
|
|||
/* Wait on outstanding fences. */
|
||||
while (fenced_mgr->num_fenced) {
|
||||
mtx_unlock(&fenced_mgr->mutex);
|
||||
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
|
||||
#if DETECT_OS_LINUX || DETECT_OS_BSD || DETECT_OS_SOLARIS
|
||||
sched_yield();
|
||||
#endif
|
||||
mtx_lock(&fenced_mgr->mutex);
|
||||
|
|
|
|||
|
|
@ -42,11 +42,11 @@
|
|||
#define MAP_ANONYMOUS MAP_ANON
|
||||
#endif
|
||||
|
||||
#if defined(PIPE_OS_WINDOWS)
|
||||
#if DETECT_OS_WINDOWS
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
#if defined(PIPE_OS_UNIX)
|
||||
#if DETECT_OS_UNIX
|
||||
|
||||
|
||||
/*
|
||||
|
|
@ -125,7 +125,7 @@ rtasm_exec_free(void *addr)
|
|||
}
|
||||
|
||||
|
||||
#elif defined(PIPE_OS_WINDOWS)
|
||||
#elif DETECT_OS_WINDOWS
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
#include "util/detect.h"
|
||||
#include "util/u_cpu_detect.h"
|
||||
|
||||
#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
|
||||
#if DETECT_ARCH_X86 || DETECT_ARCH_X86_64
|
||||
|
||||
#include "pipe/p_compiler.h"
|
||||
#include "util/u_debug.h"
|
||||
|
|
@ -2173,7 +2173,7 @@ static void x86_init_func_common( struct x86_function *p )
|
|||
if(util_get_cpu_caps()->has_sse4_1)
|
||||
p->caps |= X86_SSE4_1;
|
||||
p->csr = p->store;
|
||||
#if defined(PIPE_ARCH_X86)
|
||||
#if DETECT_ARCH_X86
|
||||
emit_1i(p, 0xfb1e0ff3);
|
||||
#else
|
||||
emit_1i(p, 0xfa1e0ff3);
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@
|
|||
#include "pipe/p_compiler.h"
|
||||
#include "util/detect.h"
|
||||
|
||||
#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
|
||||
#if DETECT_ARCH_X86 || DETECT_ARCH_X86_64
|
||||
|
||||
/* It is up to the caller to ensure that instructions issued are
|
||||
* suitable for the host cpu. There are no checks made in this module
|
||||
|
|
@ -140,9 +140,9 @@ static inline enum x86_target x86_target( struct x86_function* p )
|
|||
{
|
||||
#ifdef PIPE_ARCH_X86
|
||||
return X86_32;
|
||||
#elif (defined(PIPE_OS_CYGWIN) || defined(PIPE_OS_WINDOWS)) && defined(PIPE_ARCH_X86_64)
|
||||
#elif (DETECT_OS_CYGWIN || DETECT_OS_WINDOWS) && DETECT_ARCH_X86_64
|
||||
return X86_64_WIN64_ABI;
|
||||
#elif defined(PIPE_ARCH_X86_64)
|
||||
#elif DETECT_ARCH_X86_64
|
||||
return X86_64_STD_ABI;
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ struct translate *translate_create( const struct translate_key *key )
|
|||
{
|
||||
struct translate *translate = NULL;
|
||||
|
||||
#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
|
||||
#if DETECT_ARCH_X86 || DETECT_ARCH_X86_64
|
||||
translate = translate_sse2_create( key );
|
||||
if (translate)
|
||||
return translate;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
#include "translate.h"
|
||||
|
||||
|
||||
#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
|
||||
#if DETECT_ARCH_X86 || DETECT_ARCH_X86_64
|
||||
|
||||
#include "rtasm/rtasm_x86sse.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -29,10 +29,10 @@
|
|||
#ifndef U_FILE_H_
|
||||
#define U_FILE_H_
|
||||
|
||||
#if defined(PIPE_OS_UNIX)
|
||||
#if DETECT_OS_UNIX
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#if defined(PIPE_OS_WINDOWS)
|
||||
#if DETECT_OS_WINDOWS
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
|
|
@ -42,9 +42,9 @@ extern "C" {
|
|||
|
||||
static inline int
|
||||
u_file_access(const char *path, int mode) {
|
||||
#if defined(PIPE_OS_UNIX)
|
||||
#if DETECT_OS_UNIX
|
||||
return access(path, mode);
|
||||
#elif defined(PIPE_OS_WINDOWS)
|
||||
#elif DETECT_OS_WINDOWS
|
||||
return _access(path, mode);
|
||||
#else
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -423,7 +423,7 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen,
|
|||
return 0;
|
||||
|
||||
case PIPE_CAP_DMABUF:
|
||||
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD)
|
||||
#if DETECT_OS_LINUX || DETECT_OS_BSD
|
||||
return 1;
|
||||
#else
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
#include "pipe/p_compiler.h"
|
||||
#include "util/u_debug.h"
|
||||
|
||||
#if defined(PIPE_ARCH_SSE)
|
||||
#if DETECT_ARCH_SSE
|
||||
|
||||
#include <emmintrin.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -516,7 +516,7 @@ disabled_fragment_shader(struct pipe_context *ctx)
|
|||
util_report_result(qresult.u64 == 2);
|
||||
}
|
||||
|
||||
#if defined(PIPE_OS_LINUX) && defined(HAVE_LIBDRM)
|
||||
#if DETECT_OS_LINUX && defined(HAVE_LIBDRM)
|
||||
#include <libsync.h>
|
||||
#else
|
||||
#define sync_merge(str, fd1, fd2) (-1)
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
#include "lp_linear_priv.h"
|
||||
|
||||
|
||||
#if defined(PIPE_ARCH_SSE)
|
||||
#if DETECT_ARCH_SSE
|
||||
|
||||
|
||||
/* For debugging (LP_DEBUG=linear), shade areas of run-time fallback
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@
|
|||
*/
|
||||
|
||||
|
||||
#if defined(PIPE_ARCH_SSE)
|
||||
#if DETECT_ARCH_SSE
|
||||
|
||||
/* Linear shader which implements the BLIT_RGBA shader with the
|
||||
* additional constraints imposed by lp_setup_is_blit().
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
#include "lp_linear_priv.h"
|
||||
|
||||
|
||||
#if defined(PIPE_ARCH_SSE)
|
||||
#if DETECT_ARCH_SSE
|
||||
|
||||
#define FIXED15_ONE 0x7fff
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ struct lp_linear_sampler {
|
|||
struct lp_linear_interp {
|
||||
struct lp_linear_elem base;
|
||||
|
||||
#if defined(PIPE_ARCH_SSE)
|
||||
#if DETECT_ARCH_SSE
|
||||
__m128i a0;
|
||||
__m128i dadx;
|
||||
__m128i dady;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
#include "lp_state_fs.h"
|
||||
#include "lp_linear_priv.h"
|
||||
|
||||
#if defined(PIPE_ARCH_SSE)
|
||||
#if DETECT_ARCH_SSE
|
||||
|
||||
#define FIXED16_SHIFT 16
|
||||
#define FIXED16_ONE (1<<16)
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ lp_rast_triangle_ms_4_16(struct lp_rasterizer_task *task,
|
|||
lp_rast_triangle_ms_4(task, arg2);
|
||||
}
|
||||
|
||||
#if defined(PIPE_ARCH_SSE)
|
||||
#if DETECT_ARCH_SSE
|
||||
|
||||
#include <emmintrin.h>
|
||||
#include "util/u_sse.h"
|
||||
|
|
|
|||
|
|
@ -343,7 +343,7 @@ TAG(lp_rast_triangle)(struct lp_rasterizer_task *task,
|
|||
}
|
||||
|
||||
|
||||
#if defined(PIPE_ARCH_SSE) && defined(TRI_16)
|
||||
#if DETECT_ARCH_SSE && defined(TRI_16)
|
||||
/* XXX: special case this when intersection is not required.
|
||||
* - tile completely within bbox,
|
||||
* - bbox completely within tile.
|
||||
|
|
@ -427,7 +427,7 @@ TRI_16(struct lp_rasterizer_task *task,
|
|||
#endif
|
||||
|
||||
|
||||
#if defined(PIPE_ARCH_SSE) && defined(TRI_4)
|
||||
#if DETECT_ARCH_SSE && defined(TRI_4)
|
||||
void
|
||||
TRI_4(struct lp_rasterizer_task *task,
|
||||
const union lp_rast_cmd_arg arg)
|
||||
|
|
|
|||
|
|
@ -852,7 +852,7 @@ lp_setup_set_linear_mode(struct lp_setup_context *setup,
|
|||
* is more than ten-year-old technology, so it's a reasonable
|
||||
* baseline.
|
||||
*/
|
||||
#if defined(PIPE_ARCH_SSE)
|
||||
#if DETECT_ARCH_SSE
|
||||
setup->permit_linear_rasterizer = (mode &&
|
||||
util_get_cpu_caps()->has_sse2);
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -43,14 +43,14 @@
|
|||
#include <inttypes.h>
|
||||
|
||||
|
||||
#if defined(PIPE_ARCH_SSE)
|
||||
#if DETECT_ARCH_SSE
|
||||
#include <emmintrin.h>
|
||||
#elif defined(_ARCH_PWR8) && UTIL_ARCH_LITTLE_ENDIAN
|
||||
#include <altivec.h>
|
||||
#include "util/u_pwr8.h"
|
||||
#endif
|
||||
|
||||
#if !defined(PIPE_ARCH_SSE)
|
||||
#if !DETECT_ARCH_SSE
|
||||
|
||||
static inline int
|
||||
subpixel_snap(float a)
|
||||
|
|
@ -468,7 +468,7 @@ do_triangle_ccw(struct lp_setup_context *setup,
|
|||
|
||||
struct lp_rast_plane *plane = GET_PLANES(tri);
|
||||
|
||||
#if defined(PIPE_ARCH_SSE)
|
||||
#if DETECT_ARCH_SSE
|
||||
if (1) {
|
||||
__m128i vertx, verty;
|
||||
__m128i shufx, shufy;
|
||||
|
|
@ -750,7 +750,7 @@ do_triangle_ccw(struct lp_setup_context *setup,
|
|||
static inline uint32_t
|
||||
floor_pot(uint32_t n)
|
||||
{
|
||||
#if defined(PIPE_CC_GCC) && (defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64))
|
||||
#if DETECT_CC_GCC && (DETECT_ARCH_X86 || DETECT_ARCH_X86_64)
|
||||
if (n == 0)
|
||||
return 0;
|
||||
|
||||
|
|
@ -1031,7 +1031,7 @@ calc_fixed_position(struct lp_setup_context *setup,
|
|||
* otherwise nearest/away-from-zero).
|
||||
* Both should be acceptable, I think.
|
||||
*/
|
||||
#if defined(PIPE_ARCH_SSE)
|
||||
#if DETECT_ARCH_SSE
|
||||
__m128 v0r, v1r;
|
||||
__m128 vxy0xy2, vxy1xy0;
|
||||
__m128i vxy0xy2i, vxy1xy0i;
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
#include "lp_debug.h"
|
||||
|
||||
|
||||
#if defined(PIPE_ARCH_SSE)
|
||||
#if DETECT_ARCH_SSE
|
||||
|
||||
#include <emmintrin.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
#include "lp_linear_priv.h"
|
||||
|
||||
|
||||
#if defined(PIPE_ARCH_SSE)
|
||||
#if DETECT_ARCH_SSE
|
||||
|
||||
#include <emmintrin.h>
|
||||
|
||||
|
|
|
|||
|
|
@ -69,12 +69,12 @@ boolean
|
|||
test_all(unsigned verbose, FILE *fp);
|
||||
|
||||
|
||||
#if defined(PIPE_CC_MSVC)
|
||||
#if DETECT_CC_MSVC
|
||||
|
||||
#include <intrin.h>
|
||||
#define rdtsc() __rdtsc()
|
||||
|
||||
#elif defined(PIPE_CC_GCC) && (defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64))
|
||||
#elif DETECT_CC_GCC && (DETECT_ARCH_X86 || DETECT_ARCH_X86_64)
|
||||
|
||||
static inline uint64_t
|
||||
rdtsc(void)
|
||||
|
|
|
|||
|
|
@ -398,7 +398,7 @@ flush_denorm_to_zero(float val)
|
|||
|
||||
fi_val.f = val;
|
||||
|
||||
#if defined(PIPE_ARCH_SSE)
|
||||
#if DETECT_ARCH_SSE
|
||||
if (util_get_cpu_caps()->has_sse) {
|
||||
if ((fi_val.ui & 0x7f800000) == 0) {
|
||||
fi_val.ui &= 0xff800000;
|
||||
|
|
|
|||
|
|
@ -287,7 +287,7 @@ nv84_decoder_vp_mpeg12_mb(struct nv84_decoder *dec,
|
|||
* a lot faster if one skips over them.
|
||||
*/
|
||||
|
||||
#if defined(PIPE_ARCH_SSE) && defined(PIPE_ARCH_X86_64)
|
||||
#if DETECT_ARCH_SSE && DETECT_ARCH_X86_64
|
||||
/* Note that the SSE implementation is much more tuned to X86_64. As it's not
|
||||
* benchmarked on X86_32, disable it there. I suspect that the code needs to
|
||||
* be reorganized in terms of 32-bit wide data in order to be more
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
#include "util/u_inlines.h"
|
||||
#include "util/u_memory.h"
|
||||
|
||||
#if defined(PIPE_ARCH_X86_64) || defined(PIPE_ARCH_PPC_64) || defined(PIPE_ARCH_AARCH64) || defined(PIPE_ARCH_MIPS64)
|
||||
#if DETECT_ARCH_X86_64 || DETECT_ARCH_PPC_64 || DETECT_ARCH_AARCH64 || DETECT_ARCH_MIPS64
|
||||
#define NUM_QUERIES 5000
|
||||
#else
|
||||
#define NUM_QUERIES 500
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@
|
|||
|
||||
#define DBG_CHANNEL DBG_DEVICE
|
||||
|
||||
#if defined(PIPE_CC_GCC) && (defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64))
|
||||
#if DETECT_CC_GCC && (DETECT_ARCH_X86 || DETECT_ARCH_X86_64)
|
||||
|
||||
static void nine_setup_fpu()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@
|
|||
#define DBG_CHANNEL (DBG_BASETEXTURE|DBG_SURFACE|DBG_VOLUME|DBG_TEXTURE|DBG_CUBETEXTURE)
|
||||
|
||||
/* Use memfd only for 32 bits. Check for memfd_create support */
|
||||
#if defined(PIPE_ARCH_X86) && defined(HAVE_MEMFD_CREATE)
|
||||
#if DETECT_ARCH_X86 && defined(HAVE_MEMFD_CREATE)
|
||||
#define NINE_ENABLE_MEMFD
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ extern "C" {
|
|||
|
||||
|
||||
#if !defined(__HAIKU__) && !defined(__USE_MISC)
|
||||
#if !defined(PIPE_OS_ANDROID)
|
||||
#if !DETECT_OS_ANDROID
|
||||
typedef unsigned int uint;
|
||||
#endif
|
||||
typedef unsigned short ushort;
|
||||
|
|
@ -94,7 +94,7 @@ typedef unsigned char boolean;
|
|||
|
||||
|
||||
/* Macro for stack alignment. */
|
||||
#if defined(__GNUC__) && defined(PIPE_ARCH_X86)
|
||||
#if defined(__GNUC__) && DETECT_ARCH_X86
|
||||
#define PIPE_ALIGN_STACK __attribute__((force_align_arg_pointer))
|
||||
#else
|
||||
#define PIPE_ALIGN_STACK
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@
|
|||
#define DBG_CHANNEL DBG_ADAPTER
|
||||
|
||||
/* On non-x86 archs, Box86 has issues with thread_submit. */
|
||||
#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
|
||||
#if DETECT_ARCH_X86 || DETECT_ARCH_X86_64
|
||||
#define DEFAULT_THREADSUBMIT true
|
||||
#else
|
||||
#define DEFAULT_THREADSUBMIT false
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@
|
|||
|
||||
#include "util/detect.h"
|
||||
|
||||
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
|
||||
#if DETECT_OS_LINUX || DETECT_OS_BSD || DETECT_OS_SOLARIS
|
||||
#include <unistd.h>
|
||||
#include <sched.h>
|
||||
#endif
|
||||
|
|
@ -796,7 +796,7 @@ fenced_bufmgr_destroy(struct pb_manager *mgr)
|
|||
/* Wait on outstanding fences */
|
||||
while (fenced_mgr->num_fenced) {
|
||||
mtx_unlock(&fenced_mgr->mutex);
|
||||
#if defined(PIPE_OS_LINUX) || defined(PIPE_OS_BSD) || defined(PIPE_OS_SOLARIS)
|
||||
#if DETECT_OS_LINUX || DETECT_OS_BSD || DETECT_OS_SOLARIS
|
||||
sched_yield();
|
||||
#endif
|
||||
mtx_lock(&fenced_mgr->mutex);
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@
|
|||
#define HIGH_WORD(X) ((X & 0xFFFF0000) >> 16)
|
||||
|
||||
|
||||
#if defined(PIPE_CC_GCC) && (PIPE_CC_GCC_VERSION > 502) && (defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64))
|
||||
#if DETECT_CC_GCC && (PIPE_CC_GCC_VERSION > 502) && (DETECT_ARCH_X86 || DETECT_ARCH_X86_64)
|
||||
|
||||
/**
|
||||
* Hypervisor-specific bi-directional communication channel. Should never
|
||||
|
|
@ -124,7 +124,7 @@
|
|||
* @si: [OUT]
|
||||
* @di: [OUT]
|
||||
*/
|
||||
#if defined(PIPE_ARCH_X86_64)
|
||||
#if DETECT_ARCH_X86_64
|
||||
|
||||
typedef uint64_t VMW_REG;
|
||||
|
||||
|
|
|
|||
|
|
@ -64,8 +64,8 @@
|
|||
#define PIPE_ARCH_X86_64
|
||||
#endif
|
||||
|
||||
#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
|
||||
#if defined(PIPE_CC_GCC) && !defined(__SSE2__)
|
||||
#if DETECT_ARCH_X86 || DETECT_ARCH_X86_64
|
||||
#if DETECT_CC_GCC && !defined(__SSE2__)
|
||||
/* #warning SSE2 support requires -msse -msse2 compiler options */
|
||||
#else
|
||||
#define DETECT_ARCH_SSE 1
|
||||
|
|
|
|||
|
|
@ -1184,7 +1184,7 @@ static void
|
|||
util_format_unpack_table_init(void)
|
||||
{
|
||||
for (enum pipe_format format = PIPE_FORMAT_NONE; format < PIPE_FORMAT_COUNT; format++) {
|
||||
#if (defined(PIPE_ARCH_AARCH64) || defined(PIPE_ARCH_ARM)) && !defined(NO_FORMAT_ASM) && !defined(__SOFTFP__)
|
||||
#if (DETECT_ARCH_AARCH64 || DETECT_ARCH_ARM) && !defined(NO_FORMAT_ASM) && !defined(__SOFTFP__)
|
||||
const struct util_format_unpack_description *unpack = util_format_unpack_description_neon(format);
|
||||
if (unpack) {
|
||||
util_format_unpack_table[format] = unpack;
|
||||
|
|
|
|||
|
|
@ -944,7 +944,7 @@ util_format_test_cases[] =
|
|||
/* Max representable value */
|
||||
{PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x7bff), UNPACKED_1x1( 65504.0, 0.0, 0.0, 1.0)},
|
||||
|
||||
#if !defined(PIPE_CC_MSVC)
|
||||
#if !DETECT_CC_MSVC
|
||||
|
||||
/* NaNs */
|
||||
{PIPE_FORMAT_R16_FLOAT, PACKED_1x16(0xffff), PACKED_1x16(0x7c01), UNPACKED_1x1( NAN, 0.0, 0.0, 1.0)},
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
#include <u_format.h>
|
||||
|
||||
#if (defined(PIPE_ARCH_AARCH64) || defined(PIPE_ARCH_ARM)) && !defined(NO_FORMAT_ASM) && !defined(__SOFTFP__)
|
||||
#if (DETECT_ARCH_AARCH64 || DETECT_ARCH_ARM) && !defined(NO_FORMAT_ASM) && !defined(__SOFTFP__)
|
||||
|
||||
/* armhf builds default to vfp, not neon, and refuses to compile neon intrinsics
|
||||
* unless you tell it "no really".
|
||||
|
|
|
|||
|
|
@ -54,9 +54,9 @@ extern "C" {
|
|||
/*
|
||||
* Trap into the debugger.
|
||||
*/
|
||||
#if (defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)) && defined(PIPE_CC_GCC)
|
||||
#if (DETECT_ARCH_X86 || DETECT_ARCH_X86_64) && DETECT_CC_GCC
|
||||
# define os_break() __asm("int3")
|
||||
#elif defined(PIPE_CC_MSVC)
|
||||
#elif DETECT_CC_MSVC
|
||||
# define os_break() __debugbreak()
|
||||
#elif DETECT_OS_UNIX
|
||||
# define os_break() kill(getpid(), SIGTRAP)
|
||||
|
|
|
|||
|
|
@ -43,8 +43,8 @@
|
|||
#include <stdio.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#if defined(PIPE_ARCH_PPC)
|
||||
#if defined(PIPE_OS_APPLE)
|
||||
#if DETECT_ARCH_PPC
|
||||
#if DETECT_OS_APPLE
|
||||
#include <sys/sysctl.h>
|
||||
#else
|
||||
#include <signal.h>
|
||||
|
|
@ -52,20 +52,20 @@
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PIPE_OS_BSD)
|
||||
#if DETECT_OS_BSD
|
||||
#include <sys/param.h>
|
||||
#include <sys/sysctl.h>
|
||||
#include <machine/cpu.h>
|
||||
#endif
|
||||
|
||||
#if defined(PIPE_OS_FREEBSD)
|
||||
#if DETECT_OS_FREEBSD
|
||||
#if __has_include(<sys/auxv.h>)
|
||||
#include <sys/auxv.h>
|
||||
#define HAVE_ELF_AUX_INFO
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(PIPE_OS_LINUX)
|
||||
#if DETECT_OS_LINUX
|
||||
#include <signal.h>
|
||||
#include <fcntl.h>
|
||||
#include <elf.h>
|
||||
|
|
@ -79,9 +79,9 @@
|
|||
#include <cpu-features.h>
|
||||
#endif
|
||||
|
||||
#if defined(PIPE_OS_WINDOWS)
|
||||
#if DETECT_OS_WINDOWS
|
||||
#include <windows.h>
|
||||
#if defined(PIPE_CC_MSVC)
|
||||
#if DETECT_CC_MSVC
|
||||
#include <intrin.h>
|
||||
#endif
|
||||
#endif
|
||||
|
|
@ -104,12 +104,12 @@ struct _util_cpu_caps_state_t _util_cpu_caps_state = {
|
|||
.detect_done = 0,
|
||||
};
|
||||
|
||||
#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
|
||||
#if DETECT_ARCH_X86 || DETECT_ARCH_X86_64
|
||||
static int has_cpuid(void);
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(PIPE_ARCH_PPC) && !defined(PIPE_OS_APPLE) && !defined(PIPE_OS_BSD) && !defined(PIPE_OS_LINUX)
|
||||
#if DETECT_ARCH_PPC && !DETECT_OS_APPLE && !DETECT_OS_BSD && !DETECT_OS_LINUX
|
||||
static jmp_buf __lv_powerpc_jmpbuf;
|
||||
static volatile sig_atomic_t __lv_powerpc_canjump = 0;
|
||||
|
||||
|
|
@ -126,7 +126,7 @@ sigill_handler(int sig)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(PIPE_ARCH_PPC)
|
||||
#if DETECT_ARCH_PPC
|
||||
static void
|
||||
check_os_altivec_support(void)
|
||||
{
|
||||
|
|
@ -138,7 +138,7 @@ check_os_altivec_support(void)
|
|||
#endif
|
||||
#if defined(__ALTIVEC__) && defined(__VSX__)
|
||||
/* Do nothing */
|
||||
#elif defined(PIPE_OS_APPLE) || defined(PIPE_OS_NETBSD) || defined(PIPE_OS_OPENBSD)
|
||||
#elif DETECT_OS_APPLE || DETECT_OS_NETBSD || DETECT_OS_OPENBSD
|
||||
#ifdef HW_VECTORUNIT
|
||||
int sels[2] = {CTL_HW, HW_VECTORUNIT};
|
||||
#else
|
||||
|
|
@ -155,7 +155,7 @@ check_os_altivec_support(void)
|
|||
util_cpu_caps.has_altivec = 1;
|
||||
}
|
||||
}
|
||||
#elif defined(PIPE_OS_FREEBSD) /* !PIPE_OS_APPLE && !PIPE_OS_NETBSD && !PIPE_OS_OPENBSD */
|
||||
#elif DETECT_OS_FREEBSD /* !PIPE_OS_APPLE && !PIPE_OS_NETBSD && !PIPE_OS_OPENBSD */
|
||||
unsigned long hwcap = 0;
|
||||
#ifdef HAVE_ELF_AUX_INFO
|
||||
elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap));
|
||||
|
|
@ -167,8 +167,8 @@ check_os_altivec_support(void)
|
|||
util_cpu_caps.has_altivec = 1;
|
||||
if (hwcap & PPC_FEATURE_HAS_VSX)
|
||||
util_cpu_caps.has_vsx = 1;
|
||||
#elif defined(PIPE_OS_LINUX) /* !PIPE_OS_FREEBSD */
|
||||
#if defined(PIPE_ARCH_PPC_64)
|
||||
#elif DETECT_OS_LINUX /* !PIPE_OS_FREEBSD */
|
||||
#if DETECT_ARCH_PPC_64
|
||||
Elf64_auxv_t aux;
|
||||
#else
|
||||
Elf32_auxv_t aux;
|
||||
|
|
@ -238,11 +238,11 @@ check_os_altivec_support(void)
|
|||
#endif /* PIPE_ARCH_PPC */
|
||||
|
||||
|
||||
#if defined(PIPE_ARCH_X86) || defined (PIPE_ARCH_X86_64)
|
||||
#if DETECT_ARCH_X86 || DETECT_ARCH_X86_64
|
||||
static int has_cpuid(void)
|
||||
{
|
||||
#if defined(PIPE_ARCH_X86)
|
||||
#if defined(PIPE_OS_GCC)
|
||||
#if DETECT_ARCH_X86
|
||||
#if DETECT_OS_GCC
|
||||
int a, c;
|
||||
|
||||
__asm __volatile
|
||||
|
|
@ -263,7 +263,7 @@ static int has_cpuid(void)
|
|||
/* FIXME */
|
||||
return 1;
|
||||
#endif
|
||||
#elif defined(PIPE_ARCH_X86_64)
|
||||
#elif DETECT_ARCH_X86_64
|
||||
return 1;
|
||||
#else
|
||||
return 0;
|
||||
|
|
@ -278,7 +278,7 @@ static int has_cpuid(void)
|
|||
static inline void
|
||||
cpuid(uint32_t ax, uint32_t *p)
|
||||
{
|
||||
#if defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86)
|
||||
#if DETECT_CC_GCC && DETECT_ARCH_X86
|
||||
__asm __volatile (
|
||||
"xchgl %%ebx, %1\n\t"
|
||||
"cpuid\n\t"
|
||||
|
|
@ -289,7 +289,7 @@ cpuid(uint32_t ax, uint32_t *p)
|
|||
"=d" (p[3])
|
||||
: "0" (ax)
|
||||
);
|
||||
#elif defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86_64)
|
||||
#elif DETECT_CC_GCC && DETECT_ARCH_X86_64
|
||||
__asm __volatile (
|
||||
"cpuid\n\t"
|
||||
: "=a" (p[0]),
|
||||
|
|
@ -298,7 +298,7 @@ cpuid(uint32_t ax, uint32_t *p)
|
|||
"=d" (p[3])
|
||||
: "0" (ax)
|
||||
);
|
||||
#elif defined(PIPE_CC_MSVC)
|
||||
#elif DETECT_CC_MSVC
|
||||
__cpuid(p, ax);
|
||||
#else
|
||||
p[0] = 0;
|
||||
|
|
@ -315,7 +315,7 @@ cpuid(uint32_t ax, uint32_t *p)
|
|||
static inline void
|
||||
cpuid_count(uint32_t ax, uint32_t cx, uint32_t *p)
|
||||
{
|
||||
#if defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86)
|
||||
#if DETECT_CC_GCC && DETECT_ARCH_X86
|
||||
__asm __volatile (
|
||||
"xchgl %%ebx, %1\n\t"
|
||||
"cpuid\n\t"
|
||||
|
|
@ -326,7 +326,7 @@ cpuid_count(uint32_t ax, uint32_t cx, uint32_t *p)
|
|||
"=d" (p[3])
|
||||
: "0" (ax), "2" (cx)
|
||||
);
|
||||
#elif defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86_64)
|
||||
#elif DETECT_CC_GCC && DETECT_ARCH_X86_64
|
||||
__asm __volatile (
|
||||
"cpuid\n\t"
|
||||
: "=a" (p[0]),
|
||||
|
|
@ -335,7 +335,7 @@ cpuid_count(uint32_t ax, uint32_t cx, uint32_t *p)
|
|||
"=d" (p[3])
|
||||
: "0" (ax), "2" (cx)
|
||||
);
|
||||
#elif defined(PIPE_CC_MSVC)
|
||||
#elif DETECT_CC_MSVC
|
||||
__cpuidex(p, ax, cx);
|
||||
#else
|
||||
p[0] = 0;
|
||||
|
|
@ -348,7 +348,7 @@ cpuid_count(uint32_t ax, uint32_t cx, uint32_t *p)
|
|||
|
||||
static inline uint64_t xgetbv(void)
|
||||
{
|
||||
#if defined(PIPE_CC_GCC)
|
||||
#if DETECT_CC_GCC
|
||||
uint32_t eax, edx;
|
||||
|
||||
__asm __volatile (
|
||||
|
|
@ -359,7 +359,7 @@ static inline uint64_t xgetbv(void)
|
|||
);
|
||||
|
||||
return ((uint64_t)edx << 32) | eax;
|
||||
#elif defined(PIPE_CC_MSVC) && defined(_MSC_FULL_VER) && defined(_XCR_XFEATURE_ENABLED_MASK)
|
||||
#elif DETECT_CC_MSVC && defined(_MSC_FULL_VER) && defined(_XCR_XFEATURE_ENABLED_MASK)
|
||||
return _xgetbv(_XCR_XFEATURE_ENABLED_MASK);
|
||||
#else
|
||||
return 0;
|
||||
|
|
@ -367,7 +367,7 @@ static inline uint64_t xgetbv(void)
|
|||
}
|
||||
|
||||
|
||||
#if defined(PIPE_ARCH_X86)
|
||||
#if DETECT_ARCH_X86
|
||||
PIPE_ALIGN_STACK
|
||||
static inline bool
|
||||
sse2_has_daz(void)
|
||||
|
|
@ -379,9 +379,9 @@ sse2_has_daz(void)
|
|||
} fxarea;
|
||||
|
||||
fxarea.mxcsr_mask = 0;
|
||||
#if defined(PIPE_CC_GCC)
|
||||
#if DETECT_CC_GCC
|
||||
__asm __volatile ("fxsave %0" : "+m" (fxarea));
|
||||
#elif defined(PIPE_CC_MSVC) || defined(PIPE_CC_ICL)
|
||||
#elif DETECT_CC_MSVC || DETECT_CC_ICL
|
||||
_fxsave(&fxarea);
|
||||
#else
|
||||
fxarea.mxcsr_mask = 0;
|
||||
|
|
@ -392,7 +392,7 @@ sse2_has_daz(void)
|
|||
|
||||
#endif /* X86 or X86_64 */
|
||||
|
||||
#if defined(PIPE_ARCH_ARM)
|
||||
#if DETECT_ARCH_ARM
|
||||
static void
|
||||
check_os_arm_support(void)
|
||||
{
|
||||
|
|
@ -405,7 +405,7 @@ check_os_arm_support(void)
|
|||
*/
|
||||
#if defined(__ARM_NEON) || defined(__ARM_NEON__)
|
||||
util_cpu_caps.has_neon = 1;
|
||||
#elif defined(PIPE_OS_FREEBSD) && defined(HAVE_ELF_AUX_INFO)
|
||||
#elif DETECT_OS_FREEBSD && defined(HAVE_ELF_AUX_INFO)
|
||||
unsigned long hwcap = 0;
|
||||
elf_aux_info(AT_HWCAP, &hwcap, sizeof(hwcap));
|
||||
if (hwcap & HWCAP_NEON)
|
||||
|
|
@ -418,7 +418,7 @@ check_os_arm_support(void)
|
|||
if (cpu_features & ANDROID_CPU_ARM_FEATURE_NEON)
|
||||
util_cpu_caps.has_neon = 1;
|
||||
}
|
||||
#elif defined(PIPE_OS_LINUX)
|
||||
#elif DETECT_OS_LINUX
|
||||
Elf32_auxv_t aux;
|
||||
int fd;
|
||||
|
||||
|
|
@ -437,7 +437,7 @@ check_os_arm_support(void)
|
|||
#endif /* PIPE_OS_LINUX */
|
||||
}
|
||||
|
||||
#elif defined(PIPE_ARCH_AARCH64)
|
||||
#elif DETECT_ARCH_AARCH64
|
||||
static void
|
||||
check_os_arm_support(void)
|
||||
{
|
||||
|
|
@ -445,11 +445,11 @@ check_os_arm_support(void)
|
|||
}
|
||||
#endif /* PIPE_ARCH_ARM || PIPE_ARCH_AARCH64 */
|
||||
|
||||
#if defined(PIPE_ARCH_MIPS64)
|
||||
#if DETECT_ARCH_MIPS64
|
||||
static void
|
||||
check_os_mips64_support(void)
|
||||
{
|
||||
#if defined(PIPE_OS_LINUX)
|
||||
#if DETECT_OS_LINUX
|
||||
Elf64_auxv_t aux;
|
||||
int fd;
|
||||
|
||||
|
|
@ -478,7 +478,7 @@ get_cpu_topology(void)
|
|||
|
||||
memset(util_cpu_caps.cpu_to_L3, 0xff, sizeof(util_cpu_caps.cpu_to_L3));
|
||||
|
||||
#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
|
||||
#if DETECT_ARCH_X86 || DETECT_ARCH_X86_64
|
||||
/* AMD Zen */
|
||||
if (util_cpu_caps.family >= CPU_AMD_ZEN1_ZEN2 &&
|
||||
util_cpu_caps.family < CPU_AMD_LAST) {
|
||||
|
|
@ -599,7 +599,7 @@ static
|
|||
void check_cpu_caps_override(void)
|
||||
{
|
||||
const char *override_cpu_caps = debug_get_option("GALLIUM_OVERRIDE_CPU_CAPS", NULL);
|
||||
#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
|
||||
#if DETECT_ARCH_X86 || DETECT_ARCH_X86_64
|
||||
if (debug_get_bool_option("GALLIUM_NOSSE", false)) {
|
||||
util_cpu_caps.has_sse = 0;
|
||||
}
|
||||
|
|
@ -612,7 +612,7 @@ void check_cpu_caps_override(void)
|
|||
#endif /* PIPE_ARCH_X86 || PIPE_ARCH_X86_64 */
|
||||
|
||||
if (override_cpu_caps != NULL) {
|
||||
#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
|
||||
#if DETECT_ARCH_X86 || DETECT_ARCH_X86_64
|
||||
if (!strcmp(override_cpu_caps, "nosse")) {
|
||||
util_cpu_caps.has_sse = 0;
|
||||
} else if (!strcmp(override_cpu_caps, "sse")) {
|
||||
|
|
@ -631,7 +631,7 @@ void check_cpu_caps_override(void)
|
|||
#endif /* PIPE_ARCH_X86 || PIPE_ARCH_X86_64 */
|
||||
}
|
||||
|
||||
#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
|
||||
#if DETECT_ARCH_X86 || DETECT_ARCH_X86_64
|
||||
if (!util_cpu_caps.has_sse) {
|
||||
util_cpu_caps.has_sse2 = 0;
|
||||
}
|
||||
|
|
@ -675,7 +675,7 @@ void check_max_vector_bits(void)
|
|||
* Really needs to be a multiple of 128 so can fit 4 floats.
|
||||
*/
|
||||
util_cpu_caps.max_vector_bits = 128;
|
||||
#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
|
||||
#if DETECT_ARCH_X86 || DETECT_ARCH_X86_64
|
||||
if (util_cpu_caps.has_avx512f) {
|
||||
util_cpu_caps.max_vector_bits = 512;
|
||||
} else if (util_cpu_caps.has_avx) {
|
||||
|
|
@ -695,13 +695,13 @@ _util_cpu_detect_once(void)
|
|||
memset(&util_cpu_caps, 0, sizeof util_cpu_caps);
|
||||
|
||||
/* Count the number of CPUs in system */
|
||||
#if defined(PIPE_OS_WINDOWS)
|
||||
#if DETECT_OS_WINDOWS
|
||||
{
|
||||
SYSTEM_INFO system_info;
|
||||
GetSystemInfo(&system_info);
|
||||
available_cpus = MAX2(1, system_info.dwNumberOfProcessors);
|
||||
}
|
||||
#elif defined(PIPE_OS_UNIX)
|
||||
#elif DETECT_OS_UNIX
|
||||
# if defined(HAS_SCHED_GETAFFINITY)
|
||||
{
|
||||
/* sched_setaffinity() can be used to further restrict the number of
|
||||
|
|
@ -723,7 +723,7 @@ _util_cpu_detect_once(void)
|
|||
* _SC_NOPROCESSORS_ONLN. NetBSD and OpenBSD should have HW_NCPUONLINE.
|
||||
* This is what FFmpeg uses on those platforms.
|
||||
*/
|
||||
# if defined(PIPE_OS_BSD) && defined(HW_NCPUONLINE)
|
||||
# if DETECT_OS_BSD && defined(HW_NCPUONLINE)
|
||||
if (available_cpus == 0) {
|
||||
const int mib[] = { CTL_HW, HW_NCPUONLINE };
|
||||
int ncpu;
|
||||
|
|
@ -738,7 +738,7 @@ _util_cpu_detect_once(void)
|
|||
if (available_cpus == ~0)
|
||||
available_cpus = 1;
|
||||
}
|
||||
# elif defined(PIPE_OS_BSD)
|
||||
# elif DETECT_OS_BSD
|
||||
if (available_cpus == 0) {
|
||||
const int mib[] = { CTL_HW, HW_NCPU };
|
||||
int ncpu;
|
||||
|
|
@ -747,7 +747,7 @@ _util_cpu_detect_once(void)
|
|||
sysctl(mib, 2, &ncpu, &len, NULL, 0);
|
||||
available_cpus = ncpu;
|
||||
}
|
||||
# endif /* defined(PIPE_OS_BSD) */
|
||||
# endif /* DETECT_OS_BSD */
|
||||
|
||||
/* Determine the maximum number of CPUs configured in the system. This is
|
||||
* used to properly set num_cpu_mask_bits below. On BSDs that don't have
|
||||
|
|
@ -759,7 +759,7 @@ _util_cpu_detect_once(void)
|
|||
total_cpus = sysconf(_SC_NPROCESSORS_CONF);
|
||||
if (total_cpus == ~0)
|
||||
total_cpus = 1;
|
||||
# elif defined(PIPE_OS_BSD)
|
||||
# elif DETECT_OS_BSD
|
||||
{
|
||||
const int mib[] = { CTL_HW, HW_NCPU };
|
||||
int ncpu;
|
||||
|
|
@ -768,8 +768,8 @@ _util_cpu_detect_once(void)
|
|||
sysctl(mib, 2, &ncpu, &len, NULL, 0);
|
||||
total_cpus = ncpu;
|
||||
}
|
||||
# endif /* defined(PIPE_OS_BSD) */
|
||||
#endif /* defined(PIPE_OS_UNIX) */
|
||||
# endif /* DETECT_OS_BSD */
|
||||
#endif /* DETECT_OS_UNIX */
|
||||
|
||||
util_cpu_caps.nr_cpus = MAX2(1, available_cpus);
|
||||
total_cpus = MAX2(total_cpus, util_cpu_caps.nr_cpus);
|
||||
|
|
@ -782,7 +782,7 @@ _util_cpu_detect_once(void)
|
|||
*/
|
||||
util_cpu_caps.cacheline = sizeof(void *);
|
||||
|
||||
#if defined(PIPE_ARCH_X86) || defined(PIPE_ARCH_X86_64)
|
||||
#if DETECT_ARCH_X86 || DETECT_ARCH_X86_64
|
||||
if (has_cpuid()) {
|
||||
uint32_t regs[4];
|
||||
uint32_t regs2[4];
|
||||
|
|
@ -833,7 +833,7 @@ _util_cpu_detect_once(void)
|
|||
util_cpu_caps.has_f16c = ((regs2[2] >> 29) & 1) && util_cpu_caps.has_avx;
|
||||
util_cpu_caps.has_fma = ((regs2[2] >> 12) & 1) && util_cpu_caps.has_avx;
|
||||
util_cpu_caps.has_mmx2 = util_cpu_caps.has_sse; /* SSE cpus supports mmxext too */
|
||||
#if defined(PIPE_ARCH_X86_64)
|
||||
#if DETECT_ARCH_X86_64
|
||||
util_cpu_caps.has_daz = 1;
|
||||
#else
|
||||
util_cpu_caps.has_daz = util_cpu_caps.has_sse3 ||
|
||||
|
|
@ -898,19 +898,19 @@ _util_cpu_detect_once(void)
|
|||
}
|
||||
#endif /* PIPE_ARCH_X86 || PIPE_ARCH_X86_64 */
|
||||
|
||||
#if defined(PIPE_ARCH_ARM) || defined(PIPE_ARCH_AARCH64)
|
||||
#if DETECT_ARCH_ARM || DETECT_ARCH_AARCH64
|
||||
check_os_arm_support();
|
||||
#endif
|
||||
|
||||
#if defined(PIPE_ARCH_PPC)
|
||||
#if DETECT_ARCH_PPC
|
||||
check_os_altivec_support();
|
||||
#endif /* PIPE_ARCH_PPC */
|
||||
|
||||
#if defined(PIPE_ARCH_MIPS64)
|
||||
#if DETECT_ARCH_MIPS64
|
||||
check_os_mips64_support();
|
||||
#endif /* PIPE_ARCH_MIPS64 */
|
||||
|
||||
#if defined(PIPE_ARCH_S390)
|
||||
#if DETECT_ARCH_S390
|
||||
util_cpu_caps.family = CPU_S390X;
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ debug_serial_delete(void *p)
|
|||
}
|
||||
|
||||
|
||||
#if defined(PIPE_OS_WINDOWS)
|
||||
#if DETECT_OS_WINDOWS
|
||||
#define STACK_LEN 60
|
||||
#else
|
||||
#define STACK_LEN 64
|
||||
|
|
|
|||
|
|
@ -183,7 +183,7 @@ debug_backtrace_print(FILE *f,
|
|||
/* Not implemented here; see u_debug_stack_android.cpp */
|
||||
#else /* ! HAVE_LIBUNWIND */
|
||||
|
||||
#if defined(PIPE_OS_WINDOWS)
|
||||
#if DETECT_OS_WINDOWS
|
||||
#include <windows.h>
|
||||
#endif
|
||||
|
||||
|
|
@ -210,7 +210,7 @@ debug_backtrace_capture(struct debug_stack_frame *backtrace,
|
|||
*
|
||||
* It works reliably both for x86 for x86_64.
|
||||
*/
|
||||
#if defined(PIPE_OS_WINDOWS)
|
||||
#if DETECT_OS_WINDOWS
|
||||
{
|
||||
typedef USHORT (WINAPI *PFNCAPTURESTACKBACKTRACE)(ULONG, ULONG,
|
||||
PVOID *, PULONG);
|
||||
|
|
@ -250,12 +250,12 @@ debug_backtrace_capture(struct debug_stack_frame *backtrace,
|
|||
#endif
|
||||
|
||||
#ifdef PIPE_ARCH_X86
|
||||
#if defined(PIPE_CC_GCC) && (PIPE_CC_GCC_VERSION > 404) || defined(__clang__)
|
||||
#if DETECT_CC_GCC && (PIPE_CC_GCC_VERSION > 404) || defined(__clang__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wframe-address"
|
||||
const void **frame_pointer = ((const void **)__builtin_frame_address(1));
|
||||
#pragma GCC diagnostic pop
|
||||
#elif defined(PIPE_CC_MSVC)
|
||||
#elif DETECT_CC_MSVC
|
||||
const void **frame_pointer;
|
||||
__asm {
|
||||
mov frame_pointer, ebp
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ extern "C" {
|
|||
/**
|
||||
* Represent a frame from a stack backtrace.
|
||||
*
|
||||
#if defined(PIPE_OS_WINDOWS) && !defined(HAVE_LIBUNWIND)
|
||||
#if DETECT_OS_WINDOWS && !defined(HAVE_LIBUNWIND)
|
||||
* XXX: Do not change this. (passed to Windows' CaptureStackBackTrace())
|
||||
#endif
|
||||
*
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
#include "util/hash_table.h"
|
||||
|
||||
|
||||
#if defined(PIPE_OS_WINDOWS)
|
||||
#if DETECT_OS_WINDOWS
|
||||
|
||||
#include <windows.h>
|
||||
#include <stddef.h>
|
||||
|
|
@ -232,7 +232,7 @@ debug_symbol_name_dbghelp(const void *addr, char* buf, unsigned size)
|
|||
void
|
||||
debug_symbol_name(const void *addr, char* buf, unsigned size)
|
||||
{
|
||||
#if defined(PIPE_OS_WINDOWS)
|
||||
#if DETECT_OS_WINDOWS
|
||||
if (debug_symbol_name_dbghelp(addr, buf, size)) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
#include "util/u_math.h"
|
||||
#include "util/u_cpu_detect.h"
|
||||
|
||||
#if defined(PIPE_ARCH_SSE)
|
||||
#if DETECT_ARCH_SSE
|
||||
#include <xmmintrin.h>
|
||||
/* This is defined in pmmintrin.h, but it can only be included when -msse3 is
|
||||
* used, so just define it here to avoid further. */
|
||||
|
|
@ -77,7 +77,7 @@ util_fpstate_get(void)
|
|||
{
|
||||
unsigned mxcsr = 0;
|
||||
|
||||
#if defined(PIPE_ARCH_SSE)
|
||||
#if DETECT_ARCH_SSE
|
||||
if (util_get_cpu_caps()->has_sse) {
|
||||
mxcsr = _mm_getcsr();
|
||||
}
|
||||
|
|
@ -95,7 +95,7 @@ util_fpstate_get(void)
|
|||
unsigned
|
||||
util_fpstate_set_denorms_to_zero(unsigned current_mxcsr)
|
||||
{
|
||||
#if defined(PIPE_ARCH_SSE)
|
||||
#if DETECT_ARCH_SSE
|
||||
if (util_get_cpu_caps()->has_sse) {
|
||||
/* Enable flush to zero mode */
|
||||
current_mxcsr |= _MM_FLUSH_ZERO_MASK;
|
||||
|
|
@ -117,7 +117,7 @@ util_fpstate_set_denorms_to_zero(unsigned current_mxcsr)
|
|||
void
|
||||
util_fpstate_set(unsigned mxcsr)
|
||||
{
|
||||
#if defined(PIPE_ARCH_SSE)
|
||||
#if DETECT_ARCH_SSE
|
||||
if (util_get_cpu_caps()->has_sse) {
|
||||
_mm_setcsr(mxcsr);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -157,11 +157,11 @@ util_ifloor(float f)
|
|||
static inline int
|
||||
util_iround(float f)
|
||||
{
|
||||
#if defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86)
|
||||
#if DETECT_CC_GCC && DETECT_ARCH_X86
|
||||
int r;
|
||||
__asm__ ("fistpl %0" : "=m" (r) : "t" (f) : "st");
|
||||
return r;
|
||||
#elif defined(PIPE_CC_MSVC) && defined(PIPE_ARCH_X86)
|
||||
#elif DETECT_CC_MSVC && DETECT_ARCH_X86
|
||||
int r;
|
||||
_asm {
|
||||
fld f
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
static inline void *
|
||||
util_memset32(void *s, uint32_t ui, size_t n)
|
||||
{
|
||||
#if defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86_64)
|
||||
#if DETECT_CC_GCC && DETECT_ARCH_X86_64
|
||||
long d0, d1;
|
||||
__asm__ volatile("rep\n\t"
|
||||
"stosl"
|
||||
|
|
@ -49,7 +49,7 @@ util_memset32(void *s, uint32_t ui, size_t n)
|
|||
static inline void *
|
||||
util_memset64(void *s, uint64_t ui, size_t n)
|
||||
{
|
||||
#if defined(PIPE_CC_GCC) && defined(PIPE_ARCH_X86_64)
|
||||
#if DETECT_CC_GCC && DETECT_ARCH_X86_64
|
||||
long d0, d1;
|
||||
__asm__ volatile("rep\n\t"
|
||||
"stosq"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue