]> granicus.if.org Git - llvm/commit
[APInt] Optimize umul_ov
authorFangrui Song <maskray@google.com>
Fri, 19 Apr 2019 02:06:06 +0000 (02:06 +0000)
committerFangrui Song <maskray@google.com>
Fri, 19 Apr 2019 02:06:06 +0000 (02:06 +0000)
commitf238d270732214f8f87d086ce50b68e770c05e47
treece7b6bf9223fda7770166a523469cf76542d88a4
parent667d4f41076c8eecf56aa6a4695575183948e116
[APInt] Optimize umul_ov

Change two costly udiv() calls to lshr(1)*RHS + left-shift + plus

On one 64-bit umul_ov benchmark, I measured an obvious improvement: 12.8129s -> 3.6257s

Note, there may be some value to special case 64-bit (the most common
case) with __builtin_umulll_overflow().

Differential Revision: https://reviews.llvm.org/D60669

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@358730 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Support/APInt.cpp
unittests/ADT/APIntTest.cpp