Skip to content

Commit e3c81c9

Browse files
Dinar TemirbulatovDinar Temirbulatov
authored andcommitted
Resolve comments.
1 parent 2cb1c3d commit e3c81c9

File tree

5 files changed

+23
-28
lines changed

5 files changed

+23
-28
lines changed

clang/include/clang/Basic/DiagnosticGroups.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1412,7 +1412,7 @@ def MultiGPU: DiagGroup<"multi-gpu">;
14121412
// libc and the CRT to be skipped.
14131413
def AVRRtlibLinkingQuirks : DiagGroup<"avr-rtlib-linking-quirks">;
14141414

1415-
// A warning group AArch64 related to SME function attribues.
1415+
// A warning group related to AArch64 SME function attribues.
14161416
def AArch64SMEAttributes : DiagGroup<"aarch64-sme-attributes">;
14171417

14181418
// A warning group for things that will change semantics in the future.

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3761,7 +3761,7 @@ def warn_sme_streaming_pass_return_vl_to_non_streaming : Warning<
37613761
" different">,
37623762
InGroup<AArch64SMEAttributes>, DefaultIgnore;
37633763
def warn_sme_locally_streaming_has_vl_args_returns : Warning<
3764-
"passing/returning a VL-dependent argument from a __arm_locally_streaming"
3764+
"passing/returning a VL-dependent argument to/from a __arm_locally_streaming"
37653765
" function. The streaming and non-streaming vector"
37663766
" lengths may be different">,
37673767
InGroup<AArch64SMEAttributes>, DefaultIgnore;

