Commit 0adef454 authored by Michael R. Crusoe's avatar Michael R. Crusoe Committed by Michael R. Crusoe

avx512 gather: add MSVC native fallbacks

fix casts for GCC<9
parent ecc46929
...@@ -2269,11 +2269,11 @@ simde_mm256_i32gather_ps(const simde_float32* base_addr, simde__m256i vindex, co ...@@ -2269,11 +2269,11 @@ simde_mm256_i32gather_ps(const simde_float32* base_addr, simde__m256i vindex, co
return simde__m256_from_private(r_); return simde__m256_from_private(r_);
} }
#if defined(SIMDE_X86_AVX2_NATIVE) #if defined(SIMDE_X86_AVX2_NATIVE)
#define simde_mm256_i32gather_ps(base_addr, vindex, scale) _mm256_i32gather_ps(SIMDE_CHECKED_REINTERPRET_CAST(float const*, simde_float32 const*, base_addr), vindex, scale) #define simde_mm256_i32gather_ps(base_addr, vindex, scale) _mm256_i32gather_ps(SIMDE_CHECKED_REINTERPRET_CAST(float const*, simde_float32 const*, (base_addr)), (vindex), (scale))
#endif #endif
#if defined(SIMDE_X86_AVX2_ENABLE_NATIVE_ALIASES) #if defined(SIMDE_X86_AVX2_ENABLE_NATIVE_ALIASES)
#undef _mm256_i32gather_ps #undef _mm256_i32gather_ps
#define _mm256_i32gather_ps(base_addr, vindex, scale) simde_mm256_i32gather_ps(SIMDE_CHECKED_REINTERPRET_CAST(simde_float32 const*, float const*, base_addr), vindex, scale) #define _mm256_i32gather_ps(base_addr, vindex, scale) simde_mm256_i32gather_ps(SIMDE_CHECKED_REINTERPRET_CAST(simde_float32 const*, float const*, (base_addr)), (vindex), (scale))
#endif #endif
SIMDE_FUNCTION_ATTRIBUTES SIMDE_FUNCTION_ATTRIBUTES
......
...@@ -66,6 +66,13 @@ simde_mm512_i32gather_ps(simde__m512i vindex, const void* base_addr, const int32 ...@@ -66,6 +66,13 @@ simde_mm512_i32gather_ps(simde__m512i vindex, const void* base_addr, const int32
HEDLEY_STATIC_CAST(float const*, (base_addr)), simde_mm512_i32gather_ps_vindex_.m256i[1], (scale)); \ HEDLEY_STATIC_CAST(float const*, (base_addr)), simde_mm512_i32gather_ps_vindex_.m256i[1], (scale)); \
simde__m512_from_private(simde_mm512_i32gather_ps_r_); \ simde__m512_from_private(simde_mm512_i32gather_ps_r_); \
})) }))
#elif defined(SIMDE_X86_AVX2_NATIVE) && !defined(SIMDE_STATEMENT_EXPR_)
#define simde_mm512_i32gather_ps(vindex, base_addr, scale) \
simde_x_mm512_set_m256( \
_mm256_i32gather_ps(HEDLEY_STATIC_CAST(float const*, (base_addr)), \
simde_mm512_extracti32x8_epi32((vindex), 1), (scale)), \
_mm256_i32gather_ps(HEDLEY_STATIC_CAST(float const*, (base_addr)), \
simde_mm512_extracti32x8_epi32((vindex), 0), (scale)) )
#endif #endif
#if defined(SIMDE_X86_AVX512F_ENABLE_NATIVE_ALIASES) #if defined(SIMDE_X86_AVX512F_ENABLE_NATIVE_ALIASES)
#undef _mm512_i32gather_ps #undef _mm512_i32gather_ps
...@@ -105,6 +112,15 @@ simde_mm512_i64gather_epi32(simde__m512i vindex, const void* base_addr, const in ...@@ -105,6 +112,15 @@ simde_mm512_i64gather_epi32(simde__m512i vindex, const void* base_addr, const in
HEDLEY_STATIC_CAST(int const*, (base_addr)), simde_mm512_i64gather_epi32_vindex_.m256i[1], (scale)); \ HEDLEY_STATIC_CAST(int const*, (base_addr)), simde_mm512_i64gather_epi32_vindex_.m256i[1], (scale)); \
simde__m256i_from_private(simde_mm512_i64gather_epi32_r_); \ simde__m256i_from_private(simde_mm512_i64gather_epi32_r_); \
})) }))
#elif defined(SIMDE_X86_AVX2_NATIVE) && !defined(SIMDE_STATEMENT_EXPR_)
#define simde_mm512_i64gather_epi32(vindex, base_addr, scale) \
_mm256_insertf128_si256( \
_mm256_castsi128_si256( \
_mm256_i64gather_epi32(HEDLEY_STATIC_CAST(int const*, (base_addr)), \
simde_mm512_extracti64x4_epi64((vindex), 0), (scale))), \
_mm256_i64gather_epi32(HEDLEY_STATIC_CAST(int const*, (base_addr)), \
simde_mm512_extracti64x4_epi64((vindex), 1), (scale)), \
1)
#endif #endif
#if defined(SIMDE_X86_AVX512F_ENABLE_NATIVE_ALIASES) #if defined(SIMDE_X86_AVX512F_ENABLE_NATIVE_ALIASES)
#undef _mm512_i64gather_epi32 #undef _mm512_i64gather_epi32
...@@ -148,11 +164,18 @@ simde_mm512_i64gather_epi64(simde__m512i vindex, const void* base_addr, const in ...@@ -148,11 +164,18 @@ simde_mm512_i64gather_epi64(simde__m512i vindex, const void* base_addr, const in
simde__m512i_private simde_mm512_i64gather_epi64_r_, \ simde__m512i_private simde_mm512_i64gather_epi64_r_, \
simde_mm512_i64gather_epi64_vindex_ = simde__m512i_to_private((vindex)); \ simde_mm512_i64gather_epi64_vindex_ = simde__m512i_to_private((vindex)); \
simde_mm512_i64gather_epi64_r_.m256i[0] = _mm256_i64gather_epi64( \ simde_mm512_i64gather_epi64_r_.m256i[0] = _mm256_i64gather_epi64( \
HEDLEY_STATIC_CAST(int64_t const*, (base_addr)), simde_mm512_i64gather_epi64_vindex_.m256i[0], (scale)); \ HEDLEY_STATIC_CAST(long long const*, (base_addr)), simde_mm512_i64gather_epi64_vindex_.m256i[0], (scale)); \
simde_mm512_i64gather_epi64_r_.m256i[1] = _mm256_i64gather_epi64( \ simde_mm512_i64gather_epi64_r_.m256i[1] = _mm256_i64gather_epi64( \
HEDLEY_STATIC_CAST(int64_t const*, (base_addr)), simde_mm512_i64gather_epi64_vindex_.m256i[1], (scale)); \ HEDLEY_STATIC_CAST(long long const*, (base_addr)), simde_mm512_i64gather_epi64_vindex_.m256i[1], (scale)); \
simde__m512i_from_private(simde_mm512_i64gather_epi64_r_); \ simde__m512i_from_private(simde_mm512_i64gather_epi64_r_); \
})) }))
#elif defined(SIMDE_X86_AVX2_NATIVE) && !defined(SIMDE_STATEMENT_EXPR_)
#define simde_mm512_i64gather_epi64(vindex, base_addr, scale) \
simde_x_mm512_set_m256i( \
_mm256_i64gather_epi64(HEDLEY_STATIC_CAST(long long const*, (base_addr)), \
simde_mm512_extracti32x8_epi32((vindex), 1), (scale)), \
_mm256_i64gather_epi64(HEDLEY_STATIC_CAST(long long const*, (base_addr)), \
simde_mm512_extracti32x8_epi32((vindex), 0), (scale)) )
#endif #endif
#if defined(SIMDE_X86_AVX512F_ENABLE_NATIVE_ALIASES) #if defined(SIMDE_X86_AVX512F_ENABLE_NATIVE_ALIASES)
#undef _mm512_i64gather_epi64 #undef _mm512_i64gather_epi64
...@@ -202,6 +225,13 @@ simde_mm512_i64gather_pd(simde__m512i vindex, const void* base_addr, const int32 ...@@ -202,6 +225,13 @@ simde_mm512_i64gather_pd(simde__m512i vindex, const void* base_addr, const int32
HEDLEY_STATIC_CAST(double const*, (base_addr)), simde_mm512_i64gather_pd_vindex_.m256i[1], (scale)); \ HEDLEY_STATIC_CAST(double const*, (base_addr)), simde_mm512_i64gather_pd_vindex_.m256i[1], (scale)); \
simde__m512d_from_private(simde_mm512_i64gather_pd_r_); \ simde__m512d_from_private(simde_mm512_i64gather_pd_r_); \
})) }))
#elif defined(SIMDE_X86_AVX2_NATIVE) && !defined(SIMDE_STATEMENT_EXPR_)
#define simde_mm512_i64gather_pd(vindex, base_addr, scale) \
simde_x_mm512_set_m256d( \
_mm256_i64gather_pd(HEDLEY_STATIC_CAST(double const*, (base_addr)), \
simde_mm512_extracti64x4_epi64((vindex), 1), (scale)), \
_mm256_i64gather_pd(HEDLEY_STATIC_CAST(double const*, (base_addr)), \
simde_mm512_extracti64x4_epi64((vindex), 0), (scale)) )
#endif #endif
#if defined(SIMDE_X86_AVX512F_ENABLE_NATIVE_ALIASES) #if defined(SIMDE_X86_AVX512F_ENABLE_NATIVE_ALIASES)
#undef _mm512_i64gather_pd #undef _mm512_i64gather_pd
...@@ -251,6 +281,15 @@ simde_mm512_i64gather_ps(simde__m512i vindex, const void* base_addr, const int32 ...@@ -251,6 +281,15 @@ simde_mm512_i64gather_ps(simde__m512i vindex, const void* base_addr, const int32
HEDLEY_STATIC_CAST(float const*, (base_addr)), simde_mm512_i64gather_ps_vindex_.m256i[1], (scale)); \ HEDLEY_STATIC_CAST(float const*, (base_addr)), simde_mm512_i64gather_ps_vindex_.m256i[1], (scale)); \
simde__m256_from_private(simde_mm512_i64gather_ps_r_); \ simde__m256_from_private(simde_mm512_i64gather_ps_r_); \
})) }))
#elif defined(SIMDE_X86_AVX2_NATIVE) && !defined(SIMDE_STATEMENT_EXPR_)
#define simde_mm512_i64gather_ps(vindex, base_addr, scale) \
_mm256_insertf128_ps( \
_mm256_castps128_ps256( \
_mm256_i64gather_ps(HEDLEY_STATIC_CAST(float const*, (base_addr)), \
simde_mm512_extracti64x4_epi64((vindex), 0), (scale))), \
_mm256_i64gather_ps(HEDLEY_STATIC_CAST(float const*, (base_addr)), \
simde_mm512_extracti64x4_epi64((vindex), 1), (scale)), \
1)
#endif #endif
#if defined(SIMDE_X86_AVX512F_ENABLE_NATIVE_ALIASES) #if defined(SIMDE_X86_AVX512F_ENABLE_NATIVE_ALIASES)
#undef _mm512_i64gather_ps #undef _mm512_i64gather_ps
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment