[llvm] BasicTTI: Cleanup multiple result intrinsic handling (PR #165970)
Benjamin Maxwell via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 1 09:49:10 PDT 2025
================
@@ -311,12 +310,45 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
!isVectorizedStructTy(cast<StructType>(RetTy)))
return std::nullopt;
+ Type *Ty = getContainedTypes(RetTy).front();
+ EVT VT = getTLI()->getValueType(DL, Ty);
+
+ EVT ScalarVT = VT.getScalarType();
+ RTLIB::Libcall LC = RTLIB::UNKNOWN_LIBCALL;
+
+ switch (ICA.getID()) {
+ case Intrinsic::modf:
+ LC = RTLIB::getMODF(ScalarVT);
+ break;
+ case Intrinsic::sincospi:
+ LC = RTLIB::getSINCOSPI(ScalarVT);
+ break;
+ case Intrinsic::sincos:
+ // TODO: Account for sincos_stret not always using a memory operation for
+ // the out argument
+ LC = RTLIB::getSINCOS_STRET(ScalarVT);
+
+ if (getTLI()->getLibcallImpl(LC) == RTLIB::Unsupported)
+ LC = RTLIB::getSINCOS(ScalarVT);
+
+ break;
+ default:
+ return std::nullopt;
+ }
+
// Find associated libcall.
- const char *LCName = getTLI()->getLibcallName(LC);
- if (!LCName)
+ RTLIB::LibcallImpl LibcallImpl = getTLI()->getLibcallImpl(LC);
+ if (LibcallImpl == RTLIB::Unsupported)
return std::nullopt;
+ StringRef LCName =
+ RTLIB::RuntimeLibcallsInfo::getLibcallImplName(LibcallImpl);
+
// Search for a corresponding vector variant.
+ //
+ // FIXME: CodeGen use RuntimeLibcallsInfo, not TargetLibraryInfo and has no
+ // path to using the vector libcalls. So this guess at how legalization will
+ // work is just wrong.
----------------
MacDue wrote:
Part of the point of these intrinsics was to allow these calls to be vectorized without LAA needing to handle anything more than basic loads/stores.
https://github.com/llvm/llvm-project/pull/165970
More information about the llvm-commits
mailing list