From 1dcad079712bdc8e49d6bc2bcecc0034a4691402 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Tue, 7 Jun 2011 14:00:13 +0000 Subject: [PATCH] config.gcc: Unify V850 architecture options and add support for newer V850 architectures. * config.gcc: Unify V850 architecture options and add support for newer V850 architectures. * config/v850/t-v850e: Delete. From-SVN: r174744 --- gcc/ChangeLog | 6 +++ gcc/config.gcc | 69 ++++++++++--------------- gcc/config/v850/t-v850e | 112 ---------------------------------------- gcc/config/v850/v850.c | 30 +++++++++++ gcc/config/v850/v850.h | 4 +- gcc/config/v850/v850.md | 62 +++++++++++++++++----- 6 files changed, 114 insertions(+), 169 deletions(-) delete mode 100644 gcc/config/v850/t-v850e diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4dd12e31dbc..812b9be768f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-06-07 Nick Clifton + + * config.gcc: Unify V850 architecture options and add support for + newer V850 architectures. + * config/v850/t-v850e: Delete. + 2011-06-07 Richard Guenther * tree.c (build_common_tree_nodes): Also initialize size_type_node. diff --git a/gcc/config.gcc b/gcc/config.gcc index 624129bf424..5d88d1bf60d 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -2559,46 +2559,32 @@ spu-*-elf*) c_target_objs="${c_target_objs} spu-c.o" cxx_target_objs="${cxx_target_objs} spu-c.o" ;; -v850e1-*-*) - target_cpu_default="TARGET_CPU_v850e1" + +v850*-*-*) + case ${target} in + v850e2v3-*-*) + target_cpu_default="TARGET_CPU_v850e2v3" + ;; + v850e2-*-*) + target_cpu_default="TARGET_CPU_v850e2" + ;; + v850e1-*-* | v850es-*-*) + target_cpu_default="TARGET_CPU_v850e1" + ;; + v850e-*-*) + target_cpu_default="TARGET_CPU_v850e" + ;; + v850-*-*) + target_cpu_default="TARGET_CPU_generic" + ;; + esac tm_file="dbxelf.h elfos.h newlib-stdint.h v850/v850.h" tm_p_file=v850/v850-protos.h - tmake_file=v850/t-v850e - md_file=v850/v850.md - extra_modes=v850/v850-modes.def - out_file=v850/v850.c - extra_options="${extra_options} v850/v850.opt" - if test x$stabs = xyes - then - tm_file="${tm_file} dbx.h" - fi - use_collect2=no - c_target_objs="v850-c.o" - cxx_target_objs="v850-c.o" - use_gcc_stdint=wrap - ;; -v850e-*-*) - target_cpu_default="TARGET_CPU_v850e" - tm_file="dbxelf.h elfos.h newlib-stdint.h v850/v850.h" - tm_p_file=v850/v850-protos.h - tmake_file=v850/t-v850e - md_file=v850/v850.md - extra_modes=v850/v850-modes.def - out_file=v850/v850.c - extra_options="${extra_options} v850/v850.opt" - if test x$stabs = xyes - then - tm_file="${tm_file} dbx.h" - fi - use_collect2=no - c_target_objs="v850-c.o" - cxx_target_objs="v850-c.o" - use_gcc_stdint=wrap - ;; -v850-*-*) - target_cpu_default="TARGET_CPU_generic" - tm_file="dbxelf.h elfos.h newlib-stdint.h ${tm_file}" tmake_file=v850/t-v850 + md_file=v850/v850.md + extra_modes=v850/v850-modes.def + out_file=v850/v850.c + extra_options="${extra_options} v850/v850.opt" if test x$stabs = xyes then tm_file="${tm_file} dbx.h" @@ -3493,7 +3479,7 @@ case "${target}" in v850*-*-*) supported_defaults=cpu case ${with_cpu} in - "" | v850e | v850e1) + "" | v850e | v850e1 | v850e2 | v850es | v850e2v3) # OK ;; *) @@ -3621,14 +3607,15 @@ case ${target} in ;; v850*-*-*) - # FIXME: The v850 is "special" in that it does not support - # runtime CPU selection, only --with-cpu. case "x$with_cpu" in x) ;; - xv850e) + xv850e | xv850e1 | xv850e2 | xv850e2v3) target_cpu_default2="TARGET_CPU_$with_cpu" ;; + xv850es) + target_cpu_default2="TARGET_CPU_v850e1" + ;; esac ;; esac diff --git a/gcc/config/v850/t-v850e b/gcc/config/v850/t-v850e deleted file mode 100644 index 1eb76852081..00000000000 --- a/gcc/config/v850/t-v850e +++ /dev/null @@ -1,112 +0,0 @@ -# Copyright (C) 2003, 2008, 2009, 2010 Free Software Foundation, Inc. -# -# This file is part of GCC. -# -# GCC is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GCC is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GCC; see the file COPYING3. If not see -# . - -LIB1ASMSRC = v850/lib1funcs.asm -LIB1ASMFUNCS = _mulsi3 \ - _divsi3 \ - _udivsi3 \ - _modsi3 \ - _umodsi3 \ - _save_2 \ - _save_20 \ - _save_21 \ - _save_22 \ - _save_23 \ - _save_24 \ - _save_25 \ - _save_26 \ - _save_27 \ - _save_28 \ - _save_29 \ - _save_2c \ - _save_20c \ - _save_21c \ - _save_22c \ - _save_23c \ - _save_24c \ - _save_25c \ - _save_26c \ - _save_27c \ - _save_28c \ - _save_29c \ - _save_31c \ - _save_interrupt \ - _save_all_interrupt \ - _callt_save_20 \ - _callt_save_21 \ - _callt_save_22 \ - _callt_save_23 \ - _callt_save_24 \ - _callt_save_25 \ - _callt_save_26 \ - _callt_save_27 \ - _callt_save_28 \ - _callt_save_29 \ - _callt_save_20c \ - _callt_save_21c \ - _callt_save_22c \ - _callt_save_23c \ - _callt_save_24c \ - _callt_save_25c \ - _callt_save_26c \ - _callt_save_27c \ - _callt_save_28c \ - _callt_save_29c \ - _callt_save_31c \ - _callt_save_interrupt \ - _callt_save_all_interrupt \ - _callt_save_r2_r29 \ - _callt_save_r2_r31 \ - _negdi2 \ - _cmpdi2 \ - _ucmpdi2 \ - _muldi3 - -# We want fine grained libraries, so use the new code to build the -# floating point emulation libraries. -FPBIT = fp-bit.c -DPBIT = dp-bit.c - -dp-bit.c: $(srcdir)/config/fp-bit.c - echo '#ifdef __LITTLE_ENDIAN__' > dp-bit.c - echo '#define FLOAT_BIT_ORDER_MISMATCH' >>dp-bit.c - echo '#endif' >> dp-bit.c - cat $(srcdir)/config/fp-bit.c >> dp-bit.c - -fp-bit.c: $(srcdir)/config/fp-bit.c - echo '#define FLOAT' > fp-bit.c - echo '#ifdef __LITTLE_ENDIAN__' >> fp-bit.c - echo '#define FLOAT_BIT_ORDER_MISMATCH' >>fp-bit.c - echo '#endif' >> fp-bit.c - cat $(srcdir)/config/fp-bit.c >> fp-bit.c - -# Create target-specific versions of the libraries -MULTILIB_OPTIONS = mv850 -MULTILIB_DIRNAMES = v850 -INSTALL_LIBGCC = install-multilib - -TCFLAGS = -mno-app-regs -msmall-sld -Wa,-mwarn-signed-overflow -Wa,-mwarn-unsigned-overflow - -v850-c.o: $(srcdir)/config/v850/v850-c.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \ - $(TM_H) $(CPPLIB_H) $(TREE_H) $(C_PRAGMA_H) $(GGC_H) $(TM_P_H) - $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ - $(srcdir)/config/v850/v850-c.c - -# Local Variables: -# mode: Makefile -# End: diff --git a/gcc/config/v850/v850.c b/gcc/config/v850/v850.c index 45dad92c356..cb31f9aa381 100644 --- a/gcc/config/v850/v850.c +++ b/gcc/config/v850/v850.c @@ -118,9 +118,18 @@ v850_handle_option (struct gcc_options *opts, case OPT_mv850e: case OPT_mv850e1: + case OPT_mv850es: opts->x_target_flags &= ~(MASK_CPU ^ MASK_V850E); return true; + case OPT_mv850e2: + opts->x_target_flags &= ~(MASK_CPU ^ MASK_V850E2); + return true; + + case OPT_mv850e2v3: + opts->x_target_flags &= ~(MASK_CPU ^ MASK_V850E2V3); + return true; + case OPT_mtda_: v850_handle_memory_option (SMALL_MEMORY_TDA, opts, decoded->orig_option_with_args_text, @@ -3130,6 +3139,23 @@ v850_legitimate_constant_p (enum machine_mode mode ATTRIBUTE_UNUSED, rtx x) && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT && !CONST_OK_FOR_K (INTVAL (XEXP (XEXP (x, 0), 1))))); } + +static int +v850_memory_move_cost (enum machine_mode mode, bool in) +{ + switch (GET_MODE_SIZE (mode)) + { + case 0: + return in ? 24 : 8; + case 1: + case 2: + case 3: + case 4: + return in ? 6 : 2; + default: + return (GET_MODE_SIZE (mode) / 2) * (in ? 3 : 1); + } +} /* V850 specific attributes. */ @@ -3151,6 +3177,10 @@ static const struct attribute_spec v850_attribute_table[] = }; /* Initialize the GCC target structure. */ + +#undef TARGET_MEMORY_MOVE_COST +#define TARGET_MEMORY_MOVE_COST v850_memory_move_cost + #undef TARGET_ASM_ALIGNED_HI_OP #define TARGET_ASM_ALIGNED_HI_OP "\t.hword\t" diff --git a/gcc/config/v850/v850.h b/gcc/config/v850/v850.h index ea3bcbb97ed..6595a2e65cb 100644 --- a/gcc/config/v850/v850.h +++ b/gcc/config/v850/v850.h @@ -113,7 +113,7 @@ extern GTY(()) rtx v850_compare_op1; builtin_define ("__EP__"); \ } while(0) -#define MASK_CPU (MASK_V850 | MASK_V850E) +#define MASK_CPU (MASK_V850 | MASK_V850E | MASK_V850E1 | MASK_V850E2 | MASK_V850E2V3) /* Target machine storage layout */ @@ -156,7 +156,7 @@ extern GTY(()) rtx v850_compare_op1; /* Allocation boundary (in *bits*) for the code of a function. 16 is the minimum boundary; 32 would give better performance. */ -#define FUNCTION_BOUNDARY 16 +#define FUNCTION_BOUNDARY (optimize_size ? 16 : 32) /* No data type wants to be aligned rounder than this. */ #define BIGGEST_ALIGNMENT 32 diff --git a/gcc/config/v850/v850.md b/gcc/config/v850/v850.md index 88e42c65e90..cae929da794 100644 --- a/gcc/config/v850/v850.md +++ b/gcc/config/v850/v850.md @@ -232,7 +232,7 @@ (define_insn "*movsi_high" [(set (match_operand:SI 0 "register_operand" "=r") - (high:SI (match_operand 1 "" "")))] + (high:SI (match_operand 1 "immediate_operand" "i")))] "" "movhi hi(%1),%.,%0" [(set_attr "length" "4") @@ -543,8 +543,13 @@ (mod:SI (match_dup 1) (match_dup 2))) (clobber (reg:CC CC_REGNUM))] - "TARGET_V850E" - "div %2,%0,%3" + "TARGET_V850E || TARGET_V850E2_ALL" + { + if (TARGET_V850E2_ALL) + return "divq %2,%0,%3"; + else + return "div %2,%0,%3"; + } [(set_attr "length" "4") (set_attr "cc" "clobber") (set_attr "type" "div")]) @@ -557,8 +562,13 @@ (umod:SI (match_dup 1) (match_dup 2))) (clobber (reg:CC CC_REGNUM))] - "TARGET_V850E" - "divu %2,%0,%3" + "TARGET_V850E || TARGET_V850E2_ALL" + { + if (TARGET_V850E2_ALL) + return "divqu %2,%0,%3"; + else + return "divu %2,%0,%3"; + } [(set_attr "length" "4") (set_attr "cc" "clobber") (set_attr "type" "div")]) @@ -574,7 +584,7 @@ (mod:HI (match_dup 1) (match_dup 2))) (clobber (reg:CC CC_REGNUM))] - "TARGET_V850E" + "TARGET_V850E || TARGET_V850E2_ALL" "divh %2,%0,%3" [(set_attr "length" "4") (set_attr "cc" "clobber") @@ -591,7 +601,7 @@ (umod:HI (match_dup 1) (match_dup 2))) (clobber (reg:CC CC_REGNUM))] - "TARGET_V850E" + "TARGET_V850E || TARGET_V850E2_ALL" "zxh %0 ; divhu %2,%0,%3" [(set_attr "length" "4") (set_attr "cc" "clobber") @@ -1501,7 +1511,7 @@ ;; EXTEND INSTRUCTIONS ;; ---------------------------------------------------------------------- -(define_insn "" +(define_insn "*zero_extendhisi2_v850e" [(set (match_operand:SI 0 "register_operand" "=r,r,r,r") (zero_extend:SI (match_operand:HI 1 "nonimmediate_operand" "0,r,T,m"))) @@ -1515,17 +1525,29 @@ [(set_attr "length" "2,4,2,4") (set_attr "cc" "none_0hit,set_zn,none_0hit,none_0hit")]) -(define_insn "zero_extendhisi2" +(define_insn "*zero_extendhisi2_v850" [(set (match_operand:SI 0 "register_operand" "=r") (zero_extend:SI (match_operand:HI 1 "register_operand" "r"))) - (clobber (reg:CC CC_REGNUM))] + (clobber (reg:CC CC_REGNUM))] ;; A lie, but we have to match the expander "" "andi 65535,%1,%0" [(set_attr "length" "4") (set_attr "cc" "set_zn")]) -(define_insn "" +(define_expand "zero_extendhisi2" + [(parallel [(set (match_operand:SI 0 "register_operand") + (zero_extend:SI + (match_operand:HI 1 "nonimmediate_operand"))) + (clobber (reg:CC CC_REGNUM))])] + "" + { + if (! (TARGET_V850E || TARGET_V850E2_ALL)) + operands[1] = force_reg (HImode, operands[1]); + } +) + +(define_insn "*zero_extendqisi2_v850e" [(set (match_operand:SI 0 "register_operand" "=r,r,r,r") (zero_extend:SI (match_operand:QI 1 "nonimmediate_operand" "0,r,T,m"))) @@ -1539,16 +1561,28 @@ [(set_attr "length" "2,4,2,4") (set_attr "cc" "none_0hit,set_zn,none_0hit,none_0hit")]) -(define_insn "zero_extendqisi2" +(define_insn "*zero_extendqisi2_v850" [(set (match_operand:SI 0 "register_operand" "=r") (zero_extend:SI - (match_operand:QI 1 "register_operand" "r"))) - (clobber (reg:CC CC_REGNUM))] + (match_operand:QI 1 "register_operand" "r"))) + (clobber (reg:CC CC_REGNUM))] ;; A lie, but we have to match the expander "" "andi 255,%1,%0" [(set_attr "length" "4") (set_attr "cc" "set_zn")]) +(define_expand "zero_extendqisi2" + [(parallel [(set (match_operand:SI 0 "register_operand") + (zero_extend:SI + (match_operand:QI 1 "nonimmediate_operand"))) + (clobber (reg:CC CC_REGNUM))])] + "" + { + if (! (TARGET_V850E || TARGET_V850E2_ALL)) + operands[1] = force_reg (QImode, operands[1]); + } +) + ;;- sign extension instructions ;; ??? The extendhisi2 pattern should not emit shifts for v850e?