diff options
Diffstat (limited to 'gcc/testsuite/gcc.target/i386/funcspec-1.c')
-rw-r--r-- | gcc/testsuite/gcc.target/i386/funcspec-1.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.target/i386/funcspec-1.c b/gcc/testsuite/gcc.target/i386/funcspec-1.c new file mode 100644 index 00000000000..1ee43a0bbb8 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/funcspec-1.c @@ -0,0 +1,34 @@ +/* Test whether using target specific options, we can generate SSE2 code on + 32-bit, which does not generate SSE2 by default, but still generate 387 code + for a function that doesn't use attribute((option)). */ +/* { dg-do compile } */ +/* { dg-require-effective-target ilp32 } */ +/* { dg-options "-O3 -ftree-vectorize -march=i386" } */ +/* { dg-final { scan-assembler "addps\[ \t\]" } } */ +/* { dg-final { scan-assembler "fsubs\[ \t\]" } } */ + +#ifndef SIZE +#define SIZE 1024 +#endif + +static float a[SIZE] __attribute__((__aligned__(16))); +static float b[SIZE] __attribute__((__aligned__(16))); +static float c[SIZE] __attribute__((__aligned__(16))); + +void sse_addnums (void) __attribute__ ((__option__ ("sse2"))); + +void +sse_addnums (void) +{ + int i = 0; + for (; i < SIZE; ++i) + a[i] = b[i] + c[i]; +} + +void +i387_subnums (void) +{ + int i = 0; + for (; i < SIZE; ++i) + a[i] = b[i] - c[i]; +} |