diff options
author | Eli Friedman <efriedma@quicinc.com> | 2025-07-03 13:44:38 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-07-03 13:44:38 -0700 |
commit | 2aa0f0a3bd541278b04efcc717e7aa94ef4c1308 (patch) | |
tree | bad6cb83b2366c8e0ae9e46cd18f4187a460c5f6 /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | 3c13257f32f5669510860f5f40851e28270f36b3 (diff) | |
download | llvm-2aa0f0a3bd541278b04efcc717e7aa94ef4c1308.zip llvm-2aa0f0a3bd541278b04efcc717e7aa94ef4c1308.tar.gz llvm-2aa0f0a3bd541278b04efcc717e7aa94ef4c1308.tar.bz2 |
[AArch64] Add option -msve-streaming-vector-bits= . (#144611)
This is similar to -msve-vector-bits, but for streaming mode: it
constrains the legal values of "vscale", allowing optimizations based on
that constraint.
This also fixes conversions between SVE vectors and fixed-width vectors
in streaming functions with -msve-vector-bits and
-msve-streaming-vector-bits.
This rejects any use of arm_sve_vector_bits types in streaming
functions; if it becomes relevant, we could add
arm_sve_streaming_vector_bits types in the future.
This doesn't touch the __ARM_FEATURE_SVE_BITS define.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 70a0979..776a646 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -1109,10 +1109,16 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy, // Add vscale_range attribute if appropriate. llvm::StringMap<bool> FeatureMap; - bool IsArmStreaming = false; + auto IsArmStreaming = TargetInfo::ArmStreamingKind::NotStreaming; if (FD) { getContext().getFunctionFeatureMap(FeatureMap, FD); - IsArmStreaming = IsArmStreamingFunction(FD, true); + if (const auto *T = FD->getType()->getAs<FunctionProtoType>()) + if (T->getAArch64SMEAttributes() & + FunctionType::SME_PStateSMCompatibleMask) + IsArmStreaming = TargetInfo::ArmStreamingKind::StreamingCompatible; + + if (IsArmStreamingFunction(FD, true)) + IsArmStreaming = TargetInfo::ArmStreamingKind::Streaming; } std::optional<std::pair<unsigned, unsigned>> VScaleRange = getContext().getTargetInfo().getVScaleRange(getLangOpts(), IsArmStreaming, |