Skip to content

Commit e28163f

Browse files
committed
[X86] Swap NewX and NewY for ordered elements for minimumnum/maximumnum
It is incorrect to just check for NewX and return its ordered elements.
1 parent eace84d commit e28163f

File tree

2 files changed

+396
-402
lines changed

2 files changed

+396
-402
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29507,11 +29507,14 @@ static SDValue LowerFMINIMUM_FMAXIMUM(SDValue Op, const X86Subtarget &Subtarget,
2950729507
if (IgnoreNaN || DAG.isKnownNeverNaN(IsNum ? NewY : NewX))
2950829508
return MinMax;
2950929509

29510-
if (DAG.isKnownNeverNaN(NewX))
29510+
if (IsNum)
29511+
NewY = MinMax;
29512+
else if (DAG.isKnownNeverNaN(NewX))
2951129513
NewX = NewY;
29514+
else
29515+
NewY = NewX;
2951229516

29513-
SDValue IsNaN =
29514-
DAG.getSetCC(DL, SetCCType, NewX, NewX, IsNum ? ISD::SETO : ISD::SETUO);
29517+
SDValue IsNaN = DAG.getSetCC(DL, SetCCType, NewY, NewY, ISD::SETUO);
2951529518

2951629519
return DAG.getSelect(DL, VT, IsNaN, NewX, MinMax);
2951729520
}

0 commit comments

Comments
 (0)