[Mesa-dev] [PATCH 26/31] swr/rast: Convert C Sampler intrinsics
George Kyriazis
george.kyriazis at intel.com
Tue Feb 13 22:42:44 UTC 2018
Convert portions of the C sampler to the rasty SIMD lib.
---
src/gallium/drivers/swr/rasterizer/common/intrin.h | 3 +++
.../drivers/swr/rasterizer/common/simdlib_128_avx.inl | 16 ++++++++++++++++
2 files changed, 19 insertions(+)
diff --git a/src/gallium/drivers/swr/rasterizer/common/intrin.h b/src/gallium/drivers/swr/rasterizer/common/intrin.h
index 33d37e3..59d66bc 100644
--- a/src/gallium/drivers/swr/rasterizer/common/intrin.h
+++ b/src/gallium/drivers/swr/rasterizer/common/intrin.h
@@ -26,7 +26,10 @@
#include "os.h"
+#if !defined(SIMD_ARCH)
#define SIMD_ARCH KNOB_ARCH
+#endif
+
#include "simdlib_types.hpp"
typedef SIMDImpl::SIMD128Impl::Float simd4scalar;
diff --git a/src/gallium/drivers/swr/rasterizer/common/simdlib_128_avx.inl b/src/gallium/drivers/swr/rasterizer/common/simdlib_128_avx.inl
index 7232791..56f60a8 100644
--- a/src/gallium/drivers/swr/rasterizer/common/simdlib_128_avx.inl
+++ b/src/gallium/drivers/swr/rasterizer/common/simdlib_128_avx.inl
@@ -174,6 +174,7 @@ SIMD_IWRAPPER_2_(xor_si, _mm_xor_si128); // return a ^ b (int)
// Shift operations
//-----------------------------------------------------------------------
SIMD_IWRAPPER_1I(slli_epi32); // return a << ImmT
+SIMD_IWRAPPER_1I(slli_epi64); // return a << ImmT
static SIMDINLINE Integer SIMDCALL sllv_epi32(Integer vA, Integer vB) // return a << b (uint32)
{
@@ -205,6 +206,11 @@ SIMD_IWRAPPER_1I(srai_epi32); // return a >> ImmT (int32)
SIMD_IWRAPPER_1I(srli_epi32); // return a >> ImmT (uint32)
SIMD_IWRAPPER_1I_(srli_si, _mm_srli_si128); // return a >> (ImmT*8) (uint)
+static SIMDINLINE Integer SIMDCALL srli_epi64(Integer a, uint32_t n)
+{
+ return _mm_srli_epi64(a, n);
+}
+
template<int ImmT> // same as srli_si, but with Float cast to int
static SIMDINLINE Float SIMDCALL srlisi_ps(Float a)
{
@@ -272,6 +278,16 @@ static SIMDINLINE Float SIMDCALL cvtepi32_ps(Integer a) // return (float)a (i
return _mm_cvtepi32_ps(a);
}
+static SIMDINLINE int32_t SIMDCALL cvtsi128_si32(Integer a) // return a.v[0]
+{
+ return _mm_cvtsi128_si32(a);
+}
+
+static SIMDINLINE Integer SIMDCALL cvtsi32_si128(int32_t n) // return a[0] = n, a[1]...a[3] = 0
+{
+ return _mm_cvtsi32_si128(n);
+}
+
SIMD_IWRAPPER_1(cvtepu8_epi16); // return (int16)a (uint8 --> int16)
SIMD_IWRAPPER_1(cvtepu8_epi32); // return (int32)a (uint8 --> int32)
SIMD_IWRAPPER_1(cvtepu16_epi32); // return (int32)a (uint16 --> int32)
--
2.7.4
More information about the mesa-dev
mailing list