diff options
author | chaoyingfu <chaoyingfu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-09-07 01:24:09 +0000 |
---|---|---|
committer | chaoyingfu <chaoyingfu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-09-07 01:24:09 +0000 |
commit | 68a556d6cb1ebf7290514725565d2cf4723ab59f (patch) | |
tree | efee8ca8b1b0b17d1b3afab3a5bc101a5bfb2b1d /gcc/optabs.h | |
parent | b3b2f29f86807ed0ca83c011a143e65b97960b81 (diff) | |
download | gcc-68a556d6cb1ebf7290514725565d2cf4723ab59f.tar.gz |
* ginclude/stdfix.h: New file.
* Makefile.in (USER_H): Add $(srcdir)/ginclude/stdfix.h.
(convert.o): Add dependence on fixed-value.h.
* c-convert.c (convert): Support FIXED_POINT_TYPE.
* c-cppbuiltin.c (builtin_define_fixed_point_constants): New function
to define fixed-point constants.
(c_cpp_builtins): Define fixed-point constants.
* convert.c (fixed-value.h): New include.
(convert_to_real): Update comment to include fixed-point.
Support FIXED_POINT_TYPE.
(convert_to_integer): Update comment to include fixed-point.
Support FIXED_POINT_TYPE.
(convert_to_complex): Support FIXED_POINT_TYPE.
(convert_to_fixed): New function.
* convert.h (convert_to_fixed): Declare.
* genopinit.c: Add comment about $Q for only fixed-point modes.
(optabs): Add fract_optab, fractuns_optab, satfract_optab,
satfractuns_optab, add_optab, ssadd_optab, usadd_optab, sub_optab,
sssub_optab, ussub_optab, smul_optab, ssmul_optab, usmul_optab,
ssmadd_widen_optab, usmadd_widen_optab, ssdiv_optab, udiv_optab,
usdiv_optab, ssashl_optab, usashl_optab, neg_optab, ssneg_optab,
usneg_optab for fixed-point modes.
(gen_insn): Add force_fixed to track the $Q format for all fixed-point
modes.
* optabs.c (optab_for_tree_code): For *DIV_EXPR, LSHIFT_EXPR,
PLUS_EXPR, MINUS_EXPR, MULT_EXPR, NEGATE_EXPR, return signed or
unsigned saturation optabs, when type is saturating.
(shift_optab_p): Return true for SS_ASHIFT or US_ASHIFT.
(expand_fixed_convert): New function.
(gen_fixed_libfunc, gen_signed_fixed_libfunc,
gen_unsigned_fixed_libfunc, gen_int_fp_fixed_libfunc,
gen_int_fp_signed_fixed_libfunc, gen_int_fixed_libfunc,
gen_int_signed_fixed_libfunc, gen_int_unsigned_fixed_libfunc,
gen_fract_conv_libfunc, gen_fractuns_conv_libfunc,
gen_satfract_conv_libfunc, gen_satfractuns_conv_libfunc): New
functions.
(init_optabs): Initialize ssadd_optab, usadd_optab, sssub_optab,
ussub_optab, ssmul_optab, usmul_optab, ssmadd_widen_optab,
usmadd_widen_optab, ssmsub_widen_optab, usmsub_widen_optab,
ssdiv_optab, usdiv_optab, ssashl_optab, usashl_optab, ssneg_optab,
usneg_optab, fract_optab, fractuns_optab, satfract_optab,
satfractuns_optab.
Initialize fixed-point libraries, including add, ssadd, usadd, sub,
sssub, ussub, mul, ssmul, usmul, div, ssdiv, udiv, usdiv, ashl,
ssashl, usashl, ashr, lshr, neg, ssneg, usneg, cmp, fract, satfract,
fractuns, satfractuns.
* optabs.h (enum optab_index): Add OTI_ssadd, OTI_usadd, OTI_sssub,
OTI_ussub, OTI_ssmul, OTI_usmul, OTI_ssdiv, OTI_usdiv, OTI_ssneg,
OTI_usneg, OTI_ssashl, OTI_usashl, OTI_ssmadd_widen, OTI_usmadd_widen,
OTI_ssmsub_widen, OTI_usmsub_widen.
(ssadd_optab, usadd_optab, sssub_optab, ussub_optab, ssmul_optab,
usmul_optab, ssdiv_optab, usdiv_optab, ssneg_optab, usneg_optab,
ssashl_optab, usashl_optab, ssmadd_widen_optab, usmadd_widen_optab,
umsub_widen_optab, usmsub_widen_optab): Define.
(enum convert_optab_index): Add COI_fract, COI_fractuns, COI_satfract,
COI_satfractuns.
(fract_optab, fractuns_optab, satfract_optab, satfractuns_optab):
Define.
(expand_fixed_convert): Declare.
* expr.c (convert_move): Support the move of fixed-point modes.
(emit_move_insn_1): Handle fixed-point mode to move via integer.
(categorize_ctor_elements_1): Handle FIXED_CST.
(count_type_elements): Handle FIXED_POINT_TYPE.
(expand_expr_real_1): For VECTOR_CST, check MODE_VECTOR_FRACT,
MODE_VECTOR_UFRACT, MODE_VECTOR_ACCUM, MODE_VECTOR_UACCUM.
Support FIXED_CST.
For PLUS_EXPR and MINUS_EXPR, support saturating and non-saturating
multiply and add/subtract for fixed-point types.
For MULT_EXPR, *DIV_EXPR, *SHIFT_EXPR, if the mode if a fixed-point
mode, we jump to binop directly.
Support FIXED_CONVERT_EXPR.
(do_store_flag): Check FIXED_CST to put a constant second.
(vector_mode_valid_p): Handle MODE_VECTOR_FRACT,
MODE_VECTOR_UFRACT, MODE_VECTOR_ACCUM, MODE_VECTOR_UACCUM.
(const_vector_from_tree): Support FIXED_CST.
* doc/extend.texi (Fixed-Point): New node.
* doc/md.texi (ssadd, usadd, sssub, ussub, ssmul, usmul, ssdiv, usdiv,
ssmadd, usmadd, ssmsub, usmsub, ssashl, usashl, ssneg, usneg, fract,
satfract, fractuns, satfractuns): Document them.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@128218 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/optabs.h')
-rw-r--r-- | gcc/optabs.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/gcc/optabs.h b/gcc/optabs.h index a85b3f365e7..9dd98134a0b 100644 --- a/gcc/optabs.h +++ b/gcc/optabs.h @@ -75,6 +75,20 @@ typedef struct convert_optab *convert_optab; /* Enumeration of valid indexes into optab_table. */ enum optab_index { + /* Fixed-point operators with signed/unsigned saturation */ + OTI_ssadd, + OTI_usadd, + OTI_sssub, + OTI_ussub, + OTI_ssmul, + OTI_usmul, + OTI_ssdiv, + OTI_usdiv, + OTI_ssneg, + OTI_usneg, + OTI_ssashl, + OTI_usashl, + OTI_add, OTI_addv, OTI_sub, @@ -97,12 +111,28 @@ enum optab_index /* Unsigned multiply and add with the result and addend one machine mode wider than the multiplicand and multiplier. */ OTI_umadd_widen, + /* Signed multiply and add with the result and addend one machine mode + wider than the multiplicand and multiplier. + All involved operations are saturating. */ + OTI_ssmadd_widen, + /* Unigned multiply and add with the result and addend one machine mode + wider than the multiplicand and multiplier. + All involved operations are saturating. */ + OTI_usmadd_widen, /* Signed multiply and subtract the result and minuend one machine mode wider than the multiplicand and multiplier. */ OTI_smsub_widen, /* Unsigned multiply and subtract the result and minuend one machine mode wider than the multiplicand and multiplier. */ OTI_umsub_widen, + /* Signed multiply and subtract the result and minuend one machine mode + wider than the multiplicand and multiplier. + All involved operations are saturating. */ + OTI_ssmsub_widen, + /* Unigned multiply and subtract the result and minuend one machine mode + wider than the multiplicand and multiplier. + All involved operations are saturating. */ + OTI_usmsub_widen, /* Signed divide */ OTI_sdiv, @@ -332,6 +362,19 @@ enum optab_index extern optab optab_table[OTI_MAX]; +#define ssadd_optab (optab_table[OTI_ssadd]) +#define usadd_optab (optab_table[OTI_usadd]) +#define sssub_optab (optab_table[OTI_sssub]) +#define ussub_optab (optab_table[OTI_ussub]) +#define ssmul_optab (optab_table[OTI_ssmul]) +#define usmul_optab (optab_table[OTI_usmul]) +#define ssdiv_optab (optab_table[OTI_ssdiv]) +#define usdiv_optab (optab_table[OTI_usdiv]) +#define ssneg_optab (optab_table[OTI_ssneg]) +#define usneg_optab (optab_table[OTI_usneg]) +#define ssashl_optab (optab_table[OTI_ssashl]) +#define usashl_optab (optab_table[OTI_usashl]) + #define add_optab (optab_table[OTI_add]) #define sub_optab (optab_table[OTI_sub]) #define smul_optab (optab_table[OTI_smul]) @@ -344,8 +387,12 @@ extern optab optab_table[OTI_MAX]; #define usmul_widen_optab (optab_table[OTI_usmul_widen]) #define smadd_widen_optab (optab_table[OTI_smadd_widen]) #define umadd_widen_optab (optab_table[OTI_umadd_widen]) +#define ssmadd_widen_optab (optab_table[OTI_ssmadd_widen]) +#define usmadd_widen_optab (optab_table[OTI_usmadd_widen]) #define smsub_widen_optab (optab_table[OTI_smsub_widen]) #define umsub_widen_optab (optab_table[OTI_umsub_widen]) +#define ssmsub_widen_optab (optab_table[OTI_ssmsub_widen]) +#define usmsub_widen_optab (optab_table[OTI_usmsub_widen]) #define sdiv_optab (optab_table[OTI_sdiv]) #define smulv_optab (optab_table[OTI_smulv]) #define sdivv_optab (optab_table[OTI_sdivv]) @@ -501,6 +548,11 @@ enum convert_optab_index COI_lfloor, COI_lceil, + COI_fract, + COI_fractuns, + COI_satfract, + COI_satfractuns, + COI_MAX }; @@ -519,6 +571,10 @@ extern convert_optab convert_optab_table[COI_MAX]; #define lround_optab (convert_optab_table[COI_lround]) #define lfloor_optab (convert_optab_table[COI_lfloor]) #define lceil_optab (convert_optab_table[COI_lceil]) +#define fract_optab (convert_optab_table[COI_fract]) +#define fractuns_optab (convert_optab_table[COI_fractuns]) +#define satfract_optab (convert_optab_table[COI_satfract]) +#define satfractuns_optab (convert_optab_table[COI_satfractuns]) /* These arrays record the insn_code of insns that may be needed to perform input and output reloads of special objects. They provide a @@ -693,6 +749,9 @@ extern void set_optab_libfunc (optab, enum machine_mode, const char *); extern void set_conv_libfunc (convert_optab, enum machine_mode, enum machine_mode, const char *); +/* Generate code for a FIXED_CONVERT_EXPR. */ +extern void expand_fixed_convert (rtx, rtx, int, int); + /* Generate code for a FLOAT_EXPR. */ extern void expand_float (rtx, rtx, int); |