gallivm: Return true from arch_rounding_available() if NEON is available
authorMatt Turner <mattst88@gmail.com>
Tue, 22 Jan 2019 23:06:38 +0000 (15:06 -0800)
committerMatt Turner <mattst88@gmail.com>
Thu, 24 Jan 2019 19:07:24 +0000 (11:07 -0800)
LLVM uses the single instruction "FRINTI" to implement llvm.nearbyint.
Fixes the rounding tests of lp_test_arit.

Bug: https://bugs.gentoo.org/665570
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
src/gallium/auxiliary/gallivm/lp_bld_arit.c
src/gallium/drivers/llvmpipe/lp_test_arit.c

index c050bfdb936dbd5b6495f6ae717e6fdaf900b788..057c50ed278ce50b45dbe570373a643a942a0fb1 100644 (file)
@@ -1992,6 +1992,8 @@ arch_rounding_available(const struct lp_type type)
    else if ((util_cpu_caps.has_altivec &&
             (type.width == 32 && type.length == 4)))
       return TRUE;
+   else if (util_cpu_caps.has_neon)
+      return TRUE;
 
    return FALSE;
 }
@@ -2099,7 +2101,7 @@ lp_build_round_arch(struct lp_build_context *bld,
                     LLVMValueRef a,
                     enum lp_build_round_mode mode)
 {
-   if (util_cpu_caps.has_sse4_1) {
+   if (util_cpu_caps.has_sse4_1 || util_cpu_caps.has_neon) {
       LLVMBuilderRef builder = bld->gallivm->builder;
       const struct lp_type type = bld->type;
       const char *intrinsic_root;
index acba7ed44a85613b231a679d3b2eb46566b91460..eb3f67dc1fe872fae168a5e64aca05bfd7e20cd0 100644 (file)
@@ -458,7 +458,8 @@ test_unary(unsigned verbose, FILE *fp, const struct unary_test_t *test, unsigned
             continue;
          }
 
-         if (test->ref == &nearbyintf && length == 2 && 
+         if (!util_cpu_caps.has_neon &&
+             test->ref == &nearbyintf && length == 2 &&
              ref != roundf(testval)) {
             /* FIXME: The generic (non SSE) path in lp_build_iround, which is
              * always taken for length==2 regardless of native round support,