static void avx_test () { int i; union256d source1, source2; double s1[4] = {0, -5463, 86456, 0}; double s2[4] = {0, -1223, 0, 1}; int d[1]; int e[1]; source1.x = _mm256_loadu_pd(s1); source2.x = _mm256_loadu_pd(s2); d[0] = _mm256_testz_pd(source1.x, source2.x); e[0] = 1; for (i = 0; i < 4; i++) { union ieee754_double u1, u2; u1.d = s1[i]; u2.d = s2[i]; if (u1.bits.sign && u2.bits.sign) { e[0] = 0; } } if (checkVi(d, e, 1)) abort (); }
static void avx2_test (void) { int i; int ck[8]; int r[8]; unsigned int imm; int fail = 0; union256i_q s1, s2, d; for (i = 0; i < 256; i += 16) for (imm = 0; imm < 100; imm++) { /* Recompute the results for 256-bits */ compute_correct_result_256 (&vals[i + 0], &vals[i + 8], imm, ck); s1.x = _mm256_loadu_si256 ((__m256i *) & vals[i + 0]); s2.x = _mm256_loadu_si256 ((__m256i *) & vals[i + 8]); /* Run the 256-bit tests */ avx2_test_palignr256 (s1.x, s2.x, imm, &d.x); _mm256_storeu_si256 ((__m256i *) r, d.x); fail += checkVi (r, ck, 8); } if (fail != 0) abort (); }
static void avx_test () { int i; union128 source1, source2; float s1[4] = {0, -5463, 86456, 0}; float s2[4] = {0, -1223, 0, 0}; int d[1]; int e[1]; int c=1; int z=1; source1.x = _mm_loadu_ps(s1); source2.x = _mm_loadu_ps(s2); d[0] = _mm_testnzc_ps(source1.x, source2.x); e[0] = 1; for (i = 0; i < 4; i++) { union ieee754_float u1, u2; u1.d = s1[i]; u2.d = s2[i]; if (!u1.bits.sign && u2.bits.sign) c = 0; if (u1.bits.sign && u2.bits.sign) z = 0; } e[0] = (c == 0 && z == 0) ? 1:0; if (checkVi (d, e, 1)) abort (); }
static void TEST (void) { union128 s1, s2; int d[1]; int e[1]; s1.x = _mm_set_ps (24.43, 68.346, 43.35, 546.46); s2.x = _mm_set_ps (1.17, 2.16, 3.15, 4.14); d[0] = test (s1.x, s2.x); e[0] = s1.a[0] > s2.a[0]; if (checkVi (d, e, 1)) abort (); }
static void TEST (void) { union128d s1, s2; int d[1]; int e[1]; s1.x = _mm_set_pd (2134.3343,2344.2354); s2.x = _mm_set_pd (41124.234,2344.2354); d[0] = test (s1.x, s2.x); e[0] = s1.a[0] == s2.a[0]; if (checkVi (d, e, 1)) abort (); }
void static avx_test (void) { int i; int d; union256d s1; double source[4] = {-45, -3, -34.56, 35}; int e = 0; s1.x = _mm256_loadu_pd (source); d = _mm256_movemask_pd (s1.x); for (i = 0; i < 4; i++) if (source[i] < 0) e |= (1 << i); if (checkVi (&d, &e, 1)) abort (); }
static void TEST (void) { union128 u; float s[4] = {-2134.3343, 1234.635654, 1.2234, -876.8976}; int d; int e = 0; int i; u.x = _mm_loadu_ps (s); d = test (u.x); for (i = 0; i < 4; i++) if (s[i] < 0) e |= (1 << i); if (checkVi (&d, &e, 1)) abort (); }
void TEST (void) { int i, sign; UNION_TYPE (AVX512F_LEN_HALF, i_d) res1, res2, res3; int res4[SIZE_HALF]; UNION_TYPE (AVX512F_LEN, i_q) src; MASK_TYPE mask = MASK_VALUE; int res_ref[SIZE_HALF]; sign = -1; for (i = 0; i < SIZE; i++) { src.a[i] = 1 + 34 * i * sign; sign = sign * -1; res2.a[i] = DEFAULT_VALUE; res4[i] = DEFAULT_VALUE; } res1.x = INTRINSIC (_cvtepi64_epi32) (src.x); res2.x = INTRINSIC (_mask_cvtepi64_epi32) (res2.x, mask, src.x); res3.x = INTRINSIC (_maskz_cvtepi64_epi32) (mask, src.x); INTRINSIC (_mask_cvtepi64_storeu_epi32) (res4, mask, src.x); CALC (res_ref, src.a); if (UNION_CHECK (AVX512F_LEN_HALF, i_d) (res1, res_ref)) abort (); MASK_MERGE (i_d) (res_ref, mask, SIZE); if (UNION_CHECK (AVX512F_LEN_HALF, i_d) (res2, res_ref)) abort (); if (checkVi (res4, res_ref, SIZE_HALF)) abort (); MASK_ZERO (i_d) (res_ref, mask, SIZE); if (UNION_CHECK (AVX512F_LEN_HALF, i_d) (res3, res_ref)) abort (); }
void static avx_test (void) { int i; union256 u, s1, s2; int source1[8]={34545, 95567, 23443, 5675, 2323, 67, 2345, 45667}; int source2[8]={674, 57897, 93459, 45624, 54674, 1237, 67436, 79608}; int d[8]; int e[8]; s1.x = _mm256_loadu_ps ((float *)source1); s2.x = _mm256_loadu_ps ((float *)source2); u.x = _mm256_andnot_ps (s1.x, s2.x); _mm256_storeu_ps ((float *)d, u.x); for (i = 0; i < 8; i++) e[i] = (~source1[i]) & source2[i]; if (checkVi (d, e, 8)) abort (); }
void check(unsigned imm, char *id) { if(checkVi(d.i, e, 4)){ printf("mm_cmp_ps(0x%x, %s) FAILED\n", imm, id); } }