[llvm] APFloat: Add minimumnum and maximumnum (PR #96304)
YunQiang Su via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 21 19:44:29 PDT 2024
================
@@ -1483,6 +1483,19 @@ inline APFloat minimum(const APFloat &A, const APFloat &B) {
return B < A ? B : A;
}
+/// Implements IEEE 754-2019 minimumNumber semantics. Returns the smaller
+/// of 2 arguments, not propagating NaNs and treating -0 as less than +0.
+LLVM_READONLY
+inline APFloat minimumnum(const APFloat &A, const APFloat &B) {
+ if (A.isNaN())
+ return B.isNaN() ? B.makeQuiet() : B;
+ if (B.isNaN())
----------------
wzssyqa wrote:
So my plan is to map llvm.minnum/llvm.maxnum to fmin/fmax, and
llvm.minimumnum/llvm.maximumnum is mapped to fminimum_num/fmaximum_num
https://github.com/llvm/llvm-project/pull/96304
More information about the llvm-commits
mailing list