swr/rast: Convert C Sampler intrinsics
Convert portions of the C sampler to the rasty SIMD lib. Also fix SRL call with a non-immediate. Don't count on the compiler automagically converting an srli call to srl if the shift count isn't an immediate. Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
This commit is contained in:
parent
37ebf86add
commit
c09483cf0a
|
@ -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;
|
||||
|
|
|
@ -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 srl_epi64(Integer a, Integer n)
|
||||
{
|
||||
return _mm_srl_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)
|
||||
|
|
Loading…
Reference in New Issue