[X86] When looking for (CMOV C-1, (ADD (CTTZ X), C), (X != 0)) -> (ADD (CMOV (CTTZ...
authorCraig Topper <craig.topper@intel.com>
Wed, 1 Aug 2018 06:36:20 +0000 (06:36 +0000)
committerCraig Topper <craig.topper@intel.com>
Wed, 1 Aug 2018 06:36:20 +0000 (06:36 +0000)
commit65a13888816adb5094b06e1688ca93f3d18b7ece
treee43e42fdf859c73029ea7b4d3d8d30823c3a20f1
parent7dd0aba0b2ad712118030a73921b10042917ac18
[X86] When looking for (CMOV C-1, (ADD (CTTZ X), C), (X != 0)) -> (ADD (CMOV (CTTZ X), -1, (X != 0)), C), make sure we really have a compare with 0.

It's not strictly required by the transform of the cmov and the add, but it makes sure we restrict it to the cases we know we want to match.

While there canonicalize the operand order of the cmov to simplify the matching and emitting code.

llvm-svn: 338492
llvm/lib/Target/X86/X86ISelLowering.cpp