[PATCH] D65366: [CodeGen][SelectionDAG] More efficient code for X % C == 0 (SREM case)

Simon Pilgrim via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 13 05:54:31 PDT 2019


RKSimon accepted this revision.
RKSimon added a comment.

LGTM with a couple of minor observations



================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:3761
+          return Folded;
+      if (N0.getOpcode() == ISD::SREM)
+        if (SDValue Folded = buildSREMEqFold(VT, N0, N1, Cond, DCI, dl))
----------------
Worth doing this as an if/else with the UREM compare?


================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:4816
   // - P is the multiplicative inverse of D0 modulo 2^W
-  // - Q = floor((2^W - 1) / D0)
+  // - Q = floor(((2^W) - 1) / D)
   // where W is the width of the common type of N and D.
----------------
separate this off


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65366





More information about the llvm-commits mailing list