[flang-commits] [clang-tools-extra] [libc] [llvm] [clang] [flang] [libcxxabi] [compiler-rt] [mlir] [libcxx] [openmp] [AArch64] Add custom lowering for load <3 x i8>. (PR #78632)

Yingchi Long via flang-commits flang-commits at lists.llvm.org
Mon Jan 22 09:06:12 PST 2024


================
@@ -21095,6 +21095,50 @@ static SDValue foldTruncStoreOfExt(SelectionDAG &DAG, SDNode *N) {
   return SDValue();
 }
 
+// A custom combine to lower load <3 x i8> as the more efficient sequence
+// below:
+//    ldrb wX, [x0, #2]
+//    ldrh wY, [x0]
+//    orr wX, wY, wX, lsl #16
+//    fmov s0, wX
+//
+static SDValue combineV3I8LoadExt(LoadSDNode *LD, SelectionDAG &DAG) {
+  EVT MemVT = LD->getMemoryVT();
+  if (MemVT != EVT::getVectorVT(*DAG.getContext(), MVT::i8, 3) ||
+      LD->getOriginalAlign() >= 4)
+    return SDValue();
+
+  SDLoc DL(LD);
+  SDValue Chain = LD->getChain();
+  SDValue BasePtr = LD->getBasePtr();
----------------
inclyc wrote:

> assert to catch the use, if possible.

I think this makes sense because (as per my understanding) usually indexed loads are created while ISelDAGToDAG phase (right after ISelLowering), so I do not expect any assertion fails.

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


More information about the flang-commits mailing list