[llvm] ISel/AArch64: custom lower vector ISD::[L]LRINT (PR #89035)

David Green via llvm-commits llvm-commits at lists.llvm.org
Thu May 9 08:41:46 PDT 2024


================
@@ -4362,6 +4379,25 @@ SDValue AArch64TargetLowering::LowerFP_TO_INT_SAT(SDValue Op,
   return DAG.getNode(ISD::TRUNCATE, DL, DstVT, Sat);
 }
 
+SDValue AArch64TargetLowering::LowerVectorXRINT(SDValue Op,
+                                                SelectionDAG &DAG) const {
+  EVT VT = Op.getValueType();
+  SDValue Src = Op.getOperand(0);
+  SDLoc DL(Op);
+
+  assert(VT.isVector() && "Expected vector type");
+
+  EVT CastVT =
+      VT.changeVectorElementType(Src.getValueType().getVectorElementType());
+
+  // Round the floating-point value into a floating-point register with the
+  // current rounding mode.
+  SDValue FOp = DAG.getNode(ISD::FRINT, DL, CastVT, Src);
+
+  // Truncate the rounded floating point to an integer, rounding to zero.
----------------
davemgreen wrote:

Maybe remove "rounding to zero", as I believe it shouldn't matter what they vcvt does if we know the float holds an integer.

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


More information about the llvm-commits mailing list