1 /* { dg-do assemble { target { arm*-*-* } } } */
2 /* { dg-require-effective-target arm_softfp_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=softfp -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 /*
12 **stacktest1:
13 ** ...
14 ** strh r[0-9]+, \[r[0-9]+\] @ __bf16
15 ** ldrh r[0-9]+, \[sp, #[0-9]+\] @ __bf16
16 ** ...
17 ** bx lr
18 */
19 bfloat16_t stacktest1 (bfloat16_t __a)
20 {
21 volatile bfloat16_t b = __a;
22 return b;
23 }
24
25 /*
26 **stacktest2:
27 ** ...
28 ** strd r[0-9]+, \[sp\]
29 ** ldrd r[0-9]+, \[sp\]
30 ** ...
31 ** bx lr
32 */
33 bfloat16x4_t stacktest2 (bfloat16x4_t __a)
34 {
35 volatile bfloat16x4_t b = __a;
36 return b;
37 }
38
39 /*
40 **stacktest3:
41 ** ...
42 ** stm sp, {r[0-9]+-r[0-9]+}
43 ** ldmia sp, {r[0-9]+-r[0-9]+}
44 ** ...
45 ** bx lr
46 */
47 bfloat16x8_t stacktest3 (bfloat16x8_t __a)
48 {
49 volatile bfloat16x8_t b = __a;
50 return b;
51 }
52
53 /* Test compilation of __attribute__ vectors of 8, 16, 32, etc. BFloats. */
54 typedef bfloat16_t v8bf __attribute__((vector_size(16)));
55 typedef bfloat16_t v16bf __attribute__((vector_size(32)));
56 typedef bfloat16_t v32bf __attribute__((vector_size(64)));
57 typedef bfloat16_t v64bf __attribute__((vector_size(128)));
58 typedef bfloat16_t v128bf __attribute__((vector_size(256)));
59
60 v8bf stacktest4 (v8bf __a)
61 {
62 volatile v8bf b = __a;
63 return b;
64 }
65
66 v16bf stacktest5 (v16bf __a)
67 {
68 volatile v16bf b = __a;
69 return b;
70 }
71
72 v32bf stacktest6 (v32bf __a)
73 {
74 volatile v32bf b = __a;
75 return b;
76 }
77
78 v64bf stacktest7 (v64bf __a)
79 {
80 volatile v64bf b = __a;
81 return b;
82 }
83
84 v128bf stacktest8 (v128bf __a)
85 {
86 volatile v128bf b = __a;
87 return b;
88 }
89
90 /* Test use of constant values to assign values to vectors. */
91
92 typedef bfloat16_t v2bf __attribute__((vector_size(4)));
93 v2bf c2 (void) { return (v2bf) 0x12345678; }
94
95