@@ -25,15 +25,19 @@ avx2_test (void)
int i;
union128i_d idx;
union256d res, src, mask;
- double s1[4], res_ref[4] = { 0 };
+ double s1[16], res_ref[4] = { 0 };
+ double *s1_ptr = s1 + 8;
- for (i = 0; i < 4; ++i)
+ for (i = 0; i < ARRAY_SIZE (s1); i++)
{
/* Set some stuff */
s1[i] = 2.718281828459045 * (i + 1) * (i + 2);
+ }
+ for (i = 0; i < 4; ++i)
+ {
/* Set src as something different from s1 */
- src.a[i] = -s1[i];
+ src.a[i] = -s1_ptr[i];
/* Mask out evens */
((long long *) mask.a)[i] = i % 2 ? 0 : -1;
@@ -43,9 +47,9 @@ avx2_test (void)
idx.a[i] = (16 - (i + 1) * 8) >> 1;
}
- res.x = _mm256_mask_i32gather_pd (src.x, s1, idx.x, mask.x, 2);
+ res.x = _mm256_mask_i32gather_pd (src.x, s1_ptr, idx.x, mask.x, 2);
- compute_i32gatherpd256 (src.a, s1, idx.a, mask.a, 2, res_ref);
+ compute_i32gatherpd256 (src.a, s1_ptr, idx.a, mask.a, 2, res_ref);
if (check_union256d (res, res_ref) != 0)
abort ();
@@ -25,15 +25,19 @@ avx2_test (void)
long long i;
union128i_d idx;
union256i_q res, src, mask;
- long long s1[4], res_ref[4] = { 0 };
+ long long s1[16], res_ref[4] = { 0 };
+ long long *s1_ptr = s1 + 8;
- for (i = 0; i < 4; ++i)
+ for (i = 0; i < ARRAY_SIZE (s1); i++)
{
/* Set some stuff */
s1[i] = 1983 * (i + 1) * (i + 2);
+ }
+ for (i = 0; i < 4; ++i)
+ {
/* Set src as something different from s1 */
- src.a[i] = -s1[i];
+ src.a[i] = -s1_ptr[i];
/* Mask out evens */
mask.a[i] = i % 2 ? 0 : -1;
@@ -44,10 +48,10 @@ avx2_test (void)
}
res.x = _mm256_mask_i32gather_epi64 (src.x,
- (long long int *) s1,
+ (long long int *) s1_ptr,
idx.x, mask.x, 2);
- compute_i32gatherpd256 (src.a, s1, idx.a, mask.a, 2, res_ref);
+ compute_i32gatherpd256 (src.a, s1_ptr, idx.a, mask.a, 2, res_ref);
if (check_union256i_q (res, res_ref) != 0)
abort ();
@@ -25,15 +25,19 @@ avx2_test (void)
int i;
union256i_q idx;
union256d res, src, mask;
- double s1[4], res_ref[4] = { 0 };
+ double s1[16], res_ref[4] = { 0 };
+ double *s1_ptr = s1 + 8;
- for (i = 0; i < 4; ++i)
+ for (i = 0; i < ARRAY_SIZE (s1); i++)
{
/* Set some stuff */
s1[i] = 2.718281828459045 * (i + 1) * (i + 2);
+ }
+ for (i = 0; i < 4; ++i)
+ {
/* Set src as something different from s1 */
- src.a[i] = -s1[i];
+ src.a[i] = -s1_ptr[i];
/* Mask out evens */
((long long *) mask.a)[i] = i % 2 ? 0 : -1;
@@ -43,9 +47,9 @@ avx2_test (void)
idx.a[i] = (16 - (i + 1) * 8) >> 1;
}
- res.x = _mm256_mask_i64gather_pd (src.x, s1, idx.x, mask.x, 2);
+ res.x = _mm256_mask_i64gather_pd (src.x, s1_ptr, idx.x, mask.x, 2);
- compute_i64gatherpd256 (src.a, s1, idx.a, mask.a, 2, res_ref);
+ compute_i64gatherpd256 (src.a, s1_ptr, idx.a, mask.a, 2, res_ref);
if (check_union256d (res, res_ref) != 0)
abort ();
@@ -26,15 +26,19 @@ avx2_test (void)
long long i;
union256i_q idx;
union256i_q res, src, mask;
- long long s1[4], res_ref[4] = { 0 };
+ long long s1[16], res_ref[4] = { 0 };
+ long long *s1_ptr = s1 + 8;
- for (i = 0; i < 4; ++i)
+ for (i = 0; i < ARRAY_SIZE (s1); i++)
{
/* Set some stuff */
s1[i] = 1983 * (i + 1) * (i + 2);
+ }
+ for (i = 0; i < 4; ++i)
+ {
/* Set src as something different from s1 */
- src.a[i] = -s1[i];
+ src.a[i] = -s1_ptr[i];
/* Mask out evens */
((long long *) mask.a)[i] = i % 2 ? 0 : -1;
@@ -45,10 +49,10 @@ avx2_test (void)
}
res.x = _mm256_mask_i64gather_epi64 (src.x,
- (long long int *) s1,
+ (long long int *) s1_ptr,
idx.x, mask.x, 2);
- compute_i64gatherq256 (src.a, s1, idx.a, mask.a, 2, res_ref);
+ compute_i64gatherq256 (src.a, s1_ptr, idx.a, mask.a, 2, res_ref);
if (check_union256i_q (res, res_ref) != 0)
abort ();
@@ -28,7 +28,7 @@ avx2_test (void)
union256i_b s, d;
- for (i = 0; i < 256; ++i)
+ for (i = 0; i < 256 - 7; ++i)
{
/* Recompute the results for 256-bits */
compute_pabs256 (&vals[i], ck);
@@ -27,7 +27,7 @@ avx2_test (void)
union256i_d s, d;
- for (i = 0; i < 256; ++i)
+ for (i = 0; i < 256 - 7; ++i)
{
/* Recompute the results for 256-bits */
compute_pabs256 (&vals[i], ck);
@@ -28,7 +28,7 @@ avx2_test (void)
union256i_w s, d;
- for (i = 0; i < 256; ++i)
+ for (i = 0; i < 256 - 7; ++i)
{
/* Using only first 2 bytes of int */
/* Recompute the results for 256-bits */
@@ -16,10 +16,10 @@ __attribute__ ((noinline))
void
foo (void)
{
- mp = (char **) malloc (N);
- lp = (char **) malloc (N);
- ep = (char **) malloc (N);
- fp = (char **) malloc (N);
+ mp = (char **) malloc (N * sizeof (char **));
+ lp = (char **) malloc (N * sizeof (char **));
+ ep = (char **) malloc (N * sizeof (char **));
+ fp = (char **) malloc (N * sizeof (char **));
}
void
@@ -14,8 +14,8 @@ __attribute__ ((noinline))
void
foo (void)
{
- ep = (char **) malloc (N);
- fp = (char **) malloc (N);
+ ep = (char **) malloc (N * sizeof (char **));
+ fp = (char **) malloc (N * sizeof (char **));
}
void
@@ -24,7 +24,7 @@ int main ()
f (n);
h (d);
qp = (unsigned long*)__builtin_alloca(4099*8) + 1;
- dnp = (unsigned long*)__builtin_alloca (2049*8);
+ dnp = (unsigned long*)__builtin_alloca (2049*8) + 1;
alloc = 1;
for (test = 0; test < 1; test++)
{