| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -mavx512fp16" } */ |
| 3 |
/* { dg-final { scan-assembler-times "vcvttsh2si\[ \\t\]+\[^\{\n\]*(?:%xmm\[0-9\]|\\(%e\[bs\]p\\))+, %eax(?:\n|\[ \\t\]+#)" 3 } } */ |
| 4 |
/* { dg-final { scan-assembler-times "vcvttsh2usi\[ \\t\]+\[^\{\n\]*(?:%xmm\[0-9\]|\\(%e\[bs\]p\\))+, %eax(?:\n|\[ \\t\]+#)" 2 } } */ |
| 5 |
/* { dg-final { scan-assembler-times "vcvttsh2si\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+, %rax(?:\n|\[ \\t\]+#)" 1 { target { ! ia32 } } } } */ |
| 6 |
/* { dg-final { scan-assembler-times "vcvttsh2usi\[ \\t\]+\[^\{\n\]*%xmm\[0-9\]+, %rax(?:\n|\[ \\t\]+#)" 1 { target { ! ia32 } } } } */ |
| 7 |
/* { dg-final { scan-assembler "xorl\[ \\t\]+%edx, %edx" { target ia32 } } } */ |
| 8 |
|
| 9 |
#include <immintrin.h> |
| 10 |
|
| 11 |
short |
| 12 |
__attribute__ ((noinline, noclone)) |
| 13 |
trunc_f16_to_si16 (_Float16 f) |
| 14 |
{ |
| 15 |
return f; |
| 16 |
} |
| 17 |
|
| 18 |
unsigned short |
| 19 |
__attribute__ ((noinline, noclone)) |
| 20 |
trunc_f16_to_su16 (_Float16 f) |
| 21 |
{ |
| 22 |
return f; |
| 23 |
} |
| 24 |
|
| 25 |
int |
| 26 |
__attribute__ ((noinline, noclone)) |
| 27 |
trunc_f16_to_si32 (_Float16 f) |
| 28 |
{ |
| 29 |
return f; |
| 30 |
} |
| 31 |
|
| 32 |
unsigned int |
| 33 |
__attribute__ ((noinline, noclone)) |
| 34 |
trunc_f16_to_su32 (_Float16 f) |
| 35 |
{ |
| 36 |
return f; |
| 37 |
} |
| 38 |
|
| 39 |
long long |
| 40 |
__attribute__ ((noinline, noclone)) |
| 41 |
trunc_f16_to_si64 (_Float16 f) |
| 42 |
{ |
| 43 |
return f; |
| 44 |
} |
| 45 |
|
| 46 |
unsigned long long |
| 47 |
__attribute__ ((noinline, noclone)) |
| 48 |
trunc_f16_to_su64 (_Float16 f) |
| 49 |
{ |
| 50 |
return f; |
| 51 |
} |
| 52 |
|
| 53 |
unsigned long long |
| 54 |
__attribute__ ((noinline, noclone)) |
| 55 |
trunc_f16_to_su64_zext (_Float16 f) |
| 56 |
{ |
| 57 |
return (unsigned int) f; |
| 58 |
} |
| 59 |
|