PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / opt-1.c
blob2585236a6bc902e66479b67fc4dcbc12f9516b3a
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 --param min-insn-to-prefetch-ratio=0" } */
5 /* { dg-final { scan-assembler "prefetcht0" } } */
6 /* { dg-final { scan-assembler "addps" } } */
7 /* { dg-final { scan-assembler "subss" } } */
9 #define SIZE 10240
10 float a[SIZE] __attribute__((__aligned__(32)));
11 float b[SIZE] __attribute__((__aligned__(32)));
12 float c[SIZE] __attribute__((__aligned__(32)));
14 /* This should vectorize. */
15 void opt3 (void) __attribute__((__optimize__(3,"unroll-all-loops,-fprefetch-loop-arrays")));
17 void
18 opt3 (void)
20 int i;
22 for (i = 0; i < SIZE; i++)
23 a[i] = b[i] + c[i];
26 /* This should not vectorize. */
27 void
28 not_opt3 (void)
30 int i;
32 for (i = 0; i < SIZE; i++)
33 a[i] = b[i] - c[i];