From a46d155329201f840e4cb00897bde358392b9539 Mon Sep 17 00:00:00 2001 From: Marius Hillenbrand Date: Thu, 25 Nov 2021 12:48:27 +0100 Subject: [PATCH] util/cpu_detect, gallium: use cpu_family CPU_S390X instead of separate flag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit to also get rid of the additional function that I introduced before. Fixes: 82b261417e53 ("util/cpu_detect: Add flag for IBM Z (s390x)") Signed-off-by: Marius Hillenbrand Reviewed-by: Marek Olšák Part-of: --- src/gallium/auxiliary/gallivm/lp_bld_arit.c | 4 ++-- src/gallium/drivers/llvmpipe/lp_test_arit.c | 2 +- src/util/u_cpu_detect.c | 4 ++++ src/util/u_cpu_detect.h | 12 ++---------- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c index 171880041a1..9cff0162b23 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c @@ -1887,7 +1887,7 @@ arch_rounding_available(const struct lp_type type) return TRUE; else if (util_get_cpu_caps()->has_neon) return TRUE; - else if (util_cpu_caps_has_zarch()) + else if (util_get_cpu_caps()->family == CPU_S390X) return TRUE; return FALSE; @@ -1997,7 +1997,7 @@ lp_build_round_arch(struct lp_build_context *bld, enum lp_build_round_mode mode) { if (util_get_cpu_caps()->has_sse4_1 || util_get_cpu_caps()->has_neon || - util_cpu_caps_has_zarch()) { + util_get_cpu_caps()->family == CPU_S390X) { LLVMBuilderRef builder = bld->gallivm->builder; const struct lp_type type = bld->type; const char *intrinsic_root; diff --git a/src/gallium/drivers/llvmpipe/lp_test_arit.c b/src/gallium/drivers/llvmpipe/lp_test_arit.c index ff6cdac491f..504d3c3aa96 100644 --- a/src/gallium/drivers/llvmpipe/lp_test_arit.c +++ b/src/gallium/drivers/llvmpipe/lp_test_arit.c @@ -480,7 +480,7 @@ test_unary(unsigned verbose, FILE *fp, const struct unary_test_t *test, unsigned } if (!util_get_cpu_caps()->has_neon && - !util_cpu_caps_has_zarch() && + util_get_cpu_caps()->family != CPU_S390X && test->ref == &nearbyintf && length == 2 && ref != roundf(testval)) { /* FIXME: The generic (non SSE) path in lp_build_iround, which is diff --git a/src/util/u_cpu_detect.c b/src/util/u_cpu_detect.c index 955d087b8ea..7375fabfed8 100644 --- a/src/util/u_cpu_detect.c +++ b/src/util/u_cpu_detect.c @@ -813,6 +813,10 @@ util_cpu_detect_once(void) check_os_mips64_support(); #endif /* PIPE_ARCH_MIPS64 */ +#if defined(PIPE_ARCH_S390) + util_cpu_caps.family = CPU_S390X; +#endif + get_cpu_topology(); if (debug_get_option_dump_cpu()) { diff --git a/src/util/u_cpu_detect.h b/src/util/u_cpu_detect.h index 464ed7079b5..e89a3e0eef4 100644 --- a/src/util/u_cpu_detect.h +++ b/src/util/u_cpu_detect.h @@ -53,6 +53,8 @@ enum cpu_family { CPU_AMD_ZEN3, CPU_AMD_ZEN_NEXT, CPU_AMD_LAST, + + CPU_S390X, }; typedef uint32_t util_affinity_mask[UTIL_MAX_CPUS / 32]; @@ -140,16 +142,6 @@ util_get_cpu_caps(void) void util_cpu_detect(void); -static inline bool -util_cpu_caps_has_zarch(void) -{ -#if defined(PIPE_ARCH_S390) - return true; -#else - return false; -#endif -} - #ifdef __cplusplus }