summaryrefslogtreecommitdiff
path: root/devel/avr-gcc/files/patch-zz-atmega256x
diff options
context:
space:
mode:
Diffstat (limited to 'devel/avr-gcc/files/patch-zz-atmega256x')
-rw-r--r--devel/avr-gcc/files/patch-zz-atmega256x471
1 files changed, 170 insertions, 301 deletions
diff --git a/devel/avr-gcc/files/patch-zz-atmega256x b/devel/avr-gcc/files/patch-zz-atmega256x
index f4af252afa38..0fcaf7b3e43f 100644
--- a/devel/avr-gcc/files/patch-zz-atmega256x
+++ b/devel/avr-gcc/files/patch-zz-atmega256x
@@ -1,64 +1,76 @@
-diff -ur gcc/config/avr/avr.c gcc-4.1.1-new-devices-m256/gcc/config/avr/avr.c
---- gcc/config/avr/avr.c 2006-09-07 20:19:07.276183419 +0200
-+++ gcc/config/avr/avr.c 2006-09-07 20:49:56.268363803 +0200
-@@ -123,20 +123,26 @@
- /* Assembler only. */
- int avr_asm_only_p = 0;
+Index: gcc/config/avr/avr.c
+===================================================================
+--- gcc/config/avr/avr.c (revision 124356)
++++ gcc/config/avr/avr.c (working copy)
+@@ -129,22 +129,27 @@
+ /* Core have 'MOVW' and 'LPM Rx,Z' instructions. */
+ int avr_have_movw_lpmx_p = 0;
-+/* Usually holds the value 2, but could be 3 for the larger devices with a
-+ 3-byte program counter. */
-+int avr_pc_size = 2;
++/* Core have 'EIJMP' and 'EICALL' instructions. */
++int avr_have_eijmp_eicall_p = 0;
+
struct base_arch_s {
int asm_only;
int enhanced;
int mega;
-+ int three_byte_pc;
+ int have_movw_lpmx;
++ int have_eijmp_eicall;
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, 0, "__AVR_ARCH__=4" },
-+ { 0, 1, 1, 0, "__AVR_ARCH__=5" },
-+ { 0, 1, 1, 1, "__AVR_ARCH__=6" }
+- { 1, 0, 0, 0, NULL }, /* unknown device specified */
+- { 1, 0, 0, 0, "__AVR_ARCH__=1" },
+- { 0, 0, 0, 0, "__AVR_ARCH__=2" },
+- { 0, 0, 0, 1, "__AVR_ARCH__=25"},
+- { 0, 0, 1, 0, "__AVR_ARCH__=3" },
+- { 0, 1, 0, 1, "__AVR_ARCH__=4" },
+- { 0, 1, 1, 1, "__AVR_ARCH__=5" }
++ { 1, 0, 0, 0, 0, NULL }, /* unknown device specified */
++ { 1, 0, 0, 0, 0, "__AVR_ARCH__=1" },
++ { 0, 0, 0, 0, 0, "__AVR_ARCH__=2" },
++ { 0, 0, 0, 1, 0, "__AVR_ARCH__=25"},
++ { 0, 0, 1, 0, 0, "__AVR_ARCH__=3" },
++ { 0, 1, 0, 1, 0, "__AVR_ARCH__=4" },
++ { 0, 1, 1, 1, 0, "__AVR_ARCH__=5" },
++ { 0, 1, 1, 1, 1, "__AVR_ARCH__=6" }
+ };
+
+ /* These names are used as the index into the avr_arch_types[] table
+@@ -158,7 +163,8 @@
+ ARCH_AVR25,
+ ARCH_AVR3,
+ ARCH_AVR4,
+- ARCH_AVR5
++ ARCH_AVR5,
++ ARCH_AVR6
};
struct mcu_type_s {
-@@ -237,6 +243,10 @@
- { "at90usb1286", 5, "__AVR_AT90USB1286__" },
- { "at90usb1287", 5, "__AVR_AT90USB1287__" },
- { "at94k", 5, "__AVR_AT94K__" },
+@@ -269,6 +275,10 @@
+ { "at90usb1286", ARCH_AVR5, "__AVR_AT90USB1286__" },
+ { "at90usb1287", ARCH_AVR5, "__AVR_AT90USB1287__" },
+ { "at94k", ARCH_AVR5, "__AVR_AT94K__" },
+ /* 3-Byte PC */
-+ { "avr6", 6, NULL },
-+ { "atmega2560", 6, "__AVR_ATmega2560__" },
-+ { "atmega2561", 6, "__AVR_ATmega2561__" },
++ { "avr6", ARCH_AVR6, NULL },
++ { "atmega2560", ARCH_AVR6, "__AVR_ATmega2560__" },
++ { "atmega2561", ARCH_AVR6, "__AVR_ATmega2561__" },
/* Assembler only. */
- { "avr1", 1, NULL },
- { "at90s1200", 1, "__AVR_AT90S1200__" },
-@@ -319,6 +329,11 @@
+ { "avr1", ARCH_AVR1, NULL },
+ { "at90s1200", ARCH_AVR1, "__AVR_AT90S1200__" },
+@@ -351,6 +361,7 @@
+ avr_enhanced_p = base->enhanced;
+ avr_mega_p = base->mega;
+ avr_have_movw_lpmx_p = base->have_movw_lpmx;
++ avr_have_eijmp_eicall_p = base->have_eijmp_eicall;
avr_base_arch_macro = base->macro;
avr_extra_arch_macro = t->macro;
-+ if (base->three_byte_pc)
-+ avr_pc_size = 3;
-+ else
-+ avr_pc_size = 2;
-+
- if (optimize && !TARGET_NO_TABLEJUMP)
- avr_case_values_threshold = (!AVR_MEGA || TARGET_CALL_PROLOGUES) ? 8 : 17;
-
-@@ -476,7 +491,7 @@
+@@ -480,9 +491,10 @@
+ else
+ {
int offset = frame_pointer_needed ? 2 : 0;
++ int avr_pc_size = avr_have_eijmp_eicall_p ? 3 : 2;
offset += avr_regs_to_save (NULL);
- return get_frame_size () + 2 + 1 + offset;
@@ -66,90 +78,7 @@ diff -ur gcc/config/avr/avr.c gcc-4.1.1-new-devices-m256/gcc/config/avr/avr.c
}
}
-@@ -660,7 +675,6 @@
- int reg;
- int interrupt_func_p;
- int signal_func_p;
-- int main_p;
- int live_seq;
- int minimize;
-
-@@ -678,7 +692,6 @@
-
- interrupt_func_p = interrupt_function_p (current_function_decl);
- signal_func_p = signal_function_p (current_function_decl);
-- main_p = MAIN_NAME_P (DECL_NAME (current_function_decl));
- live_seq = sequent_regs_live ();
- minimize = (TARGET_CALL_PROLOGUES
- && !interrupt_func_p && !signal_func_p && live_seq);
-@@ -698,25 +711,14 @@
- AS1 (clr,__zero_reg__) "\n");
- prologue_size += 5;
- }
-- if (main_p)
-- {
-- fprintf (file, ("\t"
-- AS1 (ldi,r28) ",lo8(%s - " HOST_WIDE_INT_PRINT_DEC ")" CR_TAB
-- AS1 (ldi,r29) ",hi8(%s - " HOST_WIDE_INT_PRINT_DEC ")" CR_TAB
-- AS2 (out,__SP_H__,r29) CR_TAB
-- AS2 (out,__SP_L__,r28) "\n"),
-- avr_init_stack, size, avr_init_stack, size);
--
-- prologue_size += 4;
-- }
-- else if (minimize && (frame_pointer_needed || live_seq > 6))
-+ if (minimize && (frame_pointer_needed || live_seq > 6))
- {
- fprintf (file, ("\t"
- AS1 (ldi, r26) ",lo8(" HOST_WIDE_INT_PRINT_DEC ")" CR_TAB
- AS1 (ldi, r27) ",hi8(" HOST_WIDE_INT_PRINT_DEC ")" CR_TAB), size, size);
-
-- fputs ((AS2 (ldi,r30,pm_lo8(1f)) CR_TAB
-- AS2 (ldi,r31,pm_hi8(1f)) CR_TAB), file);
-+ fputs ((AS2 (ldi,r30,lo8(gs(1f))) CR_TAB
-+ AS2 (ldi,r31,hi8(gs(1f))) CR_TAB), file);
-
- prologue_size += 4;
-
-@@ -787,7 +789,6 @@
- int reg;
- int interrupt_func_p;
- int signal_func_p;
-- int main_p;
- int function_size;
- int live_seq;
- int minimize;
-@@ -819,27 +820,12 @@
-
- interrupt_func_p = interrupt_function_p (current_function_decl);
- signal_func_p = signal_function_p (current_function_decl);
-- main_p = MAIN_NAME_P (DECL_NAME (current_function_decl));
-+
- live_seq = sequent_regs_live ();
- minimize = (TARGET_CALL_PROLOGUES
- && !interrupt_func_p && !signal_func_p && live_seq);
-
-- if (main_p)
-- {
-- /* Return value from main() is already in the correct registers
-- (r25:r24) as the exit() argument. */
-- if (AVR_MEGA)
-- {
-- fputs ("\t" AS1 (jmp,exit) "\n", file);
-- epilogue_size += 2;
-- }
-- else
-- {
-- fputs ("\t" AS1 (rjmp,exit) "\n", file);
-- ++epilogue_size;
-- }
-- }
-- else if (minimize && (frame_pointer_needed || live_seq > 4))
-+ if (minimize && (frame_pointer_needed || live_seq > 4))
- {
- fprintf (file, ("\t" AS2 (ldi, r30, %d) CR_TAB), live_seq);
- ++epilogue_size;
-@@ -1097,7 +1083,7 @@
+@@ -1103,7 +1115,7 @@
&& ((GET_CODE (addr) == SYMBOL_REF && SYMBOL_REF_FUNCTION_P (addr))
|| GET_CODE (addr) == LABEL_REF))
{
@@ -158,7 +87,19 @@ diff -ur gcc/config/avr/avr.c gcc-4.1.1-new-devices-m256/gcc/config/avr/avr.c
output_addr_const (file,addr);
fprintf (file ,")");
}
-@@ -4518,7 +4504,7 @@
+@@ -1128,6 +1140,11 @@
+ if (!AVR_MEGA)
+ fputc ('r', file);
+ }
++ else if (code == '!')
++ {
++ if (AVR_HAVE_EIJMP_EICALL)
++ fputc ('e', file);
++ }
+ else if (REG_P (x))
+ {
+ if (x == zero_reg_rtx)
+@@ -4524,7 +4541,7 @@
&& ((GET_CODE (x) == SYMBOL_REF && SYMBOL_REF_FUNCTION_P (x))
|| GET_CODE (x) == LABEL_REF))
{
@@ -167,70 +108,65 @@ diff -ur gcc/config/avr/avr.c gcc-4.1.1-new-devices-m256/gcc/config/avr/avr.c
output_addr_const (asm_out_file, x);
fputs (")\n", asm_out_file);
return true;
-@@ -5880,7 +5866,7 @@
+@@ -5898,7 +5915,7 @@
{
- progmem_section ();
+ switch_to_section (progmem_section);
if (AVR_MEGA)
- fprintf (stream, "\t.word pm(.L%d)\n", value);
+ fprintf (stream, "\t.word gs(.L%d)\n", value);
else
fprintf (stream, "\trjmp .L%d\n", value);
-diff -ur gcc/config/avr/avr.h gcc-4.1.1-new-devices-m256/gcc/config/avr/avr.h
---- gcc/config/avr/avr.h 2006-09-07 20:19:07.304181348 +0200
-+++ gcc/config/avr/avr.h 2006-09-07 20:49:56.277363137 +0200
-@@ -33,6 +33,10 @@
- builtin_define (avr_extra_arch_macro); \
+--- gcc/config/avr/avr.h.orig Sun Oct 28 00:13:49 2007
++++ gcc/config/avr/avr.h Sun Oct 28 00:15:29 2007
+@@ -36,6 +36,12 @@
+ builtin_define ("__AVR_HAVE_LPMX__"); \
if (avr_asm_only_p) \
builtin_define ("__AVR_ASM_ONLY__"); \
-+ if (avr_pc_size == 2) \
++ if (!avr_have_eijmp_eicall_p) \
+ builtin_define ("__AVR_2_BYTE_PC__"); \
-+ if (avr_pc_size == 3) \
++ if (avr_have_eijmp_eicall_p) \
+ builtin_define ("__AVR_3_BYTE_PC__"); \
++ if (avr_have_eijmp_eicall_p) \
++ builtin_define ("__AVR_HAVE_EIJMP_EICALL__"); \
if (avr_enhanced_p) \
builtin_define ("__AVR_ENHANCED__"); \
- if (avr_mega_p) \
-@@ -47,10 +51,14 @@
- extern int avr_mega_p;
+ if (avr_enhanced_p) \
+@@ -53,6 +59,8 @@
extern int avr_enhanced_p;
extern int avr_asm_only_p;
-+extern int avr_pc_size;
-
+ extern int avr_have_movw_lpmx_p;
++extern int avr_have_eijmp_eicall_p;
++
+ #ifndef IN_LIBGCC2
+ extern GTY(()) section *progmem_section;
+ #endif
+@@ -60,6 +68,7 @@
#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 AVR_HAVE_EIJMP_EICALL (avr_have_eijmp_eicall_p)
-+#define AVR_3_BYTE_PC (avr_pc_size == 3)
-+#define AVR_2_BYTE_PC (avr_pc_size == 2)
-+
#define TARGET_VERSION fprintf (stderr, " (GNU assembler syntax)");
- #define OVERRIDE_OPTIONS avr_override_options ()
-@@ -747,12 +755,13 @@
+@@ -633,7 +642,7 @@
- #define CPP_SPEC "%{posix:-D_POSIX_SOURCE}"
+ #define PRINT_OPERAND(STREAM, X, CODE) print_operand (STREAM, X, CODE)
--#define CC1_SPEC "%{profile:-p}"
-+#define CC1_SPEC "%{profile:-p} -fno-delete-null-pointer-checks"
+-#define PRINT_OPERAND_PUNCT_VALID_P(CODE) ((CODE) == '~')
++#define PRINT_OPERAND_PUNCT_VALID_P(CODE) ((CODE) == '~' || (CODE) == '!')
- #define CC1PLUS_SPEC "%{!frtti:-fno-rtti} \
- %{!fenforce-eh-specs:-fno-enforce-eh-specs} \
-- %{!fexceptions:-fno-exceptions}"
--/* A C string constant that tells the GCC drvier program options to
-+ %{!fexceptions:-fno-exceptions} \
-+ -fno-delete-null-pointer-checks"
-+/* A C string constant that tells the GCC driver program options to
- pass to `cc1plus'. */
+ #define PRINT_OPERAND_ADDRESS(STREAM, X) print_operand_address(STREAM, X)
- #define ASM_SPEC "%{mmcu=*:-mmcu=%*}"
-@@ -793,6 +802,7 @@
- mmcu=at90can*|\
+@@ -779,6 +788,7 @@
+ mmcu=at90pwm316|\
mmcu=at90usb*|\
mmcu=at94k:-m avr5}\
+%{mmcu=atmega256*:-m avr6}\
%{mmcu=atmega324*|\
- mmcu=atmega325|\
- mmcu=atmega3250|\
-@@ -818,7 +828,8 @@
+ mmcu=atmega325*|\
+ mmcu=atmega328p|\
+@@ -804,7 +814,8 @@
mmcu=at90usb*: -Tdata 0x800100}\
%{mmcu=atmega640|\
mmcu=atmega1280|\
@@ -240,137 +176,87 @@ diff -ur gcc/config/avr/avr.h gcc-4.1.1-new-devices-m256/gcc/config/avr/avr.h
#define LIB_SPEC \
"%{!mmcu=at90s1*:%{!mmcu=attiny11:%{!mmcu=attiny12:%{!mmcu=attiny15:%{!mmcu=attiny28: -lc }}}}}"
-@@ -904,6 +915,8 @@
+@@ -903,6 +914,8 @@
+ %{mmcu=atmega128:crtm128.o%s} \
+ %{mmcu=atmega1280:crtm1280.o%s} \
%{mmcu=atmega1281:crtm1281.o%s} \
- %{mmcu=atmega8hva:crtm8hva.o%s} \
- %{mmcu=atmega16hva:crtm16hva.o%s} \
+%{mmcu=atmega2560:crtm2560.o%s} \
+%{mmcu=atmega2561:crtm2561.o%s} \
+ %{mmcu=atmega8hva:crtm8hva.o%s} \
+ %{mmcu=atmega16hva:crtm16hva.o%s} \
%{mmcu=at90can32:crtcan32.o%s} \
- %{mmcu=at90can64:crtcan64.o%s} \
- %{mmcu=at90can128:crtcan128.o%s} \
-diff -ur gcc/config/avr/avr.md gcc-4.1.1-new-devices-m256/gcc/config/avr/avr.md
---- gcc/config/avr/avr.md 2005-06-28 21:56:23.000000000 +0200
-+++ gcc/config/avr/avr.md 2006-09-07 20:49:56.246365431 +0200
-@@ -2087,22 +2087,47 @@
+Index: gcc/config/avr/avr.md
+===================================================================
+--- gcc/config/avr/avr.md (revision 124356)
++++ gcc/config/avr/avr.md (working copy)
+@@ -33,6 +33,7 @@
+ ;; p POST_INC or PRE_DEC address as a pointer (X, Y, Z)
+ ;; r POST_INC or PRE_DEC address as a register (r26, r28, r30)
+ ;; ~ Output 'r' if not AVR_MEGA.
++;; ! Output 'e' if AVR_HAVE_EIJMP_EICALL.
+
+ ;; UNSPEC usage:
+ ;; 0 Length of a string, see "strlenhi".
+@@ -2100,22 +2101,22 @@
"(register_operand (operands[0], HImode) || CONSTANT_P (operands[0]))"
"*{
if (which_alternative==0)
- return \"icall\";
-+ {
-+ if (AVR_3_BYTE_PC)
-+ return \"eicall\";
-+ else
-+ return \"icall\";
-+ }
++ return \"%!icall\";
else if (which_alternative==1)
{
- if (AVR_ENHANCED)
-- return (AS2 (movw, r30, %0) CR_TAB
+ if (AVR_HAVE_MOVW)
+ return (AS2 (movw, r30, %0) CR_TAB
- \"icall\");
-+ {
-+ if (AVR_3_BYTE_PC)
-+ return (AS2 (movw, r30, %0) CR_TAB
-+ \"eicall\");
-+ else
-+ return (AS2 (movw, r30, %0) CR_TAB
-+ \"icall\");
-+ }
++ \"%!icall\");
else
-- return (AS2 (mov, r30, %A0) CR_TAB
-- AS2 (mov, r31, %B0) CR_TAB
+ return (AS2 (mov, r30, %A0) CR_TAB
+ AS2 (mov, r31, %B0) CR_TAB
- \"icall\");
-+ {
-+ if (AVR_3_BYTE_PC)
-+ return (AS2 (mov, r30, %A0) CR_TAB
-+ AS2 (mov, r31, %B0) CR_TAB
-+ \"eicall\");
-+ else
-+ return (AS2 (mov, r30, %A0) CR_TAB
-+ AS2 (mov, r31, %B0) CR_TAB
-+ \"icall\");
-+ }
++ \"%!icall\");
}
else if (which_alternative==2)
return AS1(%~call,%c0);
-- return (AS2 (ldi,r30,lo8(%0)) CR_TAB
-- AS2 (ldi,r31,hi8(%0)) CR_TAB
+ return (AS2 (ldi,r30,lo8(%0)) CR_TAB
+ AS2 (ldi,r31,hi8(%0)) CR_TAB
- \"icall\");
-+
-+
-+ if (AVR_3_BYTE_PC)
-+ return (AS2 (ldi,r30,lo8(%0)) CR_TAB
-+ AS2 (ldi,r31,hi8(%0)) CR_TAB
-+ \"eicall\");
-+ else
-+ return (AS2 (ldi,r30,lo8(%0)) CR_TAB
-+ AS2 (ldi,r31,hi8(%0)) CR_TAB
-+ \"icall\");
++ \"%!icall\");
}"
[(set_attr "cc" "clobber,clobber,clobber,clobber")
(set_attr_alternative "length"
-@@ -2124,22 +2149,46 @@
+@@ -2137,22 +2138,22 @@
"(register_operand (operands[0], VOIDmode) || CONSTANT_P (operands[0]))"
"*{
if (which_alternative==0)
- return \"icall\";
-+ {
-+ if (AVR_3_BYTE_PC)
-+ return \"eicall\";
-+ else
-+ return \"icall\";
-+ }
++ return \"%!icall\";
else if (which_alternative==1)
{
- if (AVR_ENHANCED)
-- return (AS2 (movw, r30, %1) CR_TAB
+ if (AVR_HAVE_MOVW)
+ return (AS2 (movw, r30, %1) CR_TAB
- \"icall\");
-+ {
-+ if (AVR_3_BYTE_PC)
-+ return (AS2 (movw, r30, %1) CR_TAB
-+ \"eicall\");
-+ else
-+ return (AS2 (movw, r30, %1) CR_TAB
-+ \"icall\");
-+ }
++ \"%!icall\");
else
-- return (AS2 (mov, r30, %A1) CR_TAB
-- AS2 (mov, r31, %B1) CR_TAB
+ return (AS2 (mov, r30, %A1) CR_TAB
+ AS2 (mov, r31, %B1) CR_TAB
- \"icall\");
-+ {
-+ if (AVR_3_BYTE_PC)
-+ return (AS2 (mov, r30, %A1) CR_TAB
-+ AS2 (mov, r31, %B1) CR_TAB
-+ \"eicall\");
-+ else
-+ return (AS2 (mov, r30, %A1) CR_TAB
-+ AS2 (mov, r31, %B1) CR_TAB
-+ \"icall\");
-+ }
++ \"%!icall\");
}
else if (which_alternative==2)
return AS1(%~call,%c1);
-- return (AS2 (ldi, r30, lo8(%1)) CR_TAB
-- AS2 (ldi, r31, hi8(%1)) CR_TAB
+ return (AS2 (ldi, r30, lo8(%1)) CR_TAB
+ AS2 (ldi, r31, hi8(%1)) CR_TAB
- \"icall\");
-+
-+ if (AVR_3_BYTE_PC)
-+ return (AS2 (ldi, r30, lo8(%1)) CR_TAB
-+ AS2 (ldi, r31, hi8(%1)) CR_TAB
-+ \"eicall\");
-+ else
-+ return (AS2 (ldi, r30, lo8(%1)) CR_TAB
-+ AS2 (ldi, r31, hi8(%1)) CR_TAB
-+ \"icall\");
++ \"%!icall\");
}"
[(set_attr "cc" "clobber,clobber,clobber,clobber")
(set_attr_alternative "length"
-@@ -2169,13 +2218,20 @@
+@@ -2182,13 +2183,20 @@
; indirect jump
(define_insn "indirect_jump"
[(set (pc) (match_operand:HI 0 "register_operand" "!z,*r"))]
- ""
-+ "AVR_2_BYTE_PC"
++ "!AVR_HAVE_EIJMP_EICALL"
"@
ijmp
push %A0\;push %B0\;ret"
@@ -379,7 +265,7 @@ diff -ur gcc/config/avr/avr.md gcc-4.1.1-new-devices-m256/gcc/config/avr/avr.md
+(define_insn "*indirect_jump_avr6"
+ [(set (pc) (match_operand:HI 0 "register_operand" "z"))]
-+ "AVR_3_BYTE_PC"
++ "AVR_HAVE_EIJMP_EICALL"
+ "eijmp"
+ [(set_attr "length" "1")
+ (set_attr "cc" "none")])
@@ -387,60 +273,42 @@ diff -ur gcc/config/avr/avr.md gcc-4.1.1-new-devices-m256/gcc/config/avr/avr.md
;; table jump
;; Table made from "rjmp" instructions for <=8K devices.
-@@ -2183,7 +2239,7 @@
- [(set (pc) (unspec:HI [(match_operand:HI 0 "register_operand" "!z,*r")] 1))
+@@ -2197,7 +2205,7 @@
+ UNSPEC_INDEX_JMP))
(use (label_ref (match_operand 1 "" "")))
(clobber (match_dup 0))]
- "!AVR_MEGA"
-+ "(!AVR_MEGA) && (AVR_2_BYTE_PC)"
++ "(!AVR_MEGA) && (!AVR_HAVE_EIJMP_EICALL)"
"@
ijmp
push %A0\;push %B0\;ret"
-@@ -2200,11 +2256,26 @@
- [(set_attr "length" "2")
+@@ -2226,7 +2234,7 @@
+ lpm __tmp_reg__,Z+
+ lpm r31,Z
+ mov r30,__tmp_reg__
+- ijmp"
++ %!ijmp"
+ [(set_attr "length" "6")
(set_attr "cc" "clobber")])
-+(define_insn "*tablejump_avr6"
-+ [(set (pc) (unspec:HI [(match_operand:HI 0 "register_operand" "z")]
-+ 1))
-+ (use (label_ref (match_operand 1 "" "")))
-+ (clobber (match_dup 0))]
-+ "AVR_MEGA && AVR_ENHANCED && AVR_3_BYTE_PC"
-+ "lsl r30
-+ rol r31
-+ lpm __tmp_reg__,Z+
-+ lpm r31,Z
-+ mov r30,__tmp_reg__
-+ eijmp"
-+ [(set_attr "length" "6")
-+ (set_attr "cc" "clobber")])
-+
- (define_insn "*tablejump_enh"
- [(set (pc) (unspec:HI [(match_operand:HI 0 "register_operand" "z")] 1))
- (use (label_ref (match_operand 1 "" "")))
- (clobber (match_dup 0))]
-- "AVR_MEGA && AVR_ENHANCED"
-+ "AVR_MEGA && AVR_ENHANCED && AVR_2_BYTE_PC"
- "lsl r30
- rol r31
- lpm __tmp_reg__,Z+
-@@ -2218,7 +2289,7 @@
- [(set (pc) (unspec:HI [(match_operand:HI 0 "register_operand" "z")] 1))
+@@ -2235,7 +2243,7 @@
+ UNSPEC_INDEX_JMP))
(use (label_ref (match_operand 1 "" "")))
(clobber (match_dup 0))]
- "AVR_MEGA"
-+ "AVR_MEGA && AVR_2_BYTE_PC"
++ "AVR_MEGA && !AVR_HAVE_EIJMP_EICALL"
"lsl r30
rol r31
lpm
-diff -ur gcc/config/avr/libgcc.S gcc-4.1.1-new-devices-m256/gcc/config/avr/libgcc.S
---- gcc/config/avr/libgcc.S 2005-06-25 03:22:41.000000000 +0200
-+++ gcc/config/avr/libgcc.S 2006-09-07 20:49:56.232366466 +0200
+Index: gcc/config/avr/libgcc.S
+===================================================================
+--- gcc/config/avr/libgcc.S (revision 124356)
++++ gcc/config/avr/libgcc.S (working copy)
@@ -593,7 +593,12 @@
out __SP_H__,r29
out __SREG__,__tmp_reg__
out __SP_L__,r28
-+#if defined (__AVR_3_BYTE_PC__)
++#if defined (__AVR_HAVE_EIJMP_EICALL__)
+ eijmp
+#else
ijmp
@@ -454,7 +322,7 @@ diff -ur gcc/config/avr/libgcc.S gcc-4.1.1-new-devices-m256/gcc/config/avr/libgc
lpm r31, Z
mov r30, __tmp_reg__
+
-+#if defined (__AVR_3_BYTE_PC__)
++#if defined (__AVR_HAVE_EIJMP_EICALL__)
+ eijmp
+#else
ijmp
@@ -466,27 +334,28 @@ diff -ur gcc/config/avr/libgcc.S gcc-4.1.1-new-devices-m256/gcc/config/avr/libgc
push r0
lpm
push r0
-+#if defined (__AVR_3_BYTE_PC__)
++#if defined (__AVR_HAVE_EIJMP_EICALL__)
+ push __zero_reg__
+#endif
ret
#endif
.endfunc
-diff -ur gcc/config/avr/t-avr gcc-4.1.1-new-devices-m256/gcc/config/avr/t-avr
---- gcc/config/avr/t-avr 2006-09-07 20:19:07.299181718 +0200
-+++ gcc/config/avr/t-avr 2006-09-07 20:49:56.273363433 +0200
+Index: gcc/config/avr/t-avr
+===================================================================
+--- gcc/config/avr/t-avr (revision 124356)
++++ gcc/config/avr/t-avr (working copy)
@@ -37,8 +37,8 @@
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=avr3/mmcu=avr4/mmcu=avr5/mmcu=avr6
-+MULTILIB_DIRNAMES = avr2 avr3 avr4 avr5 avr6
+-MULTILIB_OPTIONS = mmcu=avr2/mmcu=avr25/mmcu=avr3/mmcu=avr4/mmcu=avr5
+-MULTILIB_DIRNAMES = avr2 avr25 avr3 avr4 avr5
++MULTILIB_OPTIONS = mmcu=avr2/mmcu=avr25/mmcu=avr3/mmcu=avr4/mmcu=avr5/mmcu=avr6
++MULTILIB_DIRNAMES = avr2 avr25 avr3 avr4 avr5 avr6
# The many avr2 matches are not listed here - this is the default.
MULTILIB_MATCHES = \
-@@ -90,7 +90,9 @@
+@@ -111,7 +111,9 @@
mmcu?avr5=mmcu?at90usb647 \
mmcu?avr5=mmcu?at90usb1286 \
mmcu?avr5=mmcu?at90usb1287 \