52 lines · c
1// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -mvscale-min=1 -mvscale-max=1 -flax-vector-conversions=none -ffreestanding -fsyntax-only -verify %s2// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -mvscale-min=2 -mvscale-max=2 -flax-vector-conversions=none -ffreestanding -fsyntax-only -verify %s3// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -mvscale-min=4 -mvscale-max=4 -flax-vector-conversions=none -ffreestanding -fsyntax-only -verify %s4// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -mvscale-min=8 -mvscale-max=8 -flax-vector-conversions=none -ffreestanding -fsyntax-only -verify %s5// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -mvscale-min=16 -mvscale-max=16 -flax-vector-conversions=none -ffreestanding -fsyntax-only -verify %s6 7// expected-no-diagnostics8 9// REQUIRES: aarch64-registered-target || arm-registered-target10 11#include <arm_sve.h>12 13#define N __ARM_FEATURE_SVE_BITS14#define FIXED_ATTR __attribute__((arm_sve_vector_bits(N)))15 16typedef svfloat32_t fixed_float32_t FIXED_ATTR;17typedef svfloat64_t fixed_float64_t FIXED_ATTR;18typedef svint32_t fixed_int32_t FIXED_ATTR;19typedef svint64_t fixed_int64_t FIXED_ATTR;20 21// SVE VLSTs can be cast to SVE VLATs, regardless of lane size.22// NOTE: the list below is NOT exhaustive for all SVE types.23 24#define CAST(from, to) \25 void from##_to_##to(from a, to b) { \26 b = (to) a; \27 }28 29#define TESTCASE(ty1, ty2) \30 CAST(ty1, ty2) \31 CAST(ty2, ty1)32 33TESTCASE(fixed_float32_t, svfloat32_t)34TESTCASE(fixed_float32_t, svfloat64_t)35TESTCASE(fixed_float32_t, svint32_t)36TESTCASE(fixed_float32_t, svint64_t)37 38TESTCASE(fixed_float64_t, svfloat32_t)39TESTCASE(fixed_float64_t, svfloat64_t)40TESTCASE(fixed_float64_t, svint32_t)41TESTCASE(fixed_float64_t, svint64_t)42 43TESTCASE(fixed_int32_t, svfloat32_t)44TESTCASE(fixed_int32_t, svfloat64_t)45TESTCASE(fixed_int32_t, svint32_t)46TESTCASE(fixed_int32_t, svint64_t)47 48TESTCASE(fixed_int64_t, svfloat32_t)49TESTCASE(fixed_int64_t, svfloat64_t)50TESTCASE(fixed_int64_t, svint32_t)51TESTCASE(fixed_int64_t, svint64_t)52