1 /*
2 * Copyright 2020 The Emscripten Authors. All rights reserved.
3 * Emscripten is available under two separate licenses, the MIT license and the
4 * University of Illinois/NCSA Open Source License. Both these licenses can be
5 * found in the LICENSE file.
6 */
7 // This file uses AVX by calling different functions with different interesting inputs and prints the results.
8 // Use a diff tool to compare the results between platforms.
9
10 #include <immintrin.h>
11 #include "test_sse.h"
12
13 bool testNaNBits = true;
14
15 float *interesting_floats = get_interesting_floats();
16 int numInterestingFloats = sizeof(interesting_floats_)/sizeof(interesting_floats_[0]);
17 uint32_t *interesting_ints = get_interesting_ints();
18 int numInterestingInts = sizeof(interesting_ints_)/sizeof(interesting_ints_[0]);
19 double *interesting_doubles = get_interesting_doubles();
20 int numInterestingDoubles = sizeof(interesting_doubles_)/sizeof(interesting_doubles_[0]);
21
main()22 int main()
23 {
24 assert(numInterestingFloats % 4 == 0);
25 assert(numInterestingInts % 4 == 0);
26 assert(numInterestingDoubles % 4 == 0);
27
28 Ret_FloatPtr(__m128, _mm_broadcast_ss, 1, 1);
29 Ret_M128d_M128d_Tint_5bits(__m128d, _mm_cmp_pd);
30 Ret_M128_M128_Tint_5bits(__m128, _mm_cmp_ps);
31 Ret_M128d_M128d_Tint_5bits(__m128d, _mm_cmp_sd);
32 Ret_M128_M128_Tint_5bits(__m128, _mm_cmp_ss);
33 Ret_DoublePtr_M128i(__m128d, _mm_maskload_pd, 2, 2);
34 Ret_FloatPtr_M128i(__m128, _mm_maskload_ps, 4, 4);
35 void_OutDoublePtr_M128i_M128d(_mm_maskstore_pd, double*, 16, 8);
36 void_OutFloatPtr_M128i_M128(_mm_maskstore_ps, float*, 16, 4);
37 Ret_M128d_Tint(__m128d, _mm_permute_pd);
38 Ret_M128_Tint(__m128, _mm_permute_ps);
39 Ret_M128d_M128d(__m128d, _mm_permutevar_pd);
40 Ret_M128_M128(__m128, _mm_permutevar_ps);
41 Ret_M128d_M128d(int, _mm_testc_pd);
42 Ret_M128_M128(int, _mm_testc_ps);
43 Ret_M128d_M128d(int, _mm_testnzc_pd);
44 Ret_M128_M128(int, _mm_testnzc_ps);
45 Ret_M128d_M128d(int, _mm_testz_pd);
46 Ret_M128_M128(int, _mm_testz_ps);
47 }
48