]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gcc.target/i386/funcspec-9.c
Add ability to set target options (ix86 only) and optimization options on a function...
[thirdparty/gcc.git] / gcc / testsuite / gcc.target / i386 / funcspec-9.c
1 /* Test whether using target specific options, we can generate SSE5 code. */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -march=k8 -mfpmath=sse -msse2" } */
4
5 extern void exit (int);
6
7 #ifdef __SSE5__
8 #warning "__SSE5__ should not be defined before #pragma GCC option."
9 #endif
10
11 #pragma GCC option (push)
12 #pragma GCC option ("sse5,fused-madd")
13
14 #ifndef __SSE5__
15 #warning "__SSE5__ should have be defined after #pragma GCC option."
16 #endif
17
18 float
19 flt_mul_add (float a, float b, float c)
20 {
21 return (a * b) + c;
22 }
23
24 #pragma GCC option (pop)
25 #ifdef __SSE5__
26 #warning "__SSE5__ should not be defined after #pragma GCC pop option."
27 #endif
28
29 double
30 dbl_mul_add (double a, double b, double c)
31 {
32 return (a * b) + c;
33 }
34
35 /* { dg-final { scan-assembler "fmaddss" } } */
36 /* { dg-final { scan-assembler "addsd" } } */