blob: 794386087b2a02cee4bf55308d8815ff5ab4adda [file] [log] [blame]
Bradley Smith0ce46a12021-10-14 11:04:33 +00001// 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 Rhodesfeed5a72020-08-11 13:04:21 +00002// expected-no-diagnostics
3
Cullen Rhodes9218f922020-09-11 15:18:44 +00004#include <stdint.h>
5
Cullen Rhodesf9091e52020-09-03 09:19:41 +00006#define N __ARM_FEATURE_SVE_BITS
Cullen Rhodesfeed5a72020-08-11 13:04:21 +00007
8typedef __SVInt8_t svint8_t;
9typedef svint8_t fixed_int8_t __attribute__((arm_sve_vector_bits(N)));
Cullen Rhodes9218f922020-09-11 15:18:44 +000010typedef int8_t gnu_int8_t __attribute__((vector_size(N / 8)));
Cullen Rhodesfeed5a72020-08-11 13:04:21 +000011
Jun Ma599b2f02021-07-19 21:10:17 +080012typedef __SVBool_t svbool_t;
13typedef svbool_t fixed_bool_t __attribute__((arm_sve_vector_bits(N)));
14typedef int8_t gnu_bool_t __attribute__((vector_size(N / 64)));
15
Cullen Rhodesfeed5a72020-08-11 13:04:21 +000016template<typename T> struct S { T var; };
17
18S<fixed_int8_t> s;
19
Cullen Rhodes9218f922020-09-11 15:18:44 +000020// Test implicit casts between VLA and VLS vectors
Cullen Rhodesfeed5a72020-08-11 13:04:21 +000021svint8_t to_svint8_t(fixed_int8_t x) { return x; }
22fixed_int8_t from_svint8_t(svint8_t x) { return x; }
Cullen Rhodes9218f922020-09-11 15:18:44 +000023
24// Test implicit casts between GNU and VLA vectors
25svint8_t to_svint8_t__from_gnu_int8_t(gnu_int8_t x) { return x; }
26gnu_int8_t from_svint8_t__to_gnu_int8_t(svint8_t x) { return x; }
27
28// Test implicit casts between GNU and VLS vectors
29fixed_int8_t to_fixed_int8_t__from_gnu_int8_t(gnu_int8_t x) { return x; }
30gnu_int8_t from_fixed_int8_t__to_gnu_int8_t(fixed_int8_t x) { return x; }
Jun Ma599b2f02021-07-19 21:10:17 +080031
32// Test implicit casts between VLA and VLS predicates
33svbool_t to_svbool_t(fixed_bool_t x) { return x; }
34fixed_bool_t from_svbool_t(svbool_t x) { return x; }
35
36// Test implicit casts between GNU and VLA predicates
37svbool_t to_svbool_t__from_gnu_bool_t(gnu_bool_t x) { return x; }
38gnu_bool_t from_svbool_t__to_gnu_bool_t(svbool_t x) { return x; }