Commit ab22c1fa by Chao-ying Fu Committed by Chao-ying Fu

c-common.h (enum rid): Add new enumeration values of RID_SAT, RID_FRACT, and RID_ACCUM.

	* c-common.h (enum rid): Add new enumeration values of RID_SAT,
	RID_FRACT, and RID_ACCUM.  RID_SAT needs to be inserted before
	RID_ONEWAY, so that it can be checked in declspecs_add_type.
	(c_common_fixed_point_type_for_size): Declare.
	* c-parser.c (reswords): Add _Fract, _Accum, and _Sat.
	(c_token_starts_typename): Handle RID_FRACT, RID_ACCUM, and RID_SAT.
	(c_token_starts_declspecs): Likewise.
	(c_parser_declspecs): Likewise.
	(c_parser_attributes): Likewise.
	* c-tree.h (enum c_typespec_keyword): Add cts_fract and cts_accum.
	(c_declspecs): Add saturating_p.
	* c-decl.c (build_null_declspecs): Initialize saturating_p.
	(declspecs_add_type): Avoid using complex with _Fract, _Accum, or _Sat.
	Handle RID_SAT.
	Avoid using void, bool, char, int, float, double, _Decimal32,
	_Decimal64, _Decimal128, and complex with _Sat.
	Handle RID_FRACT and RID_ACCUM.
	Make sure _Sat is used with _Fract or _Accum.
	(finish_declspecs): Handle cts_fract and cts_accum.
	* c-common.c (fixed-value.h): New include.
	(constant_expression_warning): Handle FIXED_CST.
	(overflow_warning): Likewise.
	(warnings_for_convert_and_check): Likewise.
	(c_common_fixed_point_type_for_size): New.
	(c_common_type_for_mode): Handle fixed-point modes to
	return various saturating/non-saturating, signed/unsigned types.
	(c_common_signed_or_unsigned_type): Support fixed-point types.
	(shorten_compare): Check fixed-point zero.
	Handle FIXED_POINT_TYPE.
	(c_common_truthvalue_conversion): Handle FIXED_CST.
	Handle FIXED_POINT_TYPE.
	(c_common_nodes_and_builtins): Record builtin types for fixed-point
	types.
	(handle_mode_attribute): Handle fixed-point modes.  Need to check
	if the signness of base type and fixed-point modes are consistent.
	(handle_vector_size_attribute): Handle fixed-point modes.
	(same_scalar_type_ignoring_signedness): Handle FIXED_POINT_TYPE.
	(warn_for_div_by_zero): Check fixed-point zero.
	* c-typeck.c (c_common_type): Check FIXED_POINT_TYPE.  Build
	a common fixed-point type based on fbit, ibit, sign, and saturation.
	(build_unary_op): Allow FIXED_POINT_TYPE for CONVERT_EXPR,
	NEGATE_EXPR, TRUTH_NOT_EXPR, PREINCREMENT_EXPR, POSTINCREMENT_EXPR,
	PREDECREMENT_EXPR, and POSTDECREMENT_EXPR.
	(convert_for_assignment): Support FIXED_POINT_TYPE.
	(digest_init): Handle FIXED_POINT_TYPE.
	(build_binary_op): Support FIXED_POINT_TYPE in *_DIV_EXPR,
	TRUTH_ANDIF_EXPR, TRUTH_ORIF_EXPR, TRUTH_AND_EXPR, TRUTH_OR_EXPR,
	TRUTH_XOR_EXPR, RSHIFT_EXPR, LSHIFT_EXPR, EQ_EXPR, NE_EXPR, LE_EXPR,
	GE_EXPR, LT_EXPR, GT_EXPR.
	* target-def.h (TARGET_FIXED_POINT_SUPPORTED_P): New.
	(TARGET_INITIALIZER): Add TARGET_FIXED_POINT_SUPPORTED_P.
	* target.h (gcc_target): Add fixed_point_supported_p.
	* targhooks.c (default_scalar_mode_supported_p): Handle MODE_FRACT,
	MODE_UFRACT, MODE_ACCUM, and MODE_UACCUM.
	(default_fixed_point_supported_p): Define.
	* targhooks.h (default_fixed_point_supported_p): Declare.
	* doc/tm.texi (TARGET_FIXED_POINT_SUPPORTED_P): Add.
	* doc/install.texi (Configuration): Add --enable-fixed-point.
	* configure.ac (--enable-fixed-point): New to enable fixed-point
	arithmetic extension to C.  For mips targets, we enable it by default.
	* configure, config.in: Regenerate.

