[clang] [AArch64] Warn when calling a NEON builtin in a streaming function (PR #73672)
Sander de Smalen via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 29 01:14:44 PST 2023
================
@@ -3136,6 +3192,31 @@ bool Sema::CheckSVEBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
bool Sema::CheckNeonBuiltinFunctionCall(const TargetInfo &TI,
unsigned BuiltinID, CallExpr *TheCall) {
+ if (const FunctionDecl *FD = getCurFunctionDecl()) {
+ std::optional<ArmStreamingType> BuiltinType;
+
+ bool IsNeon = false;
+ switch (BuiltinID) {
+ default:
+ break;
+#define GET_NEON_BUILTINS
+#define TARGET_BUILTIN(id, x, y, z) \
+ case NEON::BI##id: \
+ IsNeon = true; \
+ break;
+#define BUILTIN(id, x, y) TARGET_BUILTIN(id, x, y, "");
+#include "clang/Basic/arm_neon.inc"
+#undef TARGET_BUILTIN
+#undef BUILTIN
+#undef GET_NEON_BUILTINS
+ }
+
+ if (IsNeon) {
+ checkArmStreamingBuiltin(*this, TheCall, FD, ArmNonStreaming);
+ return true;
+ }
----------------
sdesmalen-arm wrote:
nit: Can this be simplified as:
```
switch (BuiltinID) {
default:
break;
#define TARGET_BUILTIN(id, ...) case NEON::BI##id:
#define BUILTIN(id, ...) case NEON::BI##id:
#define GET_NEON_BUILTINS
#include "clang/Basic/arm_neon.inc"
return checkArmStreamingBuiltin(*this, TheCall, FD, ArmNonStreaming);
#undef GET_NEON_BUILTINS
#undef BUILTIN
#undef TARGET_BUILTIN
```
?
https://github.com/llvm/llvm-project/pull/73672
More information about the cfe-commits
mailing list