Skip to content

Commit 6573f62

Browse files
authored
[X86] LowerATOMIC_STORE - on 32-bit targets see if i64 values were originally legal f64 values that we can store directly. (#171602)
Based off feedback from #171478
1 parent 59b13d6 commit 6573f62

File tree

2 files changed

+212
-465
lines changed

2 files changed

+212
-465
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33171,7 +33171,14 @@ static SDValue LowerATOMIC_STORE(SDValue Op, SelectionDAG &DAG,
3317133171
// For illegal i64 atomic_stores, we can try to use MOVQ or MOVLPS if SSE
3317233172
// is enabled.
3317333173
if (VT == MVT::i64) {
33174-
if (Subtarget.hasSSE1()) {
33174+
SDValue BCValue = peekThroughBitcasts(Node->getVal());
33175+
if (BCValue.getValueType() == MVT::f64 &&
33176+
(Subtarget.hasX87() || Subtarget.hasSSE2())) {
33177+
// If the i64 was bitcast from a f64 then we can do the f64 atomic store
33178+
// directly with FSTPL/MOVSD.
33179+
Chain = DAG.getStore(Node->getChain(), dl, BCValue, Node->getBasePtr(),
33180+
Node->getMemOperand());
33181+
} else if (Subtarget.hasSSE1()) {
3317533182
SDValue SclToVec =
3317633183
DAG.getNode(ISD::SCALAR_TO_VECTOR, dl, MVT::v2i64, Node->getVal());
3317733184
MVT StVT = Subtarget.hasSSE2() ? MVT::v2i64 : MVT::v4f32;

0 commit comments

Comments
 (0)