[X86] Canonicalize the pattern for __builtin_ffs in a similar way to '__builtin_ffs...
authorCraig Topper <craig.topper@intel.com>
Wed, 1 Aug 2018 18:38:46 +0000 (18:38 +0000)
committerCraig Topper <craig.topper@intel.com>
Wed, 1 Aug 2018 18:38:46 +0000 (18:38 +0000)
commitc985d42903f31f7c8b1e4e68cdceebe61a12fcea
treed1039f5a3bd77e78419de53a5c42c694ad2c0dc5
parentffb8eb30ff85d5d2ffbfbebc36b0f2002dc3aa99
[X86] Canonicalize the pattern for __builtin_ffs in a similar way to '__builtin_ffs + 5'

We now emit a move of -1 before the cmov and do the addition after the cmov just like the case with an extra addition.

This may be slightly worse for code size, but is more consistent with other compilers. And we might be able to hoist the mov -1 outside of loops.

llvm-svn: 338613
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/dagcombine-select.ll