Bradley Smith | 0ce46a1 | 2021-10-14 11:04:33 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +bf16 -ffreestanding -fsyntax-only -verify -std=c++11 -mvscale-min=4 -mvscale-max=4 -fallow-half-arguments-and-returns -Wconversion %s |
Cullen Rhodes | feed5a7 | 2020-08-11 13:04:21 +0000 | [diff] [blame] | 2 | // expected-no-diagnostics |
| 3 | |
Cullen Rhodes | 9218f92 | 2020-09-11 15:18:44 +0000 | [diff] [blame] | 4 | #include <stdint.h> |
| 5 | |
Cullen Rhodes | f9091e5 | 2020-09-03 09:19:41 +0000 | [diff] [blame] | 6 | #define N __ARM_FEATURE_SVE_BITS |
Cullen Rhodes | feed5a7 | 2020-08-11 13:04:21 +0000 | [diff] [blame] | 7 | |
| 8 | typedef __SVInt8_t svint8_t; |
| 9 | typedef svint8_t fixed_int8_t __attribute__((arm_sve_vector_bits(N))); |
Cullen Rhodes | 9218f92 | 2020-09-11 15:18:44 +0000 | [diff] [blame] | 10 | typedef int8_t gnu_int8_t __attribute__((vector_size(N / 8))); |
Cullen Rhodes | feed5a7 | 2020-08-11 13:04:21 +0000 | [diff] [blame] | 11 | |
Jun Ma | 599b2f0 | 2021-07-19 21:10:17 +0800 | [diff] [blame] | 12 | typedef __SVBool_t svbool_t; |
| 13 | typedef svbool_t fixed_bool_t __attribute__((arm_sve_vector_bits(N))); |
| 14 | typedef int8_t gnu_bool_t __attribute__((vector_size(N / 64))); |
| 15 | |
Cullen Rhodes | feed5a7 | 2020-08-11 13:04:21 +0000 | [diff] [blame] | 16 | template<typename T> struct S { T var; }; |
| 17 | |
| 18 | S<fixed_int8_t> s; |
| 19 | |
Cullen Rhodes | 9218f92 | 2020-09-11 15:18:44 +0000 | [diff] [blame] | 20 | // Test implicit casts between VLA and VLS vectors |
Cullen Rhodes | feed5a7 | 2020-08-11 13:04:21 +0000 | [diff] [blame] | 21 | svint8_t to_svint8_t(fixed_int8_t x) { return x; } |
| 22 | fixed_int8_t from_svint8_t(svint8_t x) { return x; } |
Cullen Rhodes | 9218f92 | 2020-09-11 15:18:44 +0000 | [diff] [blame] | 23 | |
| 24 | // Test implicit casts between GNU and VLA vectors |
| 25 | svint8_t to_svint8_t__from_gnu_int8_t(gnu_int8_t x) { return x; } |
| 26 | gnu_int8_t from_svint8_t__to_gnu_int8_t(svint8_t x) { return x; } |
| 27 | |
| 28 | // Test implicit casts between GNU and VLS vectors |
| 29 | fixed_int8_t to_fixed_int8_t__from_gnu_int8_t(gnu_int8_t x) { return x; } |
| 30 | gnu_int8_t from_fixed_int8_t__to_gnu_int8_t(fixed_int8_t x) { return x; } |
Jun Ma | 599b2f0 | 2021-07-19 21:10:17 +0800 | [diff] [blame] | 31 | |
| 32 | // Test implicit casts between VLA and VLS predicates |
| 33 | svbool_t to_svbool_t(fixed_bool_t x) { return x; } |
| 34 | fixed_bool_t from_svbool_t(svbool_t x) { return x; } |
| 35 | |
| 36 | // Test implicit casts between GNU and VLA predicates |
| 37 | svbool_t to_svbool_t__from_gnu_bool_t(gnu_bool_t x) { return x; } |
| 38 | gnu_bool_t from_svbool_t__to_gnu_bool_t(svbool_t x) { return x; } |