summaryrefslogtreecommitdiff
path: root/gcc/config/avr
diff options
context:
space:
mode:
authordenisc <denisc@138bc75d-0d04-0410-961f-82ee72b054a4>2006-06-18 18:14:06 +0000
committerdenisc <denisc@138bc75d-0d04-0410-961f-82ee72b054a4>2006-06-18 18:14:06 +0000
commit0aab73c229b8a0e1287facc8c8f541493250b7a5 (patch)
tree2b05d8367382dc31146b4d5d39a0a4e06357c077 /gcc/config/avr
parent98ac66519c2a7018925df2a08017034c5cfbd487 (diff)
downloadgcc-0aab73c229b8a0e1287facc8c8f541493250b7a5.tar.gz
* config/avr/avr.h (avr_have_movw_lpmx_p): Declare.
(TARGET_CPU_CPP_BUILTINS): Add __AVR_HAVE_MOVW__ and __AVR_HAVE_LPMX__. (AVR_HAVE_MOVW) Define. (ASSEMBLER_DIALECT): Use AVR_HAVE_MOVW. (ASM_SPEC): Add avr25. (LINK_SPEC): Add avr25. * config/avr/avr.c (avr_have_movw_lpmx_p): Add. (base_arch_s): Add new member 'have_movw_lpmx'. (avr_arch_types): Init 'have_movw_lpmx'. (avr_mcu_types): Add 'avr25'. Move attiny13, attiny2313, attiny24, attiny44, attiny84, attiny25, attiny45, attiny85, attiny261, attiny461, attiny861 and at86rf401 in 'avr25' arhitecture. (avr_override_options): Init 'avr_have_movw_lpmx_p'. (output_movhi, output_movsisf, ashlsi3_out, avr_rtx_costs): Use AVR_HAVE_MOVW. (avr_file_start): Do not output '.arh' derective. * config/avr/libgcc.S (mov_l): Use __AVR_HAVE_MOVW__. (__do_copy_data): Use __AVR_HAVE_LPMX__. * config/avr/avr.md (mcu_enhanced): Delete. (mcu_have_movw): Define. (negsi2, extendhisi2, zero_extendhisi2): Use 'mcu_have_movw'. (call_insn, call_value_insn): Use 'call_insn' and __AVR_HAVE_MOVW__. * config/avr/t-avr(MULTILIB_OPTIONS, MULTILIB_DIRNAMES): Add avr25. (MULTILIB_MATCHES): Add attiny13, attiny2313, attiny24, attiny44, attiny84, attiny25, attiny45, attiny85, attiny261, attiny461, attiny861 and at86rf401 devices. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@114758 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config/avr')
-rw-r--r--gcc/config/avr/avr.c75
-rw-r--r--gcc/config/avr/avr.h13
-rw-r--r--gcc/config/avr/avr.md18
-rw-r--r--gcc/config/avr/t-avr16
4 files changed, 74 insertions, 48 deletions
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
index 2f981dd9738..66ec146a36e 100644
--- a/gcc/config/avr/avr.c
+++ b/gcc/config/avr/avr.c
@@ -126,20 +126,25 @@ int avr_enhanced_p = 0;
/* Assembler only. */
int avr_asm_only_p = 0;
+/* Core have 'MOVW' and 'LPM Rx,Z' instructions. */
+int avr_have_movw_lpmx_p = 0;
+
struct base_arch_s {
int asm_only;
int enhanced;
int mega;
+ int have_movw_lpmx;
const char *const macro;
};
static const struct base_arch_s avr_arch_types[] = {
- { 1, 0, 0, NULL }, /* unknown device specified */
- { 1, 0, 0, "__AVR_ARCH__=1" },
- { 0, 0, 0, "__AVR_ARCH__=2" },
- { 0, 0, 1, "__AVR_ARCH__=3" },
- { 0, 1, 0, "__AVR_ARCH__=4" },
- { 0, 1, 1, "__AVR_ARCH__=5" }
+ { 1, 0, 0, 0, NULL }, /* unknown device specified */
+ { 1, 0, 0, 0, "__AVR_ARCH__=1" },
+ { 0, 0, 0, 0, "__AVR_ARCH__=2" },
+ { 0, 0, 1, 0, "__AVR_ARCH__=3" },
+ { 0, 1, 0, 1, "__AVR_ARCH__=4" },
+ { 0, 1, 1, 1, "__AVR_ARCH__=5" },
+ { 0, 0, 0, 1, "__AVR_ARCH__=25"}
};
struct mcu_type_s {
@@ -173,18 +178,19 @@ static const struct mcu_type_s avr_mcu_types[] = {
{ "at90c8534", 2, "__AVR_AT90C8534__" },
{ "at90s8535", 2, "__AVR_AT90S8535__" },
/* Classic + MOVW, <= 8K. */
- { "attiny13", 2, "__AVR_ATtiny13__" },
- { "attiny2313", 2, "__AVR_ATtiny2313__" },
- { "attiny24", 2, "__AVR_ATtiny24__" },
- { "attiny44", 2, "__AVR_ATtiny44__" },
- { "attiny84", 2, "__AVR_ATtiny84__" },
- { "attiny25", 2, "__AVR_ATtiny25__" },
- { "attiny45", 2, "__AVR_ATtiny45__" },
- { "attiny85", 2, "__AVR_ATtiny85__" },
- { "attiny261", 2, "__AVR_ATtiny261__" },
- { "attiny461", 2, "__AVR_ATtiny461__" },
- { "attiny861", 2, "__AVR_ATtiny861__" },
- { "at86rf401", 2, "__AVR_AT86RF401__" },
+ { "avr25", 6, NULL },
+ { "attiny13", 6, "__AVR_ATtiny13__" },
+ { "attiny2313", 6, "__AVR_ATtiny2313__" },
+ { "attiny24", 6, "__AVR_ATtiny24__" },
+ { "attiny44", 6, "__AVR_ATtiny44__" },
+ { "attiny84", 6, "__AVR_ATtiny84__" },
+ { "attiny25", 6, "__AVR_ATtiny25__" },
+ { "attiny45", 6, "__AVR_ATtiny45__" },
+ { "attiny85", 6, "__AVR_ATtiny85__" },
+ { "attiny261", 6, "__AVR_ATtiny261__" },
+ { "attiny461", 6, "__AVR_ATtiny461__" },
+ { "attiny861", 6, "__AVR_ATtiny861__" },
+ { "at86rf401", 6, "__AVR_AT86RF401__" },
/* Classic, > 8K. */
{ "avr3", 3, NULL },
{ "atmega103", 3, "__AVR_ATmega103__" },
@@ -319,6 +325,7 @@ avr_override_options (void)
avr_asm_only_p = base->asm_only;
avr_enhanced_p = base->enhanced;
avr_mega_p = base->mega;
+ avr_have_movw_lpmx_p = base->have_movw_lpmx;
avr_base_arch_macro = base->macro;
avr_extra_arch_macro = t->macro;
@@ -1656,7 +1663,7 @@ output_movhi (rtx insn, rtx operands[], int *l)
AS2 (in,%B0,__SP_H__));
}
- if (AVR_ENHANCED)
+ if (AVR_HAVE_MOVW)
{
*l = 1;
return (AS2 (movw,%0,%1));
@@ -2325,7 +2332,7 @@ output_movsisf(rtx insn, rtx operands[], int *l)
{
if (true_regnum (dest) > true_regnum (src))
{
- if (AVR_ENHANCED)
+ if (AVR_HAVE_MOVW)
{
*l = 2;
return (AS2 (movw,%C0,%C1) CR_TAB
@@ -2339,7 +2346,7 @@ output_movsisf(rtx insn, rtx operands[], int *l)
}
else
{
- if (AVR_ENHANCED)
+ if (AVR_HAVE_MOVW)
{
*l = 2;
return (AS2 (movw,%A0,%A1) CR_TAB
@@ -2366,7 +2373,7 @@ output_movsisf(rtx insn, rtx operands[], int *l)
if (GET_CODE (src) == CONST_INT)
{
const char *const clr_op0 =
- AVR_ENHANCED ? (AS1 (clr,%A0) CR_TAB
+ AVR_HAVE_MOVW ? (AS1 (clr,%A0) CR_TAB
AS1 (clr,%B0) CR_TAB
AS2 (movw,%C0,%A0))
: (AS1 (clr,%A0) CR_TAB
@@ -2376,20 +2383,20 @@ output_movsisf(rtx insn, rtx operands[], int *l)
if (src == const0_rtx) /* mov r,L */
{
- *l = AVR_ENHANCED ? 3 : 4;
+ *l = AVR_HAVE_MOVW ? 3 : 4;
return clr_op0;
}
else if (src == const1_rtx)
{
if (!real_l)
output_asm_insn (clr_op0, operands);
- *l = AVR_ENHANCED ? 4 : 5;
+ *l = AVR_HAVE_MOVW ? 4 : 5;
return AS1 (inc,%A0);
}
else if (src == constm1_rtx)
{
/* Immediate constants -1 to any register */
- if (AVR_ENHANCED)
+ if (AVR_HAVE_MOVW)
{
*l = 4;
return (AS1 (clr,%A0) CR_TAB
@@ -2410,7 +2417,7 @@ output_movsisf(rtx insn, rtx operands[], int *l)
if (bit_nr >= 0)
{
- *l = AVR_ENHANCED ? 5 : 6;
+ *l = AVR_HAVE_MOVW ? 5 : 6;
if (!real_l)
{
output_asm_insn (clr_op0, operands);
@@ -3301,7 +3308,7 @@ ashlsi3_out (rtx insn, rtx operands[], int *len)
if (INTVAL (operands[2]) < 32)
break;
- if (AVR_ENHANCED)
+ if (AVR_HAVE_MOVW)
return *len = 3, (AS1 (clr,%D0) CR_TAB
AS1 (clr,%C0) CR_TAB
AS2 (movw,%A0,%C0));
@@ -3338,7 +3345,7 @@ ashlsi3_out (rtx insn, rtx operands[], int *len)
int reg0 = true_regnum (operands[0]);
int reg1 = true_regnum (operands[1]);
*len = 4;
- if (AVR_ENHANCED && (reg0 + 2 != reg1))
+ if (AVR_HAVE_MOVW && (reg0 + 2 != reg1))
{
*len = 3;
return (AS2 (movw,%C0,%A1) CR_TAB
@@ -3685,7 +3692,7 @@ ashrsi3_out (rtx insn, rtx operands[], int *len)
int reg0 = true_regnum (operands[0]);
int reg1 = true_regnum (operands[1]);
*len=6;
- if (AVR_ENHANCED && (reg0 != reg1 + 2))
+ if (AVR_HAVE_MOVW && (reg0 != reg1 + 2))
{
*len = 5;
return (AS2 (movw,%A0,%C1) CR_TAB
@@ -3737,7 +3744,7 @@ ashrsi3_out (rtx insn, rtx operands[], int *len)
/* fall through */
case 31:
- if (AVR_ENHANCED)
+ if (AVR_HAVE_MOVW)
return *len = 4, (AS1 (lsl,%D0) CR_TAB
AS2 (sbc,%A0,%A0) CR_TAB
AS2 (mov,%B0,%A0) CR_TAB
@@ -4133,7 +4140,7 @@ lshrsi3_out (rtx insn, rtx operands[], int *len)
if (INTVAL (operands[2]) < 32)
break;
- if (AVR_ENHANCED)
+ if (AVR_HAVE_MOVW)
return *len = 3, (AS1 (clr,%D0) CR_TAB
AS1 (clr,%C0) CR_TAB
AS2 (movw,%A0,%C0));
@@ -4167,7 +4174,7 @@ lshrsi3_out (rtx insn, rtx operands[], int *len)
int reg0 = true_regnum (operands[0]);
int reg1 = true_regnum (operands[1]);
*len = 4;
- if (AVR_ENHANCED && (reg0 != reg1 + 2))
+ if (AVR_HAVE_MOVW && (reg0 != reg1 + 2))
{
*len = 3;
return (AS2 (movw,%A0,%C1) CR_TAB
@@ -4813,7 +4820,7 @@ avr_file_start (void)
default_file_start ();
- fprintf (asm_out_file, "\t.arch %s\n", avr_mcu_name);
+/* fprintf (asm_out_file, "\t.arch %s\n", avr_mcu_name);*/
fputs ("__SREG__ = 0x3f\n"
"__SP_H__ = 0x3e\n"
"__SP_L__ = 0x3d\n", asm_out_file);
@@ -5301,7 +5308,7 @@ avr_rtx_costs (rtx x, int code, int outer_code, int *total)
*total = COSTS_N_INSNS (optimize_size ? 7 : 8);
break;
case 31:
- *total = COSTS_N_INSNS (AVR_ENHANCED ? 4 : 5);
+ *total = COSTS_N_INSNS (AVR_HAVE_MOVW ? 4 : 5);
break;
default:
*total = COSTS_N_INSNS (optimize_size ? 7 : 113);
diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h
index b5931da95a2..236dae79d6c 100644
--- a/gcc/config/avr/avr.h
+++ b/gcc/config/avr/avr.h
@@ -31,6 +31,10 @@ Boston, MA 02110-1301, USA. */
builtin_define (avr_base_arch_macro); \
if (avr_extra_arch_macro) \
builtin_define (avr_extra_arch_macro); \
+ if (avr_have_movw_lpmx_p) \
+ builtin_define ("__AVR_HAVE_MOVW__"); \
+ if (avr_have_movw_lpmx_p) \
+ builtin_define ("__AVR_HAVE_LPMX__"); \
if (avr_asm_only_p) \
builtin_define ("__AVR_ASM_ONLY__"); \
if (avr_enhanced_p) \
@@ -47,12 +51,14 @@ extern const char *avr_extra_arch_macro;
extern int avr_mega_p;
extern int avr_enhanced_p;
extern int avr_asm_only_p;
+extern int avr_have_movw_lpmx_p;
#ifndef IN_LIBGCC2
extern GTY(()) section *progmem_section;
#endif
#define AVR_MEGA (avr_mega_p && !TARGET_SHORT_CALLS)
#define AVR_ENHANCED (avr_enhanced_p)
+#define AVR_HAVE_MOVW (avr_have_movw_lpmx_p)
#define TARGET_VERSION fprintf (stderr, " (GNU assembler syntax)");
@@ -626,7 +632,7 @@ sprintf (STRING, "*.%s%lu", PREFIX, (unsigned long)(NUM))
#define USER_LABEL_PREFIX ""
-#define ASSEMBLER_DIALECT AVR_ENHANCED
+#define ASSEMBLER_DIALECT AVR_HAVE_MOVW
#define ASM_OUTPUT_REG_PUSH(STREAM, REGNO) \
{ \
@@ -718,7 +724,8 @@ extern int avr_case_values_threshold;
/* A C string constant that tells the GCC drvier program options to
pass to `cc1plus'. */
-#define ASM_SPEC "%{mmcu=*:-mmcu=%*}"
+#define ASM_SPEC "%{mmcu=avr25:-mmcu=avr2;\
+mmcu=*:-mmcu=%*}"
#define LINK_SPEC " %{!mmcu*:-m avr2}\
%{mmcu=at90s1200|\
@@ -816,7 +823,7 @@ extern int avr_case_values_threshold;
%{mmcu=at90s8535:crts8535.o%s} \
%{mmcu=at86rf401:crt86401.o%s} \
%{mmcu=attiny13:crttn13.o%s} \
-%{mmcu=attiny2313:crttn2313.o%s} \
+%{mmcu=attiny2313|mmcu=avr25:crttn2313.o%s} \
%{mmcu=attiny24:crttn24.o%s} \
%{mmcu=attiny44:crttn44.o%s} \
%{mmcu=attiny84:crttn84.o%s} \
diff --git a/gcc/config/avr/avr.md b/gcc/config/avr/avr.md
index 97a000d5bb5..35b86cc014d 100644
--- a/gcc/config/avr/avr.md
+++ b/gcc/config/avr/avr.md
@@ -57,8 +57,8 @@
(define_attr "type" "branch,branch1,arith,xcall"
(const_string "arith"))
-(define_attr "mcu_enhanced" "yes,no"
- (const (if_then_else (symbol_ref "AVR_ENHANCED")
+(define_attr "mcu_have_movw" "yes,no"
+ (const (if_then_else (symbol_ref "AVR_HAVE_MOVW")
(const_string "yes")
(const_string "no"))))
@@ -1455,7 +1455,7 @@
[(set_attr_alternative "length"
[(const_int 7)
(const_int 8)
- (if_then_else (eq_attr "mcu_enhanced" "yes")
+ (if_then_else (eq_attr "mcu_have_movw" "yes")
(const_int 7)
(const_int 8))])
(set_attr "cc" "set_czn,set_n,set_czn")])
@@ -1533,7 +1533,7 @@
{mov %A0,%A1\;mov %B0,%B1|movw %A0,%A1}\;clr %C0\;sbrc %B0,7\;com %C0\;mov %D0,%C0"
[(set_attr_alternative "length"
[(const_int 4)
- (if_then_else (eq_attr "mcu_enhanced" "yes")
+ (if_then_else (eq_attr "mcu_have_movw" "yes")
(const_int 5)
(const_int 6))])
(set_attr "cc" "set_n,set_n")])
@@ -1570,7 +1570,7 @@
{mov %A0,%A1\;mov %B0,%B1|movw %A0,%A1}\;clr %C0\;clr %D0"
[(set_attr_alternative "length"
[(const_int 2)
- (if_then_else (eq_attr "mcu_enhanced" "yes")
+ (if_then_else (eq_attr "mcu_have_movw" "yes")
(const_int 3)
(const_int 4))])
(set_attr "cc" "set_n,set_n")])
@@ -2104,7 +2104,7 @@
return \"icall\";
else if (which_alternative==1)
{
- if (AVR_ENHANCED)
+ if (AVR_HAVE_MOVW)
return (AS2 (movw, r30, %0) CR_TAB
\"icall\");
else
@@ -2121,7 +2121,7 @@
[(set_attr "cc" "clobber,clobber,clobber,clobber")
(set_attr_alternative "length"
[(const_int 1)
- (if_then_else (eq_attr "mcu_enhanced" "yes")
+ (if_then_else (eq_attr "mcu_have_movw" "yes")
(const_int 2)
(const_int 3))
(if_then_else (eq_attr "mcu_mega" "yes")
@@ -2141,7 +2141,7 @@
return \"icall\";
else if (which_alternative==1)
{
- if (AVR_ENHANCED)
+ if (AVR_HAVE_MOVW)
return (AS2 (movw, r30, %1) CR_TAB
\"icall\");
else
@@ -2158,7 +2158,7 @@
[(set_attr "cc" "clobber,clobber,clobber,clobber")
(set_attr_alternative "length"
[(const_int 1)
- (if_then_else (eq_attr "mcu_enhanced" "yes")
+ (if_then_else (eq_attr "mcu_have_movw" "yes")
(const_int 2)
(const_int 3))
(if_then_else (eq_attr "mcu_mega" "yes")
diff --git a/gcc/config/avr/t-avr b/gcc/config/avr/t-avr
index a8fb8e9c416..f600c070546 100644
--- a/gcc/config/avr/t-avr
+++ b/gcc/config/avr/t-avr
@@ -37,11 +37,23 @@ fp-bit.c: $(srcdir)/config/fp-bit.c $(srcdir)/config/avr/t-avr
FPBIT = fp-bit.c
-MULTILIB_OPTIONS = mmcu=avr2/mmcu=avr3/mmcu=avr4/mmcu=avr5
-MULTILIB_DIRNAMES = avr2 avr3 avr4 avr5
+MULTILIB_OPTIONS = mmcu=avr2/mmcu=avr25/mmcu=avr3/mmcu=avr4/mmcu=avr5
+MULTILIB_DIRNAMES = avr2 avr25 avr3 avr4 avr5
# The many avr2 matches are not listed here - this is the default.
MULTILIB_MATCHES = \
+ mmcu?avr25=mmcu?attiny13 \
+ mmcu?avr25=mmcu?attiny2313 \
+ mmcu?avr25=mmcu?attiny24 \
+ mmcu?avr25=mmcu?attiny44 \
+ mmcu?avr25=mmcu?attiny84 \
+ mmcu?avr25=mmcu?attiny25 \
+ mmcu?avr25=mmcu?attiny45 \
+ mmcu?avr25=mmcu?attiny85 \
+ mmcu?avr25=mmcu?attiny261 \
+ mmcu?avr25=mmcu?attiny461 \
+ mmcu?avr25=mmcu?attiny861 \
+ mmcu?avr25=mmcu?at86rf401 \
mmcu?avr3=mmcu?atmega103 \
mmcu?avr3=mmcu?atmega603 \
mmcu?avr3=mmcu?at43usb320 \