summaryrefslogtreecommitdiff
path: root/gcc/config/v850
diff options
context:
space:
mode:
authornickc <nickc@138bc75d-0d04-0410-961f-82ee72b054a4>2011-06-07 14:00:13 +0000
committernickc <nickc@138bc75d-0d04-0410-961f-82ee72b054a4>2011-06-07 14:00:13 +0000
commitf5ec651645d37432a89d8cba8b36483a29a50fc8 (patch)
treef83009af2ecd65b2c59c14143ee7ca574f36373d /gcc/config/v850
parent1af0124d4d6507b50437fb30c19b9d4aab6f3779 (diff)
downloadgcc-f5ec651645d37432a89d8cba8b36483a29a50fc8.tar.gz
* config.gcc: Unify V850 architecture options and add support for
newer V850 architectures. * config/v850/t-v850e: Delete. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@174744 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/v850')
-rw-r--r--gcc/config/v850/t-v850e112
-rw-r--r--gcc/config/v850/v850.c30
-rw-r--r--gcc/config/v850/v850.h4
-rw-r--r--gcc/config/v850/v850.md62
4 files changed, 80 insertions, 128 deletions
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
-# <http://www.gnu.org/licenses/>.
-
-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?