aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/arm/bfloat16_scalar_1_1.c
blob: f7361d63fc210efea44630adceef280b0942c63c (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/* { dg-do assemble { target { arm*-*-* } } } */
/* { dg-require-effective-target arm_arch_v8_2a_bf16_hard_ok } */
/* { dg-add-options arm_arch_v8_2a_bf16_hard } */
/* { dg-additional-options "-O3 --save-temps -std=gnu90" } */
/* { dg-final { check-function-bodies "**" "" } } */

#include <arm_bf16.h>

/*
**stacktest1:
**	...
**	vst1.16	{d[0-9]+\[[0-9]+\]}, \[r[0-9]+\]
**	vld1.16	{d[0-9]+\[[0-9]+\]}, \[r[0-9]+\]
**	...
**	bx	lr
*/
bfloat16_t stacktest1 (bfloat16_t __a)
{
  volatile bfloat16_t b = __a;
  return b;
}

/*
**bfloat_mov_ww:
**	...
**	vmov.f32	s1, s15
**	...
**	bx	lr
*/
void bfloat_mov_ww (void)
{
  register bfloat16_t x asm ("s15");
  register bfloat16_t y asm ("s1");
  asm volatile ("#foo" : "=t" (x));
  y = x;
  asm volatile ("#foo" :: "t" (y));
}

/*
**bfloat_mov_rw:
**	...
**	vmov	s1, r4
**	...
**	bx	lr
*/
void bfloat_mov_rw (void)
{
  register bfloat16_t x asm ("r4");
  register bfloat16_t y asm ("s1");
  asm volatile ("#foo" : "=r" (x));
  y = x;
  asm volatile ("#foo" :: "t" (y));
}

/*
**bfloat_mov_wr:
**	...
**	vmov	r4, s1
**	...
**	bx	lr
*/
void bfloat_mov_wr (void)
{
  register bfloat16_t x asm ("s1");
  register bfloat16_t y asm ("r4");
  asm volatile ("#foo" : "=t" (x));
  y = x;
  asm volatile ("#foo" :: "r" (y));
}

/*
**bfloat_mov_rr:
**	...
**	mov	r4, r5	@ __bf16
**	...
**	bx	lr
*/
void bfloat_mov_rr (void)
{
  register bfloat16_t x asm ("r5");
  register bfloat16_t y asm ("r4");
  asm volatile ("#foo" : "=r" (x));
  y = x;
  asm volatile ("#foo" :: "r" (y));
}

/*
**bfloat_mov_rm:
**	...
**	strh	r4, \[.*\]	@ __bf16
**	...
**	bx	lr
*/
void bfloat_mov_rm (void)
{
  register bfloat16_t x asm ("r4");
  volatile bfloat16_t y;
  asm volatile ("#foo" : "=r" (x));
  y = x;
  asm volatile ("#foo" : : : "memory");
}

/*
**bfloat_mov_mr:
**	...
**	ldrh	r4, \[.*\]	@ __bf16
**	...
**	bx	lr
*/
void bfloat_mov_mr (void)
{
  volatile bfloat16_t x;
  register bfloat16_t y asm ("r4");
  asm volatile ("#foo" : : : "memory");
  y = x;
  asm volatile ("#foo" :: "r" (y));
}