[llvm] [X86][AVX512] Check input-types to COMX (PR #118606)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 4 01:14:58 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-backend-x86
Author: None (abhishek-kaushik22)
<details>
<summary>Changes</summary>
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
---
Full diff: https://github.com/llvm/llvm-project/pull/118606.diff
1 Files Affected:
- (modified) llvm/lib/Target/X86/X86ISelLowering.cpp (+7-2)
``````````diff
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.
``````````
</details>
https://github.com/llvm/llvm-project/pull/118606
More information about the llvm-commits
mailing list