testcase: Add testcase for PR 117330 [PR117330]
[official-gcc.git] / gcc / testsuite / gcc.target / aarch64 / bfloat16_scalar_1.c
blobef43766495c8f7bc628e658b2818bdc5b8bea247
1 /* { dg-do assemble { target { aarch64*-*-* } } } */
2 /* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
3 /* { dg-add-options arm_v8_2a_bf16_neon } */
4 /* { dg-additional-options "-O3 --save-temps -std=gnu90" } */
5 /* { dg-final { check-function-bodies "**" "" } } */
7 #include <arm_bf16.h>
9 /*
10 **stacktest1:
11 ** sub sp, sp, #16
12 ** str h0, \[sp, 14\]
13 ** ldr h0, \[sp, 14\]
14 ** add sp, sp, 16
15 ** ret
17 bfloat16_t stacktest1 (bfloat16_t __a)
19 volatile bfloat16_t b = __a;
20 return b;
24 **bfloat_mov_ww:
25 ** mov v1.h\[0\], v2.h\[0\]
26 ** ret
28 void bfloat_mov_ww (void)
30 register bfloat16_t x asm ("h2");
31 register bfloat16_t y asm ("h1");
32 asm volatile ("" : "=w" (x));
33 y = x;
34 asm volatile ("" :: "w" (y));
38 **bfloat_mov_rw:
39 ** dup v1.4h, w1
40 ** ret
42 void bfloat_mov_rw (void)
44 register bfloat16_t x asm ("w1");
45 register bfloat16_t y asm ("h1");
46 asm volatile ("" : "=r" (x));
47 y = x;
48 asm volatile ("" :: "w" (y));
52 **bfloat_mov_wr:
53 ** umov w1, v1.h\[0\]
54 ** ret
56 void bfloat_mov_wr (void)
58 register bfloat16_t x asm ("h1");
59 register bfloat16_t y asm ("w1");
60 asm volatile ("" : "=w" (x));
61 y = x;
62 asm volatile ("" :: "r" (y));
66 **bfloat_mov_rr:
67 ** mov w1, w2
68 ** ret
70 void bfloat_mov_rr (void)
72 register bfloat16_t x asm ("w2");
73 register bfloat16_t y asm ("w1");
74 asm volatile ("" : "=r" (x));
75 y = x;
76 asm volatile ("" :: "r" (y));
80 **bfloat_mov_rm:
81 ** strh w2, \[x0\]
82 ** ret
84 void bfloat_mov_rm (bfloat16_t *ptr)
86 register bfloat16_t x asm ("w2");
87 asm volatile ("" : "=r" (x));
88 *ptr = x;
92 **bfloat_mov_mr:
93 ** ldrh w2, \[x0\]
94 ** ret
96 void bfloat_mov_mr (bfloat16_t *ptr)
98 register bfloat16_t y asm ("w2");
99 y = *ptr;
100 asm volatile ("" :: "r" (y));