1 /* Test whether using target specific options, we can use the x86 builtin
2 functions in functions with the appropriate function specific options. */
3 /* { dg-do compile } */
4 /* { dg-options "-O2 -march=k8 -mfpmath=sse" } */
6 typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__));
7 typedef double __m128d __attribute__ ((__vector_size__ (16), __may_alias__));
8 typedef int __m128w __attribute__ ((__vector_size__ (16), __may_alias__));
9 typedef long long __m128i __attribute__ ((__vector_size__ (16), __may_alias__));
12 #error "-msse3 should not be set for this test"
15 __m128d sse3_hsubpd (__m128d a, __m128d b) __attribute__((__option__("sse3")));
16 __m128d generic_hsubpd (__m128d a, __m128d b);
19 sse3_hsubpd (__m128d a, __m128d b)
21 return __builtin_ia32_hsubpd (a, b);
25 generic_hsubpd (__m128d a, __m128d b)
27 return __builtin_ia32_hsubpd (a, b); /* { dg-error "needs isa option" } */
31 #error "-mssse3 should not be set for this test"
34 __m128w ssse3_psignd128 (__m128w a, __m128w b) __attribute__((__option__("ssse3")));
35 __m128w generic_psignd (__m128w ab, __m128w b);
38 ssse3_psignd128 (__m128w a, __m128w b)
40 return __builtin_ia32_psignd128 (a, b);
44 generic_psignd128 (__m128w a, __m128w b)
46 return __builtin_ia32_psignd128 (a, b); /* { dg-error "needs isa option" } */
50 #error "-msse4.1 should not be set for this test"
53 __m128d sse4_1_blendvpd (__m128d a, __m128d b, __m128d c) __attribute__((__option__("sse4.1")));
54 __m128d generic_blendvpd (__m128d a, __m128d b, __m128d c);
57 sse4_1_blendvpd (__m128d a, __m128d b, __m128d c)
59 return __builtin_ia32_blendvpd (a, b, c);
63 generic_blendvpd (__m128d a, __m128d b, __m128d c)
65 return __builtin_ia32_blendvpd (a, b, c); /* { dg-error "needs isa option" } */
69 #error "-msse4.2 should not be set for this test"
72 __m128i sse4_2_pcmpgtq (__m128i a, __m128i b) __attribute__((__option__("sse4.2")));
73 __m128i generic_pcmpgtq (__m128i ab, __m128i b);
76 sse4_2_pcmpgtq (__m128i a, __m128i b)
78 return __builtin_ia32_pcmpgtq (a, b);
82 generic_pcmpgtq (__m128i a, __m128i b)
84 return __builtin_ia32_pcmpgtq (a, b); /* { dg-error "needs isa option" } */
88 #error "-msse4a should not be set for this test"
91 __m128i sse4_2_insertq (__m128i a, __m128i b) __attribute__((__option__("sse4a")));
92 __m128i generic_insertq (__m128i ab, __m128i b);
95 sse4_2_insertq (__m128i a, __m128i b)
97 return __builtin_ia32_insertq (a, b);
101 generic_insertq (__m128i a, __m128i b)
103 return __builtin_ia32_insertq (a, b); /* { dg-error "needs isa option" } */
107 #error "-msse5 should not be set for this test"
110 __m128d sse5_fmaddpd (__m128d a, __m128d b, __m128d c) __attribute__((__option__("sse5")));
111 __m128d generic_fmaddpd (__m128d a, __m128d b, __m128d c);
114 sse5_fmaddpd (__m128d a, __m128d b, __m128d c)
116 return __builtin_ia32_fmaddpd (a, b, c);
120 generic_fmaddpd (__m128d a, __m128d b, __m128d c)
122 return __builtin_ia32_fmaddpd (a, b, c); /* { dg-error "needs isa option" } */
126 #error "-maes should not be set for this test"
129 __m128i aes_aesimc128 (__m128i a) __attribute__((__option__("aes")));
130 __m128i generic_aesimc128 (__m128i a);
133 aes_aesimc128 (__m128i a)
135 return __builtin_ia32_aesimc128 (a);
139 generic_aesimc128 (__m128i a)
141 return __builtin_ia32_aesimc128 (a); /* { dg-error "needs isa option" } */
145 #error "-mpclmul should not be set for this test"
148 __m128i pclmul_pclmulqdq128 (__m128i a, __m128i b) __attribute__((__option__("pclmul")));
149 __m128i generic_pclmulqdq128 (__m128i a, __m128i b);
152 pclmul_pclmulqdq128 (__m128i a, __m128i b)
154 return __builtin_ia32_pclmulqdq128 (a, b, 5);
158 generic_pclmulqdq128 (__m128i a, __m128i b)
160 return __builtin_ia32_pclmulqdq128 (a, b, 5); /* { dg-error "needs isa option" } */