| 1 |
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -S -o /dev/null -target-feature +sme -target-feature +sme2 -verify -DTEST_NONE %s |
| 2 |
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -S -o /dev/null -target-feature +sme -target-feature +sme2 -verify -DTEST_COMPATIBLE %s |
| 3 |
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -S -o /dev/null -target-feature +sme -target-feature +sme2 -verify -DTEST_STREAMING %s |
| 4 |
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -S -o /dev/null -target-feature +sme -target-feature +sme2 -verify -DTEST_LOCALLY %s |
| 5 |
|
| 6 |
// REQUIRES: aarch64-registered-target |
| 7 |
|
| 8 |
#define __ai __attribute__((always_inline)) |
| 9 |
__ai void inlined_fn(void) {} |
| 10 |
__ai void inlined_fn_streaming_compatible(void) __arm_streaming_compatible {} |
| 11 |
__ai void inlined_fn_streaming(void) __arm_streaming {} |
| 12 |
__ai __arm_locally_streaming void inlined_fn_local(void) {} |
| 13 |
__ai __arm_new("za") void inlined_fn_za(void) {} |
| 14 |
__ai __arm_new("zt0") void inlined_fn_zt0(void) {} |
| 15 |
|
| 16 |
#ifdef TEST_NONE |
| 17 |
void caller(void) { |
| 18 |
inlined_fn(); |
| 19 |
inlined_fn_streaming_compatible(); |
| 20 |
inlined_fn_streaming(); // expected-error {{always_inline function 'inlined_fn_streaming' and its caller 'caller' have mismatching streaming attributes}} |
| 21 |
inlined_fn_local(); // expected-error {{always_inline function 'inlined_fn_local' and its caller 'caller' have mismatching streaming attributes}} |
| 22 |
inlined_fn_za(); // expected-error {{always_inline function 'inlined_fn_za' has new za state}} |
| 23 |
inlined_fn_zt0(); // expected-error {{always_inline function 'inlined_fn_zt0' has new zt0 state}} |
| 24 |
} |
| 25 |
#endif |
| 26 |
|
| 27 |
#ifdef TEST_COMPATIBLE |
| 28 |
void caller_compatible(void) __arm_streaming_compatible { |
| 29 |
inlined_fn(); // expected-warning {{always_inline function 'inlined_fn' and its caller 'caller_compatible' have mismatching streaming attributes, inlining may change runtime behaviour}} |
| 30 |
inlined_fn_streaming_compatible(); |
| 31 |
inlined_fn_streaming(); // expected-error {{always_inline function 'inlined_fn_streaming' and its caller 'caller_compatible' have mismatching streaming attributes}} |
| 32 |
inlined_fn_local(); // expected-error {{always_inline function 'inlined_fn_local' and its caller 'caller_compatible' have mismatching streaming attributes}} |
| 33 |
} |
| 34 |
#endif |
| 35 |
|
| 36 |
#ifdef TEST_STREAMING |
| 37 |
void caller_streaming(void) __arm_streaming { |
| 38 |
inlined_fn(); // expected-warning {{always_inline function 'inlined_fn' and its caller 'caller_streaming' have mismatching streaming attributes, inlining may change runtime behaviour}} |
| 39 |
inlined_fn_streaming_compatible(); |
| 40 |
inlined_fn_streaming(); |
| 41 |
inlined_fn_local(); |
| 42 |
} |
| 43 |
#endif |
| 44 |
|
| 45 |
#ifdef TEST_LOCALLY |
| 46 |
__arm_locally_streaming |
| 47 |
void caller_local(void) { |
| 48 |
inlined_fn(); // expected-warning {{always_inline function 'inlined_fn' and its caller 'caller_local' have mismatching streaming attributes, inlining may change runtime behaviour}} |
| 49 |
inlined_fn_streaming_compatible(); |
| 50 |
inlined_fn_streaming(); |
| 51 |
inlined_fn_local(); |
| 52 |
} |
| 53 |
#endif |