[PATCH] D59041: [SDAG][X86] Expand pow2 mulo using shifts
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 11 12:59:09 PDT 2019
nikic marked 2 inline comments as done.
nikic added inline comments.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:5529
+ // mulo(X, 1 << S) -> { X << S, (X << S) >> S != X }
+ if (C.isPowerOf2() && (!isSigned || C.isNonNegative())) {
+ EVT ShiftAmtTy = getShiftAmountTy(VT, DAG.getDataLayout());
----------------
efriedma wrote:
> `(!isSigned || C.isNonNegative())` is specifically supposed to handle `llvm.smul.with.overflow.i32(%x, INT_MIN)`? Can't you just convert that to `llvm.umul.with.overflow.i32(%x, INT_MIN)` and lower it using an unsigned shift?
Yes, you're right. I've implemented this now.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D59041/new/
https://reviews.llvm.org/D59041
More information about the llvm-commits
mailing list