diff --git a/src/broadcom/common/v3d_cpu_tiling.h b/src/broadcom/common/v3d_cpu_tiling.h index cb1ee7c96f4..4cfd98f961b 100644 --- a/src/broadcom/common/v3d_cpu_tiling.h +++ b/src/broadcom/common/v3d_cpu_tiling.h @@ -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, diff --git a/src/gallium/auxiliary/driver_ddebug/dd_util.h b/src/gallium/auxiliary/driver_ddebug/dd_util.h index 10b0fc97e3b..89cb19cbf0a 100644 --- a/src/gallium/auxiliary/driver_ddebug/dd_util.h +++ b/src/gallium/auxiliary/driver_ddebug/dd_util.h @@ -38,10 +38,10 @@ #include "util/u_string.h" #include "util/detect.h" -#if defined(PIPE_OS_UNIX) +#if DETECT_OS_UNIX #include #include -#elif defined(PIPE_OS_WINDOWS) +#elif DETECT_OS_WINDOWS #include #include #define mkdir(dir, mode) _mkdir(dir) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c index dde7f06b24b..01538e0c9dd 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c @@ -65,7 +65,7 @@ #include "lp_bld_arit.h" #include "lp_bld_flow.h" -#if defined(PIPE_ARCH_SSE) +#if DETECT_ARCH_SSE #include #endif diff --git a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp index dda4c7d4273..54bc5d5ada3 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_debug.cpp @@ -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; } diff --git a/src/gallium/auxiliary/gallivm/lp_bld_format_yuv.c b/src/gallium/auxiliary/gallivm/lp_bld_format_yuv.c index 3b346f37d7c..066cb54a68c 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_format_yuv.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_format_yuv.c @@ -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 diff --git a/src/gallium/auxiliary/gallivm/lp_bld_init.c b/src/gallium/auxiliary/gallivm/lp_bld_init.c index 2ac02412a3c..22d63283881 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_init.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_init.c @@ -50,7 +50,7 @@ #if GALLIVM_USE_NEW_PASS == 1 #include #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 #endif #include @@ -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 diff --git a/src/gallium/auxiliary/gallivm/lp_bld_logic.c b/src/gallium/auxiliary/gallivm/lp_bld_logic.c index 711db17d9f7..06cf9c65404 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_logic.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_logic.c @@ -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. */ diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp index 705ee65404e..2f87fe82046 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp @@ -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 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 diff --git a/src/gallium/auxiliary/hud/hud_cpu.c b/src/gallium/auxiliary/hud/hud_cpu.c index 51e408aab7a..41f63d7c32c 100644 --- a/src/gallium/auxiliary/hud/hud_cpu.c +++ b/src/gallium/auxiliary/hud/hud_cpu.c @@ -38,10 +38,10 @@ #ifdef PIPE_OS_WINDOWS #include #endif -#if defined(PIPE_OS_BSD) +#if DETECT_OS_BSD #include #include -#if defined(PIPE_OS_NETBSD) || defined(PIPE_OS_OPENBSD) +#if DETECT_OS_NETBSD || DETECT_OS_OPENBSD #include #else #include @@ -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); diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c index 9919def4656..76608b37147 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_fenced.c @@ -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 #include #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); diff --git a/src/gallium/auxiliary/rtasm/rtasm_execmem.c b/src/gallium/auxiliary/rtasm/rtasm_execmem.c index 8cfc614e02c..6a7d0bbee2c 100644 --- a/src/gallium/auxiliary/rtasm/rtasm_execmem.c +++ b/src/gallium/auxiliary/rtasm/rtasm_execmem.c @@ -42,11 +42,11 @@ #define MAP_ANONYMOUS MAP_ANON #endif -#if defined(PIPE_OS_WINDOWS) +#if DETECT_OS_WINDOWS #include #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 /* diff --git a/src/gallium/auxiliary/rtasm/rtasm_x86sse.c b/src/gallium/auxiliary/rtasm/rtasm_x86sse.c index 5dabce21826..fd94ad70b25 100644 --- a/src/gallium/auxiliary/rtasm/rtasm_x86sse.c +++ b/src/gallium/auxiliary/rtasm/rtasm_x86sse.c @@ -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); diff --git a/src/gallium/auxiliary/rtasm/rtasm_x86sse.h b/src/gallium/auxiliary/rtasm/rtasm_x86sse.h index 58655a117ed..a576c6f70ef 100644 --- a/src/gallium/auxiliary/rtasm/rtasm_x86sse.h +++ b/src/gallium/auxiliary/rtasm/rtasm_x86sse.h @@ -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 } diff --git a/src/gallium/auxiliary/translate/translate.c b/src/gallium/auxiliary/translate/translate.c index 6ce296da89b..72e9216bc35 100644 --- a/src/gallium/auxiliary/translate/translate.c +++ b/src/gallium/auxiliary/translate/translate.c @@ -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; diff --git a/src/gallium/auxiliary/translate/translate_sse.c b/src/gallium/auxiliary/translate/translate_sse.c index 7469d8268ec..5bc93a1317b 100644 --- a/src/gallium/auxiliary/translate/translate_sse.c +++ b/src/gallium/auxiliary/translate/translate_sse.c @@ -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" diff --git a/src/gallium/auxiliary/util/u_file.h b/src/gallium/auxiliary/util/u_file.h index dddfa1a8967..3f35562df9b 100644 --- a/src/gallium/auxiliary/util/u_file.h +++ b/src/gallium/auxiliary/util/u_file.h @@ -29,10 +29,10 @@ #ifndef U_FILE_H_ #define U_FILE_H_ -#if defined(PIPE_OS_UNIX) +#if DETECT_OS_UNIX #include #endif -#if defined(PIPE_OS_WINDOWS) +#if DETECT_OS_WINDOWS #include #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; diff --git a/src/gallium/auxiliary/util/u_screen.c b/src/gallium/auxiliary/util/u_screen.c index 4cacc42fbdb..d073e732044 100644 --- a/src/gallium/auxiliary/util/u_screen.c +++ b/src/gallium/auxiliary/util/u_screen.c @@ -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; diff --git a/src/gallium/auxiliary/util/u_sse.h b/src/gallium/auxiliary/util/u_sse.h index c8acb1cfbe3..8916d4bc6c5 100644 --- a/src/gallium/auxiliary/util/u_sse.h +++ b/src/gallium/auxiliary/util/u_sse.h @@ -41,7 +41,7 @@ #include "pipe/p_compiler.h" #include "util/u_debug.h" -#if defined(PIPE_ARCH_SSE) +#if DETECT_ARCH_SSE #include diff --git a/src/gallium/auxiliary/util/u_tests.c b/src/gallium/auxiliary/util/u_tests.c index aab3ca52c50..376ef89fc65 100644 --- a/src/gallium/auxiliary/util/u_tests.c +++ b/src/gallium/auxiliary/util/u_tests.c @@ -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 #else #define sync_merge(str, fd1, fd2) (-1) diff --git a/src/gallium/drivers/llvmpipe/lp_linear.c b/src/gallium/drivers/llvmpipe/lp_linear.c index 81a677a8ab2..062586a37b5 100644 --- a/src/gallium/drivers/llvmpipe/lp_linear.c +++ b/src/gallium/drivers/llvmpipe/lp_linear.c @@ -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 diff --git a/src/gallium/drivers/llvmpipe/lp_linear_fastpath.c b/src/gallium/drivers/llvmpipe/lp_linear_fastpath.c index 07c616b2675..93fad2bd719 100644 --- a/src/gallium/drivers/llvmpipe/lp_linear_fastpath.c +++ b/src/gallium/drivers/llvmpipe/lp_linear_fastpath.c @@ -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(). diff --git a/src/gallium/drivers/llvmpipe/lp_linear_interp.c b/src/gallium/drivers/llvmpipe/lp_linear_interp.c index c372fe819b1..bbbf5a47a07 100644 --- a/src/gallium/drivers/llvmpipe/lp_linear_interp.c +++ b/src/gallium/drivers/llvmpipe/lp_linear_interp.c @@ -41,7 +41,7 @@ #include "lp_linear_priv.h" -#if defined(PIPE_ARCH_SSE) +#if DETECT_ARCH_SSE #define FIXED15_ONE 0x7fff diff --git a/src/gallium/drivers/llvmpipe/lp_linear_priv.h b/src/gallium/drivers/llvmpipe/lp_linear_priv.h index 6d4d6de79ae..561a0280c52 100644 --- a/src/gallium/drivers/llvmpipe/lp_linear_priv.h +++ b/src/gallium/drivers/llvmpipe/lp_linear_priv.h @@ -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; diff --git a/src/gallium/drivers/llvmpipe/lp_linear_sampler.c b/src/gallium/drivers/llvmpipe/lp_linear_sampler.c index 8765e3d5159..59e324a2fc1 100644 --- a/src/gallium/drivers/llvmpipe/lp_linear_sampler.c +++ b/src/gallium/drivers/llvmpipe/lp_linear_sampler.c @@ -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) diff --git a/src/gallium/drivers/llvmpipe/lp_rast_tri.c b/src/gallium/drivers/llvmpipe/lp_rast_tri.c index 21539151971..aaf2aa0829d 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_rast_tri.c @@ -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 #include "util/u_sse.h" diff --git a/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h b/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h index 4b37cbefbbe..9d9a58d8389 100644 --- a/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.h +++ b/src/gallium/drivers/llvmpipe/lp_rast_tri_tmp.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) diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index 0a651fb84ee..6589b82a80c 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -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 diff --git a/src/gallium/drivers/llvmpipe/lp_setup_tri.c b/src/gallium/drivers/llvmpipe/lp_setup_tri.c index d67f1d26a5a..7525da5f280 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup_tri.c +++ b/src/gallium/drivers/llvmpipe/lp_setup_tri.c @@ -43,14 +43,14 @@ #include -#if defined(PIPE_ARCH_SSE) +#if DETECT_ARCH_SSE #include #elif defined(_ARCH_PWR8) && UTIL_ARCH_LITTLE_ENDIAN #include #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; diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs_fastpath.c b/src/gallium/drivers/llvmpipe/lp_state_fs_fastpath.c index cf887184296..ee7cc7edd3f 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs_fastpath.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs_fastpath.c @@ -37,7 +37,7 @@ #include "lp_debug.h" -#if defined(PIPE_ARCH_SSE) +#if DETECT_ARCH_SSE #include diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs_linear.c b/src/gallium/drivers/llvmpipe/lp_state_fs_linear.c index 9554cb451ec..152e285fe8d 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs_linear.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs_linear.c @@ -41,7 +41,7 @@ #include "lp_linear_priv.h" -#if defined(PIPE_ARCH_SSE) +#if DETECT_ARCH_SSE #include diff --git a/src/gallium/drivers/llvmpipe/lp_test.h b/src/gallium/drivers/llvmpipe/lp_test.h index ecd16c87d8a..1fd04d71f6f 100644 --- a/src/gallium/drivers/llvmpipe/lp_test.h +++ b/src/gallium/drivers/llvmpipe/lp_test.h @@ -69,12 +69,12 @@ boolean test_all(unsigned verbose, FILE *fp); -#if defined(PIPE_CC_MSVC) +#if DETECT_CC_MSVC #include #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) diff --git a/src/gallium/drivers/llvmpipe/lp_test_arit.c b/src/gallium/drivers/llvmpipe/lp_test_arit.c index 4118928d52e..f2f428a01e0 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_arit.c +++ b/src/gallium/drivers/llvmpipe/lp_test_arit.c @@ -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; diff --git a/src/gallium/drivers/nouveau/nv50/nv84_video_vp.c b/src/gallium/drivers/nouveau/nv50/nv84_video_vp.c index a5d4d18fb82..1e1506e75d8 100644 --- a/src/gallium/drivers/nouveau/nv50/nv84_video_vp.c +++ b/src/gallium/drivers/nouveau/nv50/nv84_video_vp.c @@ -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 diff --git a/src/gallium/drivers/zink/zink_query.c b/src/gallium/drivers/zink/zink_query.c index 67ac1f91550..36aaad362e8 100644 --- a/src/gallium/drivers/zink/zink_query.c +++ b/src/gallium/drivers/zink/zink_query.c @@ -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 diff --git a/src/gallium/frontends/nine/device9.c b/src/gallium/frontends/nine/device9.c index ce846ea4fc1..306c6076805 100644 --- a/src/gallium/frontends/nine/device9.c +++ b/src/gallium/frontends/nine/device9.c @@ -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() { diff --git a/src/gallium/frontends/nine/nine_memory_helper.c b/src/gallium/frontends/nine/nine_memory_helper.c index f7249ea2ebe..b0ff080452a 100644 --- a/src/gallium/frontends/nine/nine_memory_helper.c +++ b/src/gallium/frontends/nine/nine_memory_helper.c @@ -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 diff --git a/src/gallium/include/pipe/p_compiler.h b/src/gallium/include/pipe/p_compiler.h index 3963e2f08b9..40058d1d3b9 100644 --- a/src/gallium/include/pipe/p_compiler.h +++ b/src/gallium/include/pipe/p_compiler.h @@ -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 diff --git a/src/gallium/targets/d3dadapter9/drm.c b/src/gallium/targets/d3dadapter9/drm.c index 174b1041c2b..64873409e2a 100644 --- a/src/gallium/targets/d3dadapter9/drm.c +++ b/src/gallium/targets/d3dadapter9/drm.c @@ -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 diff --git a/src/gallium/winsys/svga/drm/pb_buffer_simple_fenced.c b/src/gallium/winsys/svga/drm/pb_buffer_simple_fenced.c index 4b83bc2a86b..b754a066a9e 100644 --- a/src/gallium/winsys/svga/drm/pb_buffer_simple_fenced.c +++ b/src/gallium/winsys/svga/drm/pb_buffer_simple_fenced.c @@ -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 #include #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); diff --git a/src/gallium/winsys/svga/drm/vmw_msg.c b/src/gallium/winsys/svga/drm/vmw_msg.c index cc00b8ebc33..cacd8d53ccd 100644 --- a/src/gallium/winsys/svga/drm/vmw_msg.c +++ b/src/gallium/winsys/svga/drm/vmw_msg.c @@ -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; diff --git a/src/util/detect_arch.h b/src/util/detect_arch.h index ee187f7858a..66b5b2dadc9 100644 --- a/src/util/detect_arch.h +++ b/src/util/detect_arch.h @@ -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 diff --git a/src/util/format/u_format.c b/src/util/format/u_format.c index 866f8f8b317..09b4a69891a 100644 --- a/src/util/format/u_format.c +++ b/src/util/format/u_format.c @@ -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; diff --git a/src/util/format/u_format_tests.c b/src/util/format/u_format_tests.c index ffcbaca1271..3f52429062e 100644 --- a/src/util/format/u_format_tests.c +++ b/src/util/format/u_format_tests.c @@ -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)}, diff --git a/src/util/format/u_format_unpack_neon.c b/src/util/format/u_format_unpack_neon.c index a4a5cb1f723..772320ac7b2 100644 --- a/src/util/format/u_format_unpack_neon.c +++ b/src/util/format/u_format_unpack_neon.c @@ -23,7 +23,7 @@ #include -#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". diff --git a/src/util/os_misc.h b/src/util/os_misc.h index f5a22ef93a7..6a3998beaa0 100644 --- a/src/util/os_misc.h +++ b/src/util/os_misc.h @@ -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) diff --git a/src/util/u_cpu_detect.c b/src/util/u_cpu_detect.c index 8848463f47b..9fc6bf8bc06 100644 --- a/src/util/u_cpu_detect.c +++ b/src/util/u_cpu_detect.c @@ -43,8 +43,8 @@ #include #include -#if defined(PIPE_ARCH_PPC) -#if defined(PIPE_OS_APPLE) +#if DETECT_ARCH_PPC +#if DETECT_OS_APPLE #include #else #include @@ -52,20 +52,20 @@ #endif #endif -#if defined(PIPE_OS_BSD) +#if DETECT_OS_BSD #include #include #include #endif -#if defined(PIPE_OS_FREEBSD) +#if DETECT_OS_FREEBSD #if __has_include() #include #define HAVE_ELF_AUX_INFO #endif #endif -#if defined(PIPE_OS_LINUX) +#if DETECT_OS_LINUX #include #include #include @@ -79,9 +79,9 @@ #include #endif -#if defined(PIPE_OS_WINDOWS) +#if DETECT_OS_WINDOWS #include -#if defined(PIPE_CC_MSVC) +#if DETECT_CC_MSVC #include #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 diff --git a/src/util/u_debug_refcnt.c b/src/util/u_debug_refcnt.c index 6b8edf9ba65..2413dcdeafd 100644 --- a/src/util/u_debug_refcnt.c +++ b/src/util/u_debug_refcnt.c @@ -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 diff --git a/src/util/u_debug_stack.c b/src/util/u_debug_stack.c index 7ce608b664a..6972dc3dbb9 100644 --- a/src/util/u_debug_stack.c +++ b/src/util/u_debug_stack.c @@ -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 #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 diff --git a/src/util/u_debug_stack.h b/src/util/u_debug_stack.h index e8177580dca..27e8d1970cd 100644 --- a/src/util/u_debug_stack.h +++ b/src/util/u_debug_stack.h @@ -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 * diff --git a/src/util/u_debug_symbol.c b/src/util/u_debug_symbol.c index cb7482c8ab0..a1de75553c7 100644 --- a/src/util/u_debug_symbol.c +++ b/src/util/u_debug_symbol.c @@ -42,7 +42,7 @@ #include "util/hash_table.h" -#if defined(PIPE_OS_WINDOWS) +#if DETECT_OS_WINDOWS #include #include @@ -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; } diff --git a/src/util/u_math.c b/src/util/u_math.c index 6e9c3ba32a9..d6e37f71347 100644 --- a/src/util/u_math.c +++ b/src/util/u_math.c @@ -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 /* 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); } diff --git a/src/util/u_math.h b/src/util/u_math.h index 75b9bbbc70e..75d392c81f1 100644 --- a/src/util/u_math.h +++ b/src/util/u_math.h @@ -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 diff --git a/src/util/u_memset.h b/src/util/u_memset.h index c988302e430..93dc4b07709 100644 --- a/src/util/u_memset.h +++ b/src/util/u_memset.h @@ -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"