[X86] Don't allow optimizeCompareInstr to replace a CMP with BEXTR if the sign flag...
authorCraig Topper <craig.topper@intel.com>
Fri, 21 Dec 2018 21:16:26 +0000 (21:16 +0000)
committerCraig Topper <craig.topper@intel.com>
Fri, 21 Dec 2018 21:16:26 +0000 (21:16 +0000)
commit62ec024d3bc7a5788aa982b5b9d1ea4455598b53
treebdfcc9d388fc6963ecbaa7bf80684ba7ba5ac43d
parentd914174d9bd5ab3a5e6eb3f9ccc245df4d6fe5e6
[X86] Don't allow optimizeCompareInstr to replace a CMP with BEXTR if the sign flag is used.

The BEXTR instruction documents the SF bit as undefined.

The TBM BEXTR instruction has the same issue, but I'm not sure how to test it. With the control being an immediate we can determine the sign bit is 0 or the BEXTR would have been removed.

Fixes PR40060

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

llvm-svn: 349956
llvm/lib/Target/X86/X86InstrInfo.cpp
llvm/test/CodeGen/X86/bmi.ll