[fixed-point] Patch for 1.0, fixed-point defined constants, type conversions

Fu, Chao-Ying fu@mips.com
Fri Jan 19 23:21:00 GMT 2007


Hello,

  This patch improve three areas as follows.

1. Floating-point 1.0 is allowed for fract data types to
denote the maximum value.
Ex: _Fract a = 1.0; /* a will be 0x7fffffff.  */

2. Several fixed-point constants are defined.  Examples are
def.c, def.i, def3.c and def3.s.

3. Four new RTL operators are created for conversions among
fixed-point, floating-point and integer types.
Please check allconv.c and allconv.s .  New RTL operators are:
a. FIXED_ALL    : fixed <- fixed
                 fixed <- integer
                 fixed <- real
                 integer <- fixed
                 real <- integer
b. FIXED_UINT     : fixed <- unsigned int
                 unsigned <- fixed
c. SAT_FIXED_ALL: fixed <- fixed (with saturation)
                 fixed <- int (with saturation)
                 fixed <- real (with saturation)
d. SAT_FIXED_UINT:  fixed <- unsigned int (with saturation)

  The next step for this project is to have the emulation library.
Thanks a lot!

Regards,
Chao-ying

2007-01-19  Chao-ying Fu  <fu@mips.com>

	* optabs.c (expand_fixed_convert): Expand FIXED_CONVERT to four kinds
	of instructions based on UINTP and SATP.
	(init_optabs): Initialize fixed_all_optab, fixed_uint_optab,
	sat_fixed_all_optab, sat_fixed_uint_optab.
	* optabs.h (enum convert_optab_index): Add COI_fixed_all,
	COI_fixed_uint, COI_sat_fixed_all, COI_sat_fixed_uint.
	(fixed_all_optab, fixed_uint_optab, sat_fixed_all_optab,
	sat_fixed_uint_optab): Define.
	(expand_fixed_convert): Add one more parameter.
	* genopinit.c (optabs): Add fixed_all_optab, fixed_uint_optab,
	sat_fixed_all_optab, sat_fixed_uint_optab.
	* c-cppbuiltin.c (builtin_define_fixed_point_constants): New function
	to define fixed-point constants.
	(c_cpp_builtins): Define fixed-point constants.
	* rtl.def (FIXED_ALL, FIXED_UINT, SAT_FIXED_ALL, SAT_FIXED_UINT):
	New codes.
	* expr.c (expand_expr_real_1): Add one parameter to deal with
	unsigned integer for FIXED_CONVERT_EXPR.
	* fixed-value.c (fixed_convert_from_real): Allow 1.0 for fract data
	types to denote the maximum value.
	* config/mips/mips-fixed.md (FIXED2, MYSCALARF, MYSCALARI): New mode
	macros for fixed-point, floating-point and integer modes.
	(fixed_all*, fixed_uint*, sat_fixed_all*, sat_fixed_uint*): New
	instructions.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gcc.diff
Type: application/octet-stream
Size: 16096 bytes
Desc: gcc.diff
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070119/c7b369b8/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: def.c
Type: application/octet-stream
Size: 873 bytes
Desc: def.c
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070119/c7b369b8/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: def.i
Type: application/octet-stream
Size: 1080 bytes
Desc: def.i
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070119/c7b369b8/attachment-0002.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: def3.c
Type: application/octet-stream
Size: 2028 bytes
Desc: def3.c
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070119/c7b369b8/attachment-0003.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: def3.s
Type: application/octet-stream
Size: 4585 bytes
Desc: def3.s
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070119/c7b369b8/attachment-0004.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: allconv.c
Type: application/octet-stream
Size: 7922 bytes
Desc: allconv.c
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070119/c7b369b8/attachment-0005.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: allconv.s.gz
Type: application/x-gzip
Size: 36731 bytes
Desc: allconv.s.gz
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20070119/c7b369b8/attachment.bin>


More information about the Gcc-patches mailing list