brintos

brintos / llvm-project-archived public Read only

0
0
Text · 7.0 KiB · 41d8986 Raw
112 lines · c
1// Case 1: No vscale flags — should only produce warnings2// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +bf16 -target-feature +sme -target-feature +sme2 -target-feature +sve -Waarch64-sme-attributes -fsyntax-only -verify=expected-noflags %s3 4// Case 2: Explicit mismatch in vscale flags — should produce errors for 5// streaming and non-streaming callers6// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +bf16 -target-feature +sme -target-feature +sme2 -target-feature +sve -Waarch64-sme-attributes -fsyntax-only -mvscale-min=1 -mvscale-max=1 -mvscale-streaming-min=2 -mvscale-streaming-max=2 -verify=expected-flags %s7 8void sme_streaming_with_vl_arg(__SVInt8_t a) __arm_streaming;9 10__SVInt8_t sme_streaming_returns_vl(void) __arm_streaming;11 12void sme_streaming_compatible_with_vl_arg(__SVInt8_t a) __arm_streaming_compatible;13 14__SVInt8_t sme_streaming_compatible_returns_vl(void) __arm_streaming_compatible;15 16void sme_no_streaming_with_vl_arg(__SVInt8_t a);17 18__SVInt8_t sme_no_streaming_returns_vl(void);19 20 21void sme_no_streaming_calling_streaming_with_vl_args() {22  __SVInt8_t a;23  // expected-noflags-warning@+2 {{passing a VL-dependent argument to a function with a different streaming-mode is undefined behaviour when the streaming and non-streaming vector lengths are different at runtime}}24  // expected-flags-error@+1 {{passing a VL-dependent argument to a function with a different streaming-mode is undefined behaviour because the streaming vector length (256 bit) and non-streaming vector length (128 bit) differ}}25  sme_streaming_with_vl_arg(a);26}27 28void sme_no_streaming_calling_streaming_with_return_vl() {29  // expected-noflags-warning@+2 {{returning a VL-dependent argument from a function with a different streaming-mode is undefined behaviour when the streaming and non-streaming vector lengths are different at runtime}}30  // expected-flags-error@+1 {{returning a VL-dependent argument from a function with a different streaming-mode is undefined behaviour because the streaming vector length (256 bit) and non-streaming vector length (128 bit) differ}}31  __SVInt8_t r = sme_streaming_returns_vl();32}33 34void sme_streaming_calling_non_streaming_with_vl_args(void) __arm_streaming {35  __SVInt8_t a;36  // expected-noflags-warning@+2 {{passing a VL-dependent argument to a function with a different streaming-mode is undefined behaviour when the streaming and non-streaming vector lengths are different at runtime}}37  // expected-flags-error@+1 {{passing a VL-dependent argument to a function with a different streaming-mode is undefined behaviour because the streaming vector length (256 bit) and non-streaming vector length (128 bit) differ}}38  sme_no_streaming_with_vl_arg(a);39}40 41void sme_streaming_calling_non_streaming_with_return_vl(void) __arm_streaming {42  // expected-noflags-warning@+2 {{returning a VL-dependent argument from a function with a different streaming-mode is undefined behaviour when the streaming and non-streaming vector lengths are different at runtime}}43  // expected-flags-error@+1 {{returning a VL-dependent argument from a function with a different streaming-mode is undefined behaviour because the streaming vector length (256 bit) and non-streaming vector length (128 bit) differ}}44  __SVInt8_t r = sme_no_streaming_returns_vl();45}46 47void sme_streaming_compatible_calling_streaming_with_vl_args(__SVInt8_t arg) __arm_streaming_compatible {48  // expected-noflags-warning@+2 {{passing a VL-dependent argument to a function with a different streaming-mode is undefined behaviour when the streaming and non-streaming vector lengths are different at runtime}}49  // expected-flags-warning@+1 {{passing a VL-dependent argument to a streaming function is undefined behaviour when the streaming-compatible caller is not in streaming mode, because the streaming vector length (256 bit) and non-streaming vector length (128 bit) differ}}50  sme_streaming_with_vl_arg(arg);51}52 53void sme_streaming_compatible_calling_sme_streaming_return_vl(void) __arm_streaming_compatible {54  // expected-noflags-warning@+2 {{returning a VL-dependent argument from a function with a different streaming-mode is undefined behaviour when the streaming and non-streaming vector lengths are different at runtime}}55  // expected-flags-warning@+1 {{returning a VL-dependent argument from a streaming function is undefined behaviour when the streaming-compatible caller is not in streaming mode, because the streaming vector length (256 bit) and non-streaming vector length (128 bit) differ}}56  __SVInt8_t r = sme_streaming_returns_vl();57}58 59void sme_streaming_compatible_calling_no_streaming_with_vl_args(__SVInt8_t arg) __arm_streaming_compatible {60  // expected-noflags-warning@+2 {{passing a VL-dependent argument to a function with a different streaming-mode is undefined behaviour when the streaming and non-streaming vector lengths are different at runtime}}61  // expected-flags-warning@+1 {{passing a VL-dependent argument to a non-streaming function is undefined behaviour when the streaming-compatible caller is in streaming mode, because the streaming vector length (256 bit) and non-streaming vector length (128 bit) differ}}62  sme_no_streaming_with_vl_arg(arg);63}64 65void sme_streaming_compatible_calling_no_sme_streaming_return_vl(void) __arm_streaming_compatible {66  // expected-noflags-warning@+2 {{returning a VL-dependent argument from a function with a different streaming-mode is undefined behaviour when the streaming and non-streaming vector lengths are different at runtime}}67  // expected-flags-warning@+1 {{returning a VL-dependent argument from a non-streaming function is undefined behaviour when the streaming-compatible caller is in streaming mode, because the streaming vector length (256 bit) and non-streaming vector length (128 bit) differ}}68  __SVInt8_t r = sme_no_streaming_returns_vl();69}70 71void sme_streaming_calling_streaming_with_vl_args(__SVInt8_t a) __arm_streaming {72  sme_streaming_with_vl_arg(a);73}74 75void sme_streaming_calling_streaming_with_return_vl(void) __arm_streaming {76  __SVInt8_t r = sme_streaming_returns_vl();77}78 79void sme_streaming_calling_streaming_compatible_with_vl_args(__SVInt8_t a) __arm_streaming {80  sme_streaming_compatible_with_vl_arg(a);81}82 83void sme_streaming_calling_streaming_compatible_with_return_vl(void) __arm_streaming {84  __SVInt8_t r = sme_streaming_compatible_returns_vl();85}86 87void sme_no_streaming_calling_streaming_compatible_with_vl_args() {88  __SVInt8_t a;89  sme_streaming_compatible_with_vl_arg(a);90}91 92void sme_no_streaming_calling_streaming_compatible_with_return_vl() {93  __SVInt8_t r = sme_streaming_compatible_returns_vl();94}95 96void sme_no_streaming_calling_non_streaming_with_vl_args() {97  __SVInt8_t a;98  sme_no_streaming_with_vl_arg(a);99}100 101void sme_no_streaming_calling_non_streaming_with_return_vl() {102  __SVInt8_t r = sme_no_streaming_returns_vl();103}104 105void sme_streaming_compatible_calling_streaming_compatible_with_vl_args(__SVInt8_t arg) __arm_streaming_compatible {106  sme_streaming_compatible_with_vl_arg(arg);107}108 109void sme_streaming_compatible_calling_streaming_compatible_with_return_vl(void) __arm_streaming_compatible {110  __SVInt8_t r = sme_streaming_compatible_returns_vl();111}112