decRound.c: Move declarations to new file, update comments.

libdecnumber/
	* decRound.c: Move declarations to new file, update comments.
	* decRound.h: New file.
gcc/
	* mklibgcc.in: Fix dependencies for dfp-bit.c.
	* config/dfp-bit.h (CONTEXT_ROUND): Delete.
	(DFP_INIT_ROUNDMODE): Define.
	* config/dfp-bit.c: Replace CONTEXT_ROUND with DFP_INIT_ROUNDMODE.

From-SVN: r119329
This commit is contained in:
Janis Johnson 2006-11-29 18:34:56 +00:00 committed by Janis Johnson
parent 07c0282832
commit 240e6b6bd0
7 changed files with 63 additions and 18 deletions

View File

@ -1,3 +1,10 @@
2006-11-29 Janis Johnson <janis187@us.ibm.com>
* config/dfp-bit.h (CONTEXT_ROUND): Delete.
(DFP_INIT_ROUNDMODE): Define.
* config/dfp-bit.c: Replace CONTEXT_ROUND with DFP_INIT_ROUNDMODE.
* mklibgcc.in: Fix dependencies for dfp-bit.c.
2006-11-29 Tehila Meyzels <tehila@il.ibm.com>
* haifa-sched.c: Remove define LINE_NOTE(INSN). Remove line_note_head.

View File

@ -81,7 +81,7 @@ dfp_unary_op (dfp_unary_func op, DFP_C_TYPE arg)
HOST_TO_IEEE (arg, &a);
decContextDefault (&context, CONTEXT_INIT);
context.round = CONTEXT_ROUND;
DFP_INIT_ROUNDMODE (context.round);
TO_INTERNAL (&a, &arg1);
@ -107,7 +107,7 @@ dfp_binary_op (dfp_binary_func op, DFP_C_TYPE arg_a, DFP_C_TYPE arg_b)
HOST_TO_IEEE (arg_b, &b);
decContextDefault (&context, CONTEXT_INIT);
context.round = CONTEXT_ROUND;
DFP_INIT_ROUNDMODE (context.round);
TO_INTERNAL (&a, &arg1);
TO_INTERNAL (&b, &arg2);
@ -134,7 +134,7 @@ dfp_compare_op (dfp_binary_func op, DFP_C_TYPE arg_a, DFP_C_TYPE arg_b)
HOST_TO_IEEE (arg_b, &b);
decContextDefault (&context, CONTEXT_INIT);
context.round = CONTEXT_ROUND;
DFP_INIT_ROUNDMODE (context.round);
TO_INTERNAL (&a, &arg1);
TO_INTERNAL (&b, &arg2);
@ -365,7 +365,7 @@ DFP_TO_DFP (DFP_C_TYPE f_from)
decContext context;
decContextDefault (&context, CONTEXT_INIT);
context.round = CONTEXT_ROUND;
DFP_INIT_ROUNDMODE (context.round);
HOST_TO_IEEE (f_from, &s_from);
TO_INTERNAL (&s_from, &d);
@ -394,7 +394,7 @@ DFP_TO_INT (DFP_C_TYPE x)
decContextDefault (&context, CONTEXT_INIT);
/* Need non-default rounding mode here. */
context.round = DEC_ROUND_DOWN;
DFP_INIT_ROUNDMODE (context.round);
HOST_TO_IEEE (x, &s);
TO_INTERNAL (&s, &n1);
@ -428,7 +428,7 @@ INT_TO_DFP (INT_TYPE i)
decContext context;
decContextDefault (&context, CONTEXT_INIT);
context.round = CONTEXT_ROUND;
DFP_INIT_ROUNDMODE (context.round);
/* Use a C library function to get a floating point string. */
sprintf (buf, INT_FMT ".0", CAST_FOR_FMT(i));
@ -470,7 +470,7 @@ BFP_TO_DFP (BFP_TYPE x)
decContext context;
decContextDefault (&context, CONTEXT_INIT);
context.round = CONTEXT_ROUND;
DFP_INIT_ROUNDMODE (context.round);
/* Use a C library function to write the floating point value to a string. */
#ifdef BFP_VIA_TYPE

