summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2011-03-21 23:30:19 +0000
committerDaniel Dunbar <daniel@zuster.org>2011-03-21 23:30:19 +0000
commit0868ca6589dee209effebdcb0aa2af1281b1a814 (patch)
treeab50903fbc1dfea825df34cdf3d72debc93e3eb5
parent2caeeefe078e7c10170f02b717e4a5ab7623e554 (diff)
downloadcompiler-rt-0868ca6589dee209effebdcb0aa2af1281b1a814.tar.gz
compiler-rt: Split subdf3 and subsf3 out of add implementations, for
consistency. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@128038 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/adddf3.c11
-rw-r--r--lib/addsf3.c21
-rw-r--r--lib/subdf3.c23
-rw-r--r--lib/subsf3.c23
4 files changed, 52 insertions, 26 deletions
diff --git a/lib/adddf3.c b/lib/adddf3.c
index c40135613..5338a4b4f 100644
--- a/lib/adddf3.c
+++ b/lib/adddf3.c
@@ -1,4 +1,4 @@
-//===-- lib/adddf3.c - Double-precision addition and subtraction --*- C -*-===//
+//===-- lib/adddf3.c - Double-precision addition ------------------*- C -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
//
-// This file implements double-precision soft-float addition and subtraction
-// with the IEEE-754 default rounding (to nearest, ties to even).
+// This file implements double-precision soft-float addition with the IEEE-754
+// default rounding (to nearest, ties to even).
//
//===----------------------------------------------------------------------===//
@@ -147,8 +147,3 @@ fp_t __adddf3(fp_t a, fp_t b) {
if (roundGuardSticky == 0x4) result += result & 1;
return fromRep(result);
}
-
-// Subtraction; flip the sign bit of b and add.
-fp_t __subdf3(fp_t a, fp_t b) {
- return __adddf3(a, fromRep(toRep(b) ^ signBit));
-}
diff --git a/lib/addsf3.c b/lib/addsf3.c
index c0e8d8e70..061528b35 100644
--- a/lib/addsf3.c
+++ b/lib/addsf3.c
@@ -1,4 +1,4 @@
-//===-- lib/addsf3.c - Single-precision addition and subtraction --*- C -*-===//
+//===-- lib/addsf3.c - Single-precision addition ------------------*- C -*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -7,8 +7,8 @@
//
//===----------------------------------------------------------------------===//
//
-// This file implements single-precision soft-float addition and subtraction
-// with the IEEE-754 default rounding (to nearest, ties to even).
+// This file implements single-precision soft-float addition with the IEEE-754
+// default rounding (to nearest, ties to even).
//
//===----------------------------------------------------------------------===//
@@ -147,18 +147,3 @@ fp_t __addsf3(fp_t a, fp_t b) {
if (roundGuardSticky == 0x4) result += result & 1;
return fromRep(result);
}
-
-// Subtraction; flip the sign bit of b and add.
-fp_t __subsf3(fp_t a, fp_t b) {
- return __addsf3(a, fromRep(toRep(b) ^ signBit));
-}
-
-
-
-
-
-
-
-
-
-
diff --git a/lib/subdf3.c b/lib/subdf3.c
new file mode 100644
index 000000000..241bf1b12
--- /dev/null
+++ b/lib/subdf3.c
@@ -0,0 +1,23 @@
+//===-- lib/adddf3.c - Double-precision subtraction ---------------*- C -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements double-precision soft-float subtraction with the
+// IEEE-754 default rounding (to nearest, ties to even).
+//
+//===----------------------------------------------------------------------===//
+
+#define DOUBLE_PRECISION
+#include "fp_lib.h"
+
+fp_t __adddf3(fp_t a, fp_t b);
+
+// Subtraction; flip the sign bit of b and add.
+fp_t __subdf3(fp_t a, fp_t b) {
+ return __adddf3(a, fromRep(toRep(b) ^ signBit));
+}
diff --git a/lib/subsf3.c b/lib/subsf3.c
new file mode 100644
index 000000000..9ce14d7ac
--- /dev/null
+++ b/lib/subsf3.c
@@ -0,0 +1,23 @@
+//===-- lib/subsf3.c - Single-precision subtraction ---------------*- C -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file implements single-precision soft-float subtraction with the
+// IEEE-754 default rounding (to nearest, ties to even).
+//
+//===----------------------------------------------------------------------===//
+
+#define SINGLE_PRECISION
+#include "fp_lib.h"
+
+fp_t __addsf3(fp_t a, fp_t b);
+
+// Subtraction; flip the sign bit of b and add.
+fp_t __subsf3(fp_t a, fp_t b) {
+ return __addsf3(a, fromRep(toRep(b) ^ signBit));
+}