[libc-commits] [libc] [libc][math][c23] Add ffma{, l, f128} and fdiv{, l, f128} C23 math functions #101089 (PR #101253)

via libc-commits libc-commits at lists.llvm.org
Sun Aug 4 15:41:18 PDT 2024


================
@@ -1086,9 +1086,14 @@ template void
 explain_ternary_operation_one_output_error(Operation,
                                            const TernaryInput<long double> &,
                                            long double, double, RoundingMode);
+template void explain_ternary_operation_one_output_error(
+    Operation, const TernaryInput<double> &, float, double, RoundingMode);
+template void explain_ternary_operation_one_output_error(
+    Operation, const TernaryInput<long double> &, float, double, RoundingMode);
----------------
overmighty wrote:

Nit: should sort by ascending size of input type, then by ascending size of output type.

Non-nit: the instantiation of `compare_ternary_operation_one_output` for `double` input and `float` output was incorrectly put inside the `#ifdef LIBC_TYPES_HAS_FLOAT16` guard.

Suggested patch:

```diff
diff --git a/libc/utils/MPFRWrapper/MPFRUtils.cpp b/libc/utils/MPFRWrapper/MPFRUtils.cpp
index 1695354565f5..b2dd92890b40 100644
--- a/libc/utils/MPFRWrapper/MPFRUtils.cpp
+++ b/libc/utils/MPFRWrapper/MPFRUtils.cpp
@@ -1080,20 +1080,18 @@ void explain_ternary_operation_one_output_error(
 
 template void explain_ternary_operation_one_output_error(
     Operation, const TernaryInput<float> &, float, double, RoundingMode);
-template void explain_ternary_operation_one_output_error(
-    Operation, const TernaryInput<double> &, double, double, RoundingMode);
-template void
-explain_ternary_operation_one_output_error(Operation,
-                                           const TernaryInput<long double> &,
-                                           long double, double, RoundingMode);
 template void explain_ternary_operation_one_output_error(
     Operation, const TernaryInput<double> &, float, double, RoundingMode);
+template void explain_ternary_operation_one_output_error(
+    Operation, const TernaryInput<double> &, double, double, RoundingMode);
 template void explain_ternary_operation_one_output_error(
     Operation, const TernaryInput<long double> &, float, double, RoundingMode);
-
 template void explain_ternary_operation_one_output_error(
     Operation, const TernaryInput<long double> &, double, double, RoundingMode);
-
+template void
+explain_ternary_operation_one_output_error(Operation,
+                                           const TernaryInput<long double> &,
+                                           long double, double, RoundingMode);
 #ifdef LIBC_TYPES_HAS_FLOAT16
 template void explain_ternary_operation_one_output_error(
     Operation, const TernaryInput<float> &, float16, double, RoundingMode);
@@ -1271,19 +1269,21 @@ bool compare_ternary_operation_one_output(Operation op,
 template bool compare_ternary_operation_one_output(Operation,
                                                    const TernaryInput<float> &,
                                                    float, double, RoundingMode);
+template bool compare_ternary_operation_one_output(Operation,
+                                                   const TernaryInput<double> &,
+                                                   float, double, RoundingMode);
 template bool compare_ternary_operation_one_output(Operation,
                                                    const TernaryInput<double> &,
                                                    double, double,
                                                    RoundingMode);
+template bool compare_ternary_operation_one_output(
+    Operation, const TernaryInput<long double> &, float, double, RoundingMode);
+template bool compare_ternary_operation_one_output(
+    Operation, const TernaryInput<long double> &, double, double, RoundingMode);
 template bool
 compare_ternary_operation_one_output(Operation,
                                      const TernaryInput<long double> &,
                                      long double, double, RoundingMode);
-
-template bool compare_ternary_operation_one_output(
-    Operation, const TernaryInput<long double> &, double, double, RoundingMode);
-template bool compare_ternary_operation_one_output(
-    Operation, const TernaryInput<long double> &, float, double, RoundingMode);
 #ifdef LIBC_TYPES_HAS_FLOAT16
 template bool compare_ternary_operation_one_output(Operation,
                                                    const TernaryInput<float> &,
@@ -1293,10 +1293,6 @@ template bool compare_ternary_operation_one_output(Operation,
                                                    const TernaryInput<double> &,
                                                    float16, double,
                                                    RoundingMode);
-template bool compare_ternary_operation_one_output(Operation,
-                                                   const TernaryInput<double> &,
-                                                   float, double, RoundingMode);
-
 template bool
 compare_ternary_operation_one_output(Operation,
                                      const TernaryInput<long double> &, float16,
```

https://github.com/llvm/llvm-project/pull/101253


More information about the libc-commits mailing list