View File

@ -30,6 +30,8 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#ifndef _DFPBIT_H
#define _DFPBIT_H
#include <fenv.h>
#include <decRound.h>
#include "tconfig.h"
#include "coretypes.h"
#include "tm.h"
@ -114,9 +116,9 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#define CONTEXT_INIT DEC_INIT_DECIMAL128
#endif
/* Define CONTEXT_ROUND to obtain the current decNumber rounding mode. */
extern enum rounding __decGetRound (void);
#define CONTEXT_ROUND __decGetRound ()
#ifndef DFP_INIT_ROUNDMODE
#define DFP_INIT_ROUNDMODE(A) A = DEC_ROUND_HALF_EVEN
#endif
/* Conversions between different decimal float types use WIDTH_TO to
determine additional macros to define. */

View File

@ -145,6 +145,9 @@ decnumber_dep='stmp-dirs $(srcdir)/../libdecnumber/decContext.h $(srcdir)/../lib
$(srcdir)/../libdecnumber/decNumberLocal.h $(srcdir)/../libdecnumber/decimal32.h $(srcdir)/../libdecnumber/decimal64.h
$(srcdir)/../libdecnumber/decimal128.h $(srcdir)/../libdecnumber/decDPD.h $(srcdir)/../libdecnumber/decUtility.h'
# Dependencies for dfp-bit.c
dfpbit_c_dep='$(srcdir)/../libdecnumber/decRound.h'" $libgcc_dep $decnumber_dep"
# Flag whether we need eh_dummy.c
need_eh_dummy=
@ -456,7 +459,7 @@ for ml in $MULTILIBS; do
if [ "$dpbit" ]; then
for name in $dpfuncs; do
out="libgcc/${dir}/${name}${objext}"
echo $out: config/dfp-bit.h config/dfp-bit.c $fpbit_c_dep
echo $out: config/dfp-bit.h config/dfp-bit.c $dfpbit_c_dep
echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name -DWIDTH=$dpwidth \
$DFP_CFLAGS -c $\(srcdir\)/config/dfp-bit.c -o $out
echo $libgcc_a: $out

View File

@ -1,3 +1,8 @@
2006-11-29 Janis Johnson <janis187@us.ibm.com>
* decRound.c: Move declarations to new file, update comments.
* decRound.h: New file.
2006-11-21 Janis Johnson <janis187@us.ibm.com>
* decLibrary.c (__dec_type_swap): Add prototype.

View File

@ -1,5 +1,6 @@
/* Temporary support for a libc-like fp environment for decimal float.
Copyright (C) 2005 Free Software Foundation, Inc.
/* Internal testing support for rounding for decimal float.
Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GCC.
@ -20,6 +21,10 @@
#include "config.h"
#include "decContext.h"
#include "decRound.h"
/* Internal, non-documented functions for testing libgcc functions.
This support is not sufficient for application use. */
#define FE_DEC_DOWNWARD 0
#define FE_DEC_TONEAREST 1
@ -28,11 +33,6 @@
#define FE_DEC_UPWARD 4
#define FE_DEC_MAX 5
extern void __dfp_set_round (int);
extern int __dfp_get_round (void);
extern enum rounding __decGetRound (void);
/* FIXME: these should be in thread-local storage for runtime support. */
static enum rounding __dfp_rounding_mode = DEC_ROUND_HALF_EVEN;
/* Set the decNumber rounding mode from the FE_DEC_* value in MODE. */

28
libdecnumber/decRound.h Normal file
View File

@ -0,0 +1,28 @@
/* Internal testing support for rounding for decimal float.
Copyright (C) 2006 Free Software Foundation, Inc.
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GCC is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
License for more details.
You should have received a copy of the GNU General Public License
along with GCC; see the file COPYING. If not, write to the Free
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA. */
#include "decContext.h"
#define DFP_INIT_ROUNDMODE(A) A = __decGetRound()
extern void __dfp_set_round (int);
extern int __dfp_get_round (void);
extern enum rounding __decGetRound (void);