[llvm] [LoongArch] Remove inaccurate LASX conversion pattern and use [X]VFFINT.S.L instead (PR #207107)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 2 01:44:40 PDT 2026


================
@@ -8151,15 +8158,91 @@ static SDValue ExtendSrcToDst(SDNode *N, SelectionDAG &DAG, unsigned ExtendOp) {
   return DAG.getNode(N->getOpcode(), DL, VT, Extend);
 }
 
+// Merge two 64 to 32 convert instructions into one,
+// e.g.
+//   vffint.s.l $vr0, $vr1, $vr2
+// will convert 4 si64 into 4 float at once.
+// or
+//   vftintrz.w.d $vr0, $vr1, $vr2
+// which will convert 4 double into 4 si32 at once.
+// also deal with their 256-bits LASX version.
+static SDValue MergeBlocksConvert(SDNode *N, SelectionDAG &DAG, unsigned Opcode,
+                                  unsigned BlockBits) {
+  SDLoc DL(N);
+  MVT DstVT = N->getSimpleValueType(0);
+  SDValue Src = N->getOperand(0);
+  MVT SrcVT = Src.getSimpleValueType();
+  unsigned SrcBits = SrcVT.getSizeInBits();
+
+  SmallVector<SDValue, 8> Blocks;
----------------
wangleiat wrote:

Would `4` be sufficient here?

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


More information about the llvm-commits mailing list