From-SVN: r127652
parent 43f14744
2007-08-20 Chao-ying Fu <fu@mips.com>
* c-common.h (enum rid): Add new enumeration values of RID_SAT,
RID_FRACT, and RID_ACCUM. RID_SAT needs to be inserted before
RID_ONEWAY, so that it can be checked in declspecs_add_type.
(c_common_fixed_point_type_for_size): Declare.
* c-parser.c (reswords): Add _Fract, _Accum, and _Sat.
(c_token_starts_typename): Handle RID_FRACT, RID_ACCUM, and RID_SAT.
(c_token_starts_declspecs): Likewise.
(c_parser_declspecs): Likewise.
(c_parser_attributes): Likewise.
* c-tree.h (enum c_typespec_keyword): Add cts_fract and cts_accum.
(c_declspecs): Add saturating_p.
* c-decl.c (build_null_declspecs): Initialize saturating_p.
(declspecs_add_type): Avoid using complex with _Fract, _Accum, or _Sat.
Handle RID_SAT.
Avoid using void, bool, char, int, float, double, _Decimal32,
_Decimal64, _Decimal128, and complex with _Sat.
Handle RID_FRACT and RID_ACCUM.
Make sure _Sat is used with _Fract or _Accum.
(finish_declspecs): Handle cts_fract and cts_accum.
* c-common.c (fixed-value.h): New include.
(constant_expression_warning): Handle FIXED_CST.
(overflow_warning): Likewise.
(warnings_for_convert_and_check): Likewise.
(c_common_fixed_point_type_for_size): New.
(c_common_type_for_mode): Handle fixed-point modes to
return various saturating/non-saturating, signed/unsigned types.
(c_common_signed_or_unsigned_type): Support fixed-point types.
(shorten_compare): Check fixed-point zero.
Handle FIXED_POINT_TYPE.
(c_common_truthvalue_conversion): Handle FIXED_CST.
Handle FIXED_POINT_TYPE.
(c_common_nodes_and_builtins): Record builtin types for fixed-point
types.
(handle_mode_attribute): Handle fixed-point modes. Need to check
if the signness of base type and fixed-point modes are consistent.
(handle_vector_size_attribute): Handle fixed-point modes.
(same_scalar_type_ignoring_signedness): Handle FIXED_POINT_TYPE.
(warn_for_div_by_zero): Check fixed-point zero.
* c-typeck.c (c_common_type): Check FIXED_POINT_TYPE. Build
a common fixed-point type based on fbit, ibit, sign, and saturation.
(build_unary_op): Allow FIXED_POINT_TYPE for CONVERT_EXPR,
NEGATE_EXPR, TRUTH_NOT_EXPR, PREINCREMENT_EXPR, POSTINCREMENT_EXPR,
PREDECREMENT_EXPR, and POSTDECREMENT_EXPR.
(convert_for_assignment): Support FIXED_POINT_TYPE.
(digest_init): Handle FIXED_POINT_TYPE.
(build_binary_op): Support FIXED_POINT_TYPE in *_DIV_EXPR,
TRUTH_ANDIF_EXPR, TRUTH_ORIF_EXPR, TRUTH_AND_EXPR, TRUTH_OR_EXPR,
TRUTH_XOR_EXPR, RSHIFT_EXPR, LSHIFT_EXPR, EQ_EXPR, NE_EXPR, LE_EXPR,
GE_EXPR, LT_EXPR, GT_EXPR.
* target-def.h (TARGET_FIXED_POINT_SUPPORTED_P): New.
(TARGET_INITIALIZER): Add TARGET_FIXED_POINT_SUPPORTED_P.
* target.h (gcc_target): Add fixed_point_supported_p.
* targhooks.c (default_scalar_mode_supported_p): Handle MODE_FRACT,
MODE_UFRACT, MODE_ACCUM, and MODE_UACCUM.
(default_fixed_point_supported_p): Define.
* targhooks.h (default_fixed_point_supported_p): Declare.
* doc/tm.texi (TARGET_FIXED_POINT_SUPPORTED_P): Add.
* doc/install.texi (Configuration): Add --enable-fixed-point.
* configure.ac (--enable-fixed-point): New to enable fixed-point
arithmetic extension to C. For mips targets, we enable it by default.
* configure, config.in: Regenerate.
2007-08-20 Pawel Sikora <pluto@pld-linux.org>
* doc/invoke.texi (-Wnon-virtual-dtor): Update documentation.
......
......@@ -52,7 +52,7 @@ enum rid
RID_VOLATILE, RID_SIGNED, RID_AUTO, RID_RESTRICT,
/* C extensions */
RID_COMPLEX, RID_THREAD,
RID_COMPLEX, RID_THREAD, RID_SAT,
/* C++ */
RID_FRIEND, RID_VIRTUAL, RID_EXPLICIT, RID_EXPORT, RID_MUTABLE,
......@@ -72,6 +72,7 @@ enum rid
RID_EXTENSION, RID_IMAGPART, RID_REALPART, RID_LABEL, RID_CHOOSE_EXPR,
RID_TYPES_COMPATIBLE_P,
RID_DFLOAT32, RID_DFLOAT64, RID_DFLOAT128,
RID_FRACT, RID_ACCUM,
/* Too many ways of getting the name of a function as a string */
RID_FUNCTION_NAME, RID_PRETTY_FUNCTION_NAME, RID_C99_FUNCTION_NAME,
......@@ -670,6 +671,8 @@ extern int c_common_handle_option (size_t code, const char *arg, int value);
extern bool c_common_missing_argument (const char *opt, size_t code);
extern tree c_common_type_for_mode (enum machine_mode, int);
extern tree c_common_type_for_size (unsigned int, int);
extern tree c_common_fixed_point_type_for_size (unsigned int, unsigned int,
int, int);
extern tree c_common_unsigned_type (tree);
extern tree c_common_signed_type (tree);
extern tree c_common_signed_or_unsigned_type (int, tree);
......
......@@ -7134,6 +7134,7 @@ build_null_declspecs (void)
ret->const_p = false;
ret->volatile_p = false;
ret->restrict_p = false;
ret->saturating_p = false;
return ret;
}
......@@ -7196,7 +7197,7 @@ declspecs_add_type (struct c_declspecs *specs, struct c_typespec spec)
}
if ((int) i <= (int) RID_LAST_MODIFIER)
{
/* "long", "short", "signed", "unsigned" or "_Complex". */
/* "long", "short", "signed", "unsigned", "_Complex" or "_Sat". */
bool dupe = false;
switch (i)
{
......@@ -7356,9 +7357,55 @@ declspecs_add_type (struct c_declspecs *specs, struct c_typespec spec)
else if (specs->typespec_word == cts_dfloat128)
error ("both %<complex%> and %<_Decimal128%> in "
"declaration specifiers");
else if (specs->typespec_word == cts_fract)
error ("both %<complex%> and %<_Fract%> in "
"declaration specifiers");
else if (specs->typespec_word == cts_accum)
error ("both %<complex%> and %<_Accum%> in "
"declaration specifiers");
else if (specs->saturating_p)
error ("both %<complex%> and %<_Sat%> in "
"declaration specifiers");
else
specs->complex_p = true;
break;
case RID_SAT:
dupe = specs->saturating_p;
if (pedantic)
pedwarn ("ISO C does not support saturating types");
if (specs->typespec_word == cts_void)
error ("both %<_Sat%> and %<void%> in "
"declaration specifiers");
else if (specs->typespec_word == cts_bool)
error ("both %<_Sat%> and %<_Bool%> in "
"declaration specifiers");
else if (specs->typespec_word == cts_char)
error ("both %<_Sat%> and %<char%> in "
"declaration specifiers");
else if (specs->typespec_word == cts_int)
error ("both %<_Sat%> and %<int%> in "
"declaration specifiers");
else if (specs->typespec_word == cts_float)
error ("both %<_Sat%> and %<float%> in "
"declaration specifiers");
else if (specs->typespec_word == cts_double)
error ("both %<_Sat%> and %<double%> in "
"declaration specifiers");
else if (specs->typespec_word == cts_dfloat32)
error ("both %<_Sat%> and %<_Decimal32%> in "
"declaration specifiers");
else if (specs->typespec_word == cts_dfloat64)
error ("both %<_Sat%> and %<_Decimal64%> in "
"declaration specifiers");
else if (specs->typespec_word == cts_dfloat128)
error ("both %<_Sat%> and %<_Decimal128%> in "
"declaration specifiers");
else if (specs->complex_p)
error ("both %<_Sat%> and %<complex%> in "
"declaration specifiers");
else
specs->saturating_p = true;
break;
default:
gcc_unreachable ();
}
......@@ -7370,7 +7417,8 @@ declspecs_add_type (struct c_declspecs *specs, struct c_typespec spec)
}
else
{
/* "void", "_Bool", "char", "int", "float" or "double". */
/* "void", "_Bool", "char", "int", "float", "double", "_Decimal32",
"_Decimal64", "_Decimal128", "_Fract" or "_Accum". */
if (specs->typespec_word != cts_none)
{
error ("two or more data types in declaration specifiers");
......@@ -7394,6 +7442,9 @@ declspecs_add_type (struct c_declspecs *specs, struct c_typespec spec)
else if (specs->complex_p)
error ("both %<complex%> and %<void%> in "
"declaration specifiers");
else if (specs->saturating_p)
error ("both %<_Sat%> and %<void%> in "
"declaration specifiers");
else
specs->typespec_word = cts_void;
return specs;
......@@ -7413,6 +7464,9 @@ declspecs_add_type (struct c_declspecs *specs, struct c_typespec spec)
else if (specs->complex_p)
error ("both %<complex%> and %<_Bool%> in "
"declaration specifiers");
else if (specs->saturating_p)
error ("both %<_Sat%> and %<_Bool%> in "
"declaration specifiers");
else
specs->typespec_word = cts_bool;
return specs;
......@@ -7423,11 +7477,18 @@ declspecs_add_type (struct c_declspecs *specs, struct c_typespec spec)
else if (specs->short_p)
error ("both %<short%> and %<char%> in "
"declaration specifiers");
else if (specs->saturating_p)
error ("both %<_Sat%> and %<char%> in "
"declaration specifiers");
else
specs->typespec_word = cts_char;
return specs;
case RID_INT:
specs->typespec_word = cts_int;
if (specs->saturating_p)
error ("both %<_Sat%> and %<int%> in "
"declaration specifiers");
else
specs->typespec_word = cts_int;
return specs;
case RID_FLOAT:
if (specs->long_p)
......@@ -7442,6 +7503,9 @@ declspecs_add_type (struct c_declspecs *specs, struct c_typespec spec)
else if (specs->unsigned_p)
error ("both %<unsigned%> and %<float%> in "
"declaration specifiers");
else if (specs->saturating_p)
error ("both %<_Sat%> and %<float%> in "
"declaration specifiers");
else
specs->typespec_word = cts_float;
return specs;
......@@ -7458,6 +7522,9 @@ declspecs_add_type (struct c_declspecs *specs, struct c_typespec spec)
else if (specs->unsigned_p)
error ("both %<unsigned%> and %<double%> in "
"declaration specifiers");
else if (specs->saturating_p)
error ("both %<_Sat%> and %<double%> in "
"declaration specifiers");
else
specs->typespec_word = cts_double;
return specs;
......@@ -7490,6 +7557,9 @@ declspecs_add_type (struct c_declspecs *specs, struct c_typespec spec)
else if (specs->complex_p)
error ("both %<complex%> and %<%s%> in "
"declaration specifiers", str);
else if (specs->saturating_p)
error ("both %<_Sat%> and %<%s%> in "
"declaration specifiers", str);
else if (i == RID_DFLOAT32)
specs->typespec_word = cts_dfloat32;
else if (i == RID_DFLOAT64)
......@@ -7502,6 +7572,27 @@ declspecs_add_type (struct c_declspecs *specs, struct c_typespec spec)
if (pedantic)
pedwarn ("ISO C does not support decimal floating point");
return specs;
case RID_FRACT:
case RID_ACCUM:
{
const char *str;
if (i == RID_FRACT)
str = "_Fract";
else
str = "_Accum";
if (specs->complex_p)
error ("both %<complex%> and %<%s%> in "
"declaration specifiers", str);
else if (i == RID_FRACT)
specs->typespec_word = cts_fract;
else
specs->typespec_word = cts_accum;
}
if (!targetm.fixed_point_supported_p ())
error ("fixed-point types not supported for this target");
if (pedantic)
pedwarn ("ISO C does not support fixed-point types");
return specs;
default:
/* ObjC reserved word "id", handled below. */
break;
......@@ -7673,6 +7764,8 @@ finish_declspecs (struct c_declspecs *specs)
"_Complex short" is equivalent to "_Complex short int". */
if (specs->typespec_word == cts_none)
{
if (specs->saturating_p)
error ("%<_Sat%> is used without %<_Fract%> or %<_Accum%>");
if (specs->long_p || specs->short_p
|| specs->signed_p || specs->unsigned_p)
{
......@@ -7792,6 +7885,88 @@ finish_declspecs (struct c_declspecs *specs)
else
specs->type = dfloat128_type_node;
break;
case cts_fract:
gcc_assert (!specs->complex_p);
if (specs->saturating_p)
{
if (specs->long_long_p)
specs->type = specs->unsigned_p
? sat_unsigned_long_long_fract_type_node
: sat_long_long_fract_type_node;
else if (specs->long_p)
specs->type = specs->unsigned_p
? sat_unsigned_long_fract_type_node
: sat_long_fract_type_node;
else if (specs->short_p)
specs->type = specs->unsigned_p
? sat_unsigned_short_fract_type_node
: sat_short_fract_type_node;
else
specs->type = specs->unsigned_p
? sat_unsigned_fract_type_node
: sat_fract_type_node;
}
else
{
if (specs->long_long_p)
specs->type = specs->unsigned_p
? unsigned_long_long_fract_type_node
: long_long_fract_type_node;
else if (specs->long_p)
specs->type = specs->unsigned_p
? unsigned_long_fract_type_node
: long_fract_type_node;
else if (specs->short_p)
specs->type = specs->unsigned_p
? unsigned_short_fract_type_node
: short_fract_type_node;
else
specs->type = specs->unsigned_p
? unsigned_fract_type_node
: fract_type_node;
}
break;
case cts_accum:
gcc_assert (!specs->complex_p);
if (specs->saturating_p)
{
if (specs->long_long_p)
specs->type = specs->unsigned_p
? sat_unsigned_long_long_accum_type_node
: sat_long_long_accum_type_node;
else if (specs->long_p)
specs->type = specs->unsigned_p
? sat_unsigned_long_accum_type_node
: sat_long_accum_type_node;
else if (specs->short_p)
specs->type = specs->unsigned_p
? sat_unsigned_short_accum_type_node
: sat_short_accum_type_node;
else
specs->type = specs->unsigned_p
? sat_unsigned_accum_type_node
: sat_accum_type_node;
}
else
{
if (specs->long_long_p)
specs->type = specs->unsigned_p
? unsigned_long_long_accum_type_node
: long_long_accum_type_node;
else if (specs->long_p)
specs->type = specs->unsigned_p
? unsigned_long_accum_type_node
: long_accum_type_node;
else if (specs->short_p)
specs->type = specs->unsigned_p
? unsigned_short_accum_type_node
: short_accum_type_node;
else
specs->type = specs->unsigned_p
? unsigned_accum_type_node
: accum_type_node;
}
break;
default:
gcc_unreachable ();
}
......
......@@ -80,6 +80,9 @@ static const struct resword reswords[] =
{ "_Decimal32", RID_DFLOAT32, D_EXT },
{ "_Decimal64", RID_DFLOAT64, D_EXT },
{ "_Decimal128", RID_DFLOAT128, D_EXT },
{ "_Fract", RID_FRACT, D_EXT },
{ "_Accum", RID_ACCUM, D_EXT },
{ "_Sat", RID_SAT, D_EXT },
{ "__FUNCTION__", RID_FUNCTION_NAME, 0 },
{ "__PRETTY_FUNCTION__", RID_PRETTY_FUNCTION_NAME, 0 },
{ "__alignof", RID_ALIGNOF, 0 },
......@@ -486,6 +489,9 @@ c_token_starts_typename (c_token *token)
case RID_VOLATILE:
case RID_RESTRICT:
case RID_ATTRIBUTE:
case RID_FRACT:
case RID_ACCUM:
case RID_SAT:
return true;
default:
return false;
......@@ -560,6 +566,9 @@ c_token_starts_declspecs (c_token *token)
case RID_VOLATILE:
case RID_RESTRICT:
case RID_ATTRIBUTE:
case RID_FRACT:
case RID_ACCUM:
case RID_SAT:
return true;
default:
return false;
......@@ -1493,6 +1502,12 @@ c_parser_asm_definition (c_parser *parser)
_Decimal32
_Decimal64
_Decimal128
_Fract
_Accum
_Sat
(_Fract, _Accum, and _Sat are new from ISO/IEC DTR 18037:
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1169.pdf)
Objective-C:
......@@ -1595,6 +1610,9 @@ c_parser_declspecs (c_parser *parser, struct c_declspecs *specs,
case RID_DFLOAT64:
case RID_DFLOAT128:
case RID_BOOL:
case RID_FRACT:
case RID_ACCUM:
case RID_SAT:
if (!typespec_ok)
goto out;
attrs_ok = true;
......@@ -2857,6 +2875,9 @@ c_parser_attributes (c_parser *parser)
case RID_DFLOAT64:
case RID_DFLOAT128:
case RID_BOOL:
case RID_FRACT:
case RID_ACCUM:
case RID_SAT:
ok = true;
break;
default:
......
......@@ -202,7 +202,8 @@ enum c_storage_class {
};
/* A type specifier keyword "void", "_Bool", "char", "int", "float",
"double", or none of these. */
"double", "_Decimal32", "_Decimal64", "_Decimal128", "_Fract", "_Accum",
or none of these. */
enum c_typespec_keyword {
cts_none,
cts_void,
......@@ -213,7 +214,9 @@ enum c_typespec_keyword {
cts_double,
cts_dfloat32,
cts_dfloat64,
cts_dfloat128
cts_dfloat128,
cts_fract,
cts_accum
};
/* A sequence of declaration specifiers in C. */
......@@ -281,6 +284,8 @@ struct c_declspecs {
BOOL_BITFIELD volatile_p : 1;
/* Whether "restrict" was specified. */
BOOL_BITFIELD restrict_p : 1;
/* Whether "_Sat" was specified. */
BOOL_BITFIELD saturating_p : 1;
};
/* The various kinds of declarators in C. */
......
......@@ -65,6 +65,12 @@
#endif
/* Define to 1 to enable fixed-point arithmetic extension to C. */
#ifndef USED_FOR_TARGET
#undef ENABLE_FIXED_POINT
#endif
/* Define if you want fold checked that it never destructs its argument. This
is quite expensive. */
#ifndef USED_FOR_TARGET
......@@ -1363,37 +1369,37 @@
#endif
/* The size of a `int', as computed by sizeof. */
/* The size of `int', as computed by sizeof. */
#ifndef USED_FOR_TARGET
#undef SIZEOF_INT
#endif
/* The size of a `long', as computed by sizeof. */
/* The size of `long', as computed by sizeof. */
#ifndef USED_FOR_TARGET
#undef SIZEOF_LONG
#endif
/* The size of a `long long', as computed by sizeof. */
/* The size of `long long', as computed by sizeof. */
#ifndef USED_FOR_TARGET
#undef SIZEOF_LONG_LONG
#endif
/* The size of a `short', as computed by sizeof. */
/* The size of `short', as computed by sizeof. */
#ifndef USED_FOR_TARGET
#undef SIZEOF_SHORT
#endif
/* The size of a `void *', as computed by sizeof. */
/* The size of `void *', as computed by sizeof. */
#ifndef USED_FOR_TARGET
#undef SIZEOF_VOID_P
#endif
/* The size of a `__int64', as computed by sizeof. */
/* The size of `__int64', as computed by sizeof. */
#ifndef USED_FOR_TARGET
#undef SIZEOF___INT64
#endif
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -641,6 +641,28 @@ AC_DEFINE_UNQUOTED(ENABLE_DECIMAL_BID_FORMAT, $bid,
[Define to 1 to specify that we are using the BID decimal floating
point format instead of DPD])
# Enable C extension for fixed-point arithmetic.
AC_ARG_ENABLE(fixed-point,
[ --enable-fixed-point enable fixed-point arithmetic extension to C],
[
],
[
case $target in
mips*-*-*)
enable_fixed_point=yes
;;
*)
AC_MSG_WARN(fixed-point is not supported for this target, ignored)
enable_fixed_point=no
;;
esac
])
AC_SUBST(enable_fixed_point)
fixedpoint=`if test $enable_fixed_point = yes; then echo 1; else echo 0; fi`
AC_DEFINE_UNQUOTED(ENABLE_FIXED_POINT, $fixedpoint,
[Define to 1 to enable fixed-point arithmetic extension to C.])
# Enable threads
# Pass with no value to take the default
# Pass with a value to specify a thread package
......
......@@ -1317,6 +1317,13 @@ or @samp{dpd}). The @samp{bid} (binary integer decimal) format is
default on i386 and x86_64 systems, and the @samp{dpd} (densely packed
decimal) format is default on PowerPC systems.
@item --enable-fixed-point
@itemx --disable-fixed-point
Enable (or disable) support for C fixed-point arithmetic.
This option is enabled by default for some targets (such as MIPS) which
have hardware-support for fixed-point operations. On other targets, you
may enable this option manually.
@item --with-long-double-128
Specify if @code{long double} type should be 128-bit by default on selected
GNU/Linux architectures. If using @code{--without-long-double-128},
......
......@@ -1502,6 +1502,10 @@ may affect its placement.
Returns true if the target supports decimal floating point.
@end deftypefn
@deftypefn {Target Hook} {bool} TARGET_FIXED_POINT_SUPPORTED_P (void)
Returns true if the target supports fixed-point arithmetic.
@end deftypefn
@deftypefn {Target Hook} {const char *} TARGET_MANGLE_TYPE (tree @var{type})
If your target defines any fundamental types, or any types your target
uses should be mangled differently from the default, define this hook
......
......@@ -437,6 +437,10 @@
#define TARGET_DECIMAL_FLOAT_SUPPORTED_P default_decimal_float_supported_p
#endif
#ifndef TARGET_FIXED_POINT_SUPPORTED_P
#define TARGET_FIXED_POINT_SUPPORTED_P default_fixed_point_supported_p
#endif
#ifndef TARGET_VECTOR_MODE_SUPPORTED_P
#define TARGET_VECTOR_MODE_SUPPORTED_P hook_bool_mode_false
#endif
......@@ -689,6 +693,7 @@
TARGET_FUNCTION_ATTRIBUTE_INLINABLE_P, \
TARGET_MS_BITFIELD_LAYOUT_P, \
TARGET_DECIMAL_FLOAT_SUPPORTED_P, \
TARGET_FIXED_POINT_SUPPORTED_P, \
TARGET_ALIGN_ANON_BITFIELD, \
TARGET_NARROW_VOLATILE_BITFIELD, \
TARGET_INIT_BUILTINS, \
......
......@@ -479,6 +479,9 @@ struct gcc_target
/* True if the target supports decimal floating point. */
bool (* decimal_float_supported_p) (void);
/* True if the target supports fixed-point. */
bool (* fixed_point_supported_p) (void);
/* Return true if anonymous bitfields affect structure alignment. */
bool (* align_anon_bitfield) (void);
......
......@@ -298,6 +298,10 @@ default_scalar_mode_supported_p (enum machine_mode mode)
return false;
case MODE_DECIMAL_FLOAT:
case MODE_FRACT:
case MODE_UFRACT:
case MODE_ACCUM:
case MODE_UACCUM:
return false;
default:
......@@ -313,6 +317,14 @@ default_decimal_float_supported_p (void)
return ENABLE_DECIMAL_FLOAT;
}
/* True if the target supports fixed-point arithmetic. */
bool
default_fixed_point_supported_p (void)
{
return ENABLE_FIXED_POINT;
}
/* NULL if INSN insn is valid within a low-overhead loop, otherwise returns
an error message.
......
......@@ -55,6 +55,7 @@ extern void default_unwind_emit (FILE *, rtx);
extern bool default_scalar_mode_supported_p (enum machine_mode);
extern bool default_decimal_float_supported_p (void);
extern bool default_fixed_point_supported_p (void);
extern const char * default_invalid_within_doloop (rtx);
......
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