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/genopinit.c | |
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/genopinit.c')
-rw-r--r-- | gcc/genopinit.c | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/gcc/genopinit.c b/gcc/genopinit.c index 44c48c7a663..c5d0df2fd94 100644 --- a/gcc/genopinit.c +++ b/gcc/genopinit.c @@ -50,6 +50,7 @@ along with GCC; see the file COPYING3. If not see only full integer modes should be considered for the next mode, and $F means that only float modes should be considered. $P means that both full and partial integer modes should be considered. + $Q means that only fixed-point modes should be considered. $V means to emit 'v' if the first mode is a MODE_FLOAT mode. @@ -67,14 +68,28 @@ static const char * const optabs[] = "convert_optab_handler (sfloat_optab, $B, $A)->insn_code = CODE_FOR_$(float$I$a$F$b2$)", "convert_optab_handler (ufloat_optab, $B, $A)->insn_code = CODE_FOR_$(floatuns$I$a$F$b2$)", "convert_optab_handler (trunc_optab, $B, $A)->insn_code = CODE_FOR_$(trunc$a$b2$)", + "convert_optab_handler (fract_optab, $B, $A)->insn_code = CODE_FOR_$(fract$a$b2$)", + "convert_optab_handler (fractuns_optab, $B, $A)->insn_code = CODE_FOR_$(fractuns$I$a$Q$b2$)", + "convert_optab_handler (fractuns_optab, $B, $A)->insn_code = CODE_FOR_$(fractuns$Q$a$I$b2$)", + "convert_optab_handler (satfract_optab, $B, $A)->insn_code = CODE_FOR_$(satfract$a$Q$b2$)", + "convert_optab_handler (satfractuns_optab, $B, $A)->insn_code = CODE_FOR_$(satfractuns$I$a$Q$b2$)", "optab_handler (add_optab, $A)->insn_code = CODE_FOR_$(add$P$a3$)", "optab_handler (addv_optab, $A)->insn_code =\n\ optab_handler (add_optab, $A)->insn_code = CODE_FOR_$(add$F$a3$)", "optab_handler (addv_optab, $A)->insn_code = CODE_FOR_$(addv$I$a3$)", + "optab_handler (add_optab, $A)->insn_code = CODE_FOR_$(add$Q$a3$)", + "optab_handler (ssadd_optab, $A)->insn_code = CODE_FOR_$(ssadd$Q$a3$)", + "optab_handler (usadd_optab, $A)->insn_code = CODE_FOR_$(usadd$Q$a3$)", "optab_handler (sub_optab, $A)->insn_code = CODE_FOR_$(sub$P$a3$)", "optab_handler (subv_optab, $A)->insn_code =\n\ optab_handler (sub_optab, $A)->insn_code = CODE_FOR_$(sub$F$a3$)", "optab_handler (subv_optab, $A)->insn_code = CODE_FOR_$(subv$I$a3$)", + "optab_handler (sub_optab, $A)->insn_code = CODE_FOR_$(sub$Q$a3$)", + "optab_handler (sssub_optab, $A)->insn_code = CODE_FOR_$(sssub$Q$a3$)", + "optab_handler (ussub_optab, $A)->insn_code = CODE_FOR_$(ussub$Q$a3$)", + "optab_handler (smul_optab, $A)->insn_code = CODE_FOR_$(mul$Q$a3$)", + "optab_handler (ssmul_optab, $A)->insn_code = CODE_FOR_$(ssmul$Q$a3$)", + "optab_handler (usmul_optab, $A)->insn_code = CODE_FOR_$(usmul$Q$a3$)", "optab_handler (smul_optab, $A)->insn_code = CODE_FOR_$(mul$P$a3$)", "optab_handler (smulv_optab, $A)->insn_code =\n\ optab_handler (smul_optab, $A)->insn_code = CODE_FOR_$(mul$F$a3$)", @@ -86,11 +101,18 @@ static const char * const optabs[] = "optab_handler (usmul_widen_optab, $B)->insn_code = CODE_FOR_$(usmul$a$b3$)$N", "optab_handler (smadd_widen_optab, $B)->insn_code = CODE_FOR_$(madd$a$b4$)$N", "optab_handler (umadd_widen_optab, $B)->insn_code = CODE_FOR_$(umadd$a$b4$)$N", + "optab_handler (ssmadd_widen_optab, $B)->insn_code = CODE_FOR_$(ssmadd$a$b4$)$N", + "optab_handler (usmadd_widen_optab, $B)->insn_code = CODE_FOR_$(usmadd$a$b4$)$N", "optab_handler (smsub_widen_optab, $B)->insn_code = CODE_FOR_$(msub$a$b4$)$N", "optab_handler (umsub_widen_optab, $B)->insn_code = CODE_FOR_$(umsub$a$b4$)$N", + "optab_handler (ssmsub_widen_optab, $B)->insn_code = CODE_FOR_$(ssmsub$a$b4$)$N", + "optab_handler (usmsub_widen_optab, $B)->insn_code = CODE_FOR_$(usmsub$a$b4$)$N", "optab_handler (sdiv_optab, $A)->insn_code = CODE_FOR_$(div$a3$)", + "optab_handler (ssdiv_optab, $A)->insn_code = CODE_FOR_$(ssdiv$Q$a3$)", "optab_handler (sdivv_optab, $A)->insn_code = CODE_FOR_$(div$V$I$a3$)", "optab_handler (udiv_optab, $A)->insn_code = CODE_FOR_$(udiv$I$a3$)", + "optab_handler (udiv_optab, $A)->insn_code = CODE_FOR_$(udiv$Q$a3$)", + "optab_handler (usdiv_optab, $A)->insn_code = CODE_FOR_$(usdiv$Q$a3$)", "optab_handler (sdivmod_optab, $A)->insn_code = CODE_FOR_$(divmod$a4$)", "optab_handler (udivmod_optab, $A)->insn_code = CODE_FOR_$(udivmod$a4$)", "optab_handler (smod_optab, $A)->insn_code = CODE_FOR_$(mod$a3$)", @@ -102,6 +124,8 @@ static const char * const optabs[] = "optab_handler (ior_optab, $A)->insn_code = CODE_FOR_$(ior$a3$)", "optab_handler (xor_optab, $A)->insn_code = CODE_FOR_$(xor$a3$)", "optab_handler (ashl_optab, $A)->insn_code = CODE_FOR_$(ashl$a3$)", + "optab_handler (ssashl_optab, $A)->insn_code = CODE_FOR_$(ssashl$Q$a3$)", + "optab_handler (usashl_optab, $A)->insn_code = CODE_FOR_$(usashl$Q$a3$)", "optab_handler (ashr_optab, $A)->insn_code = CODE_FOR_$(ashr$a3$)", "optab_handler (lshr_optab, $A)->insn_code = CODE_FOR_$(lshr$a3$)", "optab_handler (rotl_optab, $A)->insn_code = CODE_FOR_$(rotl$a3$)", @@ -116,6 +140,9 @@ static const char * const optabs[] = "optab_handler (negv_optab, $A)->insn_code =\n\ optab_handler (neg_optab, $A)->insn_code = CODE_FOR_$(neg$F$a2$)", "optab_handler (negv_optab, $A)->insn_code = CODE_FOR_$(negv$I$a2$)", + "optab_handler (neg_optab, $A)->insn_code = CODE_FOR_$(neg$Q$a2$)", + "optab_handler (ssneg_optab, $A)->insn_code = CODE_FOR_$(ssneg$Q$a2$)", + "optab_handler (usneg_optab, $A)->insn_code = CODE_FOR_$(usneg$Q$a2$)", "optab_handler (abs_optab, $A)->insn_code = CODE_FOR_$(abs$P$a2$)", "optab_handler (absv_optab, $A)->insn_code =\n\ optab_handler (abs_optab, $A)->insn_code = CODE_FOR_$(abs$F$a2$)", @@ -267,6 +294,7 @@ gen_insn (rtx insn) for (pindex = 0; pindex < ARRAY_SIZE (optabs); pindex++) { int force_float = 0, force_int = 0, force_partial_int = 0; + int force_fixed = 0; int force_consec = 0; int matches = 1; @@ -296,6 +324,9 @@ gen_insn (rtx insn) case 'F': force_float = 1; break; + case 'Q': + force_fixed = 1; + break; case 'V': break; case 'c': @@ -342,7 +373,16 @@ gen_insn (rtx insn) || mode_class[i] == MODE_FLOAT || mode_class[i] == MODE_DECIMAL_FLOAT || mode_class[i] == MODE_COMPLEX_FLOAT - || mode_class[i] == MODE_VECTOR_FLOAT)) + || mode_class[i] == MODE_VECTOR_FLOAT) + && (! force_fixed + || mode_class[i] == MODE_FRACT + || mode_class[i] == MODE_UFRACT + || mode_class[i] == MODE_ACCUM + || mode_class[i] == MODE_UACCUM + || mode_class[i] == MODE_VECTOR_FRACT + || mode_class[i] == MODE_VECTOR_UFRACT + || mode_class[i] == MODE_VECTOR_ACCUM + || mode_class[i] == MODE_VECTOR_UACCUM)) break; } @@ -353,7 +393,7 @@ gen_insn (rtx insn) else m2 = i, np += strlen (GET_MODE_NAME(i)); - force_int = force_partial_int = force_float = 0; + force_int = force_partial_int = force_float = force_fixed = 0; break; default: |