diff options
author | Daniel Dunbar <daniel@zuster.org> | 2011-03-25 18:45:39 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2011-03-25 18:45:39 +0000 |
commit | ce750fdaab5c9c1d013817ad949c9109eb3f2af2 (patch) | |
tree | 05c8c6e8ce51d97a2cca43cf8e55aa392c8db2cb | |
parent | fb92f4bd1dec8ddd6132d9a365fd7be3b8086824 (diff) | |
download | compiler-rt-ce750fdaab5c9c1d013817ad949c9109eb3f2af2.tar.gz |
Revert "Split single & double comparison routines into separate implementation
files," for now, I missed some necesary updates.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@128296 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/comparedf2.c (renamed from lib/ledf2.c) | 61 | ||||
-rw-r--r-- | lib/comparesf2.c (renamed from lib/lesf2.c) | 60 | ||||
-rw-r--r-- | lib/eqdf2.c | 16 | ||||
-rw-r--r-- | lib/eqsf2.c | 16 | ||||
-rw-r--r-- | lib/fp_lib.h | 14 | ||||
-rw-r--r-- | lib/gedf2.c | 61 | ||||
-rw-r--r-- | lib/gesf2.c | 61 | ||||
-rw-r--r-- | lib/gtdf2.c | 17 | ||||
-rw-r--r-- | lib/gtsf2.c | 16 | ||||
-rw-r--r-- | lib/ltdf2.c | 16 | ||||
-rw-r--r-- | lib/ltsf2.c | 16 | ||||
-rw-r--r-- | lib/nedf2.c | 17 | ||||
-rw-r--r-- | lib/nesf2.c | 16 | ||||
-rw-r--r-- | lib/unorddf2.c | 47 | ||||
-rw-r--r-- | lib/unordsf2.c | 17 | ||||
-rw-r--r-- | make/platform/clang_darwin.mk | 3 |
16 files changed, 121 insertions, 333 deletions
diff --git a/lib/ledf2.c b/lib/comparedf2.c index f730ee003..fe35fd80a 100644 --- a/lib/ledf2.c +++ b/lib/comparedf2.c @@ -1,4 +1,4 @@ -//===-- lib/ledf2.c - Double-precision comparisons ----------------*- C -*-===// +//===-- lib/comparedf2.c - Double-precision comparisons -----------*- C -*-===// // // The LLVM Compiler Infrastructure // @@ -40,6 +40,13 @@ #define DOUBLE_PRECISION #include "fp_lib.h" +enum LE_RESULT { + LE_LESS = -1, + LE_EQUAL = 0, + LE_GREATER = 1, + LE_UNORDERED = 1 +}; + enum LE_RESULT __ledf2(fp_t a, fp_t b) { const srep_t aInt = toRep(a); @@ -71,3 +78,55 @@ enum LE_RESULT __ledf2(fp_t a, fp_t b) { else return LE_GREATER; } } + +enum GE_RESULT { + GE_LESS = -1, + GE_EQUAL = 0, + GE_GREATER = 1, + GE_UNORDERED = -1 // Note: different from LE_UNORDERED +}; + +enum GE_RESULT __gedf2(fp_t a, fp_t b) { + + const srep_t aInt = toRep(a); + const srep_t bInt = toRep(b); + const rep_t aAbs = aInt & absMask; + const rep_t bAbs = bInt & absMask; + + if (aAbs > infRep || bAbs > infRep) return GE_UNORDERED; + if ((aAbs | bAbs) == 0) return GE_EQUAL; + if ((aInt & bInt) >= 0) { + if (aInt < bInt) return GE_LESS; + else if (aInt == bInt) return GE_EQUAL; + else return GE_GREATER; + } else { + if (aInt > bInt) return GE_LESS; + else if (aInt == bInt) return GE_EQUAL; + else return GE_GREATER; + } +} + +int __unorddf2(fp_t a, fp_t b) { + const rep_t aAbs = toRep(a) & absMask; + const rep_t bAbs = toRep(b) & absMask; + return aAbs > infRep || bAbs > infRep; +} + +// The following are alternative names for the preceeding routines. + +enum LE_RESULT __eqdf2(fp_t a, fp_t b) { + return __ledf2(a, b); +} + +enum LE_RESULT __ltdf2(fp_t a, fp_t b) { + return __ledf2(a, b); +} + +enum LE_RESULT __nedf2(fp_t a, fp_t b) { + return __ledf2(a, b); +} + +enum GE_RESULT __gtdf2(fp_t a, fp_t b) { + return __gedf2(a, b); +} + diff --git a/lib/lesf2.c b/lib/comparesf2.c index 371dc148f..3f2e358ad 100644 --- a/lib/lesf2.c +++ b/lib/comparesf2.c @@ -1,4 +1,4 @@ -//===-- lib/lesf2.c - Single-precision comparisons ----------------*- C -*-===// +//===-- lib/comparesf2.c - Single-precision comparisons -----------*- C -*-===// // // The LLVM Compiler Infrastructure // @@ -40,6 +40,13 @@ #define SINGLE_PRECISION #include "fp_lib.h" +enum LE_RESULT { + LE_LESS = -1, + LE_EQUAL = 0, + LE_GREATER = 1, + LE_UNORDERED = 1 +}; + enum LE_RESULT __lesf2(fp_t a, fp_t b) { const srep_t aInt = toRep(a); @@ -71,3 +78,54 @@ enum LE_RESULT __lesf2(fp_t a, fp_t b) { else return LE_GREATER; } } + +enum GE_RESULT { + GE_LESS = -1, + GE_EQUAL = 0, + GE_GREATER = 1, + GE_UNORDERED = -1 // Note: different from LE_UNORDERED +}; + +enum GE_RESULT __gesf2(fp_t a, fp_t b) { + + const srep_t aInt = toRep(a); + const srep_t bInt = toRep(b); + const rep_t aAbs = aInt & absMask; + const rep_t bAbs = bInt & absMask; + + if (aAbs > infRep || bAbs > infRep) return GE_UNORDERED; + if ((aAbs | bAbs) == 0) return GE_EQUAL; + if ((aInt & bInt) >= 0) { + if (aInt < bInt) return GE_LESS; + else if (aInt == bInt) return GE_EQUAL; + else return GE_GREATER; + } else { + if (aInt > bInt) return GE_LESS; + else if (aInt == bInt) return GE_EQUAL; + else return GE_GREATER; + } +} + +int __unordsf2(fp_t a, fp_t b) { + const rep_t aAbs = toRep(a) & absMask; + const rep_t bAbs = toRep(b) & absMask; + return aAbs > infRep || bAbs > infRep; +} + +// The following are alternative names for the preceeding routines. + +enum LE_RESULT __eqsf2(fp_t a, fp_t b) { + return __lesf2(a, b); +} + +enum LE_RESULT __ltsf2(fp_t a, fp_t b) { + return __lesf2(a, b); +} + +enum LE_RESULT __nesf2(fp_t a, fp_t b) { + return __lesf2(a, b); +} + +enum GE_RESULT __gtsf2(fp_t a, fp_t b) { + return __gesf2(a, b); +} diff --git a/lib/eqdf2.c b/lib/eqdf2.c deleted file mode 100644 index 4ca544ede..000000000 --- a/lib/eqdf2.c +++ /dev/null @@ -1,16 +0,0 @@ -//===-- lib/eqdf2.c - Double-precision comparisons -----------*- 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. -// -//===----------------------------------------------------------------------===// - -#define DOUBLE_PRECISION -#include "fp_lib.h" - -enum LE_RESULT __ledf2(fp_t a, fp_t b); -enum LE_RESULT __eqdf2(fp_t a, fp_t b) { - return __ledf2(a, b); -} diff --git a/lib/eqsf2.c b/lib/eqsf2.c deleted file mode 100644 index 8d1cf97f6..000000000 --- a/lib/eqsf2.c +++ /dev/null @@ -1,16 +0,0 @@ -//===-- lib/comparesf2.c - Single-precision comparisons -----------*- 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. -// -//===----------------------------------------------------------------------===// - -#define SINGLE_PRECISION -#include "fp_lib.h" - -enum LE_RESULT __lesf2(fp_t a, fp_t b); -enum LE_RESULT __eqsf2(fp_t a, fp_t b) { - return __lesf2(a, b); -} diff --git a/lib/fp_lib.h b/lib/fp_lib.h index 2333c8aec..6c9455ace 100644 --- a/lib/fp_lib.h +++ b/lib/fp_lib.h @@ -25,20 +25,6 @@ #include <stdbool.h> #include <limits.h> -// Result enumerations used in comparison routines. -enum LE_RESULT { - LE_LESS = -1, - LE_EQUAL = 0, - LE_GREATER = 1, - LE_UNORDERED = 1 -}; -enum GE_RESULT { - GE_LESS = -1, - GE_EQUAL = 0, - GE_GREATER = 1, - GE_UNORDERED = -1 // Note: different from LE_UNORDERED -}; - #if defined SINGLE_PRECISION typedef uint32_t rep_t; diff --git a/lib/gedf2.c b/lib/gedf2.c deleted file mode 100644 index c6ce2137b..000000000 --- a/lib/gedf2.c +++ /dev/null @@ -1,61 +0,0 @@ -//===-- lib/gedf2.c - Double-precision comparisons ----------------*- 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 the following soft-float comparison routines: -// -// __eqdf2 __gedf2 __unorddf2 -// __ledf2 __gtdf2 -// __ltdf2 -// __nedf2 -// -// The semantics of the routines grouped in each column are identical, so there -// is a single implementation for each, and wrappers to provide the other names. -// -// The main routines behave as follows: -// -// __ledf2(a,b) returns -1 if a < b -// 0 if a == b -// 1 if a > b -// 1 if either a or b is NaN -// -// __gedf2(a,b) returns -1 if a < b -// 0 if a == b -// 1 if a > b -// -1 if either a or b is NaN -// -// __unorddf2(a,b) returns 0 if both a and b are numbers -// 1 if either a or b is NaN -// -// Note that __ledf2( ) and __gedf2( ) are identical except in their handling of -// NaN values. -// -//===----------------------------------------------------------------------===// - -#define DOUBLE_PRECISION -#include "fp_lib.h" - -enum GE_RESULT __gedf2(fp_t a, fp_t b) { - - const srep_t aInt = toRep(a); - const srep_t bInt = toRep(b); - const rep_t aAbs = aInt & absMask; - const rep_t bAbs = bInt & absMask; - - if (aAbs > infRep || bAbs > infRep) return GE_UNORDERED; - if ((aAbs | bAbs) == 0) return GE_EQUAL; - if ((aInt & bInt) >= 0) { - if (aInt < bInt) return GE_LESS; - else if (aInt == bInt) return GE_EQUAL; - else return GE_GREATER; - } else { - if (aInt > bInt) return GE_LESS; - else if (aInt == bInt) return GE_EQUAL; - else return GE_GREATER; - } -} diff --git a/lib/gesf2.c b/lib/gesf2.c deleted file mode 100644 index fb8a291df..000000000 --- a/lib/gesf2.c +++ /dev/null @@ -1,61 +0,0 @@ -//===-- lib/gesf2.c - Single-precision comparisons ----------------*- 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 the following soft-fp_t comparison routines: -// -// __eqsf2 __gesf2 __unordsf2 -// __lesf2 __gtsf2 -// __ltsf2 -// __nesf2 -// -// The semantics of the routines grouped in each column are identical, so there -// is a single implementation for each, and wrappers to provide the other names. -// -// The main routines behave as follows: -// -// __lesf2(a,b) returns -1 if a < b -// 0 if a == b -// 1 if a > b -// 1 if either a or b is NaN -// -// __gesf2(a,b) returns -1 if a < b -// 0 if a == b -// 1 if a > b -// -1 if either a or b is NaN -// -// __unordsf2(a,b) returns 0 if both a and b are numbers -// 1 if either a or b is NaN -// -// Note that __lesf2( ) and __gesf2( ) are identical except in their handling of -// NaN values. -// -//===----------------------------------------------------------------------===// - -#define SINGLE_PRECISION -#include "fp_lib.h" - -enum GE_RESULT __gesf2(fp_t a, fp_t b) { - - const srep_t aInt = toRep(a); - const srep_t bInt = toRep(b); - const rep_t aAbs = aInt & absMask; - const rep_t bAbs = bInt & absMask; - - if (aAbs > infRep || bAbs > infRep) return GE_UNORDERED; - if ((aAbs | bAbs) == 0) return GE_EQUAL; - if ((aInt & bInt) >= 0) { - if (aInt < bInt) return GE_LESS; - else if (aInt == bInt) return GE_EQUAL; - else return GE_GREATER; - } else { - if (aInt > bInt) return GE_LESS; - else if (aInt == bInt) return GE_EQUAL; - else return GE_GREATER; - } -} diff --git a/lib/gtdf2.c b/lib/gtdf2.c deleted file mode 100644 index 4af83d533..000000000 --- a/lib/gtdf2.c +++ /dev/null @@ -1,17 +0,0 @@ -//===-- lib/gtdf2.c - Double-precision comparisons ----------------*- 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. -// -//===----------------------------------------------------------------------===// - -#define DOUBLE_PRECISION -#include "fp_lib.h" - -enum GE_RESULT __gedf2(fp_t a, fp_t b); -enum GE_RESULT __gtdf2(fp_t a, fp_t b) { - return __gedf2(a, b); -} - diff --git a/lib/gtsf2.c b/lib/gtsf2.c deleted file mode 100644 index 3c32d7f41..000000000 --- a/lib/gtsf2.c +++ /dev/null @@ -1,16 +0,0 @@ -//===-- lib/gtsf2.c - Single-precision comparisons ----------------*- 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. -// -//===----------------------------------------------------------------------===// - -#define SINGLE_PRECISION -#include "fp_lib.h" - -enum GE_RESULT __gesf2(fp_t a, fp_t b); -enum GE_RESULT __gtsf2(fp_t a, fp_t b) { - return __gesf2(a, b); -} diff --git a/lib/ltdf2.c b/lib/ltdf2.c deleted file mode 100644 index 07e2a396c..000000000 --- a/lib/ltdf2.c +++ /dev/null @@ -1,16 +0,0 @@ -//===-- lib/ltdf2.c - Double-precision comparisons ----------------*- 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. -// -//===----------------------------------------------------------------------===// - -#define DOUBLE_PRECISION -#include "fp_lib.h" - -enum LE_RESULT __ledf2(fp_t a, fp_t b); -enum LE_RESULT __ltdf2(fp_t a, fp_t b) { - return __ledf2(a, b); -} diff --git a/lib/ltsf2.c b/lib/ltsf2.c deleted file mode 100644 index 85415fd3d..000000000 --- a/lib/ltsf2.c +++ /dev/null @@ -1,16 +0,0 @@ -//===-- lib/comparesf2.c - Single-precision comparisons -----------*- 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. -// -//===----------------------------------------------------------------------===// - -#define SINGLE_PRECISION -#include "fp_lib.h" - -enum LE_RESULT __lesf2(fp_t a, fp_t b); -enum LE_RESULT __ltsf2(fp_t a, fp_t b) { - return __lesf2(a, b); -} diff --git a/lib/nedf2.c b/lib/nedf2.c deleted file mode 100644 index db0694602..000000000 --- a/lib/nedf2.c +++ /dev/null @@ -1,17 +0,0 @@ -//===-- lib/nedf2.c - Double-precision comparisons ----------------*- 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. -// -//===----------------------------------------------------------------------===// - -#define DOUBLE_PRECISION -#include "fp_lib.h" - -enum LE_RESULT __ledf2(fp_t a, fp_t b); -enum LE_RESULT __nedf2(fp_t a, fp_t b) { - return __ledf2(a, b); -} - diff --git a/lib/nesf2.c b/lib/nesf2.c deleted file mode 100644 index 465cd1a05..000000000 --- a/lib/nesf2.c +++ /dev/null @@ -1,16 +0,0 @@ -//===-- lib/nesf2.c - Single-precision comparisons ----------------*- 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. -// -//===----------------------------------------------------------------------===// - -#define SINGLE_PRECISION -#include "fp_lib.h" - -enum LE_RESULT __lesf2(fp_t a, fp_t b); -enum LE_RESULT __nesf2(fp_t a, fp_t b) { - return __lesf2(a, b); -} diff --git a/lib/unorddf2.c b/lib/unorddf2.c deleted file mode 100644 index 0327f103c..000000000 --- a/lib/unorddf2.c +++ /dev/null @@ -1,47 +0,0 @@ -//===-- lib/unorddf2.c - Double-precision comparisons -------------*- 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 the following soft-float comparison routines: -// -// __eqdf2 __gedf2 __unorddf2 -// __ledf2 __gtdf2 -// __ltdf2 -// __nedf2 -// -// The semantics of the routines grouped in each column are identical, so there -// is a single implementation for each, and wrappers to provide the other names. -// -// The main routines behave as follows: -// -// __ledf2(a,b) returns -1 if a < b -// 0 if a == b -// 1 if a > b -// 1 if either a or b is NaN -// -// __gedf2(a,b) returns -1 if a < b -// 0 if a == b -// 1 if a > b -// -1 if either a or b is NaN -// -// __unorddf2(a,b) returns 0 if both a and b are numbers -// 1 if either a or b is NaN -// -// Note that __ledf2( ) and __gedf2( ) are identical except in their handling of -// NaN values. -// -//===----------------------------------------------------------------------===// - -#define DOUBLE_PRECISION -#include "fp_lib.h" - -int __unorddf2(fp_t a, fp_t b) { - const rep_t aAbs = toRep(a) & absMask; - const rep_t bAbs = toRep(b) & absMask; - return aAbs > infRep || bAbs > infRep; -} diff --git a/lib/unordsf2.c b/lib/unordsf2.c deleted file mode 100644 index 0ef7c11d1..000000000 --- a/lib/unordsf2.c +++ /dev/null @@ -1,17 +0,0 @@ -//===-- lib/unordsf2.c - Single-precision comparisons -------------*- 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. -// -//===----------------------------------------------------------------------===// - -#define SINGLE_PRECISION -#include "fp_lib.h" - -int __unordsf2(fp_t a, fp_t b) { - const rep_t aAbs = toRep(a) & absMask; - const rep_t bAbs = toRep(b) & absMask; - return aAbs > infRep || bAbs > infRep; -} diff --git a/make/platform/clang_darwin.mk b/make/platform/clang_darwin.mk index dc377c416..e27c92c87 100644 --- a/make/platform/clang_darwin.mk +++ b/make/platform/clang_darwin.mk @@ -223,7 +223,8 @@ FUNCTIONS.cc_kext.x86_64 := $(CCKEXT_X86_FUNCTIONS) \ CCKEXT_MISSING_FUNCTIONS := \ cmpdf2 cmpsf2 div0 \ ffssi2 \ - udiv_w_sdiv bswapdi2 \ + gtdf2 gtsf2 ltdf2 ltsf2 \ + udiv_w_sdiv unorddf2 unordsf2 bswapdi2 \ bswapsi2 \ gcc_bcmp \ do_global_dtors \ |