fixed-value.h: New file.
* fixed-value.h: New file. * fixed-value.c: New file. * Makefile.in (OBJS-common): Add fixed-value.o. (fixed-value.o): New rule. (GTFILES): Add fixed-value.h. * double-int.c (double_int_scmp): We should use unsigned HOST_WIDE_INT to compare a.low and b.low. * gengtype.c (main): Handle FIXED_VALUE_TYPE type as scalar typedef. From-SVN: r127260
This commit is contained in:
parent
19c222f890
commit
1e1ba00288
|
@ -1,3 +1,14 @@
|
|||
2007-08-06 Chao-ying Fu <fu@mips.com>
|
||||
|
||||
* fixed-value.h: New file.
|
||||
* fixed-value.c: New file.
|
||||
* Makefile.in (OBJS-common): Add fixed-value.o.
|
||||
(fixed-value.o): New rule.
|
||||
(GTFILES): Add fixed-value.h.
|
||||
* double-int.c (double_int_scmp): We should use unsigned HOST_WIDE_INT
|
||||
to compare a.low and b.low.
|
||||
* gengtype.c (main): Handle FIXED_VALUE_TYPE type as scalar typedef.
|
||||
|
||||
2007-08-06 H.J. Lu <hongjiu.lu@intel.com>
|
||||
Daniel Jacobowitz <dan@codesourcery.com>
|
||||
|
||||
|
|
|
@ -1028,6 +1028,7 @@ OBJS-common = \
|
|||
expmed.o \
|
||||
expr.o \
|
||||
final.o \
|
||||
fixed-value.o \
|
||||
fold-const.o \
|
||||
function.o \
|
||||
fwprop.o \
|
||||
|
@ -2413,6 +2414,8 @@ real.o : real.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
|
|||
toplev.h $(TM_P_H) $(REAL_H)
|
||||
dfp.o : dfp.c dfp.h $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
|
||||
toplev.h $(TM_P_H) $(REAL_H) $(DECNUM_H)
|
||||
fixed-value.o: fixed-value.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
|
||||
$(TREE_H) fixed-value.h $(REAL_H) toplev.h
|
||||
integrate.o : integrate.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
|
||||
$(RTL_H) $(TREE_H) $(FLAGS_H) debug.h $(INTEGRATE_H) insn-config.h \
|
||||
$(EXPR_H) $(REAL_H) $(REGS_H) intl.h $(FUNCTION_H) output.h $(RECOG_H) \
|
||||
|
@ -3038,6 +3041,7 @@ GTFILES = $(srcdir)/input.h $(srcdir)/coretypes.h \
|
|||
$(srcdir)/coverage.c $(srcdir)/rtl.h \
|
||||
$(srcdir)/optabs.h $(srcdir)/tree.h $(srcdir)/function.h $(srcdir)/libfuncs.h $(SYMTAB_H) \
|
||||
$(srcdir)/real.h $(srcdir)/varray.h $(srcdir)/insn-addr.h $(srcdir)/hwint.h \
|
||||
$(srcdir)/fixed-value.h \
|
||||
$(srcdir)/ipa-reference.h $(srcdir)/output.h $(srcdir)/cfgloop.h \
|
||||
$(srcdir)/cselib.h $(srcdir)/basic-block.h $(srcdir)/cgraph.h \
|
||||
$(srcdir)/reload.h $(srcdir)/caller-save.c \
|
||||
|
|
|
@ -362,9 +362,9 @@ double_int_scmp (double_int a, double_int b)
|
|||
return -1;
|
||||
if (a.high > b.high)
|
||||
return 1;
|
||||
if ((HOST_WIDE_INT) a.low < (HOST_WIDE_INT) b.low)
|
||||
if (a.low < b.low)
|
||||
return -1;
|
||||
if ((HOST_WIDE_INT) a.low > (HOST_WIDE_INT) b.low)
|
||||
if (a.low > b.low)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,100 @@
|
|||
/* Fixed-point arithmetic support.
|
||||
Copyright (C) 2006, 2007 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 3, 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 COPYING3. If not see
|
||||
<http://www.gnu.org/licenses/>. */
|
||||
|
||||
#ifndef GCC_FIXED_VALUE_H
|
||||
#define GCC_FIXED_VALUE_H
|
||||
|
||||
#include "machmode.h"
|
||||
#include "real.h"
|
||||
#include "double-int.h"
|
||||
|
||||
struct fixed_value GTY(())
|
||||
{
|
||||
double_int data; /* Store data up to 2 wide integers. */
|
||||
unsigned int mode; /* Use machine mode to know IBIT and FBIT. */
|
||||
};
|
||||
|
||||
#define FIXED_VALUE_TYPE struct fixed_value
|
||||
|
||||
#define MAX_FCONST0 18 /* For storing 18 fixed-point zeros per
|
||||
fract, ufract, accum, and uaccum modes . */
|
||||
#define MAX_FCONST1 8 /* For storing 8 fixed-point ones per accum
|
||||
and uaccum modes. */
|
||||
/* Constant fixed-point values 0 and 1. */
|
||||
extern FIXED_VALUE_TYPE fconst0[MAX_FCONST0];
|
||||
extern FIXED_VALUE_TYPE fconst1[MAX_FCONST1];
|
||||
|
||||
/* Macros to access fconst0 and fconst1 via machine modes. */
|
||||
#define FCONST0(mode) fconst0[mode - QQmode]
|
||||
#define FCONST1(mode) fconst1[mode - HAmode]
|
||||
|
||||
/* Return a CONST_FIXED with value R and mode M. */
|
||||
#define CONST_FIXED_FROM_FIXED_VALUE(r, m) \
|
||||
const_fixed_from_fixed_value (r, m)
|
||||
extern rtx const_fixed_from_fixed_value (FIXED_VALUE_TYPE, enum machine_mode);
|
||||
|
||||
/* Initialize from a decimal or hexadecimal string. */
|
||||
extern void fixed_from_string (FIXED_VALUE_TYPE *, const char *,
|
||||
enum machine_mode);
|
||||
|
||||
/* In tree.c: wrap up a FIXED_VALUE_TYPE in a tree node. */
|
||||
extern tree build_fixed (tree, FIXED_VALUE_TYPE);
|
||||
|
||||
/* Extend or truncate to a new mode. */
|
||||
extern bool fixed_convert (FIXED_VALUE_TYPE *, enum machine_mode,
|
||||
const FIXED_VALUE_TYPE *, bool);
|
||||
|
||||
/* Convert to a fixed-point mode from an integer. */
|
||||
extern bool fixed_convert_from_int (FIXED_VALUE_TYPE *, enum machine_mode,
|
||||
double_int, bool, bool);
|
||||
|
||||
/* Convert to a fixed-point mode from a real. */
|
||||
extern bool fixed_convert_from_real (FIXED_VALUE_TYPE *, enum machine_mode,
|
||||
const REAL_VALUE_TYPE *, bool);
|
||||
|
||||
/* Convert to a real mode from a fixed-point. */
|
||||
extern void real_convert_from_fixed (REAL_VALUE_TYPE *, enum machine_mode,
|
||||
const FIXED_VALUE_TYPE *);
|
||||
|
||||
/* Compare two fixed-point objects for bitwise identity. */
|
||||
extern bool fixed_identical (const FIXED_VALUE_TYPE *, const FIXED_VALUE_TYPE *);
|
||||
|
||||
/* Calculate a hash value. */
|
||||
extern unsigned int fixed_hash (const FIXED_VALUE_TYPE *);
|
||||
|
||||
#define FIXED_VALUES_IDENTICAL(x, y) fixed_identical (&(x), &(y))
|
||||
|
||||
/* Determine whether a fixed-point value X is negative. */
|
||||
#define FIXED_VALUE_NEGATIVE(x) fixed_isneg (&(x))
|
||||
|
||||
/* Render F as a decimal floating point constant. */
|
||||
extern void fixed_to_decimal (char *str, const FIXED_VALUE_TYPE *, size_t);
|
||||
|
||||
/* Binary or unary arithmetic on tree_code. */
|
||||
extern bool fixed_arithmetic (FIXED_VALUE_TYPE *, int, const FIXED_VALUE_TYPE *,
|
||||
const FIXED_VALUE_TYPE *, bool);
|
||||
|
||||
/* Compare fixed-point values by tree_code. */
|
||||
extern bool fixed_compare (int, const FIXED_VALUE_TYPE *,
|
||||
const FIXED_VALUE_TYPE *);
|
||||
|
||||
/* Determine whether a fixed-point value X is negative. */
|
||||
extern bool fixed_isneg (const FIXED_VALUE_TYPE *);
|
||||
|
||||
#endif /* GCC_FIXED_VALUE_H */
|
|
@ -3533,6 +3533,7 @@ main (int argc, char **argv)
|
|||
pos.line = __LINE__ + 1;
|
||||
do_scalar_typedef ("CUMULATIVE_ARGS", &pos); pos.line++;
|
||||
do_scalar_typedef ("REAL_VALUE_TYPE", &pos); pos.line++;
|
||||
do_scalar_typedef ("FIXED_VALUE_TYPE", &pos); pos.line++;
|
||||
do_scalar_typedef ("double_int", &pos); pos.line++;
|
||||
do_scalar_typedef ("uint8", &pos); pos.line++;
|
||||
do_scalar_typedef ("jword", &pos); pos.line++;
|
||||
|
|
Loading…
Reference in New Issue