aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/nvptx/float16-1.c
blob: 017774c29415b3798d78936693e5fcdea280ce47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/* { dg-do compile } */
/* { dg-options "-O2 -ffast-math -misa=sm_53 -mptx=_" } */
/* { dg-additional-options "-mexperimental" } */

_Float16 var;

float load()
{
  return var;
}

void store(float x)
{
  var = x;
}

void move(_Float16 *dst, _Float16 *src)
{
  *dst = *src;
}

double plus(double x, double y)
{
  _Float16 hx = x;
  _Float16 hy = y;
  _Float16 hz = hx + hy;
  return hz;
}

double minus(double x, double y)
{
  _Float16 hx = x;
  _Float16 hy = y;
  _Float16 hz = hx - hy;
  return hz;
}

double mult(double x, double y)
{
  _Float16 hx = x;
  _Float16 hy = y;
  _Float16 hz = hx * hy;
  return hz;
}

/* { dg-final { scan-assembler-times "ld.b16" 2 } } */
/* { dg-final { scan-assembler-times "cvt.f32.f16" 1 } } */
/* { dg-final { scan-assembler-times "cvt.rn.f16.f32" 1 } } */
/* { dg-final { scan-assembler-times "st.b16" 2 } } */
/* { dg-final { scan-assembler-times "add.f16" 1 } } */
/* { dg-final { scan-assembler-times "sub.f16" 1 } } */
/* { dg-final { scan-assembler-times "mul.f16" 1 } } */
/* { dg-final { scan-assembler-times "cvt.rn.f16.f64" 6 } } */
/* { dg-final { scan-assembler-times "cvt.f64.f16" 3 } } */