[llvm] [X86][AVX512] Check input-types to COMX (PR #118606)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 4 01:14:22 PST 2024
https://github.com/abhishek-kaushik22 created https://github.com/llvm/llvm-project/pull/118606
Supported types for COMX are f16, f32 and f64.
Without this check there's a crash on f80 types.
Fixes: https://github.com/llvm/llvm-project/issues/118605
>From a23a670a297e511025bc562b621d9f67bd25503c Mon Sep 17 00:00:00 2001
From: abhishek-kaushik22 <abhishek.kaushik at intel.com>
Date: Wed, 4 Dec 2024 14:42:34 +0530
Subject: [PATCH] [X86][AVX512] Check input-types to COMX
---
llvm/lib/Target/X86/X86ISelLowering.cpp | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 96b03feaa45803..c8d6bd7c622127 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -24228,8 +24228,13 @@ SDValue X86TargetLowering::LowerSETCC(SDValue Op, SelectionDAG &DAG) const {
if (Subtarget.hasAVX10_2()) {
if (CC == ISD::SETOEQ || CC == ISD::SETUNE) {
auto NewCC = (CC == ISD::SETOEQ) ? X86::COND_E : (X86::COND_NE);
- return getSETCC(NewCC, DAG.getNode(X86ISD::UCOMX, dl, MVT::i32, Op0, Op1),
- dl, DAG);
+ auto isValidType = [&](MVT Type) {
+ return Type == MVT::f16 || Type == MVT::f32 || Type == MVT::f64;
+ };
+ if (isValidType(Op0.getSimpleValueType()) &&
+ isValidType(Op1.getSimpleValueType()))
+ return getSETCC(
+ NewCC, DAG.getNode(X86ISD::UCOMX, dl, MVT::i32, Op0, Op1), dl, DAG);
}
}
// Handle floating point.
More information about the llvm-commits
mailing list