[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
This commit is contained in:
Simon Pilgrim 2025-12-11 09:03:05 +00:00 committed by GitHub
parent 59b13d6d9c
commit 6573f62a88
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 215 additions and 468 deletions

View File

@ -33171,7 +33171,14 @@ static SDValue LowerATOMIC_STORE(SDValue Op, SelectionDAG &DAG,
// For illegal i64 atomic_stores, we can try to use MOVQ or MOVLPS if SSE
// is enabled.
if (VT == MVT::i64) {
if (Subtarget.hasSSE1()) {
SDValue BCValue = peekThroughBitcasts(Node->getVal());
if (BCValue.getValueType() == MVT::f64 &&
(Subtarget.hasX87() || Subtarget.hasSSE2())) {
// If the i64 was bitcast from a f64 then we can do the f64 atomic store
// directly with FSTPL/MOVSD.
Chain = DAG.getStore(Node->getChain(), dl, BCValue, Node->getBasePtr(),
Node->getMemOperand());
} else if (Subtarget.hasSSE1()) {
SDValue SclToVec =
DAG.getNode(ISD::SCALAR_TO_VECTOR, dl, MVT::v2i64, Node->getVal());
MVT StVT = Subtarget.hasSSE2() ? MVT::v2i64 : MVT::v4f32;

File diff suppressed because it is too large Load Diff