Mesa (master): gallivm: don't use integer min/ max sse intrinsics with llvm >= 3.9

Roland Scheidegger sroland at kemper.freedesktop.org
Mon Jun 20 15:19:47 UTC 2016


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

Author: Roland Scheidegger <sroland at vmware.com>
Date:   Sun Jun 19 03:56:11 2016 +0200

gallivm: don't use integer min/max sse intrinsics with llvm >= 3.9

Apparently, these are deprecated. There's some AutoUpgrade feature which
is supposed to promote these to cmp/select, which apparently doesn't work
with jit code. It is possible it's not actually even meant to work (see
the bug filed against llvm which couldn't provide an answer neither)
but in any case this is meant to be only temporary unless the intrinsics
are really illegal. So, just use the fallback code (which should be cmp/select,
we're actually doing cmp/sext/trunc/select, but in any case llvm 3.9 manages
to optimize this back to pmin/pmax in the end).

This addresses https://llvm.org/bugs/show_bug.cgi?id=28176

CC: <mesa-stable at lists.freedesktop.org>

Reviewed-by: Jose Fonseca <jfonseca at vmware.com>
Tested-by: Vinson Lee <vlee at freedesktop.org>
Tested-by: Aaron Watry <awatry at gmail.com>

---

 src/gallium/auxiliary/gallivm/lp_bld_arit.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_arit.c b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
index 114c766..c4e35a2 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_arit.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_arit.c
@@ -142,7 +142,8 @@ lp_build_min_simple(struct lp_build_context *bld,
          intrinsic = "llvm.ppc.altivec.vminfp";
          intr_size = 128;
       }
-   } else if (util_cpu_caps.has_sse2 && type.length >= 2) {
+   } else if (HAVE_LLVM < 0x0309 &&
+              util_cpu_caps.has_sse2 && type.length >= 2) {
       intr_size = 128;
       if ((type.width == 8 || type.width == 16) &&
           (type.width * type.length <= 64) &&
@@ -345,7 +346,8 @@ lp_build_max_simple(struct lp_build_context *bld,
          intrinsic = "llvm.ppc.altivec.vmaxfp";
          intr_size = 128;
       }
-   } else if (util_cpu_caps.has_sse2 && type.length >= 2) {
+   } else if (HAVE_LLVM < 0x0309 &&
+              util_cpu_caps.has_sse2 && type.length >= 2) {
       intr_size = 128;
       if ((type.width == 8 || type.width == 16) &&
           (type.width * type.length <= 64) &&




More information about the mesa-commit mailing list