| 1 |
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -target-feature +sme -mvscale-min=1 -mvscale-max=1 -mvscale-streaming-min=2 -mvscale-streaming-max=2 -flax-vector-conversions=integer -ffreestanding -fsyntax-only -verify %s |
| 2 |
// REQUIRES: aarch64-registered-target |
| 3 |
|
| 4 |
#include <arm_sve.h> |
| 5 |
|
| 6 |
#define SVE_BITS 128 |
| 7 |
#define SVE_FIXED_ATTR __attribute__((arm_sve_vector_bits(SVE_BITS))) |
| 8 |
#define GNU_FIXED_ATTR __attribute__((vector_size(SVE_BITS / 8))) |
| 9 |
#define GNU_BOOL_FIXED_ATTR __attribute__((vector_size(SVE_BITS / 64))) |
| 10 |
#define STREAMING_BITS 256 |
| 11 |
#define GNU_FIXED_STREAMING_ATTR __attribute__((vector_size(STREAMING_BITS / 8))) |
| 12 |
#define GNU_BOOL_FIXED_STREAMING_ATTR __attribute__((vector_size(STREAMING_BITS / 64))) |
| 13 |
|
| 14 |
typedef svfloat32_t sve_fixed_float32_t SVE_FIXED_ATTR; |
| 15 |
typedef svint32_t sve_fixed_int32_t SVE_FIXED_ATTR; |
| 16 |
typedef svbool_t sve_fixed_bool_t SVE_FIXED_ATTR; |
| 17 |
typedef float gnu_fixed_float32_t GNU_FIXED_ATTR; |
| 18 |
typedef int gnu_fixed_int32_t GNU_FIXED_ATTR; |
| 19 |
typedef int8_t gnu_fixed_bool_t GNU_BOOL_FIXED_ATTR; |
| 20 |
|
| 21 |
typedef float gnu_fixed_float32_t_streaming GNU_FIXED_STREAMING_ATTR; |
| 22 |
typedef int gnu_fixed_int32_t_streaming GNU_FIXED_STREAMING_ATTR; |
| 23 |
typedef int8_t gnu_fixed_bool_t_streaming GNU_BOOL_FIXED_STREAMING_ATTR; |
| 24 |
|
| 25 |
void sve_fixed() { |
| 26 |
gnu_fixed_int32_t fi; |
| 27 |
gnu_fixed_float32_t_streaming fi_wrong; |
| 28 |
gnu_fixed_float32_t ff; |
| 29 |
gnu_fixed_float32_t_streaming ff_wrong; |
| 30 |
gnu_fixed_bool_t fb; |
| 31 |
gnu_fixed_bool_t_streaming fb_wrong; |
| 32 |
*(volatile svint32_t*)0 = fi; |
| 33 |
*(volatile svint32_t*)0 = fi_wrong; // expected-error {{incompatible}} |
| 34 |
*(volatile svfloat32_t*)0 = ff; |
| 35 |
*(volatile svfloat32_t*)0 = ff_wrong; // expected-error {{incompatible}} |
| 36 |
*(volatile svbool_t*)0 = fb; |
| 37 |
*(volatile svbool_t*)0 = fb_wrong; // expected-error {{incompatible}} |
| 38 |
} |
| 39 |
|
| 40 |
__arm_locally_streaming void streaming_fixed() { |
| 41 |
gnu_fixed_int32_t_streaming fi; |
| 42 |
gnu_fixed_float32_t fi_wrong; |
| 43 |
gnu_fixed_float32_t_streaming ff; |
| 44 |
gnu_fixed_float32_t ff_wrong; |
| 45 |
gnu_fixed_bool_t_streaming fb; |
| 46 |
gnu_fixed_bool_t fb_wrong; |
| 47 |
*(volatile svint32_t*)0 = fi; |
| 48 |
*(volatile svint32_t*)0 = fi_wrong; // expected-error {{incompatible}} |
| 49 |
*(volatile svfloat32_t*)0 = ff; |
| 50 |
*(volatile svfloat32_t*)0 = ff_wrong; // expected-error {{incompatible}} |
| 51 |
*(volatile svbool_t*)0 = fb; |
| 52 |
*(volatile svbool_t*)0 = fb_wrong; // expected-error {{incompatible}} |
| 53 |
} |
| 54 |
|
| 55 |
void streaming_compatible() __arm_streaming_compatible { |
| 56 |
gnu_fixed_int32_t fi_ns; |
| 57 |
gnu_fixed_float32_t_streaming fi_s; |
| 58 |
gnu_fixed_float32_t ff_ns; |
| 59 |
gnu_fixed_float32_t_streaming ff_s; |
| 60 |
gnu_fixed_bool_t fb_ns; |
| 61 |
gnu_fixed_bool_t_streaming fb_s; |
| 62 |
*(volatile svint32_t*)0 = fi_ns; // expected-error {{incompatible}} |
| 63 |
*(volatile svint32_t*)0 = fi_s; // expected-error {{incompatible}} |
| 64 |
*(volatile svfloat32_t*)0 = ff_ns; // expected-error {{incompatible}} |
| 65 |
*(volatile svfloat32_t*)0 = ff_s; // expected-error {{incompatible}} |
| 66 |
*(volatile svbool_t*)0 = fb_ns; // expected-error {{incompatible}} |
| 67 |
*(volatile svbool_t*)0 = fb_s; // expected-error {{incompatible}} |
| 68 |
} |
| 69 |
|