OSDN Git Service

1ee43a0bbb8ee70a98322c631003200a049543f0
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.target / i386 / funcspec-1.c
1 /* Test whether using target specific options, we can generate SSE2 code on
2    32-bit, which does not generate SSE2 by default, but still generate 387 code
3    for a function that doesn't use attribute((option)).  */
4 /* { dg-do compile } */
5 /* { dg-require-effective-target ilp32 } */
6 /* { dg-options "-O3 -ftree-vectorize -march=i386" } */
7 /* { dg-final { scan-assembler "addps\[ \t\]" } } */
8 /* { dg-final { scan-assembler "fsubs\[ \t\]" } } */
9
10 #ifndef SIZE
11 #define SIZE 1024
12 #endif
13
14 static float a[SIZE] __attribute__((__aligned__(16)));
15 static float b[SIZE] __attribute__((__aligned__(16)));
16 static float c[SIZE] __attribute__((__aligned__(16)));
17
18 void sse_addnums (void) __attribute__ ((__option__ ("sse2")));
19
20 void
21 sse_addnums (void)
22 {
23   int i = 0;
24   for (; i < SIZE; ++i)
25     a[i] = b[i] + c[i];
26 }
27
28 void
29 i387_subnums (void)
30 {
31   int i = 0;
32   for (; i < SIZE; ++i)
33     a[i] = b[i] - c[i];
34 }