Mesa (main): llvmpipe: Use lp_build_round_arch on IBM Z (s390x)

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Nov 23 18:25:32 UTC 2021


Module: Mesa
Branch: main
Commit: c5d6e57e42adf118648b566a59aa0db6ccd65bc4
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c5d6e57e42adf118648b566a59aa0db6ccd65bc4

Author: Marius Hillenbrand <mhillen at linux.ibm.com>
Date:   Thu Nov 18 18:27:35 2021 +0100

llvmpipe: Use lp_build_round_arch on IBM Z (s390x)

LLVM has all the required intrinsics available on IBM Z, so use them for
rounding operations (they will be implemented as a single instruction).
This change makes the test case lp_test_arit pass, because it avoids
using the buggy generic code.

v2: update .gitlab-ci/cross-xfail-s390x to reflect passing lp_test_arit

Signed-off-by: Marius Hillenbrand <mhillen at linux.ibm.com>
Reviewed-by: Adam Jackson <ajax at redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13927>

---

 .gitlab-ci/cross-xfail-s390x                | 1 -
 src/gallium/auxiliary/gallivm/lp_bld_arit.c | 5 ++++-
 src/gallium/drivers/llvmpipe/lp_test_arit.c | 1 +
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci/cross-xfail-s390x b/.gitlab-ci/cross-xfail-s390x
index 2bfef18e64e..3c3c8ac0c85 100644
--- a/.gitlab-ci/cross-xfail-s390x
+++ b/.gitlab-ci/cross-xfail-s390x
@@ -1,2 +1 @@
-lp_test_arit
 lp_test_format
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
index 1c71c050822..171880041a1 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
@@ -1887,6 +1887,8 @@ 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())
+      return TRUE;
 
    return FALSE;
 }
@@ -1994,7 +1996,8 @@ lp_build_round_arch(struct lp_build_context *bld,
                     LLVMValueRef a,
                     enum lp_build_round_mode mode)
 {
-   if (util_get_cpu_caps()->has_sse4_1 || util_get_cpu_caps()->has_neon) {
+   if (util_get_cpu_caps()->has_sse4_1 || util_get_cpu_caps()->has_neon ||
+       util_cpu_caps_has_zarch()) {
       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 cbea1e2aada..ff6cdac491f 100644
--- a/src/gallium/drivers/llvmpipe/lp_test_arit.c
+++ b/src/gallium/drivers/llvmpipe/lp_test_arit.c
@@ -480,6 +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() &&
              test->ref == &nearbyintf && length == 2 &&
              ref != roundf(testval)) {
             /* FIXME: The generic (non SSE) path in lp_build_iround, which is



More information about the mesa-commit mailing list