From 0868ca6589dee209effebdcb0aa2af1281b1a814 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Mon, 21 Mar 2011 23:30:19 +0000 Subject: 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 --- lib/adddf3.c | 11 +++-------- lib/addsf3.c | 21 +++------------------ lib/subdf3.c | 23 +++++++++++++++++++++++ lib/subsf3.c | 23 +++++++++++++++++++++++ 4 files changed, 52 insertions(+), 26 deletions(-) create mode 100644 lib/subdf3.c create mode 100644 lib/subsf3.c 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)); +} -- cgit v1.2.1