-
Notifications
You must be signed in to change notification settings - Fork 13.6k
SelectionDAG: Support FMINIMUMNUM and FMINIMUM in combineMinNumMaxNumImpl #137449
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -229,13 +229,10 @@ define float @fminnum32_intrinsic(float %x, float %y) { | |
; CHECK-LABEL: fminnum32_intrinsic: | ||
; CHECK: .functype fminnum32_intrinsic (f32, f32) -> (f32) | ||
; CHECK-NEXT: # %bb.0: | ||
; CHECK-NEXT: local.get $push5=, 0 | ||
; CHECK-NEXT: local.get $push4=, 1 | ||
; CHECK-NEXT: local.get $push3=, 0 | ||
; CHECK-NEXT: local.get $push2=, 1 | ||
; CHECK-NEXT: f32.lt $push0=, $pop3, $pop2 | ||
; CHECK-NEXT: f32.select $push1=, $pop5, $pop4, $pop0 | ||
; CHECK-NEXT: return $pop1 | ||
; CHECK-NEXT: local.get $push2=, 0 | ||
; CHECK-NEXT: local.get $push1=, 1 | ||
; CHECK-NEXT: f32.min $push0=, $pop2, $pop1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sunfishcode Because Wasm doesn't support FP exceptions and doesn't distinguish between sNaN and qNaN, implementing llvm.minnum directly with Wasm's There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree, the existing code looks incorrect. The new code here also looks incorrect; Wasm's |
||
; CHECK-NEXT: return $pop0 | ||
%a = call nnan float @llvm.minnum.f32(float %x, float %y) | ||
ret float %a | ||
} | ||
|
@@ -282,13 +279,10 @@ define float @fmaxnum32_intrinsic(float %x, float %y) { | |
; CHECK-LABEL: fmaxnum32_intrinsic: | ||
; CHECK: .functype fmaxnum32_intrinsic (f32, f32) -> (f32) | ||
; CHECK-NEXT: # %bb.0: | ||
; CHECK-NEXT: local.get $push5=, 0 | ||
; CHECK-NEXT: local.get $push4=, 1 | ||
; CHECK-NEXT: local.get $push3=, 0 | ||
; CHECK-NEXT: local.get $push2=, 1 | ||
; CHECK-NEXT: f32.gt $push0=, $pop3, $pop2 | ||
; CHECK-NEXT: f32.select $push1=, $pop5, $pop4, $pop0 | ||
; CHECK-NEXT: return $pop1 | ||
; CHECK-NEXT: local.get $push2=, 0 | ||
; CHECK-NEXT: local.get $push1=, 1 | ||
; CHECK-NEXT: f32.max $push0=, $pop2, $pop1 | ||
; CHECK-NEXT: return $pop0 | ||
%a = call nnan float @llvm.maxnum.f32(float %x, float %y) | ||
ret float %a | ||
} | ||
|
@@ -309,13 +303,10 @@ define float @fmaxnum32_zero_intrinsic(float %x) { | |
; CHECK-LABEL: fmaxnum32_zero_intrinsic: | ||
; CHECK: .functype fmaxnum32_zero_intrinsic (f32) -> (f32) | ||
; CHECK-NEXT: # %bb.0: | ||
; CHECK-NEXT: local.get $push5=, 0 | ||
; CHECK-NEXT: local.get $push2=, 0 | ||
; CHECK-NEXT: f32.const $push0=, 0x0p0 | ||
; CHECK-NEXT: local.get $push4=, 0 | ||
; CHECK-NEXT: f32.const $push3=, 0x0p0 | ||
; CHECK-NEXT: f32.gt $push1=, $pop4, $pop3 | ||
; CHECK-NEXT: f32.select $push2=, $pop5, $pop0, $pop1 | ||
; CHECK-NEXT: return $pop2 | ||
; CHECK-NEXT: f32.max $push1=, $pop2, $pop0 | ||
; CHECK-NEXT: return $pop1 | ||
%a = call nnan float @llvm.maxnum.f32(float %x, float 0.0) | ||
ret float %a | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain in the comment why IEEE2019Num and IEEE2019 are preferred in that order?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In some architectures FMINNUM is not defined well.
We are working on improve FMINNUM and finally remove FMINNUM_IEEE.
Currently, on some architectures that defines FMINNUM_IEEE , like AArch64/MipsR6, FMINNUM_IEEE is a better choice.