Skip to content

Commit 4fbf67f

Browse files
authored
[X86][FP16] Do not generate X86 FMIN/FMAX for FP16 when VLX not enabled (#143100)
Fixes: https://godbolt.org/z/7jYa3bWK9
1 parent f3867f9 commit 4fbf67f

File tree

3 files changed

+878
-81
lines changed

3 files changed

+878
-81
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55354,10 +55354,17 @@ static SDValue combineFMinNumFMaxNum(SDNode *N, SelectionDAG &DAG,
5535455354

5535555355
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
5535655356

55357+
auto IsMinMaxLegal = [&](EVT VT) {
55358+
if (!TLI.isTypeLegal(VT))
55359+
return false;
55360+
return VT.getScalarType() != MVT::f16 ||
55361+
(Subtarget.hasFP16() && (VT == MVT::v32f16 || Subtarget.hasVLX()));
55362+
};
55363+
5535755364
if (!((Subtarget.hasSSE1() && VT == MVT::f32) ||
5535855365
(Subtarget.hasSSE2() && VT == MVT::f64) ||
5535955366
(Subtarget.hasFP16() && VT == MVT::f16) ||
55360-
(VT.isVector() && TLI.isTypeLegal(VT))))
55367+
(VT.isVector() && IsMinMaxLegal(VT))))
5536155368
return SDValue();
5536255369

5536355370
SDValue Op0 = N->getOperand(0);

0 commit comments

Comments
 (0)