[PATCH] D151878: [GlobalIsel][X86] Update legalization of G_ADD/G_SUB

Thorsten via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 1 06:57:17 PDT 2023


tschuett added a comment.

I found this pattern in AArch64. Note that they invoke `legalFor`only once! In my prototype, I also legalize only once.

  auto &MinMaxActions = getActionDefinitionsBuilder(
      {G_SMIN, G_SMAX, G_UMIN, G_UMAX});
  if (HasCSSC)
    MinMaxActions
        .legalFor({s32, s64, v8s8, v16s8, v4s16, v8s16, v2s32, v4s32})
        // Making clamping conditional on CSSC extension as without legal types we
        // lower to CMP which can fold one of the two sxtb's we'd otherwise need
        // if we detect a type smaller than 32-bit.
        .minScalar(0, s32);
  else
    MinMaxActions
        .legalFor({v8s8, v16s8, v4s16, v8s16, v2s32, v4s32});
  MinMaxActions
      .clampNumElements(0, v8s8, v16s8)
      .clampNumElements(0, v4s16, v8s16)
      .clampNumElements(0, v2s32, v4s32)
      // FIXME: This sholdn't be needed as v2s64 types are going to
      // be expanded anyway, but G_ICMP doesn't support splitting vectors yet
      .clampNumElements(0, v2s64, v2s64)
      .lower();


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151878



More information about the llvm-commits mailing list