summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/funcspec-8.c
blob: 225843493d9cdf33fde3e3427149719e8ac4a574 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
/* Test whether using target specific options, we can use the x86 builtin
   functions in functions with the appropriate function specific options.  */
/* { dg-do compile } */
/* { dg-skip-if "" { i?86-*-* x86_64-*-* } { "-march=*" } { "-march=k8" } } */
/* { dg-options "-O2 -march=k8 -mno-sse3 -mfpmath=sse" } */

typedef float     __m128  __attribute__ ((__vector_size__ (16), __may_alias__));
typedef double    __m128d __attribute__ ((__vector_size__ (16), __may_alias__));
typedef int	  __m128w __attribute__ ((__vector_size__ (16), __may_alias__));
typedef long long __m128i __attribute__ ((__vector_size__ (16), __may_alias__));

#ifdef __SSE3__
#error "-msse3 should not be set for this test"
#endif

__m128d sse3_hsubpd (__m128d a, __m128d b) __attribute__((__target__("sse3")));
__m128d generic_hsubpd (__m128d a, __m128d b);

__m128d
sse3_hsubpd (__m128d a, __m128d b)
{
  return __builtin_ia32_hsubpd (a, b);
}

__m128d
generic_hsubpd (__m128d a, __m128d b)
{
  return __builtin_ia32_hsubpd (a, b);			/* { dg-error "needs isa option" } */
}

#ifdef __SSSE3__
#error "-mssse3 should not be set for this test"
#endif

__m128w ssse3_psignd128 (__m128w a, __m128w b) __attribute__((__target__("ssse3")));
__m128w generic_psignd (__m128w ab, __m128w b);

__m128w
ssse3_psignd128 (__m128w a, __m128w b)
{
  return __builtin_ia32_psignd128 (a, b);
}

__m128w
generic_psignd128 (__m128w a, __m128w b)
{
  return __builtin_ia32_psignd128 (a, b);		/* { dg-error "needs isa option" } */
}

#ifdef __SSE4_1__
#error "-msse4.1 should not be set for this test"
#endif

__m128d sse4_1_blendvpd (__m128d a, __m128d b, __m128d c) __attribute__((__target__("sse4.1")));
__m128d generic_blendvpd (__m128d a, __m128d b, __m128d c);

__m128d
sse4_1_blendvpd  (__m128d a, __m128d b, __m128d c)
{
  return __builtin_ia32_blendvpd (a, b, c);
}

__m128d
generic_blendvpd  (__m128d a, __m128d b, __m128d c)
{
  return __builtin_ia32_blendvpd (a, b, c);		/* { dg-error "needs isa option" } */
}

#ifdef __SSE4_2__
#error "-msse4.2 should not be set for this test"
#endif

__m128i sse4_2_pcmpgtq (__m128i a, __m128i b) __attribute__((__target__("sse4.2")));
__m128i generic_pcmpgtq (__m128i ab, __m128i b);

__m128i
sse4_2_pcmpgtq (__m128i a, __m128i b)
{
  return __builtin_ia32_pcmpgtq (a, b);
}

__m128i
generic_pcmpgtq (__m128i a, __m128i b)
{
  return __builtin_ia32_pcmpgtq (a, b);			/* { dg-error "needs isa option" } */
}

#ifdef __SSE4A__
#error "-msse4a should not be set for this test"
#endif

__m128i sse4_2_insertq (__m128i a, __m128i b) __attribute__((__target__("sse4a")));
__m128i generic_insertq (__m128i ab, __m128i b);

__m128i
sse4_2_insertq (__m128i a, __m128i b)
{
  return __builtin_ia32_insertq (a, b);
}

__m128i
generic_insertq (__m128i a, __m128i b)
{
  return __builtin_ia32_insertq (a, b);			/* { dg-error "needs isa option" } */
}

#ifdef __FMA4__
#error "-mfma4 should not be set for this test"
#endif

__m128d fma4_fmaddpd (__m128d a, __m128d b, __m128d c) __attribute__((__target__("fma4")));
__m128d generic_fmaddpd (__m128d a, __m128d b, __m128d c);

__m128d
fma4_fmaddpd  (__m128d a, __m128d b, __m128d c)
{
  return __builtin_ia32_vfmaddpd (a, b, c);
}

__m128d
generic_fmaddpd  (__m128d a, __m128d b, __m128d c)
{
  return __builtin_ia32_vfmaddpd (a, b, c);		/* { dg-error "needs isa option" } */
}

#ifdef __AES__
#error "-maes should not be set for this test"
#endif

__m128i aes_aesimc128 (__m128i a) __attribute__((__target__("aes")));
__m128i generic_aesimc128 (__m128i a);

__m128i
aes_aesimc128 (__m128i a)
{
  return __builtin_ia32_aesimc128 (a);
}

__m128i
generic_aesimc128 (__m128i a)
{
  return __builtin_ia32_aesimc128 (a);			/* { dg-error "needs isa option" } */
}

#ifdef __PCLMUL__
#error "-mpclmul should not be set for this test"
#endif

__m128i pclmul_pclmulqdq128 (__m128i a, __m128i b) __attribute__((__target__("pclmul")));
__m128i generic_pclmulqdq128 (__m128i a, __m128i b);

__m128i
pclmul_pclmulqdq128 (__m128i a, __m128i b)
{
  return __builtin_ia32_pclmulqdq128 (a, b, 5);
}

__m128i
generic_pclmulqdq128 (__m128i a, __m128i b)
{
  return __builtin_ia32_pclmulqdq128 (a, b, 5);		/* { dg-error "needs isa option" } */
}