| 1 |
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -fsyntax-only -verify %s |
| 2 |
|
| 3 |
// REQUIRES: aarch64-registered-target |
| 4 |
|
| 5 |
#include <arm_sme.h> |
| 6 |
|
| 7 |
void test_streaming(svint32_t *out, svint32_t *in) __arm_streaming { |
| 8 |
*out = *in; |
| 9 |
} |
| 10 |
|
| 11 |
void test_non_streaming(svint32_t *out, svint32_t *in) { |
| 12 |
*out = *in; // expected-error {{SVE vector type 'svint32_t' (aka '__SVInt32_t') cannot be used in a non-streaming function}} \ |
| 13 |
expected-error {{SVE vector type 'svint32_t' (aka '__SVInt32_t') cannot be used in a non-streaming function}} |
| 14 |
} |
| 15 |
|
| 16 |
// This previously led to a diagnostic that '&a' could not be used in a non-streaming function, |
| 17 |
// even though all functions are streaming. |
| 18 |
void test_both_streaming(int32_t *out) __arm_streaming { |
| 19 |
svint32_t a; |
| 20 |
[&a, &out]() __arm_streaming { |
| 21 |
a = svdup_s32(1); |
| 22 |
svst1(svptrue_b32(), out, a); |
| 23 |
}(); |
| 24 |
} |
| 25 |
|
| 26 |
void test_lambda_streaming(int32_t *out) { |
| 27 |
svint32_t a; // expected-error {{SVE vector type 'svint32_t' (aka '__SVInt32_t') cannot be used in a non-streaming function}} |
| 28 |
[&a, &out]() __arm_streaming { |
| 29 |
a = 1; |
| 30 |
svst1(svptrue_b32(), out, a); |
| 31 |
}(); |
| 32 |
} |
| 33 |
|
| 34 |
void test_lambda_non_streaming_capture_do_nothing() __arm_streaming { |
| 35 |
svint32_t a; |
| 36 |
[&a] { |
| 37 |
// Do nothing. |
| 38 |
}(); |
| 39 |
} |
| 40 |
|
| 41 |
// Error: Non-streaming function attempts to dereference capture: |
| 42 |
void test_lambda_non_streaming_capture_return_vector() __arm_streaming { |
| 43 |
svint32_t a; |
| 44 |
[&a] { |
| 45 |
return a; // expected-error {{SVE vector type 'svint32_t' (aka '__SVInt32_t') cannot be used in a non-streaming function}} |
| 46 |
}(); |
| 47 |
} |
| 48 |
|
| 49 |
// By reference capture, only records and uses the address of `a`: |
| 50 |
// FIXME: This should be okay. |
| 51 |
void test_lambda_non_streaming_capture_return_address() __arm_streaming { |
| 52 |
svint32_t a; |
| 53 |
[&a] { |
| 54 |
return &a; // expected-error {{SVE vector type 'svint32_t' (aka '__SVInt32_t') cannot be used in a non-streaming function}} |
| 55 |
}(); |
| 56 |
} |