Fix build error "first two arguments to __builtin_shufflevector must be vectors" when passing struct/union types to _mm_shuffle_ps() and expecting an implicit cast to be taken. Add a test.
This commit is contained in:
Родитель
5b12b7c365
Коммит
b569e7e1df
|
@ -138,7 +138,7 @@ _mm_sfence(void)
|
|||
// This is defined as a macro because __builtin_shufflevector requires its
|
||||
// mask argument to be a compile-time constant.
|
||||
#define _mm_shuffle_ps(a, b, mask) \
|
||||
((__m128)__builtin_shufflevector((a), (b), \
|
||||
((__m128)__builtin_shufflevector((__m128)(a), (__m128)(b), \
|
||||
(((mask) >> 0) & 0x3) + 0, \
|
||||
(((mask) >> 2) & 0x3) + 0, \
|
||||
(((mask) >> 4) & 0x3) + 4, \
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
#include <xmmintrin.h>
|
||||
#include <stdio.h>
|
||||
|
||||
class float4
|
||||
{
|
||||
public:
|
||||
float4(){}
|
||||
float4(__m128 in) { m128 = in; }
|
||||
operator __m128() { return m128; }
|
||||
operator const __m128() const { return m128; }
|
||||
__m128 m128;
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
float4 v = _mm_set_ps(3, 2, 1, 0);
|
||||
float4 w = _mm_shuffle_ps(v, v, _MM_SHUFFLE(3,3,3,3));
|
||||
printf("%d\n", (int)_mm_cvtss_f32(w));
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
3
|
|
@ -5877,6 +5877,15 @@ return malloc(size);
|
|||
self.emcc_args = self.emcc_args + ['-msse']
|
||||
self.do_run_from_file(src, output)
|
||||
|
||||
def test_simd13(self):
|
||||
if self.is_emterpreter(): return self.skip('todo')
|
||||
|
||||
test_path = path_from_root('tests', 'core', 'test_simd13')
|
||||
src, output = (test_path + s for s in ('.in', '.out'))
|
||||
|
||||
self.emcc_args = self.emcc_args + ['-msse']
|
||||
self.do_run_from_file(src, output)
|
||||
|
||||
def test_simd_dyncall(self):
|
||||
if self.is_emterpreter(): return self.skip('todo')
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче