This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[fixed-point] Type conversion for fixed-point constants


  This patch enables type conversion for fixed-point constants
when assigning or constant folding.  Thanks!


2006-12-4  Chao-ying Fu  <>

	* fold-const.c (fold_convert_const_fixed_from_fixed): New function.
	(fold_convert_const): Support FIXED_POINT_TYPE.
	(fold_convert): Likewise.
	* c-typeck.c (c_common_type): Check FIXED_POINT_TYPE.  Build
	a common fixed-point type based on fbit, ibit, sign, and saturation.
	(comptypes_internal): Allow saturating and non-saturating
	fixed-point types compatible.
	(build_unary_op): Allow FIXED_POINT_TYPE for PREINCREMENT_EXPR,
	Don't convert integer_one_node to a fixed-point type.
	(convert_for_assignment): Support FIXED_POINT_TYPE.
	* c-convert.c (convert): Support FIXED_POINT_TYPE.
	* fixed-value.h (fixed_convert): Declare.
	* fixed-value.c (do_fixed_multiply): Delete one space.
	(fixed_convert): New function.
	* c-common.h (c_common_fixed_point_type_for_size): Declare.
	* c-common.c (c_common_fixed_point_type_for_size): New function.
	* convert.h (convert_to_fixed): Declare.
	* convert.c (convert_to_fixed): New function.

  TYPE NAME ## 1 = SET + 0.1hr; \
  TYPE NAME ## 2 = SET + 0.1r; \
  TYPE NAME ## 3 = SET + 0.1lr; \
  TYPE NAME ## 4 = SET + 0.1llr; \
  TYPE NAME ## 5 = SET + 0.1uhr; \
  TYPE NAME ## 6 = SET + 0.1ur; \
  TYPE NAME ## 7 = SET + 0.1ulr; \
  TYPE NAME ## 8 = SET + 0.1ullr;

  TYPE NAME ## 9 = SET + 1.1hk; \
  TYPE NAME ## 10 = SET + 1.1k; \
  TYPE NAME ## 11 = SET + 1.1lk; \
  TYPE NAME ## 12 = SET + 1.1llk; \
  TYPE NAME ## 13 = SET + 1.1uhk; \
  TYPE NAME ## 14 = SET + 1.1uk; \
  TYPE NAME ## 15 = SET + 1.1ulk; \
  TYPE NAME ## 16 = SET + 1.1ullk;

MIXED1(short _Fract, sf, 0.1hr);
MIXED1(_Fract, f, 0.1r);
MIXED1(long _Fract, lf, 0.1lr);
MIXED1(long long _Fract, llf, 0.1llr);
MIXED1(unsigned short _Fract, usf, 0.1uhr);
MIXED1(unsigned _Fract, uf, 0.1ur);
MIXED1(unsigned long _Fract, ulf, 0.1ulr);
MIXED1(unsigned long long _Fract, ullf, 0.1ullr);
MIXED1(_Sat short _Fract, Ssf, 0.1hr);
MIXED1(_Sat _Fract, Sf, 0.1r);
MIXED1(_Sat long _Fract, Slf, 0.1lr);
MIXED1(_Sat long long _Fract, Sllf, 0.1llr);
MIXED1(_Sat unsigned short _Fract, Susf, 0.1uhr);
MIXED1(_Sat unsigned _Fract, Suf, 0.1ur);
MIXED1(_Sat unsigned long _Fract, Sulf, 0.1ulr);
MIXED1(_Sat unsigned long long _Fract, Sullf, 0.1ullr);

MIXED2(short _Fract, sf, 0.1hr);
MIXED2(_Fract, f, 0.1r);
MIXED2(long _Fract, lf, 0.1lr);
MIXED2(unsigned short _Fract, usf, 0.1uhr);
MIXED2(unsigned _Fract, uf, 0.1ur);
MIXED2(unsigned long _Fract, ulf, 0.1ulr);
MIXED2(_Sat short _Fract, Ssf, 0.1hr);
MIXED2(_Sat _Fract, Sf, 0.1r);
MIXED2(_Sat long _Fract, Slf, 0.1lr);
MIXED2(_Sat unsigned short _Fract, Susf, 0.1uhr);
MIXED2(_Sat unsigned _Fract, Suf, 0.1ur);
MIXED2(_Sat unsigned long _Fract, Sulf, 0.1ulr);

Attachment: gcc.diff
Description: gcc.diff

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]