[Mesa-stable] [PATCH] swr: modifications to allow gcc-4.8 compilation

Rowley, Timothy O timothy.o.rowley at intel.com
Mon Jul 10 20:56:08 UTC 2017


On Jul 10, 2017, at 3:32 PM, Andres Gomez <agomez at igalia.com<mailto:agomez at igalia.com>> wrote:

Tim, I'm a bit confused with this patch.

You landed in master:
f0a22956be4802e01f2b4f3244f011212626f12d "swr/rast: _mm*_undefined_* implementations for gcc<4.9"

And marked it for -stable picking but the patch in this mail also has
changes that only apply to the stable branch.

Is this a backport and I should use it instead of the patch which
landed in master?


This is the branch equivalent of these two patches:

f0a22956be4802e01f2b4f3244f011212626f12d swr/rast: _mm*_undefined_* implementations for gcc<4.9
d50ef7332c956785934336d757815196c48ac1d6 swr/rast: don't use _mm256_fmsub_ps in AVX code

The simd intrinsics library we used has diverged significantly between branch and master; the non-“undefined intrinsics” portion is specific to the branch.


On Wed, 2017-07-05 at 13:26 -0500, Tim Rowley wrote:
gcc-4.8 was missing the _mm*_undefined_* intrinsics and code
unconditionally used avx2 intrinsics in the avx compilation.
---
src/gallium/drivers/swr/rasterizer/common/os.h           | 6 ++++++
src/gallium/drivers/swr/rasterizer/common/simd16intrin.h | 4 ++--
2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/swr/rasterizer/common/os.h b/src/gallium/drivers/swr/rasterizer/common/os.h
index ef00a25..0b8f273 100644
--- a/src/gallium/drivers/swr/rasterizer/common/os.h
+++ b/src/gallium/drivers/swr/rasterizer/common/os.h
@@ -171,6 +171,12 @@ void _mm256_storeu2_m128i(__m128i *hi, __m128i *lo, __m256i a)
    _mm_storeu_si128((__m128i*)lo, _mm256_castsi256_si128(a));
    _mm_storeu_si128((__m128i*)hi, _mm256_extractf128_si256(a, 0x1));
}
+
+// gcc prior to 4.9 doesn't have _mm*_undefined_*
+#if (__GNUC__) && (GCC_VERSION < 409000)
+#define _mm_undefined_si128 _mm_setzero_si128
+#define _mm256_undefined_ps _mm256_setzero_ps
+#endif
#endif

inline
diff --git a/src/gallium/drivers/swr/rasterizer/common/simd16intrin.h b/src/gallium/drivers/swr/rasterizer/common/simd16intrin.h
index aa47574..90c903d 100644
--- a/src/gallium/drivers/swr/rasterizer/common/simd16intrin.h
+++ b/src/gallium/drivers/swr/rasterizer/common/simd16intrin.h
@@ -405,8 +405,8 @@ INLINE simd16mask SIMDAPI _simd16_movemask_pd(simd16scalard a)

INLINE uint64_t SIMDAPI _simd16_movemask_epi8(simd16scalari a)
{
-    uint32_t mask_lo = _mm256_movemask_epi8(a.lo);
-    uint32_t mask_hi = _mm256_movemask_epi8(a.hi);
+    uint32_t mask_lo = _simd_movemask_epi8(a.lo);
+    uint32_t mask_hi = _simd_movemask_epi8(a.hi);

    return static_cast<uint64_t>(mask_lo) | (static_cast<uint64_t>(mask_hi) << 32);
}
--
Br,

Andres

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-stable/attachments/20170710/f14ba791/attachment-0001.html>


More information about the mesa-stable mailing list