1 /* { dg-do assemble { target { arm*-*-* } } } */
2 /* { dg-skip-if "" { *-*-* } { "-fno-fat-lto-objects" } } */
3 /* { dg-require-effective-target arm_v8_2a_fp16_neon_ok } */
4 /* { dg-require-effective-target arm_v8_2a_bf16_neon_ok } */
5 /* { dg-add-options arm_v8_2a_fp16_neon } */
6 /* { dg-add-options arm_v8_2a_bf16_neon } */
7 /* { dg-additional-options "-march=armv8.6-a+bf16+fp16 -Wno-pedantic -O3 --save-temps" } */
11 bfloat16_t glob_bfloat
;
12 bfloat16x8_t glob_bfloat_vec
;
14 float32x4_t is_a_float_vec
;
16 float16x8_t
*float_ptr
;
17 float16x8_t is_a_float16_vec
;
19 int32x4_t is_an_int_vec
;
20 int64x2_t is_a_long_int_pair
;
21 int16x8_t is_a_short_vec
;
29 bfloat16x8_t
foo3 (void) { return (bfloat16x8_t
) 0x12345678123456781234567812345678; }
30 /* { dg-error {integer constant is too large for its type} "" {target *-*-*} .-1 } */
31 /* { dg-error {cannot convert a value of type 'long long int' to vector type '__simd128_bfloat16_t' which has different size} "" {target *-*-*} .-2 } */
33 bfloat16x8_t
footest (bfloat16x8_t vector0
)
37 bfloat16x8_t vector1_1
;
38 bfloat16x8_t vector1_2
= glob_bfloat_vec
;
39 bfloat16x8_t vector1_3
= is_a_float_vec
; /* { dg-error {incompatible types when initializing type 'bfloat16x8_t' using type 'float32x4_t'} } */
40 bfloat16x8_t vector1_4
= is_an_int_vec
; /* { dg-error {incompatible types when initializing type 'bfloat16x8_t' using type 'int32x4_t'} } */
41 bfloat16x8_t vector1_5
= is_a_float16_vec
; /* { dg-error {incompatible types when initializing type 'bfloat16x8_t' using type 'float16x8_t'} } */
42 bfloat16x8_t vector1_7
= is_a_long_int_pair
; /* { dg-error {incompatible types when initializing type 'bfloat16x8_t' using type 'int64x2_t'} } */
43 bfloat16x8_t vector1_8
= is_a_short_vec
; /* { dg-error {incompatible types when initializing type 'bfloat16x8_t' using type 'int16x8_t'} } */
45 int32x4_t initi_1_1
= glob_bfloat_vec
; /* { dg-error {incompatible types when initializing type 'int32x4_t' using type 'bfloat16x8_t'} } */
46 float32x4_t initi_1_2
= glob_bfloat_vec
; /* { dg-error {incompatible types when initializing type 'float32x4_t' using type 'bfloat16x8_t'} } */
47 float16x8_t initi_1_3
= glob_bfloat_vec
; /* { dg-error {incompatible types when initializing type 'float16x8_t' using type 'bfloat16x8_t'} } */
48 int64x2_t initi_1_5
= glob_bfloat_vec
; /* { dg-error {incompatible types when initializing type 'int64x2_t' using type 'bfloat16x8_t'} } */
49 int16x8_t initi_1_6
= glob_bfloat_vec
; /* { dg-error {incompatible types when initializing type 'int16x8_t' using type 'bfloat16x8_t'} } */
51 bfloat16x8_t vector2_1
= {};
52 bfloat16x8_t vector2_2
= { glob_bfloat
};
53 bfloat16x8_t vector2_3
= { glob_bfloat
, glob_bfloat
, glob_bfloat
, glob_bfloat
};
54 bfloat16x8_t vector2_4
= { 0 }; /* { dg-error {invalid conversion to type 'bfloat16_t'} } */
55 bfloat16x8_t vector2_5
= { 0.1 }; /* { dg-error {invalid conversion to type 'bfloat16_t'} } */
56 bfloat16x8_t vector2_6
= { is_a_float16
}; /* { dg-error {invalid conversion to type 'bfloat16_t'} } */
57 bfloat16x8_t vector2_7
= { is_a_float
}; /* { dg-error {invalid conversion to type 'bfloat16_t'} } */
58 bfloat16x8_t vector2_8
= { is_an_int
}; /* { dg-error {invalid conversion to type 'bfloat16_t'} } */
59 bfloat16x8_t vector2_9
= { is_a_short_int
}; /* { dg-error {invalid conversion to type 'bfloat16_t'} } */
60 bfloat16x8_t vector2_10
= { 0.0, 0, is_a_short_int
, is_a_float
}; /* { dg-error "invalid conversion to type 'bfloat16_t'" } */
62 int32x4_t initi_2_1
= { glob_bfloat
}; /* { dg-error {invalid conversion from type 'bfloat16_t'} } */
63 float32x4_t initi_2_2
= { glob_bfloat
}; /* { dg-error {invalid conversion from type 'bfloat16_t'} } */
64 float16x8_t initi_2_3
= { glob_bfloat
}; /* { dg-error {invalid conversion from type 'bfloat16_t'} } */
65 int64x2_t initi_2_5
= { glob_bfloat
}; /* { dg-error {invalid conversion from type 'bfloat16_t'} } */
66 int16x8_t initi_2_6
= { glob_bfloat
}; /* { dg-error {invalid conversion from type 'bfloat16_t'} } */
68 /* Assignments to/from vectors. */
70 glob_bfloat_vec
= glob_bfloat_vec
;
71 glob_bfloat_vec
= 0; /* { dg-error {incompatible types when assigning to type 'bfloat16x8_t' from type 'int'} } */
72 glob_bfloat_vec
= 0.1; /* { dg-error {incompatible types when assigning to type 'bfloat16x8_t' from type 'double'} } */
73 glob_bfloat_vec
= is_a_float_vec
; /* { dg-error {incompatible types when assigning to type 'bfloat16x8_t' from type 'float32x4_t'} } */
74 glob_bfloat_vec
= is_an_int_vec
; /* { dg-error {incompatible types when assigning to type 'bfloat16x8_t' from type 'int32x4_t'} } */
75 glob_bfloat_vec
= is_a_float16_vec
; /* { dg-error {incompatible types when assigning to type 'bfloat16x8_t' from type 'float16x8_t'} } */
76 glob_bfloat_vec
= is_a_long_int_pair
; /* { dg-error {incompatible types when assigning to type 'bfloat16x8_t' from type 'int64x2_t'} } */
77 glob_bfloat_vec
= is_a_short_vec
; /* { dg-error {incompatible types when assigning to type 'bfloat16x8_t' from type 'int16x8_t'} } */
79 is_an_int_vec
= glob_bfloat_vec
; /* { dg-error {incompatible types when assigning to type 'int32x4_t' from type 'bfloat16x8_t'} } */
80 is_a_float_vec
= glob_bfloat_vec
; /* { dg-error {incompatible types when assigning to type 'float32x4_t' from type 'bfloat16x8_t'} } */
81 is_a_float16_vec
= glob_bfloat_vec
; /* { dg-error {incompatible types when assigning to type 'float16x8_t' from type 'bfloat16x8_t'} } */
82 is_a_long_int_pair
= glob_bfloat_vec
; /* { dg-error {incompatible types when assigning to type 'int64x2_t' from type 'bfloat16x8_t'} } */
83 is_a_short_vec
= glob_bfloat_vec
;/* { dg-error {incompatible types when assigning to type 'int16x8_t' from type 'bfloat16x8_t'} } */
85 /* Assignments to/from elements. */
87 vector2_3
[0] = glob_bfloat
;
88 vector2_3
[0] = is_an_int
; /* { dg-error {invalid conversion to type 'bfloat16_t'} } */
89 vector2_3
[0] = is_a_short_int
; /* { dg-error {invalid conversion to type 'bfloat16_t'} } */
90 vector2_3
[0] = is_a_float
; /* { dg-error {invalid conversion to type 'bfloat16_t'} } */
91 vector2_3
[0] = is_a_float16
; /* { dg-error {invalid conversion to type 'bfloat16_t'} } */
92 vector2_3
[0] = 0; /* { dg-error {invalid conversion to type 'bfloat16_t'} } */
93 vector2_3
[0] = 0.1; /* { dg-error {invalid conversion to type 'bfloat16_t'} } */
95 glob_bfloat
= vector2_3
[0];
96 is_an_int
= vector2_3
[0]; /* { dg-error {invalid conversion from type 'bfloat16_t'} } */
97 is_a_short_int
= vector2_3
[0]; /* { dg-error {invalid conversion from type 'bfloat16_t'} } */
98 is_a_float
= vector2_3
[0]; /* { dg-error {invalid conversion from type 'bfloat16_t'} } */
99 is_a_float16
= vector2_3
[0]; /* { dg-error {invalid conversion from type 'bfloat16_t'} } */
101 /* Compound literals. */
105 (bfloat16x8_t
) { 0 }; /* { dg-error {invalid conversion to type 'bfloat16_t'} } */
106 (bfloat16x8_t
) { 0.1 }; /* { dg-error {invalid conversion to type 'bfloat16_t'} } */
107 (bfloat16x8_t
) { is_a_float_vec
}; /* { dg-error {incompatible types when initializing type '__bf16' using type 'float32x4_t'} } */
108 (bfloat16x8_t
) { is_an_int_vec
}; /* { dg-error {incompatible types when initializing type '__bf16' using type 'int32x4_t'} } */
109 (bfloat16x8_t
) { is_a_long_int_pair
}; /* { dg-error {incompatible types when initializing type '__bf16' using type 'int64x2_t'} } */
110 (bfloat16x8_t
) { is_a_float16_vec
}; /* { dg-error {incompatible types when initializing type '__bf16' using type 'float16x8_t'} } */
111 (bfloat16x8_t
) { is_a_short_vec
}; /* { dg-error {incompatible types when initializing type '__bf16' using type 'int16x8_t'} } */
113 (bfloat16x8_t
) { glob_bfloat_vec
}; /* { dg-error {incompatible types when initializing type '__bf16' using type 'bfloat16x8_t'} } */
114 (int32x4_t
) { glob_bfloat_vec
}; /* { dg-error {incompatible types when initializing type '(?:long )?int' using type 'bfloat16x8_t'} } */
115 (float32x4_t
) { glob_bfloat_vec
}; /* { dg-error {incompatible types when initializing type 'float' using type 'bfloat16x8_t'} } */
116 (int64x2_t
) { glob_bfloat_vec
}; /* { dg-error {incompatible types when initializing type 'long long int' using type 'bfloat16x8_t'} } */
117 (float16x8_t
) { glob_bfloat_vec
}; /* { dg-error {incompatible types when initializing type '__fp16' using type 'bfloat16x8_t'} } */
118 (int16x8_t
) { glob_bfloat_vec
}; /* { dg-error {incompatible types when initializing type 'short int' using type 'bfloat16x8_t'} } */
122 (void) glob_bfloat_vec
;
123 (bfloat16x8_t
) glob_bfloat_vec
;
125 (bfloat16_t
) glob_bfloat_vec
; /* { dg-error {vector value used where a floating-point was expected} } */
126 (short) glob_bfloat_vec
; /* { dg-error {cannot convert a vector of type 'bfloat16x8_t' to type 'short int' which has different size} } */
127 (int) glob_bfloat_vec
; /* { dg-error {cannot convert a vector of type 'bfloat16x8_t' to type 'int' which has different size} } */
128 (float16_t
) glob_bfloat_vec
; /* { dg-error {vector value used where a floating-point was expected} } */
129 (float) glob_bfloat_vec
; /* { dg-error {vector value used where a floating-point was expected} } */
130 (double) glob_bfloat_vec
; /* { dg-error {vector value used where a floating-point was expected} } */
132 (int32x4_t
) glob_bfloat_vec
;
133 (float32x4_t
) glob_bfloat_vec
;
134 (float16x8_t
) glob_bfloat_vec
;
135 (int64x2_t
) glob_bfloat_vec
;
136 (int16x8_t
) glob_bfloat_vec
;
138 (bfloat16x8_t
) is_an_int_vec
;
139 (bfloat16x8_t
) is_a_float_vec
;
140 (bfloat16x8_t
) is_a_float16_vec
;
141 (bfloat16x8_t
) is_a_long_int_pair
;
142 (bfloat16x8_t
) is_a_short_vec
;
144 /* Arrays and Structs. */
146 typedef bfloat16x8_t array_type
[2];
147 extern bfloat16x8_t extern_array
[];
149 bfloat16x8_t array
[2];
150 bfloat16x8_t zero_length_array
[0];
151 bfloat16x8_t empty_init_array
[] = {};
152 typedef bfloat16x8_t some_other_type
[is_an_int
];
162 /* Addressing and dereferencing. */
164 bfloat16x8_t
*bfloat_ptr
= &vector0
;
165 vector0
= *bfloat_ptr
;
167 /* Pointer assignment. */
169 bfloat16x8_t
*bfloat_ptr2
= bfloat_ptr
;
170 bfloat16x8_t
*bfloat_ptr3
= array
;
172 /* Pointer arithmetic. */
180 bfloat_ptr
- bfloat_ptr2
;
181 bfloat_ptr
= &bfloat_ptr3
[0];
182 bfloat_ptr
= &bfloat_ptr3
[1];
184 /* Simple comparison. */
185 vector0
> glob_bfloat_vec
; /* { dg-error {operation not permitted on type 'bfloat16_t'} } */
186 glob_bfloat_vec
== vector0
; /* { dg-error {operation not permitted on type 'bfloat16_t'} } */
187 vector0
> is_a_float_vec
; /* { dg-error {operation not permitted on type 'bfloat16_t'} } */
188 is_a_float_vec
== vector0
; /* { dg-error {operation not permitted on type 'bfloat16_t'} } */
189 vector0
> 0; /* { dg-error {operation not permitted on type 'bfloat16_t'} } */
190 0 == vector0
; /* { dg-error {operation not permitted on type 'bfloat16_t'} } */
191 vector0
> 0.1; /* { dg-error {operation not permitted on type 'bfloat16_t'} } */
192 0.1 == vector0
; /* { dg-error {operation not permitted on type 'bfloat16_t'} } */
193 vector0
> is_an_int_vec
; /* { dg-error {operation not permitted on type 'bfloat16_t'} } */
194 is_an_int_vec
== vector0
; /* { dg-error {operation not permitted on type 'bfloat16_t'} } */
196 /* Pointer comparison. */
198 bfloat_ptr
== &vector0
;
199 bfloat_ptr
!= &vector0
;
200 bfloat_ptr
< &vector0
;
201 bfloat_ptr
<= &vector0
;
202 bfloat_ptr
> &vector0
;
203 bfloat_ptr
>= &vector0
;
204 bfloat_ptr
== bfloat_ptr2
;
205 bfloat_ptr
!= bfloat_ptr2
;
206 bfloat_ptr
< bfloat_ptr2
;
207 bfloat_ptr
<= bfloat_ptr2
;
208 bfloat_ptr
> bfloat_ptr2
;
209 bfloat_ptr
>= bfloat_ptr2
;
211 /* Conditional expressions. */
213 0 ? vector0
: vector0
;
214 0 ? vector0
: is_a_float_vec
; /* { dg-error {type mismatch in conditional expression} } */
215 0 ? is_a_float_vec
: vector0
; /* { dg-error {type mismatch in conditional expression} } */
216 0 ? vector0
: is_a_float16_vec
; /* { dg-error {type mismatch in conditional expression} } */
217 0 ? is_a_float16_vec
: vector0
; /* { dg-error {type mismatch in conditional expression} } */
218 0 ? vector0
: 0; /* { dg-error {type mismatch in conditional expression} } */
219 0 ? 0 : vector0
; /* { dg-error {type mismatch in conditional expression} } */
220 0 ? 0.1 : vector0
; /* { dg-error {type mismatch in conditional expression} } */
221 0 ? vector0
: 0.1; /* { dg-error {type mismatch in conditional expression} } */
222 0 ? bfloat_ptr
: bfloat_ptr2
;
223 0 ? bfloat_ptr
: float_ptr
; /* { dg-error {pointer type mismatch in conditional expression} } */
224 0 ? float_ptr
: bfloat_ptr
; /* { dg-error {pointer type mismatch in conditional expression} } */
226 vector0
? vector0
: vector0
; /* { dg-error {used vector type where scalar is required} } */
227 vector0
? is_a_float16_vec
: vector0
; /* { dg-error {used vector type where scalar is required} } */
228 vector0
? vector0
: is_a_float16_vec
; /* { dg-error {used vector type where scalar is required} } */
229 vector0
? is_a_float16_vec
: is_a_float16_vec
; /* { dg-error {used vector type where scalar is required} } */
231 /* Unary operators. */
233 +vector0
; /* { dg-error {operation not permitted on type 'bfloat16_t'} } */
234 -vector0
; /* { dg-error {operation not permitted on type 'bfloat16_t'} } */
235 ~vector0
; /* { dg-error {operation not permitted on type 'bfloat16_t'} } */
236 !vector0
; /* { dg-error {operation not permitted on type 'bfloat16_t'} } */
237 *vector0
; /* { dg-error {invalid type argument of unary '\*'} } */
238 __real vector0
; /* { dg-error {operation not permitted on type 'bfloat16_t'} } */
239 __imag vector0
; /* { dg-error {operation not permitted on type 'bfloat16_t'} } */
240 ++vector0
; /* { dg-error {operation not permitted on type 'bfloat16_t'} } */
241 --vector0
; /* { dg-error {operation not permitted on type 'bfloat16_t'} } */
242 vector0
++; /* { dg-error {operation not permitted on type 'bfloat16_t'} } */
243 vector0
--; /* { dg-error {operation not permitted on type 'bfloat16_t'} } */
245 /* Binary arithmetic operations. */
247 vector0
= glob_bfloat_vec
+ *bfloat_ptr
; /* { dg-error {operation not permitted on type 'bfloat16_t'} } */
248 vector0
= glob_bfloat_vec
+ 0.1; /* { dg-error {operation not permitted on type 'bfloat16_t'} } */
249 vector0
= glob_bfloat_vec
+ 0; /* { dg-error {operation not permitted on type 'bfloat16_t'} } */
250 vector0
= glob_bfloat_vec
+ is_a_float_vec
; /* { dg-error {operation not permitted on type 'bfloat16_t'} } */