From 74fc61d171cc8e3ff649d9c926233e9e31df6e18 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Sun, 29 Aug 2004 11:25:19 +0000 Subject: [PATCH] mips.c (mips_init_builtins): Simplify. * config/mips/mips.c (mips_init_builtins): Simplify. Only create V2SF_type_node if it will be needed. From-SVN: r86718 --- gcc/ChangeLog | 5 ++ gcc/config/mips/mips.c | 187 ++++++++++------------------------------- 2 files changed, 49 insertions(+), 143 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 38f35be3da8..d2eb213cf45 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2004-08-29 Richard Sandiford + + * config/mips/mips.c (mips_init_builtins): Simplify. Only create + V2SF_type_node if it will be needed. + 2004-08-29 Richard Sandiford * config/mips/mips.h (MIPS_CMP_MOVT, MIPS_CMP_MOVF): Delete. diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 1ee3743a54f..3f2cb41249e 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -10449,175 +10449,76 @@ void mips_init_builtins (void) { const struct builtin_description *d; - size_t i; - tree v2sf_ftype_v2sf_v2sf; - tree v2sf_ftype_sf_sf; - tree sf_ftype_v2sf; - tree v2sf_ftype_v2sf; - tree int_ftype_v2sf_v2sf; - tree int_ftype_v2sf_v2sf_v2sf_v2sf; - tree v2sf_ftype_v2sf_v2sf_int; - tree int_ftype_sf_sf; - tree int_ftype_df_df; - tree sf_ftype_sf; - tree df_ftype_df; - tree sf_ftype_sf_sf; - tree df_ftype_df_df; - tree v2sf_ftype_v2sf_v2sf_v2sf_v2sf; - tree V2SF_type_node = build_vector_type_for_mode (float_type_node, V2SFmode); + tree types[(int) MIPS_MAX_FTYPE_MAX]; + tree V2SF_type_node; /* We have only builtins for -mpaired-single and -mips3d. */ if (!TARGET_PAIRED_SINGLE_FLOAT) return; - int_ftype_sf_sf - = build_function_type_list (integer_type_node, - float_type_node, float_type_node, - NULL_TREE); + V2SF_type_node = build_vector_type_for_mode (float_type_node, V2SFmode); - int_ftype_df_df - = build_function_type_list (integer_type_node, - double_type_node, double_type_node, - NULL_TREE); + types[MIPS_V2SF_FTYPE_V2SF] + = build_function_type_list (V2SF_type_node, V2SF_type_node, NULL_TREE); - v2sf_ftype_v2sf_v2sf - = build_function_type_list (V2SF_type_node, + types[MIPS_V2SF_FTYPE_V2SF_V2SF] + = build_function_type_list (V2SF_type_node, V2SF_type_node, V2SF_type_node, NULL_TREE); - v2sf_ftype_sf_sf - = build_function_type_list (V2SF_type_node, - float_type_node, float_type_node, - NULL_TREE); + types[MIPS_V2SF_FTYPE_V2SF_V2SF_INT] + = build_function_type_list (V2SF_type_node, + V2SF_type_node, V2SF_type_node, + integer_type_node, NULL_TREE); - sf_ftype_v2sf - = build_function_type_list (float_type_node, V2SF_type_node, NULL_TREE); + types[MIPS_V2SF_FTYPE_V2SF_V2SF_V2SF_V2SF] + = build_function_type_list (V2SF_type_node, + V2SF_type_node, V2SF_type_node, + V2SF_type_node, V2SF_type_node, NULL_TREE); - v2sf_ftype_v2sf - = build_function_type_list (V2SF_type_node, V2SF_type_node, NULL_TREE); + types[MIPS_V2SF_FTYPE_SF_SF] + = build_function_type_list (V2SF_type_node, + float_type_node, float_type_node, NULL_TREE); - int_ftype_v2sf_v2sf + types[MIPS_INT_FTYPE_V2SF_V2SF] = build_function_type_list (integer_type_node, V2SF_type_node, V2SF_type_node, NULL_TREE); - int_ftype_v2sf_v2sf_v2sf_v2sf + types[MIPS_INT_FTYPE_V2SF_V2SF_V2SF_V2SF] = build_function_type_list (integer_type_node, V2SF_type_node, V2SF_type_node, V2SF_type_node, V2SF_type_node, NULL_TREE); - v2sf_ftype_v2sf_v2sf_v2sf_v2sf - = build_function_type_list (V2SF_type_node, - V2SF_type_node, V2SF_type_node, - V2SF_type_node, V2SF_type_node, NULL_TREE); - - v2sf_ftype_v2sf_v2sf_int - = build_function_type_list (V2SF_type_node, - V2SF_type_node, V2SF_type_node, - integer_type_node, NULL_TREE); - - sf_ftype_sf - = build_function_type_list (float_type_node, - float_type_node, NULL_TREE); - - df_ftype_df - = build_function_type_list (double_type_node, - double_type_node, NULL_TREE); - - sf_ftype_sf_sf - = build_function_type_list (float_type_node, - float_type_node, float_type_node, - NULL_TREE); - - df_ftype_df_df - = build_function_type_list (double_type_node, - double_type_node, double_type_node, - NULL_TREE); - - for (i = 0, d = mips_bdesc; i < ARRAY_SIZE (mips_bdesc); i++, d++) - { - if ((d->target_flags & MASK_PAIRED_SINGLE) - && !TARGET_PAIRED_SINGLE_FLOAT) - continue; - - if ((d->target_flags & MASK_MIPS3D) - && !TARGET_MIPS3D) - continue; - - switch (d->ftype) - { - case MIPS_V2SF_FTYPE_V2SF_V2SF: - lang_hooks.builtin_function (d->name, v2sf_ftype_v2sf_v2sf, - d->code, BUILT_IN_MD, NULL, NULL_TREE); - break; - - case MIPS_V2SF_FTYPE_SF_SF: - lang_hooks.builtin_function (d->name, v2sf_ftype_sf_sf, - d->code, BUILT_IN_MD, NULL, NULL_TREE); - break; - - case MIPS_SF_FTYPE_V2SF: - lang_hooks.builtin_function (d->name, sf_ftype_v2sf, - d->code, BUILT_IN_MD, NULL, NULL_TREE); - break; - - case MIPS_V2SF_FTYPE_V2SF: - lang_hooks.builtin_function (d->name, v2sf_ftype_v2sf, - d->code, BUILT_IN_MD, NULL, NULL_TREE); - break; - - case MIPS_INT_FTYPE_V2SF_V2SF: - lang_hooks.builtin_function (d->name, int_ftype_v2sf_v2sf, - d->code, BUILT_IN_MD, NULL, NULL_TREE); - break; - - case MIPS_INT_FTYPE_V2SF_V2SF_V2SF_V2SF: - lang_hooks.builtin_function (d->name, int_ftype_v2sf_v2sf_v2sf_v2sf, - d->code, BUILT_IN_MD, NULL, NULL_TREE); - break; - - case MIPS_V2SF_FTYPE_V2SF_V2SF_INT: - lang_hooks.builtin_function (d->name, v2sf_ftype_v2sf_v2sf_int, - d->code, BUILT_IN_MD, NULL, NULL_TREE); - break; - - case MIPS_V2SF_FTYPE_V2SF_V2SF_V2SF_V2SF: - lang_hooks.builtin_function (d->name, v2sf_ftype_v2sf_v2sf_v2sf_v2sf, - d->code, BUILT_IN_MD, NULL, NULL_TREE); - break; + types[MIPS_INT_FTYPE_SF_SF] + = build_function_type_list (integer_type_node, + float_type_node, float_type_node, NULL_TREE); - case MIPS_SF_FTYPE_SF: - lang_hooks.builtin_function (d->name, sf_ftype_sf, - d->code, BUILT_IN_MD, NULL, NULL_TREE); - break; + types[MIPS_INT_FTYPE_DF_DF] + = build_function_type_list (integer_type_node, + double_type_node, double_type_node, NULL_TREE); - case MIPS_DF_FTYPE_DF: - lang_hooks.builtin_function (d->name, df_ftype_df, - d->code, BUILT_IN_MD, NULL, NULL_TREE); - break; + types[MIPS_SF_FTYPE_V2SF] + = build_function_type_list (float_type_node, V2SF_type_node, NULL_TREE); - case MIPS_INT_FTYPE_SF_SF: - lang_hooks.builtin_function (d->name, int_ftype_sf_sf, - d->code, BUILT_IN_MD, NULL, NULL_TREE); - break; + types[MIPS_SF_FTYPE_SF] + = build_function_type_list (float_type_node, + float_type_node, NULL_TREE); - case MIPS_INT_FTYPE_DF_DF: - lang_hooks.builtin_function (d->name, int_ftype_df_df, - d->code, BUILT_IN_MD, NULL, NULL_TREE); - break; + types[MIPS_SF_FTYPE_SF_SF] + = build_function_type_list (float_type_node, + float_type_node, float_type_node, NULL_TREE); - case MIPS_SF_FTYPE_SF_SF: - lang_hooks.builtin_function (d->name, sf_ftype_sf_sf, - d->code, BUILT_IN_MD, NULL, NULL_TREE); - break; + types[MIPS_DF_FTYPE_DF] + = build_function_type_list (double_type_node, + double_type_node, NULL_TREE); - case MIPS_DF_FTYPE_DF_DF: - lang_hooks.builtin_function (d->name, df_ftype_df_df, - d->code, BUILT_IN_MD, NULL, NULL_TREE); - break; + types[MIPS_DF_FTYPE_DF_DF] + = build_function_type_list (double_type_node, + double_type_node, double_type_node, NULL_TREE); - default: - break; - } - } + for (d = mips_bdesc; d < &mips_bdesc[ARRAY_SIZE (mips_bdesc)]; d++) + if ((d->target_flags & target_flags) == d->target_flags) + lang_hooks.builtin_function (d->name, types[d->ftype], + d->code, BUILT_IN_MD, NULL, NULL_TREE); } /* Expand a __builtin_mips_movt_*_ps() or __builtin_mips_movf_*_ps() -- 2.30.2