util/cpu_detect, gallium: use cpu_family CPU_S390X instead of separate flag
authorMarius Hillenbrand <mhillen@linux.ibm.com>
Thu, 25 Nov 2021 11:48:27 +0000 (12:48 +0100)
committerMarge Bot <emma+marge@anholt.net>
Thu, 25 Nov 2021 12:57:20 +0000 (12:57 +0000)
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 <mhillen@linux.ibm.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13958>

src/gallium/auxiliary/gallivm/lp_bld_arit.c
src/gallium/drivers/llvmpipe/lp_test_arit.c
src/util/u_cpu_detect.c
src/util/u_cpu_detect.h

index 1718800..9cff016 100644 (file)
@@ -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;
index ff6cdac..504d3c3 100644 (file)
@@ -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
index 955d087..7375fab 100644 (file)
@@ -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()) {
index 464ed70..e89a3e0 100644 (file)
@@ -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
 }