1 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -msve-vector-bits=128 -flax-vector-conversions=none -fallow-half-arguments-and-returns -ffreestanding -fsyntax-only -verify %s 2 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -msve-vector-bits=256 -flax-vector-conversions=none -fallow-half-arguments-and-returns -ffreestanding -fsyntax-only -verify %s 3 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -msve-vector-bits=512 -flax-vector-conversions=none -fallow-half-arguments-and-returns -ffreestanding -fsyntax-only -verify %s 4 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -msve-vector-bits=1024 -flax-vector-conversions=none -fallow-half-arguments-and-returns -ffreestanding -fsyntax-only -verify %s 5 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -msve-vector-bits=2048 -flax-vector-conversions=none -fallow-half-arguments-and-returns -ffreestanding -fsyntax-only -verify %s 6 7 // expected-no-diagnostics 8 9 #include <arm_sve.h> 10 11 #define N __ARM_FEATURE_SVE_BITS 12 #define FIXED_ATTR __attribute__((arm_sve_vector_bits(N))) 13 14 typedef svfloat32_t fixed_float32_t FIXED_ATTR; 15 typedef svfloat64_t fixed_float64_t FIXED_ATTR; 16 typedef svint32_t fixed_int32_t FIXED_ATTR; 17 typedef svint64_t fixed_int64_t FIXED_ATTR; 18 19 // SVE VLSTs can be cast to SVE VLATs, regardless of lane size. 20 // NOTE: the list below is NOT exhaustive for all SVE types. 21 22 #define CAST(from, to) \ 23 void from##_to_##to(from a, to b) { \ 24 b = (to) a; \ 25 } 26 27 #define TESTCASE(ty1, ty2) \ 28 CAST(ty1, ty2) \ 29 CAST(ty2, ty1) 30 31 TESTCASE(fixed_float32_t, svfloat32_t) 32 TESTCASE(fixed_float32_t, svfloat64_t) 33 TESTCASE(fixed_float32_t, svint32_t) 34 TESTCASE(fixed_float32_t, svint64_t) 35 36 TESTCASE(fixed_float64_t, svfloat32_t) 37 TESTCASE(fixed_float64_t, svfloat64_t) 38 TESTCASE(fixed_float64_t, svint32_t) 39 TESTCASE(fixed_float64_t, svint64_t) 40 41 TESTCASE(fixed_int32_t, svfloat32_t) 42 TESTCASE(fixed_int32_t, svfloat64_t) 43 TESTCASE(fixed_int32_t, svint32_t) 44 TESTCASE(fixed_int32_t, svint64_t) 45 46 TESTCASE(fixed_int64_t, svfloat32_t) 47 TESTCASE(fixed_int64_t, svfloat64_t) 48 TESTCASE(fixed_int64_t, svint32_t) 49 TESTCASE(fixed_int64_t, svint64_t) 50