[PATCH] D125988: [x86][SelectionDAG] Unroll vectorized FREM instructions which will be lowered to libcalls

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 23 09:34:41 PDT 2022


spatel added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp:3682
+  case ISD::FREM: {
+    // We're going to widen this vector op to a legal type by padding with undef
+    // elements. If the wide vector op is eventually going to be expanded to
----------------
Instead of copying this block, create a lambda above the switch and call it from here and the existing code?
  auto unrollExpandedOp = [&]() {
    // We're going to widen this vector op to a legal type by padding with undef
    // elements. If the wide vector op is eventually going to be expanded to
    // scalar libcalls, then unroll into scalar ops now to avoid unnecessary
    // libcalls on the undef elements.
    EVT VT = N->getValueType(0);
    EVT WideVecVT = TLI.getTypeToTransformTo(*DAG.getContext(), VT);
    if (!TLI.isOperationLegalOrCustom(N->getOpcode(), WideVecVT) &&
        TLI.isOperationExpand(N->getOpcode(), VT.getScalarType())) {
      Res = DAG.UnrollVectorOp(N, WideVecVT.getVectorNumElements());
      return true;
    }
    return false;
  };



CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125988/new/

https://reviews.llvm.org/D125988



More information about the llvm-commits mailing list