| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-O2 -ffast-math -misa=sm_53 -mptx=_" } */ |
| 3 |
/* { dg-additional-options "-mexperimental" } */ |
| 4 |
|
| 5 |
_Float16 var; |
| 6 |
|
| 7 |
float load() |
| 8 |
{ |
| 9 |
return var; |
| 10 |
} |
| 11 |
|
| 12 |
void store(float x) |
| 13 |
{ |
| 14 |
var = x; |
| 15 |
} |
| 16 |
|
| 17 |
void move(_Float16 *dst, _Float16 *src) |
| 18 |
{ |
| 19 |
*dst = *src; |
| 20 |
} |
| 21 |
|
| 22 |
double plus(double x, double y) |
| 23 |
{ |
| 24 |
_Float16 hx = x; |
| 25 |
_Float16 hy = y; |
| 26 |
_Float16 hz = hx + hy; |
| 27 |
return hz; |
| 28 |
} |
| 29 |
|
| 30 |
double minus(double x, double y) |
| 31 |
{ |
| 32 |
_Float16 hx = x; |
| 33 |
_Float16 hy = y; |
| 34 |
_Float16 hz = hx - hy; |
| 35 |
return hz; |
| 36 |
} |
| 37 |
|
| 38 |
double mult(double x, double y) |
| 39 |
{ |
| 40 |
_Float16 hx = x; |
| 41 |
_Float16 hy = y; |
| 42 |
_Float16 hz = hx * hy; |
| 43 |
return hz; |
| 44 |
} |
| 45 |
|
| 46 |
/* { dg-final { scan-assembler-times "ld.b16" 2 } } */ |
| 47 |
/* { dg-final { scan-assembler-times "cvt.f32.f16" 1 } } */ |
| 48 |
/* { dg-final { scan-assembler-times "cvt.rn.f16.f32" 1 } } */ |
| 49 |
/* { dg-final { scan-assembler-times "st.b16" 2 } } */ |
| 50 |
/* { dg-final { scan-assembler-times "add.f16" 1 } } */ |
| 51 |
/* { dg-final { scan-assembler-times "sub.f16" 1 } } */ |
| 52 |
/* { dg-final { scan-assembler-times "mul.f16" 1 } } */ |
| 53 |
/* { dg-final { scan-assembler-times "cvt.rn.f16.f64" 6 } } */ |
| 54 |
/* { dg-final { scan-assembler-times "cvt.f64.f16" 3 } } */ |