[X86] Canonicalize (x > 1) ? x : 1 -> (x >= 1) ? x : 1 for sign and unsigned to enabl...
authorCraig Topper <craig.topper@intel.com>
Wed, 30 Sep 2020 19:36:28 +0000 (12:36 -0700)
committerCraig Topper <craig.topper@intel.com>
Wed, 30 Sep 2020 20:50:52 +0000 (13:50 -0700)
commitd1d7fc98325d948bede85e6304c5ca93f79e050e
tree70168d64c60478b2c2388d277ce9bfa1d3333a12
parentce5379f0f0675592fd10a522009fd5b1561ca72b
[X86] Canonicalize (x > 1) ? x : 1 -> (x >= 1) ? x : 1 for sign and unsigned to enable the use of test instructions for the compare.

This will be further canonicalized to a compare involving 0
which will enable the use of test instructions. Either using
cmovg for signed for cmovne for unsigned.

Fixes more case for PR47049
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/test/CodeGen/X86/cmov.ll