Stop only if there aren't any usable algorithms
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / pr46085-2.c
blob568cdd96f46e9a2dd74240fe1045488702e1a8a0
1 /* { dg-do run } */
2 /* { dg-require-effective-target avx } */
3 /* { dg-options "-O2 -ftree-vectorize -mavx -mtune=generic -ffast-math" } */
5 #include "avx-check.h"
7 #define N 16
8 #define DIFF 242
10 double b[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
11 double c[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
13 void
14 main1 (double x, double max_result)
16 int i;
17 double diff = 2;
18 double max = x;
19 double min = 10;
21 for (i = 0; i < N; i++) {
22 diff += (b[i] - c[i]);
25 for (i = 0; i < N; i++) {
26 max = max < c[i] ? c[i] : max;
29 for (i = 0; i < N; i++) {
30 min = min > c[i] ? c[i] : min;
33 /* check results: */
34 if (diff != DIFF)
35 abort ();
36 if (max != max_result)
37 abort ();
38 if (min != 0)
39 abort ();
42 static void
43 avx_test (void)
45 main1 (100, 100);
46 main1 (0, 15);