Commit 240e6b6b by Janis Johnson Committed by Janis Johnson

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
parent 07c02828
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> 2006-11-29 Tehila Meyzels <tehila@il.ibm.com>
* haifa-sched.c: Remove define LINE_NOTE(INSN). Remove line_note_head. * haifa-sched.c: Remove define LINE_NOTE(INSN). Remove line_note_head.
......
...@@ -81,7 +81,7 @@ dfp_unary_op (dfp_unary_func op, DFP_C_TYPE arg) ...@@ -81,7 +81,7 @@ dfp_unary_op (dfp_unary_func op, DFP_C_TYPE arg)
HOST_TO_IEEE (arg, &a); HOST_TO_IEEE (arg, &a);
decContextDefault (&context, CONTEXT_INIT); decContextDefault (&context, CONTEXT_INIT);
context.round = CONTEXT_ROUND; DFP_INIT_ROUNDMODE (context.round);
TO_INTERNAL (&a, &arg1); 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) ...@@ -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); HOST_TO_IEEE (arg_b, &b);
decContextDefault (&context, CONTEXT_INIT); decContextDefault (&context, CONTEXT_INIT);
context.round = CONTEXT_ROUND; DFP_INIT_ROUNDMODE (context.round);
TO_INTERNAL (&a, &arg1); TO_INTERNAL (&a, &arg1);
TO_INTERNAL (&b, &arg2); 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) ...@@ -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); HOST_TO_IEEE (arg_b, &b);
decContextDefault (&context, CONTEXT_INIT); decContextDefault (&context, CONTEXT_INIT);
context.round = CONTEXT_ROUND; DFP_INIT_ROUNDMODE (context.round);
TO_INTERNAL (&a, &arg1); TO_INTERNAL (&a, &arg1);
TO_INTERNAL (&b, &arg2); TO_INTERNAL (&b, &arg2);
...@@ -365,7 +365,7 @@ DFP_TO_DFP (DFP_C_TYPE f_from) ...@@ -365,7 +365,7 @@ DFP_TO_DFP (DFP_C_TYPE f_from)
decContext context; decContext context;
decContextDefault (&context, CONTEXT_INIT); decContextDefault (&context, CONTEXT_INIT);
context.round = CONTEXT_ROUND; DFP_INIT_ROUNDMODE (context.round);
HOST_TO_IEEE (f_from, &s_from); HOST_TO_IEEE (f_from, &s_from);
TO_INTERNAL (&s_from, &d); TO_INTERNAL (&s_from, &d);
...@@ -394,7 +394,7 @@ DFP_TO_INT (DFP_C_TYPE x) ...@@ -394,7 +394,7 @@ DFP_TO_INT (DFP_C_TYPE x)
decContextDefault (&context, CONTEXT_INIT); decContextDefault (&context, CONTEXT_INIT);
/* Need non-default rounding mode here. */ /* Need non-default rounding mode here. */
context.round = DEC_ROUND_DOWN; DFP_INIT_ROUNDMODE (context.round);
HOST_TO_IEEE (x, &s); HOST_TO_IEEE (x, &s);
TO_INTERNAL (&s, &n1); TO_INTERNAL (&s, &n1);
...@@ -428,7 +428,7 @@ INT_TO_DFP (INT_TYPE i) ...@@ -428,7 +428,7 @@ INT_TO_DFP (INT_TYPE i)
decContext context; decContext context;
decContextDefault (&context, CONTEXT_INIT); decContextDefault (&context, CONTEXT_INIT);
context.round = CONTEXT_ROUND; DFP_INIT_ROUNDMODE (context.round);
/* Use a C library function to get a floating point string. */ /* Use a C library function to get a floating point string. */
sprintf (buf, INT_FMT ".0", CAST_FOR_FMT(i)); sprintf (buf, INT_FMT ".0", CAST_FOR_FMT(i));
...@@ -470,7 +470,7 @@ BFP_TO_DFP (BFP_TYPE x) ...@@ -470,7 +470,7 @@ BFP_TO_DFP (BFP_TYPE x)
decContext context; decContext context;
decContextDefault (&context, CONTEXT_INIT); 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. */ /* Use a C library function to write the floating point value to a string. */
#ifdef BFP_VIA_TYPE #ifdef BFP_VIA_TYPE
......
...@@ -30,6 +30,8 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA ...@@ -30,6 +30,8 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#ifndef _DFPBIT_H #ifndef _DFPBIT_H
#define _DFPBIT_H #define _DFPBIT_H
#include <fenv.h>
#include <decRound.h>
#include "tconfig.h" #include "tconfig.h"
#include "coretypes.h" #include "coretypes.h"
#include "tm.h" #include "tm.h"
...@@ -114,9 +116,9 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA ...@@ -114,9 +116,9 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
#define CONTEXT_INIT DEC_INIT_DECIMAL128 #define CONTEXT_INIT DEC_INIT_DECIMAL128
#endif #endif
/* Define CONTEXT_ROUND to obtain the current decNumber rounding mode. */ #ifndef DFP_INIT_ROUNDMODE
extern enum rounding __decGetRound (void); #define DFP_INIT_ROUNDMODE(A) A = DEC_ROUND_HALF_EVEN
#define CONTEXT_ROUND __decGetRound () #endif
/* Conversions between different decimal float types use WIDTH_TO to /* Conversions between different decimal float types use WIDTH_TO to
determine additional macros to define. */ determine additional macros to define. */
......
...@@ -145,6 +145,9 @@ decnumber_dep='stmp-dirs $(srcdir)/../libdecnumber/decContext.h $(srcdir)/../lib ...@@ -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/decNumberLocal.h $(srcdir)/../libdecnumber/decimal32.h $(srcdir)/../libdecnumber/decimal64.h
$(srcdir)/../libdecnumber/decimal128.h $(srcdir)/../libdecnumber/decDPD.h $(srcdir)/../libdecnumber/decUtility.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 # Flag whether we need eh_dummy.c
need_eh_dummy= need_eh_dummy=
...@@ -456,7 +459,7 @@ for ml in $MULTILIBS; do ...@@ -456,7 +459,7 @@ for ml in $MULTILIBS; do
if [ "$dpbit" ]; then if [ "$dpbit" ]; then
for name in $dpfuncs; do for name in $dpfuncs; do
out="libgcc/${dir}/${name}${objext}" 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 \ echo " $gcc_compile" -DFINE_GRAINED_LIBRARIES $flags -DL$name -DWIDTH=$dpwidth \
$DFP_CFLAGS -c $\(srcdir\)/config/dfp-bit.c -o $out $DFP_CFLAGS -c $\(srcdir\)/config/dfp-bit.c -o $out
echo $libgcc_a: $out echo $libgcc_a: $out
......
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> 2006-11-21 Janis Johnson <janis187@us.ibm.com>
* decLibrary.c (__dec_type_swap): Add prototype. * decLibrary.c (__dec_type_swap): Add prototype.
......
/* Temporary support for a libc-like fp environment for decimal float. /* Internal testing support for rounding for decimal float.
Copyright (C) 2005 Free Software Foundation, Inc.
Copyright (C) 2005, 2006 Free Software Foundation, Inc.
This file is part of GCC. This file is part of GCC.
...@@ -20,6 +21,10 @@ ...@@ -20,6 +21,10 @@
#include "config.h" #include "config.h"
#include "decContext.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_DOWNWARD 0
#define FE_DEC_TONEAREST 1 #define FE_DEC_TONEAREST 1
...@@ -28,11 +33,6 @@ ...@@ -28,11 +33,6 @@
#define FE_DEC_UPWARD 4 #define FE_DEC_UPWARD 4
#define FE_DEC_MAX 5 #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; static enum rounding __dfp_rounding_mode = DEC_ROUND_HALF_EVEN;
/* Set the decNumber rounding mode from the FE_DEC_* value in MODE. */ /* Set the decNumber rounding mode from the FE_DEC_* value in MODE. */
......
/* 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);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment