Skip to content

Commit 4db99be

Browse files
committed
Fixups
1 parent 71e6ba2 commit 4db99be

File tree

2 files changed

+48
-36
lines changed

2 files changed

+48
-36
lines changed

clang/lib/Sema/SemaStmt.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4572,15 +4572,14 @@ static std::optional<int>
45724572
isOpenMPCapturedRegionInArmSMEFunction(Sema const &S, CapturedRegionKind Kind) {
45734573
if (!S.getLangOpts().OpenMP || Kind != CR_OpenMP)
45744574
return {};
4575-
FunctionDecl *FD = S.getCurFunctionDecl(/*AllowLambda=*/true);
4576-
if (!FD)
4577-
return {};
4578-
if (IsArmStreamingFunction(FD, /*IncludeLocallyStreaming=*/true))
4579-
return /* in streaming functions */ 0;
4580-
if (hasArmZAState(FD))
4581-
return /* in functions with ZA state */ 1;
4582-
if (hasArmZT0State(FD))
4583-
return /* in fuctions with ZT0 state */ 2;
4575+
if (const FunctionDecl *FD = S.getCurFunctionDecl(/*AllowLambda=*/true)) {
4576+
if (IsArmStreamingFunction(FD, /*IncludeLocallyStreaming=*/true))
4577+
return /* in streaming functions */ 0;
4578+
if (hasArmZAState(FD))
4579+
return /* in functions with ZA state */ 1;
4580+
if (hasArmZT0State(FD))
4581+
return /* in fuctions with ZT0 state */ 2;
4582+
}
45844583
return {};
45854584
}
45864585

clang/test/Sema/aarch64-sme-attrs-openmp-captured-region.c

Lines changed: 40 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -3,66 +3,79 @@
33

44
int compute(int);
55

6-
void streaming_openmp_captured_region(int* out) __arm_streaming
7-
{
6+
void streaming_openmp_captured_region(int * out) __arm_streaming {
87
// expected-error@+2 {{OpenMP captured regions are not yet supported in streaming functions}}
98
// expected-cpp-error@+1 {{OpenMP captured regions are not yet supported in streaming functions}}
109
#pragma omp parallel for num_threads(32)
11-
for(int ci =0;ci< 8;ci++)
12-
{
13-
out[ci] =compute(ci);
10+
for (int ci = 0; ci < 8; ci++) {
11+
out[ci] = compute(ci);
1412
}
1513
}
1614

17-
__arm_locally_streaming void locally_streaming_openmp_captured_region(int* out)
18-
{
15+
__arm_locally_streaming void locally_streaming_openmp_captured_region(int * out) {
1916
// expected-error@+2 {{OpenMP captured regions are not yet supported in streaming functions}}
2017
// expected-cpp-error@+1 {{OpenMP captured regions are not yet supported in streaming functions}}
2118
#pragma omp parallel for num_threads(32)
22-
for(int ci =0;ci< 8;ci++)
23-
{
19+
for (int ci = 0; ci < 8; ci++) {
2420
out[ci] = compute(ci);
2521
}
2622
}
2723

28-
void za_state_captured_region(int* out) __arm_inout("za")
29-
{
24+
void za_state_captured_region(int * out) __arm_inout("za") {
3025
// expected-error@+2 {{OpenMP captured regions are not yet supported in functions with ZA state}}
3126
// expected-cpp-error@+1 {{OpenMP captured regions are not yet supported in functions with ZA state}}
3227
#pragma omp parallel for num_threads(32)
33-
for(int ci =0;ci< 8;ci++)
34-
{
35-
out[ci] =compute(ci);
28+
for (int ci = 0; ci < 8; ci++) {
29+
out[ci] = compute(ci);
30+
}
31+
}
32+
33+
__arm_new("za") void new_za_state_captured_region(int * out) {
34+
// expected-error@+2 {{OpenMP captured regions are not yet supported in functions with ZA state}}
35+
// expected-cpp-error@+1 {{OpenMP captured regions are not yet supported in functions with ZA state}}
36+
#pragma omp parallel for num_threads(32)
37+
for (int ci = 0; ci < 8; ci++) {
38+
out[ci] = compute(ci);
39+
}
40+
}
41+
42+
void zt0_state_openmp_captured_region(int * out) __arm_inout("zt0") {
43+
// expected-error@+2 {{OpenMP captured regions are not yet supported in functions with ZT0 state}}
44+
// expected-cpp-error@+1 {{OpenMP captured regions are not yet supported in functions with ZT0 state}}
45+
#pragma omp parallel for num_threads(32)
46+
for (int ci = 0; ci < 8; ci++) {
47+
out[ci] = compute(ci);
3648
}
3749
}
3850

39-
void zt0_state_openmp_captured_region(int* out) __arm_inout("zt0")
40-
{
51+
__arm_new("zt0") void new_zt0_state_openmp_captured_region(int * out) {
4152
// expected-error@+2 {{OpenMP captured regions are not yet supported in functions with ZT0 state}}
4253
// expected-cpp-error@+1 {{OpenMP captured regions are not yet supported in functions with ZT0 state}}
4354
#pragma omp parallel for num_threads(32)
44-
for(int ci =0;ci< 8;ci++)
45-
{
55+
for (int ci = 0; ci < 8; ci++) {
4656
out[ci] = compute(ci);
4757
}
4858
}
4959

5060
/// OpenMP directives that don't create a captured region are okay:
5161

52-
void streaming_function_openmp(int* out) __arm_streaming __arm_inout("za", "zt0")
53-
{
62+
void streaming_function_openmp(int * out) __arm_streaming __arm_inout("za", "zt0") {
5463
#pragma omp unroll full
55-
for(int ci =0;ci< 8;ci++)
56-
{
57-
out[ci] =compute(ci);
64+
for (int ci = 0; ci < 8; ci++) {
65+
out[ci] = compute(ci);
66+
}
67+
}
68+
69+
__arm_locally_streaming void locally_streaming_openmp(int * out) __arm_inout("za", "zt0") {
70+
#pragma omp unroll full
71+
for (int ci = 0; ci < 8; ci++) {
72+
out[ci] = compute(ci);
5873
}
5974
}
6075

61-
__arm_locally_streaming void locally_streaming_openmp(int* out) __arm_inout("za", "zt0")
62-
{
76+
__arm_new("za", "zt0") void arm_new_openmp(int * out) {
6377
#pragma omp unroll full
64-
for(int ci =0;ci< 8;ci++)
65-
{
78+
for (int ci = 0; ci < 8; ci++) {
6679
out[ci] = compute(ci);
6780
}
6881
}

0 commit comments

Comments
 (0)