Skip to content

[X86][AVX10] Fix assertion with strict fcmp #139500

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions llvm/lib/Target/X86/X86ISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24573,9 +24573,11 @@ SDValue X86TargetLowering::LowerSETCC(SDValue Op, SelectionDAG &DAG) const {
if (CC == ISD::SETOEQ || CC == ISD::SETUNE) {
auto NewCC = (CC == ISD::SETOEQ) ? X86::COND_E : (X86::COND_NE);
assert(Op0.getSimpleValueType() != MVT::bf16 && "Unsupported Type");
if (Op0.getSimpleValueType() != MVT::f80)
return getSETCC(
if (Op0.getSimpleValueType() != MVT::f80) {
SDValue Res = getSETCC(
NewCC, DAG.getNode(X86ISD::UCOMX, dl, MVT::i32, Op0, Op1), dl, DAG);
return IsStrict ? DAG.getMergeValues({Res, Chain}, dl) : Res;
}
}
}
// Handle floating point.
Expand Down
21 changes: 21 additions & 0 deletions llvm/test/CodeGen/X86/avx10_2-cmp.ll
Original file line number Diff line number Diff line change
Expand Up @@ -276,3 +276,24 @@ if.then66: ; preds = %entry
if.end70: ; preds = %entry
ret i32 0
}

define i1 @constrained_fcmp() {
; X64-LABEL: constrained_fcmp:
; X64: # %bb.0: # %entry
; X64-NEXT: vxorpd %xmm0, %xmm0, %xmm0
; X64-NEXT: vucomxsd %xmm0, %xmm0
; X64-NEXT: setne %al
; X64-NEXT: retq
;
; X86-LABEL: constrained_fcmp:
; X86: # %bb.0: # %entry
; X86-NEXT: vxorpd %xmm0, %xmm0, %xmm0
; X86-NEXT: vucomxsd %xmm0, %xmm0
; X86-NEXT: setne %al
; X86-NEXT: retl
entry:
%0 = tail call i1 @llvm.experimental.constrained.fcmps.f64(double 0.000000e+00, double 0.000000e+00, metadata !"une", metadata !"fpexcept.strict")
ret i1 %0
}

declare i1 @llvm.experimental.constrained.fcmps.f64(double, double, metadata, metadata)
Loading