1 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -mvscale-min=4 -mvscale-max=4 -flax-vector-conversions=none -fallow-half-arguments-and-returns -ffreestanding -fsyntax-only -verify=lax-vector-none %s
2 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -mvscale-min=4 -mvscale-max=4 -flax-vector-conversions=integer -fallow-half-arguments-and-returns -ffreestanding -fsyntax-only -verify=lax-vector-integer %s
3 // RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sve -mvscale-min=4 -mvscale-max=4 -flax-vector-conversions=all -fallow-half-arguments-and-returns -ffreestanding -fsyntax-only -verify=lax-vector-all %s
5 // lax-vector-all-no-diagnostics
7 // REQUIRES: aarch64-registered-target || arm-registered-target
11 #define N __ARM_FEATURE_SVE_BITS
12 #define SVE_FIXED_ATTR __attribute__((arm_sve_vector_bits(N)))
13 #define GNU_FIXED_ATTR __attribute__((vector_size(N / 8)))
15 typedef svfloat32_t sve_fixed_float32_t SVE_FIXED_ATTR
;
16 typedef svint32_t sve_fixed_int32_t SVE_FIXED_ATTR
;
17 typedef float gnu_fixed_float32_t GNU_FIXED_ATTR
;
18 typedef int gnu_fixed_int32_t GNU_FIXED_ATTR
;
20 void sve_allowed_with_integer_lax_conversions() {
21 sve_fixed_int32_t fi32
;
24 // The implicit cast here should fail if -flax-vector-conversions=none, but pass if
25 // -flax-vector-conversions={integer,all}.
27 // lax-vector-none-error@-1 {{assigning to 'sve_fixed_int32_t' (vector of 16 'int' values) from incompatible type}}
29 // lax-vector-none-error@-1 {{assigning to 'svint64_t' (aka '__SVInt64_t') from incompatible type}}
32 void sve_allowed_with_all_lax_conversions() {
33 sve_fixed_float32_t ff32
;
36 // The implicit cast here should fail if -flax-vector-conversions={none,integer}, but pass if
37 // -flax-vector-conversions=all.
39 // lax-vector-none-error@-1 {{assigning to 'sve_fixed_float32_t' (vector of 16 'float' values) from incompatible type}}
40 // lax-vector-integer-error@-2 {{assigning to 'sve_fixed_float32_t' (vector of 16 'float' values) from incompatible type}}
42 // lax-vector-none-error@-1 {{assigning to 'svfloat64_t' (aka '__SVFloat64_t') from incompatible type}}
43 // lax-vector-integer-error@-2 {{assigning to 'svfloat64_t' (aka '__SVFloat64_t') from incompatible type}}
46 void gnu_allowed_with_integer_lax_conversions() {
47 gnu_fixed_int32_t fi32
;
50 // The implicit cast here should fail if -flax-vector-conversions=none, but pass if
51 // -flax-vector-conversions={integer,all}.
53 // lax-vector-none-error@-1 {{assigning to 'gnu_fixed_int32_t' (vector of 16 'int' values) from incompatible type}}
55 // lax-vector-none-error@-1 {{assigning to 'svint64_t' (aka '__SVInt64_t') from incompatible type}}
58 void gnu_allowed_with_all_lax_conversions() {
59 gnu_fixed_float32_t ff32
;
62 // The implicit cast here should fail if -flax-vector-conversions={none,integer}, but pass if
63 // -flax-vector-conversions=all.
65 // lax-vector-none-error@-1 {{assigning to 'gnu_fixed_float32_t' (vector of 16 'float' values) from incompatible type}}
66 // lax-vector-integer-error@-2 {{assigning to 'gnu_fixed_float32_t' (vector of 16 'float' values) from incompatible type}}
68 // lax-vector-none-error@-1 {{assigning to 'svfloat64_t' (aka '__SVFloat64_t') from incompatible type}}
69 // lax-vector-integer-error@-2 {{assigning to 'svfloat64_t' (aka '__SVFloat64_t') from incompatible type}}