55 lines · cpp
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// REQUIRES: aarch64-registered-target || arm-registered-target8 9// expected-no-diagnostics10 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;20typedef svbool_t fixed_bool_t FIXED_ATTR;21 22// SVE VLSTs can be cast to SVE VLATs, regardless of lane size.23// NOTE: the list below is NOT exhaustive for all SVE types.24 25#define CAST(from, to) \26 void from##_to_##to(from a, to b) { \27 b = (to) a; \28 }29 30#define TESTCASE(ty1, ty2) \31 CAST(ty1, ty2) \32 CAST(ty2, ty1)33 34TESTCASE(fixed_float32_t, svfloat32_t)35TESTCASE(fixed_float32_t, svfloat64_t)36TESTCASE(fixed_float32_t, svint32_t)37TESTCASE(fixed_float32_t, svint64_t)38 39TESTCASE(fixed_float64_t, svfloat32_t)40TESTCASE(fixed_float64_t, svfloat64_t)41TESTCASE(fixed_float64_t, svint32_t)42TESTCASE(fixed_float64_t, svint64_t)43 44TESTCASE(fixed_int32_t, svfloat32_t)45TESTCASE(fixed_int32_t, svfloat64_t)46TESTCASE(fixed_int32_t, svint32_t)47TESTCASE(fixed_int32_t, svint64_t)48 49TESTCASE(fixed_int64_t, svfloat32_t)50TESTCASE(fixed_int64_t, svfloat64_t)51TESTCASE(fixed_int64_t, svint32_t)52TESTCASE(fixed_int64_t, svint64_t)53 54TESTCASE(fixed_bool_t, svbool_t)55