summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2019-05-13 21:01:24 +0000
committerCraig Topper <craig.topper@intel.com>2019-05-13 21:01:24 +0000
commit5f999c2beaf0a4fbfb4d14d16279f661b29a7e7a (patch)
treea0be87ecba9ed2d7dd7ae71279d5fc60cdd0d2fb
parent56baade10dcf43855faf577554e1810873793da5 (diff)
downloadbcm5719-llvm-5f999c2beaf0a4fbfb4d14d16279f661b29a7e7a.tar.gz
bcm5719-llvm-5f999c2beaf0a4fbfb4d14d16279f661b29a7e7a.zip
[X86] Various type corrections to the code that creates LOCK_OR32mi8/OR32mi8Locked to the stack for idempotent atomic rmw and atomic fence.
These are updates to match how isel table would emit a LOCK_OR32mi8 node. -Use i32 for the immediate zero even though only 8 bits are encoded. -Use i16 for segment register. -Use LOCK_OR32mi8 for idempotent atomic operations in 32-bit mode to match 64-bit mode. I'm not sure why OR32mi8Locked and LOCK_OR32mi8 both exist. The only difference seems to be that OR32mi8Locked is marked as UnmodeledSideEffects=1. -Emit an extra i32 result for the flags output. I don't know if the types here really matter just noticed it was inconsistent with normal behavior. llvm-svn: 360619
-rw-r--r--llvm/lib/Target/X86/X86ISelLowering.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index ef28d676fa1..65f3af3f544 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -25848,12 +25848,13 @@ static SDValue LowerATOMIC_FENCE(SDValue Op, const X86Subtarget &Subtarget,
DAG.getTargetConstant(1, dl, MVT::i8), // Scale
DAG.getRegister(0, MVT::i32), // Index
DAG.getTargetConstant(0, dl, MVT::i32), // Disp
- DAG.getRegister(0, MVT::i32), // Segment.
+ DAG.getRegister(0, MVT::i16), // Segment.
Zero,
Chain
};
- SDNode *Res = DAG.getMachineNode(X86::OR32mi8Locked, dl, MVT::Other, Ops);
- return SDValue(Res, 0);
+ SDNode *Res = DAG.getMachineNode(X86::OR32mi8Locked, dl, MVT::i32,
+ MVT::Other, Ops);
+ return SDValue(Res, 1);
}
// MEMBARRIER is a compiler barrier; it codegens to a no-op.
@@ -26299,17 +26300,18 @@ static SDValue emitLockedStackOp(SelectionDAG &DAG,
// https://shipilev.net/blog/2014/on-the-fence-with-dependencies/
if (Subtarget.is64Bit()) {
- SDValue Zero = DAG.getTargetConstant(0, DL, MVT::i8);
+ SDValue Zero = DAG.getTargetConstant(0, DL, MVT::i32);
SDValue Ops[] = {
DAG.getRegister(X86::RSP, MVT::i64), // Base
DAG.getTargetConstant(1, DL, MVT::i8), // Scale
DAG.getRegister(0, MVT::i64), // Index
DAG.getTargetConstant(0, DL, MVT::i32), // Disp
- DAG.getRegister(0, MVT::i32), // Segment.
+ DAG.getRegister(0, MVT::i16), // Segment.
Zero,
Chain};
- SDNode *Res = DAG.getMachineNode(X86::LOCK_OR32mi8, DL, MVT::Other, Ops);
- return SDValue(Res, 0);
+ SDNode *Res = DAG.getMachineNode(X86::LOCK_OR32mi8, DL, MVT::i32,
+ MVT::Other, Ops);
+ return SDValue(Res, 1);
}
SDValue Zero = DAG.getTargetConstant(0, DL, MVT::i32);
@@ -26318,12 +26320,13 @@ static SDValue emitLockedStackOp(SelectionDAG &DAG,
DAG.getTargetConstant(1, DL, MVT::i8), // Scale
DAG.getRegister(0, MVT::i32), // Index
DAG.getTargetConstant(0, DL, MVT::i32), // Disp
- DAG.getRegister(0, MVT::i32), // Segment.
+ DAG.getRegister(0, MVT::i16), // Segment.
Zero,
Chain
};
- SDNode *Res = DAG.getMachineNode(X86::OR32mi8Locked, DL, MVT::Other, Ops);
- return SDValue(Res, 0);
+ SDNode *Res = DAG.getMachineNode(X86::LOCK_OR32mi8, DL, MVT::i32,
+ MVT::Other, Ops);
+ return SDValue(Res, 1);
}
static SDValue lowerAtomicArithWithLOCK(SDValue N, SelectionDAG &DAG,
OpenPOWER on IntegriCloud