[X86] Make sure we don't create locked inc/dec instructions when the carry flag is...
authorCraig Topper <craig.topper@intel.com>
Mon, 30 Oct 2017 14:51:37 +0000 (14:51 +0000)
committerCraig Topper <craig.topper@intel.com>
Mon, 30 Oct 2017 14:51:37 +0000 (14:51 +0000)
commit4e13d4de52783dbdf9268a01055b546f5176947c
tree0fa9e558c6b033c6cdcc2bd5c3ee7e5057fde6e0
parent367cc12fa9be5650369499888265a9d1405d1fe1
[X86] Make sure we don't create locked inc/dec instructions when the carry flag is being used.

Summary:
INC/DEC don't update the carry flag so we need to make sure we don't try to use it.

This patch introduces new X86ISD opcodes for locked INC/DEC. Teaches lowerAtomicArithWithLOCK to emit these nodes if INC/DEC is not slow or the function is being optimized for size. An additional flag is added that allows the INC/DEC to be disabled if the caller determines that the carry flag is being requested.

The test_sub_1_cmp_1_setcc_ugt test is currently showing this bug. The other test case changes are recovering cases that were regressed in r316860.

This should fully fix PR35068 finishing the fix started in r316860.

Reviewers: RKSimon, zvi, spatel

Reviewed By: zvi

Subscribers: llvm-commits

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

llvm-svn: 316913
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/lib/Target/X86/X86ISelLowering.h
llvm/lib/Target/X86/X86InstrCompiler.td
llvm/lib/Target/X86/X86InstrInfo.td
llvm/test/CodeGen/X86/atomic-eflags-reuse.ll