| 1 |
/* PR target/102464. */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-Ofast -mavx512fp16 -mavx512vl -mprefer-vector-width=512" } */ |
| 4 |
#ifndef __NO_MATH_INLINES |
| 5 |
#define __NO_MATH_INLINES |
| 6 |
#endif |
| 7 |
#include<math.h> |
| 8 |
void |
| 9 |
foo (_Float16* __restrict a, _Float16* b) |
| 10 |
{ |
| 11 |
for (int i = 0; i != 8; i++) |
| 12 |
a[i] = floor (b[i]); |
| 13 |
} |
| 14 |
|
| 15 |
void |
| 16 |
foo1 (_Float16* __restrict a, _Float16* b) |
| 17 |
{ |
| 18 |
for (int i = 0; i != 8; i++) |
| 19 |
a[i] = ceil (b[i]); |
| 20 |
} |
| 21 |
|
| 22 |
void |
| 23 |
foo2 (_Float16* __restrict a, _Float16* b) |
| 24 |
{ |
| 25 |
for (int i = 0; i != 8; i++) |
| 26 |
a[i] = trunc (b[i]); |
| 27 |
} |
| 28 |
|
| 29 |
void |
| 30 |
foo3 (_Float16* __restrict a, _Float16* b) |
| 31 |
{ |
| 32 |
for (int i = 0; i != 8; i++) |
| 33 |
a[i] = nearbyint (b[i]); |
| 34 |
} |
| 35 |
|
| 36 |
void |
| 37 |
foo4 (_Float16* __restrict a, _Float16* b) |
| 38 |
{ |
| 39 |
for (int i = 0; i != 8; i++) |
| 40 |
a[i] = rint (b[i]); |
| 41 |
} |
| 42 |
|
| 43 |
void |
| 44 |
foo5 (_Float16* __restrict a, _Float16* b) |
| 45 |
{ |
| 46 |
for (int i = 0; i != 16; i++) |
| 47 |
a[i] = floor (b[i]); |
| 48 |
} |
| 49 |
|
| 50 |
void |
| 51 |
foo6 (_Float16* __restrict a, _Float16* b) |
| 52 |
{ |
| 53 |
for (int i = 0; i != 16; i++) |
| 54 |
a[i] = ceil (b[i]); |
| 55 |
} |
| 56 |
|
| 57 |
void |
| 58 |
foo7 (_Float16* __restrict a, _Float16* b) |
| 59 |
{ |
| 60 |
for (int i = 0; i != 16; i++) |
| 61 |
a[i] = trunc (b[i]); |
| 62 |
} |
| 63 |
|
| 64 |
void |
| 65 |
foo8 (_Float16* __restrict a, _Float16* b) |
| 66 |
{ |
| 67 |
for (int i = 0; i != 16; i++) |
| 68 |
a[i] = nearbyint (b[i]); |
| 69 |
} |
| 70 |
|
| 71 |
void |
| 72 |
foo9 (_Float16* __restrict a, _Float16* b) |
| 73 |
{ |
| 74 |
for (int i = 0; i != 16; i++) |
| 75 |
a[i] = rint (b[i]); |
| 76 |
} |
| 77 |
|
| 78 |
void |
| 79 |
foo10 (_Float16* __restrict a, _Float16* b) |
| 80 |
{ |
| 81 |
for (int i = 0; i != 32; i++) |
| 82 |
a[i] = floor (b[i]); |
| 83 |
} |
| 84 |
|
| 85 |
void |
| 86 |
foo11 (_Float16* __restrict a, _Float16* b) |
| 87 |
{ |
| 88 |
for (int i = 0; i != 32; i++) |
| 89 |
a[i] = ceil (b[i]); |
| 90 |
} |
| 91 |
|
| 92 |
void |
| 93 |
foo12 (_Float16* __restrict a, _Float16* b) |
| 94 |
{ |
| 95 |
for (int i = 0; i != 32; i++) |
| 96 |
a[i] = trunc (b[i]); |
| 97 |
} |
| 98 |
|
| 99 |
void |
| 100 |
foo13 (_Float16* __restrict a, _Float16* b) |
| 101 |
{ |
| 102 |
for (int i = 0; i != 32; i++) |
| 103 |
a[i] = nearbyint (b[i]); |
| 104 |
} |
| 105 |
|
| 106 |
void |
| 107 |
foo14 (_Float16* __restrict a, _Float16* b) |
| 108 |
{ |
| 109 |
for (int i = 0; i != 32; i++) |
| 110 |
a[i] = rint (b[i]); |
| 111 |
} |
| 112 |
|
| 113 |
/* { dg-final { scan-assembler-not "vcvtsh2s\[sd\]" } } */ |
| 114 |
/* { dg-final { scan-assembler-not "vcvtph2p\[sd\]" } } */ |
| 115 |
/* { dg-final { scan-assembler-not "extendhfxf" } } */ |
| 116 |
/* { dg-final { scan-assembler-times "vrndscaleph\[^\n\r\]*xmm\[0-9\]" 5 } } */ |
| 117 |
/* { dg-final { scan-assembler-times "vrndscaleph\[^\n\r\]*ymm\[0-9\]" 5 } } */ |
| 118 |
/* { dg-final { scan-assembler-times "vrndscaleph\[^\n\r\]*zmm\[0-9\]" 5 } } */ |