sse4.1: workaround broken _mm_insert_epi{8,32} on clang-3.8
The clang function returns the incorrect type, so we just add a cast
to the correct type (__m128i).
@@ -1077,8 +1077,15 @@ simde_mm_insert_epi8 (simde__m128i a, int i, const int imm8)
return simde__m128i_from_private(r_);
}
#if defined(SIMDE_X86_SSE4_1_NATIVE)
+ /* clang-3.8 returns an incompatible type, so we need the cast. MSVC
+ * can't handle the cast ("error C2440: 'type cast': cannot convert
+ * from '__m128i' to '__m128i'"). */
+ #if defined(__clang__)
+ #define simde_mm_insert_epi8(a, i, imm8) HEDLEY_STATIC_CAST(__m128i, _mm_insert_epi8(a, i, imm8))
+ #else
#define simde_mm_insert_epi8(a, i, imm8) _mm_insert_epi8(a, i, imm8)
#endif
+#endif
#if defined(SIMDE_X86_SSE4_1_ENABLE_NATIVE_ALIASES)
# define _mm_insert_epi8(a, i, imm8) simde_mm_insert_epi8(a, i, imm8)
#endif
@@ -1095,8 +1102,12 @@ simde_mm_insert_epi32 (simde__m128i a, int i, const int imm8)
return simde__m128i_from_private(r_);
}
#if defined(SIMDE_X86_SSE4_1_NATIVE)
+ #if defined(__clang__)
+ #define simde_mm_insert_epi32(a, i, imm8) HEDLEY_STATIC_CAST(__m128i, _mm_insert_epi32(a, i, imm8))
+ #else
#define simde_mm_insert_epi32(a, i, imm8) _mm_insert_epi32(a, i, imm8)
#endif
+#endif
#if defined(SIMDE_X86_SSE4_1_ENABLE_NATIVE_ALIASES)
# define _mm_insert_epi32(a, i, imm8) simde_mm_insert_epi32(a, i, imm8)
#endif
