OSDN Git Service

Add NIOS2 support. Code from SourceyG++.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.target / i386 / opt-2.c
1 /* Test the attribute((optimize)) really works.  Do this test by checking
2    whether we vectorize a simple loop.  */
3 /* { dg-do compile } */
4 /* { dg-options "-O1 -msse2 -mfpmath=sse -march=k8" } */
5 /* { dg-require-effective-target sse2 } */
6 /* { dg-final { scan-assembler "prefetcht0" } } */
7 /* { dg-final { scan-assembler "addps" } } */
8 /* { dg-final { scan-assembler "subss" } } */
9
10 #define SIZE 10240
11 float a[SIZE] __attribute__((__aligned__(32)));
12 float b[SIZE] __attribute__((__aligned__(32)));
13 float c[SIZE] __attribute__((__aligned__(32)));
14
15 /* This should vectorize.  */
16 #pragma GCC push_options
17 #pragma GCC optimize (3, "unroll-all-loops", "-fprefetch-loop-arrays")
18
19 void
20 opt3 (void)
21 {
22   int i;
23
24   for (i = 0; i < SIZE; i++)
25     a[i] = b[i] + c[i];
26 }
27
28 #pragma GCC pop_options
29
30 /* This should not vectorize.  */
31 void
32 not_opt3 (void)
33 {
34   int i;
35
36   for (i = 0; i < SIZE; i++)
37     a[i] = b[i] - c[i];
38 }
39