[PATCH] D56214: AggressiveInstCombine: Fold full mul i64 x i64 -> i128

Paweł Bylica via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 3 13:47:06 PST 2019


chfast marked an inline comment as done.
chfast added a comment.

I did a small update.

I rebased the diff on top of the review with tests.

I focused on merging replacement for low and high parts. The strategy is to instead of blindly replacing the pattern with the single multiplication to first try to find the desired multiplication instruction. This feels quite "manual". And I also have trouble with properly placing the new mul instruction.

The types are not checked yet.
I plan to check the native integer size from DataLayout. So this transform will be applied for i64xi64->i128 when i64 is native.

Answering the question: the CodeGen generates the same pattern (I was fixing some bugs there years ago, will verify that claim later on). I don't see benefit of applying this transform if it is going to be reverted in CodeGen unless you know any optimization what this might enable.



================
Comment at: lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp:255-265
+template <typename LHS>
+inline BinaryOp_match<LHS, specific_intval, Instruction::And>
+m_LowPart(const LHS &L) {
+  return m_And(L, m_SpecificInt(0xffffffff));
+}
+
+template <typename LHS>
----------------
chfast wrote:
> lebedev.ri wrote:
> > I don't see why these need to be actual functions, lambdas will do?
> Yes, that's true. I was struggling with the matchers at first so I did them by copy&paste. Will fix that, unless this pattern is useful to someone else.
These must be templates, so lambada will not work until C++14.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D56214





More information about the llvm-commits mailing list