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 | |
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')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 10 | ||||
-rw-r--r-- | clang/lib/CodeGen/Targets/RISCV.cpp | 2 |
2 files changed, 9 insertions, 3 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, diff --git a/clang/lib/CodeGen/Targets/RISCV.cpp b/clang/lib/CodeGen/Targets/RISCV.cpp index 14d4cee..cc3d487 100644 --- a/clang/lib/CodeGen/Targets/RISCV.cpp +++ b/clang/lib/CodeGen/Targets/RISCV.cpp @@ -544,7 +544,7 @@ ABIArgInfo RISCVABIInfo::coerceVLSVector(QualType Ty, unsigned ABIVLen) const { assert(VT->getElementType()->isBuiltinType() && "expected builtin type!"); auto VScale = getContext().getTargetInfo().getVScaleRange( - getContext().getLangOpts(), false); + getContext().getLangOpts(), TargetInfo::ArmStreamingKind::NotStreaming); unsigned NumElts = VT->getNumElements(); llvm::Type *EltType = llvm::Type::getInt1Ty(getVMContext()); |