[llvm] BasicTTI: Cleanup multiple result intrinsic handling (PR #165970)

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 1 05:13:07 PDT 2025


================
@@ -311,11 +310,43 @@ 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;
+
+    bool UsesMemoryOutArgument = true;
+
+    switch (ICA.getID()) {
+    case Intrinsic::modf:
+      LC = RTLIB::getMODF(ScalarVT);
+      break;
+    case Intrinsic::sincospi:
+      LC = RTLIB::getSINCOSPI(ScalarVT);
+      break;
+    case Intrinsic::sincos:
+      LC = RTLIB::getSINCOS_STRET(ScalarVT);
+      UsesMemoryOutArgument = false;
+
+      if (getTLI()->getLibcallImpl(LC) == RTLIB::Unsupported) {
+        LC = RTLIB::getSINCOS(ScalarVT);
+        UsesMemoryOutArgument = true;
+      }
----------------
MacDue wrote:

I think this will prevent the vector variants of `sincos` from being found if `SINCOS_STRET` is available, costing a vector `sincos` intrinsic, as the vector mappings only exist for the standard library call (so the `getVectorMappingInfo` will fail). That'll result in a more costly scalarization. 

https://github.com/llvm/llvm-project/pull/165970


More information about the llvm-commits mailing list