OSDN Git Service

[X86] When expanding a multiply by a negative of one less than a power of 2, like...
authorCraig Topper <craig.topper@intel.com>
Tue, 24 Jul 2018 21:31:21 +0000 (21:31 +0000)
committerCraig Topper <craig.topper@intel.com>
Tue, 24 Jul 2018 21:31:21 +0000 (21:31 +0000)
commita783e1fbc23e537035bcdc50cb19978ed3b34958
tree26cf61fe05024975f29c0291870937c2942a6759
parent89b692c82852941c7085e9a1f62ec7a7d660b24e
[X86] When expanding a multiply by a negative of one less than a power of 2, like 31, don't generate a negate of a subtract that we'll never optimize.

We generated a subtract for the power of 2 minus one then negated the result. The negate can be optimized away by swapping the subtract operands, but DAG combine doesn't know how to do that and we don't add any of the new nodes to the worklist anyway.

This patch makes use explicitly emit the swapped subtract.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337858 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/imul.ll