1 /* { dg-do compile } */
2 /* { dg-options "-Ofast -mavx -mno-avx2" } */
3 
4 #include <x86intrin.h>
5 
6 __attribute__((noinline, noclone)) double
f1(double x)7 f1 (double x)
8 {
9   return __builtin_round (x);
10 }
11 
12 __attribute__((noinline, noclone)) float
f2(float x)13 f2 (float x)
14 {
15   return __builtin_roundf (x);
16 }
17 
18 __attribute__((noinline, noclone)) __m128d
f3(__m128d x,__m128d y)19 f3 (__m128d x, __m128d y)
20 {
21   return _mm_round_sd (x, y, _MM_FROUND_NINT);
22 }
23 
24 __attribute__((noinline, noclone)) __m128
f4(__m128 x,__m128 y)25 f4 (__m128 x, __m128 y)
26 {
27   return _mm_round_ss (x, y, _MM_FROUND_NINT);
28 }
29 
30 __attribute__((noinline, noclone)) __m128d
f5(__m128d x)31 f5 (__m128d x)
32 {
33   return _mm_round_pd (x, _MM_FROUND_NINT);
34 }
35 
36 __attribute__((noinline, noclone)) __m128
f6(__m128 x)37 f6 (__m128 x)
38 {
39   return _mm_round_ps (x, _MM_FROUND_NINT);
40 }
41 
42 __attribute__((noinline, noclone)) __m256d
f7(__m256d x)43 f7 (__m256d x)
44 {
45   return _mm256_round_pd (x, _MM_FROUND_NINT);
46 }
47 
48 __attribute__((noinline, noclone)) __m256
f8(__m256 x)49 f8 (__m256 x)
50 {
51   return _mm256_round_ps (x, _MM_FROUND_NINT);
52 }
53 
54 /* { dg-final { scan-assembler-times "vroundsd\[^\n\r\]*xmm" 2 } } */
55 /* { dg-final { scan-assembler-times "vroundss\[^\n\r\]*xmm" 2 } } */
56 /* { dg-final { scan-assembler-times "vroundpd\[^\n\r\]*xmm" 1 } } */
57 /* { dg-final { scan-assembler-times "vroundps\[^\n\r\]*xmm" 1 } } */
58 /* { dg-final { scan-assembler-times "vroundpd\[^\n\r\]*ymm" 1 } } */
59 /* { dg-final { scan-assembler-times "vroundps\[^\n\r\]*ymm" 1 } } */
60