]> granicus.if.org Git - llvm/commit
[X86] Teach EmitTest to handle ISD::SSUBO/USUBO in order to use the Z flag from the...
authorCraig Topper <craig.topper@intel.com>
Mon, 14 Oct 2019 06:47:56 +0000 (06:47 +0000)
committerCraig Topper <craig.topper@intel.com>
Mon, 14 Oct 2019 06:47:56 +0000 (06:47 +0000)
commiteca2f6ad30e9137009551cbf81bf53c416af2dd7
tree7320d8248578e6cbf0534e608f2bb291db2a6634
parent7cfac687766d794a977a9d64537eba78d3c09135
[X86] Teach EmitTest to handle ISD::SSUBO/USUBO in order to use the Z flag from the subtract directly during isel.

This prevents isel from emitting a TEST instruction that
optimizeCompareInstr will need to remove later.

In some of the modified tests, the SUB gets duplicated due to
the flags being needed in two places and being clobbered in
between. optimizeCompareInstr was able to optimize away the TEST
that was using the result of one of them, but optimizeCompareInstr
doesn't know to turn SUB into CMP after removing the TEST. It
only knows how to turn SUB into CMP if the result was already
dead.

With this change the TEST never exists, so optimizeCompareInstr
doesn't have to remove it. Then it can just turn the SUB into
CMP immediately.

Fixes PR43649.

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