[llvm] [IA]: Construct (de)interleave4 out of (de)interleave2 (PR #89276)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 7 06:50:34 PDT 2024


================
@@ -17082,53 +17084,45 @@ bool AArch64TargetLowering::lowerDeinterleaveIntrinsicToLoad(
       Value *Idx =
           Builder.getInt64(I * LdTy->getElementCount().getKnownMinValue());
       for (unsigned J = 0; J < Factor; ++J) {
-        WideValues[J] = Builder.CreateInsertVector(
-            VTy, WideValues[J], Builder.CreateExtractValue(LdN, J), Idx);
+        ExtractedLdValues[J] = Builder.CreateInsertVector(
+            VTy, ExtractedLdValues[J], Builder.CreateExtractValue(LdN, J), Idx);
       }
+      LLVM_DEBUG(dbgs() << "LdN4 res: "; LdN->dump());
     }
-    if (Factor == 2)
-      Result = PoisonValue::get(StructType::get(VTy, VTy));
-    else
-      Result = PoisonValue::get(StructType::get(VTy, VTy, VTy, VTy));
-    // Construct the wide result out of the small results.
-    for (unsigned J = 0; J < Factor; ++J) {
-      Result = Builder.CreateInsertValue(Result, WideValues[J], J);
-    }
+    // Replcae output of deinterleave2 intrinsic by output of ldN2/ldN4
+    for (unsigned J = 0; J < Factor; ++J)
+      DeinterleavedValues[J]->replaceAllUsesWith(ExtractedLdValues[J]);
   } else {
+    Value *Result;
     if (UseScalable)
       Result = Builder.CreateCall(LdNFunc, {Pred, BaseAddr}, "ldN");
     else
       Result = Builder.CreateCall(LdNFunc, BaseAddr, "ldN");
+    // Replcae output of deinterleave2 intrinsic by output of ldN2/ldN4
----------------
paulwalker-arm wrote:

s/Replcae/Replace/

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


More information about the llvm-commits mailing list