clang/lib/Sema/SemaChecking.cpp

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7978,19 +7978,17 @@ void Sema::checkCall(NamedDecl *FDecl, const FunctionProtoType *Proto,
79787978
// arguments or return values, then warn the user that the streaming and
79797979
// non-streaming vector lengths may be different.
79807980
const auto *CallerFD = dyn_cast<FunctionDecl>(CurContext);
7981-
if (CallerFD) {
7982-
if ((!FD || !FD->getBuiltinID()) && AnyScalableArgsOrRet) {
7983-
bool IsCalleeStreaming = ExtInfo.AArch64SMEAttributes &
7984-
FunctionType::SME_PStateSMEnabledMask;
7985-
bool IsCalleeStreamingCompatible =
7986-
ExtInfo.AArch64SMEAttributes &
7987-
FunctionType::SME_PStateSMCompatibleMask;
7988-
ArmStreamingType CallerFnType = getArmStreamingFnType(CallerFD);
7989-
if (!IsCalleeStreamingCompatible &&
7990-
(CallerFnType == ArmStreamingCompatible ||
7991-
((CallerFnType == ArmStreaming) ^ IsCalleeStreaming)))
7992-
Diag(Loc, diag::warn_sme_streaming_pass_return_vl_to_non_streaming);
7993-
}
7981+
if (CallerFD && (!FD || !FD->getBuiltinID()) && AnyScalableArgsOrRet) {
7982+
bool IsCalleeStreaming =
7983+
ExtInfo.AArch64SMEAttributes & FunctionType::SME_PStateSMEnabledMask;
7984+
bool IsCalleeStreamingCompatible =
7985+
ExtInfo.AArch64SMEAttributes &
7986+
FunctionType::SME_PStateSMCompatibleMask;
7987+
ArmStreamingType CallerFnType = getArmStreamingFnType(CallerFD);
7988+
if (!IsCalleeStreamingCompatible &&
7989+
(CallerFnType == ArmStreamingCompatible ||
7990+
((CallerFnType == ArmStreaming) ^ IsCalleeStreaming)))
7991+
Diag(Loc, diag::warn_sme_streaming_pass_return_vl_to_non_streaming);
79947992
}
79957993

79967994
FunctionType::ArmStateValue CalleeArmZAState =

clang/test/Sema/aarch64-incompat-sm-builtin-calls.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ svuint32_t incompat_sve_sm(svbool_t pg, svuint32_t a, int16_t b) __arm_streaming
3333
return __builtin_sve_svld1_gather_u32base_index_u32(pg, a, b);
3434
}
3535

36-
// expected-warning@+1 {{passing/returning a VL-dependent argument from a __arm_locally_streaming function. The streaming and non-streaming vector lengths may be different}}
36+
// expected-warning@+1 {{passing/returning a VL-dependent argument to/from a __arm_locally_streaming function. The streaming and non-streaming vector lengths may be different}}
3737
__arm_locally_streaming svuint32_t incompat_sve_ls(svbool_t pg, svuint32_t a, int64_t b) {
3838
// expected-warning@+1 {{builtin call has undefined behaviour when called from a streaming function}}
3939
return __builtin_sve_svld1_gather_u32base_index_u32(pg, a, b);
@@ -49,7 +49,7 @@ svuint32_t incompat_sve2_sm(svbool_t pg, svuint32_t a, int64_t b) __arm_streamin
4949
return __builtin_sve_svldnt1_gather_u32base_index_u32(pg, a, b);
5050
}
5151

52-
// expected-warning@+1 {{passing/returning a VL-dependent argument from a __arm_locally_streaming function. The streaming and non-streaming vector lengths may be different}}
52+
// expected-warning@+1 {{passing/returning a VL-dependent argument to/from a __arm_locally_streaming function. The streaming and non-streaming vector lengths may be different}}
5353
__arm_locally_streaming svuint32_t incompat_sve2_ls(svbool_t pg, svuint32_t a, int64_t b) {
5454
// expected-warning@+1 {{builtin call has undefined behaviour when called from a streaming function}}
5555
return __builtin_sve_svldnt1_gather_u32base_index_u32(pg, a, b);
@@ -70,7 +70,7 @@ svfloat64_t streaming_caller_sve(svbool_t pg, svfloat64_t a, float64_t b) __arm_
7070
return svadd_n_f64_m(pg, a, b);
7171
}
7272

73-
// expected-warning@+1 {{passing/returning a VL-dependent argument from a __arm_locally_streaming function. The streaming and non-streaming vector lengths may be different}}
73+
// expected-warning@+1 {{passing/returning a VL-dependent argument to/from a __arm_locally_streaming function. The streaming and non-streaming vector lengths may be different}}
7474
__arm_locally_streaming svfloat64_t locally_streaming_caller_sve(svbool_t pg, svfloat64_t a, float64_t b) {
7575
// expected-no-warning
7676
return svadd_n_f64_m(pg, a, b);
@@ -86,7 +86,7 @@ svint16_t streaming_caller_sve2(svint16_t op1, svint16_t op2) __arm_streaming {
8686
return svmul_lane_s16(op1, op2, 0);
8787
}
8888

89-
// expected-warning@+1 {{passing/returning a VL-dependent argument from a __arm_locally_streaming function. The streaming and non-streaming vector lengths may be different}}
89+
// expected-warning@+1 {{passing/returning a VL-dependent argument to/from a __arm_locally_streaming function. The streaming and non-streaming vector lengths may be different}}
9090
__arm_locally_streaming svint16_t locally_streaming_caller_sve2(svint16_t op1, svint16_t op2) {
9191
// expected-no-warning
9292
return svmul_lane_s16(op1, op2, 0);

clang/test/Sema/aarch64-sme-func-attrs.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -Waarch64-sme-attributes -fsyntax-only -verify %s
2-
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme -target-feature +sve -Waarch64-sme-attributes -fsyntax-only -verify=expected-cpp -x c++ %s
1+
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve -Waarch64-sme-attributes -fsyntax-only -verify %s
2+
// RUN: %clang_cc1 -triple aarch64-none-linux-gnu -target-feature +sme2 -target-feature +sve -Waarch64-sme-attributes -fsyntax-only -verify=expected-cpp -x c++ %s
33

44
// Valid attributes
55

@@ -48,9 +48,6 @@ typedef void (*fptrty6) (void);
4848
fptrty6 cast_nza_func_to_normal() { return sme_arm_new_za; }
4949
fptrty6 cast_ls_func_to_normal() { return sme_arm_locally_streaming; }
5050

51-
void sme_arm_streaming_with_vl_args(void) __arm_streaming;
52-
53-
5451
// Invalid attributes
5552

5653
// expected-cpp-error@+4 {{'__arm_streaming_compatible' and '__arm_streaming' are not compatible}}
@@ -512,12 +509,12 @@ void sme_no_streaming_with_vl_arg(__SVInt8_t a) { }
512509

513510
__SVInt8_t sme_no_streaming_returns_vl(void) { __SVInt8_t r; return r; }
514511

515-
// expected-warning@+2 {{passing/returning a VL-dependent argument from a __arm_locally_streaming function. The streaming and non-streaming vector lengths may be different}}
516-
// expected-cpp-warning@+1 {{passing/returning a VL-dependent argument from a __arm_locally_streaming function. The streaming and non-streaming vector lengths may be different}}
512+
// expected-warning@+2 {{passing/returning a VL-dependent argument to/from a __arm_locally_streaming function. The streaming and non-streaming vector lengths may be different}}
513+
// expected-cpp-warning@+1 {{passing/returning a VL-dependent argument to/from a __arm_locally_streaming function. The streaming and non-streaming vector lengths may be different}}
517514
__arm_locally_streaming void sme_locally_streaming_with_vl_arg(__SVInt8_t a) { }
518515

519-
// expected-warning@+2 {{passing/returning a VL-dependent argument from a __arm_locally_streaming function. The streaming and non-streaming vector lengths may be different}}
520-
// expected-cpp-warning@+1 {{passing/returning a VL-dependent argument from a __arm_locally_streaming function. The streaming and non-streaming vector lengths may be different}}
516+
// expected-warning@+2 {{passing/returning a VL-dependent argument to/from a __arm_locally_streaming function. The streaming and non-streaming vector lengths may be different}}
517+
// expected-cpp-warning@+1 {{passing/returning a VL-dependent argument to/from a __arm_locally_streaming function. The streaming and non-streaming vector lengths may be different}}
521518
__arm_locally_streaming __SVInt8_t sme_locally_streaming_returns_vl(void) { __SVInt8_t r; return r; }
522519

523520
void sme_no_streaming_calling_streaming_with_vl_args() {

0 commit comments

Comments
 (0)