[compiler-rt] [builtins] Support building the 128-bit float functions on ld80 platforms (PR #68132)

Alexander Richardson via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 17 14:44:43 PDT 2023


================
@@ -6,100 +6,85 @@
 
 #if __LDBL_MANT_DIG__ == 113
 
-#include "int_lib.h"
-#include "fp_test.h"
+#  include "fp_test.h"
+#  include "int_lib.h"
 
 // Returns: a + b
-COMPILER_RT_ABI long double __addtf3(long double a, long double b);
+COMPILER_RT_ABI tf_float __addtf3(tf_float a, tf_float b);
 
-int test__addtf3(long double a, long double b,
-                 uint64_t expectedHi, uint64_t expectedLo)
-{
-    long double x = __addtf3(a, b);
-    int ret = compareResultLD(x, expectedHi, expectedLo);
+int test__addtf3(tf_float a, tf_float b, uint64_t expectedHi,
+                 uint64_t expectedLo) {
+  tf_float x = __addtf3(a, b);
+  int ret = compareResultLD(x, expectedHi, expectedLo);
 
-    if (ret){
-        printf("error in test__addtf3(%.20Lf, %.20Lf) = %.20Lf, "
-               "expected %.20Lf\n", a, b, x,
-               fromRep128(expectedHi, expectedLo));
-    }
+  if (ret) {
+    printf("error in test__addtf3(%.20Lf, %.20Lf) = %.20Lf, "
+           "expected %.20Lf\n",
+           a, b, x, fromRep128(expectedHi, expectedLo));
+  }
 
-    return ret;
+  return ret;
 }
 
-char assumption_1[sizeof(long double) * CHAR_BIT == 128] = {0};
+char assumption_1[sizeof(tf_float) * CHAR_BIT == 128] = {0};
 
 #endif
 
-int main()
-{
+int main() {
 #if __LDBL_MANT_DIG__ == 113
----------------
arichardson wrote:

The tests assume IEEE results, so they fail on PPC64 where the "tf" mode is IBM 128-bit float format rather than IEEE

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


More information about the llvm-commits mailing list