Skip to content

Commit 03068fa

Browse files
committed
[X86][FP16] Do not generate X86 FMIN/FMAX for FP16 when VLX not enabled
Fixes: https://godbolt.org/z/7jYa3bWK9
1 parent 052d588 commit 03068fa

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
@@ -55357,10 +55357,17 @@ static SDValue combineFMinNumFMaxNum(SDNode *N, SelectionDAG &DAG,
5535755357

5535855358
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
5535955359

55360+
auto IsMinMaxLegal = [&](EVT VT) {
55361+
if (!TLI.isTypeLegal(VT))
55362+
return false;
55363+
return VT.getScalarType() != MVT::f16 ||
55364+
(Subtarget.hasFP16() && (VT == MVT::v32f16 || Subtarget.hasVLX()));
55365+
};
55366+
5536055367
if (!((Subtarget.hasSSE1() && VT == MVT::f32) ||
5536155368
(Subtarget.hasSSE2() && VT == MVT::f64) ||
5536255369
(Subtarget.hasFP16() && VT == MVT::f16) ||
55363-
(VT.isVector() && TLI.isTypeLegal(VT))))
55370+
(VT.isVector() && IsMinMaxLegal(VT))))
5536455371
return SDValue();
5536555372

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

0 commit comments

Comments
 (0)