1 /* { dg-do assemble { target { arm*-*-* } } } */
2 /* { dg-require-effective-target arm_hard_ok } */
3 /* { dg-require-effective-target arm_v8_neon_ok } */
4 /* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
5 /* { dg-additional-options "-march=armv8.2-a -mfloat-abi=hard -mfpu=neon-fp-armv8" } */
6 /* { dg-additional-options "-O3 --save-temps -std=gnu90" } */
7 /* { dg-final { check-function-bodies "**" "" } } */
8
9 #include <arm_neon.h>
10
11 #pragma GCC push_options
12 #pragma GCC target ("+bf16")
13
14 /*
15 **stacktest1:
16 ** ...
17 ** vst1.16 {d[0-9]+\[[0-9]+\]}, \[r[0-9]+\]
18 ** vld1.16 {d[0-9]+\[[0-9]+\]}, \[r[0-9]+\]
19 ** ...
20 ** bx lr
21 */
22 bfloat16_t stacktest1 (bfloat16_t __a)
23 {
24 volatile bfloat16_t b = __a;
25 return b;
26 }
27
28 /*
29 **stacktest2:
30 ** ...
31 ** vstr d[0-9]+, \[sp\]
32 ** vldr d[0-9]+, \[sp\]
33 ** ...
34 ** bx lr
35 */
36 bfloat16x4_t stacktest2 (bfloat16x4_t __a)
37 {
38 volatile bfloat16x4_t b = __a;
39 return b;
40 }
41
42 /*
43 **stacktest3:
44 ** ...
45 ** vst1.64 {d[0-9]+-d[0-9]+}, \[sp:[0-9]+\]
46 ** vld1.64 {d[0-9]+-d[0-9]+}, \[sp:[0-9]+\]
47 ** ...
48 ** bx lr
49 */
50 bfloat16x8_t stacktest3 (bfloat16x8_t __a)
51 {
52 volatile bfloat16x8_t b = __a;
53 return b;
54 }
55
56 /* Test compilation of __attribute__ vectors of 8, 16, 32, etc. BFloats. */
57 typedef bfloat16_t v8bf __attribute__((vector_size(16)));
58 typedef bfloat16_t v16bf __attribute__((vector_size(32)));
59 typedef bfloat16_t v32bf __attribute__((vector_size(64)));
60 typedef bfloat16_t v64bf __attribute__((vector_size(128)));
61 typedef bfloat16_t v128bf __attribute__((vector_size(256)));
62
63 v8bf stacktest4 (v8bf __a)
64 {
65 volatile v8bf b = __a;
66 return b;
67 }
68
69 v16bf stacktest5 (v16bf __a)
70 {
71 volatile v16bf b = __a;
72 return b;
73 }
74
75 v32bf stacktest6 (v32bf __a)
76 {
77 volatile v32bf b = __a;
78 return b;
79 }
80
81 v64bf stacktest7 (v64bf __a)
82 {
83 volatile v64bf b = __a;
84 return b;
85 }
86
87 v128bf stacktest8 (v128bf __a)
88 {
89 volatile v128bf b = __a;
90 return b;
91 }
92
93 /* Test use of constant values to assign values to vectors. */
94
95 typedef bfloat16_t v2bf __attribute__((vector_size(4)));
96 v2bf c2 (void) { return (v2bf) 0x12345678; }
97
98 #pragma GCC pop_options