[packages/crossavr-gcc] - synchronized patches with official AVR toolchain 3.4.1.830

kosmo kosmo at pld-linux.org
Fri Jan 18 22:08:04 CET 2013


commit ab7f78a4a6b0448f315db017e24209b62c772e22
Author: Piotr Ziecik <kosmo at angel.net.pl>
Date:   Fri Jan 18 22:07:05 2013 +0100

    - synchronized patches with official AVR toolchain 3.4.1.830

 302-gcc-avrtiny10.patch                            |   20 +-
 307-gcc-avrtc536.patch                             |   28 +
 308-gcc-avrtc537.patch                             |   31 +
 410-gcc-atxmega128a4u.patch                        |    4 +-
 411-gcc-atxmega64d4.patch                          |    4 +-
 412-gcc-atmega164pa_168pa_32a_64a.patch            |   14 +-
 413-gcc-atxmega64_128_b3.patch                     |    8 +-
 414-gcc-atxmega64b1.patch                          |    4 +-
 415-gcc-atmega_8a_128a_1284.patch                  |    8 +-
 416-gcc-atxmega64a4u.patch                         |    6 +-
 417-gcc-atxmega128d4.patch                         |    4 +-
 418-gcc-atmxt336s.patch                            |    4 +-
 419-gcc-atxmega16c4_32c4_128c3_256c3.patch         |   12 +-
 420-gcc-atxmega384d3.patch                         |    4 +-
 421-gcc-atmega48hvf.patch                          |    4 +-
 422-gcc-atmega26hvg.patch                          |    4 +-
 423-gcc-atmxt224_224e.patch                        |    4 +-
 424-gcc-atxmega192c3.patch                         |    4 +-
 425-gcc-atmxt112sl.patch                           |    4 +-
 426-gcc-atxmega64c3.patch                          |    4 +-
 427-gcc-ata6285_6286.patch                         |    4 +-
 428-gcc-attiny828.patch                            |   16 +-
 429-gcc-ata5790_5790n_5795.patch                   |    4 +-
 430-gcc-ata5272_ata5505.patch                      |    4 +-
 431-gcc-atmxt540s.patch                            |   24 +
 432-gcc-ata5831.patch                              |   54 +
 409-gcc-attiny80.patch => 433-gcc-attiny841.patch  |   20 +-
 434-gcc-atxmega32_16_8e5.patch                     |   26 +
 501-gcc-avrtiny10-bug-12510.patch                  |   10 +-
 503-gcc-bug13789.patch                             |   18 +-
 504-gcc-conditional-register.patch                 |   10 +-
 506-gcc-avrtc541.patch                             |   42 +
 507-gcc-avrtc-518.patch                            |   23 +
 508-gcc-avrtc514-tiny.patch                        |   12 +
 509-gcc-AVRTC-544-call-used-registers-tiny10.patch |  173 ++
 510-gcc-avrtc496-tiny.patch                        |   42 +
 511-gcc-avrtc539-backported.patch                  |   44 +
 512-gcc-avrtc542.patch                             | 2753 ++++++++++++++++++++
 513-gcc-avrtc556-tiny-same-base-and-dest.patch     |  130 +
 514-gcc-avrtc558.patch                             |   46 +
 515-gcc-avrtc446.patch                             |   38 +
 crossavr-gcc.spec                                  |  108 +-
 42 files changed, 3637 insertions(+), 139 deletions(-)
---
diff --git a/crossavr-gcc.spec b/crossavr-gcc.spec
index fe84950..be8f6ce 100644
--- a/crossavr-gcc.spec
+++ b/crossavr-gcc.spec
@@ -10,10 +10,10 @@ Summary(pt_BR.UTF-8):	Utilitários para desenvolvimento de binários da GNU - AV
 Summary(tr.UTF-8):	GNU geliştirme araçları - AVR gcc
 Name:		crossavr-gcc
 Version:	4.6.2
-Release:	4
+Release:	5
 Epoch:		1
 Patch1:		gcc-bug51969.patch
-# Patches 1xx are taken form Atmel official AVR8-GNU toolchain version 3.4.0.663.
+# Patches 1xx are taken form Atmel official AVR8-GNU toolchain version 3.4.1.830
 Patch100:	200-gcc-libiberty-Makefile.in.patch
 Patch101:	300-gcc-fixedpoint-3-4-2010.patch
 Patch102:	301-gcc-xmega-v14.patch
@@ -22,43 +22,58 @@ Patch104:	303-gcc-osmain.patch
 Patch105:	304-gcc-builtins-v6.patch
 Patch106:	305-gcc-avrtiny10-non-fixedpoint.patch
 Patch107:	306-gcc-option-list-devices.patch
-Patch108:	400-gcc-new-devices.patch
-Patch109:	401-gcc-atmega32_5_50_90_pa.patch
-Patch110:	402-gcc-attiny1634.patch
-Patch111:	403-gcc-atmega48pa.patch
-Patch112:	404-gcc-atxmega_16_32_a4u.patch
-Patch113:	405-gcc-atxmega64_128_192_256a3u.patch
-Patch114:	406-gcc-atmegarfr2_a2.patch
-Patch115:	407-gcc-atmega165pa.patch
-Patch116:	408-gcc-atxmega384c3.patch
-Patch117:	409-gcc-attiny80.patch
-Patch118:	410-gcc-atxmega128a4u.patch
-Patch119:	411-gcc-atxmega64d4.patch
-Patch120:	412-gcc-atmega164pa_168pa_32a_64a.patch
-Patch121:	413-gcc-atxmega64_128_b3.patch
-Patch122:	414-gcc-atxmega64b1.patch
-Patch123:	415-gcc-atmega_8a_128a_1284.patch
-Patch124:	416-gcc-atxmega64a4u.patch
-Patch125:	417-gcc-atxmega128d4.patch
-Patch126:	418-gcc-atmxt336s.patch
-Patch127:	419-gcc-atxmega16c4_32c4_128c3_256c3.patch
-Patch128:	420-gcc-atxmega384d3.patch
-Patch129:	421-gcc-atmega48hvf.patch
-Patch130:	422-gcc-atmega26hvg.patch
-Patch131:	423-gcc-atmxt224_224e.patch
-Patch132:	424-gcc-atxmega192c3.patch
-Patch133:	425-gcc-atmxt112sl.patch
-Patch134:	426-gcc-atxmega64c3.patch
-Patch135:	427-gcc-ata6285_6286.patch
-Patch136:	428-gcc-attiny828.patch
-Patch137:	429-gcc-ata5790_5790n_5795.patch
-Patch138:	430-gcc-ata5272_ata5505.patch
-Patch139:	500-gcc-bug13473.patch
-Patch140:	501-gcc-avrtiny10-bug-12510.patch
-Patch141:	502-gcc-bug12915.patch
-Patch142:	503-gcc-bug13789.patch
-Patch143:	504-gcc-conditional-register.patch
-Patch144:	505-gcc-avrtc381-tiny.patch
+Patch108:	307-gcc-avrtc536.patch
+Patch109:	308-gcc-avrtc537.patch
+Patch110:	400-gcc-new-devices.patch
+Patch111:	401-gcc-atmega32_5_50_90_pa.patch
+Patch112:	402-gcc-attiny1634.patch
+Patch113:	403-gcc-atmega48pa.patch
+Patch114:	404-gcc-atxmega_16_32_a4u.patch
+Patch115:	405-gcc-atxmega64_128_192_256a3u.patch
+Patch116:	406-gcc-atmegarfr2_a2.patch
+Patch117:	407-gcc-atmega165pa.patch
+Patch118:	408-gcc-atxmega384c3.patch
+Patch119:	410-gcc-atxmega128a4u.patch
+Patch120:	411-gcc-atxmega64d4.patch
+Patch121:	412-gcc-atmega164pa_168pa_32a_64a.patch
+Patch122:	413-gcc-atxmega64_128_b3.patch
+Patch123:	414-gcc-atxmega64b1.patch
+Patch124:	415-gcc-atmega_8a_128a_1284.patch
+Patch125:	416-gcc-atxmega64a4u.patch
+Patch126:	417-gcc-atxmega128d4.patch
+Patch127:	418-gcc-atmxt336s.patch
+Patch128:	419-gcc-atxmega16c4_32c4_128c3_256c3.patch
+Patch129:	420-gcc-atxmega384d3.patch
+Patch130:	421-gcc-atmega48hvf.patch
+Patch131:	422-gcc-atmega26hvg.patch
+Patch132:	423-gcc-atmxt224_224e.patch
+Patch133:	424-gcc-atxmega192c3.patch
+Patch134:	425-gcc-atmxt112sl.patch
+Patch135:	426-gcc-atxmega64c3.patch
+Patch136:	427-gcc-ata6285_6286.patch
+Patch137:	428-gcc-attiny828.patch
+Patch138:	429-gcc-ata5790_5790n_5795.patch
+Patch139:	430-gcc-ata5272_ata5505.patch
+Patch140:	431-gcc-atmxt540s.patch
+Patch141:	432-gcc-ata5831.patch
+Patch142:	433-gcc-attiny841.patch
+Patch143:	434-gcc-atxmega32_16_8e5.patch
+Patch144:	500-gcc-bug13473.patch
+Patch145:	501-gcc-avrtiny10-bug-12510.patch
+Patch146:	502-gcc-bug12915.patch
+Patch147:	503-gcc-bug13789.patch
+Patch148:	504-gcc-conditional-register.patch
+Patch149:	505-gcc-avrtc381-tiny.patch
+Patch150:	506-gcc-avrtc541.patch
+Patch151:	507-gcc-avrtc-518.patch
+Patch152:	508-gcc-avrtc514-tiny.patch
+Patch153:	509-gcc-AVRTC-544-call-used-registers-tiny10.patch
+Patch154:	510-gcc-avrtc496-tiny.patch
+Patch155:	511-gcc-avrtc539-backported.patch
+Patch156:	512-gcc-avrtc542.patch
+Patch157:	513-gcc-avrtc556-tiny-same-base-and-dest.patch
+Patch158:	514-gcc-avrtc558.patch
+Patch159:	515-gcc-avrtc446.patch
 License:	GPL
 Group:		Development/Languages
 Source0:	ftp://gcc.gnu.org/pub/gcc/releases/gcc-%{version}/gcc-%{version}.tar.bz2
@@ -163,6 +178,21 @@ cd gcc/config/%{target} && %undos -f c,h && cd -
 %patch142 -p0
 %patch143 -p0
 %patch144 -p0
+%patch145 -p0
+%patch146 -p0
+%patch147 -p0
+%patch148 -p0
+%patch149 -p0
+%patch150 -p0
+%patch151 -p0
+%patch152 -p0
+%patch153 -p0
+%patch154 -p0
+%patch155 -p0
+%patch156 -p0
+%patch157 -p0
+%patch158 -p0
+%patch159 -p0
 
 %build
 rm -rf obj-%{target}
diff --git a/302-gcc-avrtiny10.patch b/302-gcc-avrtiny10.patch
index 98ed7ff..2bab2a4 100644
--- a/302-gcc-avrtiny10.patch
+++ b/302-gcc-avrtiny10.patch
@@ -217,7 +217,7 @@ diff -Naurp gcc/config/avr/avr.c gcc/config/avr/avr.c
 +						AS2 (ld,__tmp_reg__,Y+)     CR_TAB
 +		                AS2 (ld,%B0,Y)         CR_TAB
 +						AS2 (subi,%A2,lo8(%o1+1)) CR_TAB
-+						AS2 (subi,%B2,hi8(%o1+1)) CR_TAB
++						AS2 (sbci,%B2,hi8(%o1+1)) CR_TAB
 +						AS2 (mov,%A0,__tmp_reg__))
 +				         :  (AS2 (ldd,__tmp_reg__,%A1) CR_TAB
 +		                AS2 (ldd,%B0,%B1)         CR_TAB
@@ -228,7 +228,7 @@ diff -Naurp gcc/config/avr/avr.c gcc/config/avr/avr.c
 +						AS2 (ld,__tmp_reg__,Z+)     CR_TAB
 +		                AS2 (ld,%B0,Z)         CR_TAB
 +						AS2 (subi,%A2,lo8(%o1+1)) CR_TAB
-+						AS2 (subi,%B2,hi8(%o1+1)) CR_TAB
++						AS2 (sbci,%B2,hi8(%o1+1)) CR_TAB
 +						AS2 (mov,%A0,__tmp_reg__))
 +				         :  (AS2 (ldd,__tmp_reg__,%A1) CR_TAB
  		  AS2 (ldd,%B0,%B1)         CR_TAB
@@ -246,7 +246,7 @@ diff -Naurp gcc/config/avr/avr.c gcc/config/avr/avr.c
 +						AS2 (ld,%A0,Y+)             CR_TAB
 +		                AS2 (ld,%B0,Y)               CR_TAB
 +						AS2 (subi,%A2,lo8(%o1+1)) CR_TAB
-+						AS2 (subi,%B2,hi8(%o1+1)))
++						AS2 (sbci,%B2,hi8(%o1+1)))
 +				         :  (AS2 (ldd,%A0,%A1) CR_TAB
 +		                AS2 (ldd,%B0,%B1));
 +	  if(REGNO(op[2]) == REG_Z)
@@ -255,7 +255,7 @@ diff -Naurp gcc/config/avr/avr.c gcc/config/avr/avr.c
 +						AS2 (ld,%A0,Z+)             CR_TAB
 +		                AS2 (ld,%B0,Z)              CR_TAB
 +						AS2 (subi,%A2,lo8(%o1+1)) CR_TAB
-+						AS2 (subi,%B2,hi8(%o1+1)))
++						AS2 (sbci,%B2,hi8(%o1+1)))
 +				         :  (AS2 (ldd,%A0,%A1) CR_TAB
  	      AS2 (ldd,%B0,%B1));
 +      
@@ -571,7 +571,7 @@ diff -Naurp gcc/config/avr/avr.c gcc/config/avr/avr.c
 +
 +		if(REGNO(op[2]) == REG_Y)
 +        return *l=5, AVR_TINY ? (AS2 (subi,%A2,lo8(-(%o1)))   CR_TAB
-+						AS2 (subi,%B2,hi8(-(%o1)))   CR_TAB
++						AS2 (sbci,%B2,hi8(-(%o1)))   CR_TAB
 +		                AS2 (ld,%A0,Y+)               CR_TAB
 +		                AS2 (ld,%B0,Y+)               CR_TAB
 +		                AS2 (ld,__tmp_reg__,Y+)       CR_TAB
@@ -587,7 +587,7 @@ diff -Naurp gcc/config/avr/avr.c gcc/config/avr/avr.c
 -      return *l=4, (AS2 (ldd,%A0,%A1) CR_TAB
 +		if(REGNO(op[2]) == REG_Z)
 +        return *l=5, AVR_TINY ? (AS2 (subi,%A2,lo8(-(%o1)))   CR_TAB
-+						AS2 (subi,%B2,hi8(-(%o1)))   CR_TAB
++						AS2 (sbci,%B2,hi8(-(%o1)))   CR_TAB
 +		                AS2 (ld,%A0,Z+)              CR_TAB
 +		                AS2 (ld,%B0,Z+)              CR_TAB
 +		                AS2 (ld,__tmp_reg__,Z+)      CR_TAB
@@ -604,7 +604,7 @@ diff -Naurp gcc/config/avr/avr.c gcc/config/avr/avr.c
 +			op[2] = XEXP(base, 0);
 +		if(REGNO(op[2]) == REG_Y)
 +        return *l=4, AVR_TINY ? (AS2 (subi,%A2,lo8(-(%o1)))   CR_TAB
-+						AS2 (subi,%B2,hi8(-(%o1)))   CR_TAB
++						AS2 (sbci,%B2,hi8(-(%o1)))   CR_TAB
 +		                AS2 (ld,%A0,Y+)               CR_TAB
 +		                AS2 (ld,%B0,Y+)               CR_TAB
 +		                AS2 (ld,%C0,Y+)               CR_TAB
@@ -617,7 +617,7 @@ diff -Naurp gcc/config/avr/avr.c gcc/config/avr/avr.c
 +                        AS2 (ldd,%D0,%D1));
 +		if(REGNO(op[2]) == REG_Z)
 +        return *l=4, AVR_TINY ? (AS2 (subi,%A2,lo8(-(%o1)))   CR_TAB
-+						AS2 (subi,%B2,hi8(-(%o1)))   CR_TAB
++						AS2 (sbci,%B2,hi8(-(%o1)))   CR_TAB
 +		                AS2 (ld,%A0,Z+)               CR_TAB
 +		                AS2 (ld,%B0,Z+)               CR_TAB
 +		                AS2 (ld,%C0,Z+)               CR_TAB
@@ -1203,8 +1203,8 @@ diff -Naurp gcc/config/avr/avr.c gcc/config/avr/avr.c
 +			             : (AS2 (std,%B0,%B1)    CR_TAB
                      AS2 (std,%A0,%A1));
 +		if(REGNO(op[2]) == REG_Z)
-+        return *l=2, AVR_TINY ? (AS2 (subi,%A2,lo8(-(%o0+1)))    CR_TAB
-+						AS2 (sbci,%B2,hi8(-(%o0+1)))    CR_TAB
++        return *l=2, AVR_TINY ? (AS2 (subi,%A2,lo8(-(%o0+2)))    CR_TAB
++						AS2 (sbci,%B2,hi8(-(%o0+2)))    CR_TAB
 +						AS2 (st,-Z,%B1)                  CR_TAB
 +                        AS2 (st,-Z,%A1)                  CR_TAB
 +                        AS2 (subi,%A2,lo8(%o0))    CR_TAB
diff --git a/307-gcc-avrtc536.patch b/307-gcc-avrtc536.patch
new file mode 100644
index 0000000..e520a9d
--- /dev/null
+++ b/307-gcc-avrtc536.patch
@@ -0,0 +1,28 @@
+diff -Naurp gcc/config/avr/avr-c.c gcc/config/avr/avr-c.c
+--- gcc/config/avr/avr-c.c	2012-05-30 14:46:12.000000000 +0530
++++ gcc/config/avr/avr-c.c	2012-06-06 13:00:15.000000000 +0530
+@@ -95,8 +95,22 @@ avr_cpu_cpp_builtins (struct cpp_reader 
+     }
+ 
+   if (avr_current_arch->avrtiny)
+- 	{
++    {
+       cpp_define (pfile, "__AVR_TINY__");
+- 	}
++
++      /*
++      Define macro "__AVR_TINY_PM_BASE_ADDRESS__" with mapped program memory
++      start address. This macro shall be referred where mapped program memory
++      is accessed. (Eg. copying data section (do_copy_data) contents to data
++      memory region.
++      NOTE:
++      Program memory of AVR_TINY devices can not be accessed directly, it has
++      been mapped to the data memory. For AVR_TINY devices (ATtiny4/ 5/ 9/ 10/
++      20 and 40) mapped program memory starts at 0x4000.
++      */
++      cpp_define (pfile, "__AVR_TINY_PM_BASE_ADDRESS__=0x4000");
++    }
++
++
+ }
+ 
diff --git a/308-gcc-avrtc537.patch b/308-gcc-avrtc537.patch
new file mode 100644
index 0000000..676a892
--- /dev/null
+++ b/308-gcc-avrtc537.patch
@@ -0,0 +1,31 @@
+diff -Naurp gcc/config/avr/libgcc.S gcc/config/avr/libgcc.S
+--- gcc/config/avr/libgcc.S	2012-05-29 16:32:53.000000000 +0530
++++ gcc/config/avr/libgcc.S	2012-06-04 18:31:55.000000000 +0530
+@@ -782,7 +782,26 @@ __tablejump__:
+ #endif /* defined (L_tablejump) */
+ #endif
+ 
+-#if !defined(__AVR_TINY__)
++#if defined(__AVR_TINY__)
++#ifdef L_copy_data
++        .section .init4,"ax", at progbits
++        .global __do_copy_data
++__do_copy_data:
++        ldi     r18, hi8(__data_end)
++        ldi     r26, lo8(__data_start)
++        ldi     r27, hi8(__data_start)
++        ldi     r30, lo8(__data_load_start + __AVR_TINY_PM_BASE_ADDRESS__)
++        ldi     r31, hi8(__data_load_start + __AVR_TINY_PM_BASE_ADDRESS__)
++        rjmp    .L__do_copy_data_start
++.L__do_copy_data_loop:
++        ld      r19, z+
++        st      X+, r19
++.L__do_copy_data_start:
++        cpi     r26, lo8(__data_end)
++        cpc     r27, r18
++        brne    .L__do_copy_data_loop
++#endif
++#else
+ #ifdef L_copy_data
+ 	.section .init4,"ax", at progbits
+ 	.global __do_copy_data
diff --git a/410-gcc-atxmega128a4u.patch b/410-gcc-atxmega128a4u.patch
index 0f5be09..000880e 100644
--- a/410-gcc-atxmega128a4u.patch
+++ b/410-gcc-atxmega128a4u.patch
@@ -1,7 +1,7 @@
 diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 --- gcc/config/avr/avr-devices.c	2011-10-28 11:55:44.000000000 +0530
 +++ gcc/config/avr/avr-devices.c	2011-10-28 12:00:41.000000000 +0530
-@@ -295,6 +295,7 @@ const struct mcu_type_s avr_mcu_types[] 
+@@ -294,6 +294,7 @@ const struct mcu_type_s avr_mcu_types[] 
    { "avrxmega7",    ARCH_AVRXMEGA7, NULL,                           0, 0x2000, "x128a1" },
    { "atxmega128a1", ARCH_AVRXMEGA7, "__AVR_ATxmega128A1__",         0, 0x2000, "x128a1" },
    { "atxmega128a1u", ARCH_AVRXMEGA7, "__AVR_ATxmega128A1U__",       0, 0x2000, "x128a1u" },
@@ -12,7 +12,7 @@ diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 diff -Naurp gcc/config/avr/t-avr gcc/config/avr/t-avr
 --- gcc/config/avr/t-avr	2011-10-28 11:55:44.000000000 +0530
 +++ gcc/config/avr/t-avr	2011-10-28 12:00:41.000000000 +0530
-@@ -299,6 +299,7 @@ MULTILIB_MATCHES = \
+@@ -298,6 +298,7 @@ MULTILIB_MATCHES = \
  	mmcu?avrxmega6=mmcu?atxmega384c3 \
  	mmcu?avrxmega7=mmcu?atxmega128a1 \
  	mmcu?avrxmega7=mmcu?atxmega128a1u \
diff --git a/411-gcc-atxmega64d4.patch b/411-gcc-atxmega64d4.patch
index 320397d..d1f625d 100644
--- a/411-gcc-atxmega64d4.patch
+++ b/411-gcc-atxmega64d4.patch
@@ -1,7 +1,7 @@
 diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 --- gcc/config/avr/avr-devices.c	2011-10-28 12:00:41.000000000 +0530
 +++ gcc/config/avr/avr-devices.c	2011-10-28 12:06:09.000000000 +0530
-@@ -272,6 +272,7 @@ const struct mcu_type_s avr_mcu_types[] 
+@@ -271,6 +271,7 @@ const struct mcu_type_s avr_mcu_types[] 
    { "atxmega64a3",  ARCH_AVRXMEGA4, "__AVR_ATxmega64A3__",          0, 0x2000, "x64a3" },
    { "atxmega64a3u", ARCH_AVRXMEGA4, "__AVR_ATxmega64A3U__",         0, 0x2000, "x64a3u"},
    { "atxmega64d3",  ARCH_AVRXMEGA4, "__AVR_ATxmega64D3__",          0, 0x2000, "x64d3" },
@@ -12,7 +12,7 @@ diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 diff -Naurp gcc/config/avr/t-avr gcc/config/avr/t-avr
 --- gcc/config/avr/t-avr	2011-10-28 12:00:41.000000000 +0530
 +++ gcc/config/avr/t-avr	2011-10-28 12:04:00.000000000 +0530
-@@ -282,6 +282,7 @@ MULTILIB_MATCHES = \
+@@ -281,6 +281,7 @@ MULTILIB_MATCHES = \
  	mmcu?avrxmega4=mmcu?atxmega64a3 \
  	mmcu?avrxmega4=mmcu?atxmega64a3u \
  	mmcu?avrxmega4=mmcu?atxmega64d3 \
diff --git a/412-gcc-atmega164pa_168pa_32a_64a.patch b/412-gcc-atmega164pa_168pa_32a_64a.patch
index 0a08fe8..6d07827 100644
--- a/412-gcc-atmega164pa_168pa_32a_64a.patch
+++ b/412-gcc-atmega164pa_168pa_32a_64a.patch
@@ -1,7 +1,7 @@
 diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 --- gcc/config/avr/avr-devices.c	2011-10-28 12:06:09.000000000 +0530
 +++ gcc/config/avr/avr-devices.c	2011-10-28 12:15:49.000000000 +0530
-@@ -147,6 +147,7 @@ const struct mcu_type_s avr_mcu_types[] 
+@@ -146,6 +146,7 @@ const struct mcu_type_s avr_mcu_types[] 
    { "atmega163",            ARCH_AVR5, "__AVR_ATmega163__",         0, 0x0060, "m163" },
    { "atmega164a",           ARCH_AVR5, "__AVR_ATmega164A__",        0, 0x0100, "m164a" },
    { "atmega164p",           ARCH_AVR5, "__AVR_ATmega164P__",        0, 0x0100, "m164p" },
@@ -9,7 +9,7 @@ diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
    { "atmega165",            ARCH_AVR5, "__AVR_ATmega165__",         0, 0x0100, "m165" },
    { "atmega165a",           ARCH_AVR5, "__AVR_ATmega165A__",        0, 0x0100, "m165a" },
    { "atmega165p",           ARCH_AVR5, "__AVR_ATmega165P__",        0, 0x0100, "m165p" },
-@@ -154,6 +155,7 @@ const struct mcu_type_s avr_mcu_types[] 
+@@ -153,6 +154,7 @@ const struct mcu_type_s avr_mcu_types[] 
    { "atmega168",            ARCH_AVR5, "__AVR_ATmega168__",         0, 0x0100, "m168" },
    { "atmega168a",           ARCH_AVR5, "__AVR_ATmega168A__",        0, 0x0100, "m168a" },
    { "atmega168p",           ARCH_AVR5, "__AVR_ATmega168P__",        0, 0x0100, "m168p" },
@@ -17,7 +17,7 @@ diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
    { "atmega169",            ARCH_AVR5, "__AVR_ATmega169__",         0, 0x0100, "m169" },
    { "atmega169a",           ARCH_AVR5, "__AVR_ATmega169A__",        0, 0x0100, "m169a" },
    { "atmega169p",           ARCH_AVR5, "__AVR_ATmega169P__",        0, 0x0100, "m169p" },
-@@ -164,6 +166,7 @@ const struct mcu_type_s avr_mcu_types[] 
+@@ -163,6 +165,7 @@ const struct mcu_type_s avr_mcu_types[] 
    { "atmega16m1",           ARCH_AVR5, "__AVR_ATmega16M1__",        0, 0x0100, "m16m1" },
    { "atmega16u4",           ARCH_AVR5, "__AVR_ATmega16U4__",        0, 0x0100, "m16u4" },
    { "atmega32",             ARCH_AVR5, "__AVR_ATmega32__",          0, 0x0060, "m32" },
@@ -25,7 +25,7 @@ diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
    { "atmega323",            ARCH_AVR5, "__AVR_ATmega323__",         0, 0x0060, "m323" },
    { "atmega324a",           ARCH_AVR5, "__AVR_ATmega324A__",        0, 0x0100, "m324a" },
    { "atmega324p",           ARCH_AVR5, "__AVR_ATmega324P__",        0, 0x0100, "m324p" },
-@@ -192,6 +195,7 @@ const struct mcu_type_s avr_mcu_types[] 
+@@ -191,6 +194,7 @@ const struct mcu_type_s avr_mcu_types[] 
    { "atmega32u6",           ARCH_AVR5, "__AVR_ATmega32U6__",        0, 0x0100, "m32u6" },
    { "atmega406",            ARCH_AVR5, "__AVR_ATmega406__",         0, 0x0100, "m406" },
    { "atmega64",             ARCH_AVR5, "__AVR_ATmega64__",          0, 0x0100, "m64" },
@@ -36,7 +36,7 @@ diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 diff -Naurp gcc/config/avr/t-avr gcc/config/avr/t-avr
 --- gcc/config/avr/t-avr	2011-10-28 12:04:00.000000000 +0530
 +++ gcc/config/avr/t-avr	2011-10-28 12:15:49.000000000 +0530
-@@ -178,6 +178,7 @@ MULTILIB_MATCHES = \
+@@ -177,6 +177,7 @@ MULTILIB_MATCHES = \
  	mmcu?avr5=mmcu?atmega163 \
  	mmcu?avr5=mmcu?atmega164a \
  	mmcu?avr5=mmcu?atmega164p \
@@ -44,7 +44,7 @@ diff -Naurp gcc/config/avr/t-avr gcc/config/avr/t-avr
  	mmcu?avr5=mmcu?atmega165 \
  	mmcu?avr5=mmcu?atmega165a \
  	mmcu?avr5=mmcu?atmega165p \
-@@ -185,11 +186,13 @@ MULTILIB_MATCHES = \
+@@ -184,11 +185,13 @@ MULTILIB_MATCHES = \
  	mmcu?avr5=mmcu?atmega168 \
  	mmcu?avr5=mmcu?atmega168a \
  	mmcu?avr5=mmcu?atmega168p \
@@ -58,7 +58,7 @@ diff -Naurp gcc/config/avr/t-avr gcc/config/avr/t-avr
  	mmcu?avr5=mmcu?atmega323 \
  	mmcu?avr5=mmcu?atmega324a \
  	mmcu?avr5=mmcu?atmega324p \
-@@ -216,6 +219,7 @@ MULTILIB_MATCHES = \
+@@ -215,6 +218,7 @@ MULTILIB_MATCHES = \
  	mmcu?avr5=mmcu?atmega64rfa2 \
  	mmcu?avr5=mmcu?atmega64rfr2 \
  	mmcu?avr5=mmcu?atmega64  \
diff --git a/413-gcc-atxmega64_128_b3.patch b/413-gcc-atxmega64_128_b3.patch
index 3f3bb54..63a414b 100644
--- a/413-gcc-atxmega64_128_b3.patch
+++ b/413-gcc-atxmega64_128_b3.patch
@@ -1,7 +1,7 @@
 diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 --- gcc/config/avr/avr-devices.c	2011-10-28 12:15:49.000000000 +0530
 +++ gcc/config/avr/avr-devices.c	2011-10-28 14:31:05.000000000 +0530
-@@ -275,6 +275,7 @@ const struct mcu_type_s avr_mcu_types[] 
+@@ -274,6 +274,7 @@ const struct mcu_type_s avr_mcu_types[] 
    { "avrxmega4",    ARCH_AVRXMEGA4, NULL,                           0, 0x2000, "x64d3" },
    { "atxmega64a3",  ARCH_AVRXMEGA4, "__AVR_ATxmega64A3__",          0, 0x2000, "x64a3" },
    { "atxmega64a3u", ARCH_AVRXMEGA4, "__AVR_ATxmega64A3U__",         0, 0x2000, "x64a3u"},
@@ -9,7 +9,7 @@ diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
    { "atxmega64d3",  ARCH_AVRXMEGA4, "__AVR_ATxmega64D3__",          0, 0x2000, "x64d3" },
    { "atxmega64d4",  ARCH_AVRXMEGA4, "__AVR_ATxmega64D4__",          0, 0x2000, "x64d4" },
      /* Xmega, > 64K, <= 128K FLASH, > 64K RAM.  */
-@@ -286,6 +287,7 @@ const struct mcu_type_s avr_mcu_types[] 
+@@ -285,6 +286,7 @@ const struct mcu_type_s avr_mcu_types[] 
    { "atxmega128a3", ARCH_AVRXMEGA6, "__AVR_ATxmega128A3__",         0, 0x2000, "x128a3" },
    { "atxmega128a3u",ARCH_AVRXMEGA6, "__AVR_ATxmega128A3U__",        0, 0x2000, "x128a3u"},
    { "atxmega128b1", ARCH_AVRXMEGA6, "__AVR_ATxmega128B1__",         0, 0x2000, "x128b1" },
@@ -20,7 +20,7 @@ diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 diff -Naurp gcc/config/avr/t-avr gcc/config/avr/t-avr
 --- gcc/config/avr/t-avr	2011-10-28 12:15:49.000000000 +0530
 +++ gcc/config/avr/t-avr	2011-10-28 14:31:05.000000000 +0530
-@@ -285,6 +285,7 @@ MULTILIB_MATCHES = \
+@@ -284,6 +284,7 @@ MULTILIB_MATCHES = \
  	mmcu?avrxmega2=mmcu?atxmega32x1 \
  	mmcu?avrxmega4=mmcu?atxmega64a3 \
  	mmcu?avrxmega4=mmcu?atxmega64a3u \
@@ -28,7 +28,7 @@ diff -Naurp gcc/config/avr/t-avr gcc/config/avr/t-avr
  	mmcu?avrxmega4=mmcu?atxmega64d3 \
  	mmcu?avrxmega4=mmcu?atxmega64d4 \
  	mmcu?avrxmega5=mmcu?atxmega64a1 \
-@@ -292,6 +293,7 @@ MULTILIB_MATCHES = \
+@@ -291,6 +292,7 @@ MULTILIB_MATCHES = \
  	mmcu?avrxmega6=mmcu?atxmega128a3 \
  	mmcu?avrxmega6=mmcu?atxmega128a3u \
  	mmcu?avrxmega6=mmcu?atxmega128b1 \
diff --git a/414-gcc-atxmega64b1.patch b/414-gcc-atxmega64b1.patch
index 8a65026..12302b3 100644
--- a/414-gcc-atxmega64b1.patch
+++ b/414-gcc-atxmega64b1.patch
@@ -1,7 +1,7 @@
 diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 --- gcc/config/avr/avr-devices.c	2011-10-28 14:31:05.000000000 +0530
 +++ gcc/config/avr/avr-devices.c	2011-10-28 14:34:49.000000000 +0530
-@@ -275,6 +275,7 @@ const struct mcu_type_s avr_mcu_types[] 
+@@ -274,6 +274,7 @@ const struct mcu_type_s avr_mcu_types[] 
    { "avrxmega4",    ARCH_AVRXMEGA4, NULL,                           0, 0x2000, "x64d3" },
    { "atxmega64a3",  ARCH_AVRXMEGA4, "__AVR_ATxmega64A3__",          0, 0x2000, "x64a3" },
    { "atxmega64a3u", ARCH_AVRXMEGA4, "__AVR_ATxmega64A3U__",         0, 0x2000, "x64a3u"},
@@ -12,7 +12,7 @@ diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 diff -Naurp gcc/config/avr/t-avr gcc/config/avr/t-avr
 --- gcc/config/avr/t-avr	2011-10-28 14:31:05.000000000 +0530
 +++ gcc/config/avr/t-avr	2011-10-28 14:34:49.000000000 +0530
-@@ -285,6 +285,7 @@ MULTILIB_MATCHES = \
+@@ -284,6 +284,7 @@ MULTILIB_MATCHES = \
  	mmcu?avrxmega2=mmcu?atxmega32x1 \
  	mmcu?avrxmega4=mmcu?atxmega64a3 \
  	mmcu?avrxmega4=mmcu?atxmega64a3u \
diff --git a/415-gcc-atmega_8a_128a_1284.patch b/415-gcc-atmega_8a_128a_1284.patch
index 98c9d40..034f664 100644
--- a/415-gcc-atmega_8a_128a_1284.patch
+++ b/415-gcc-atmega_8a_128a_1284.patch
@@ -1,7 +1,7 @@
 diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 --- gcc/config/avr/avr-devices.c	2011-10-28 14:34:49.000000000 +0530
 +++ gcc/config/avr/avr-devices.c	2011-10-28 14:39:27.000000000 +0530
-@@ -118,6 +118,7 @@ const struct mcu_type_s avr_mcu_types[] 
+@@ -117,6 +117,7 @@ const struct mcu_type_s avr_mcu_types[] 
      /* Enhanced, <= 8K + 2-byte PC + { MOVW/LPMX, MUL }.  */
    { "avr4",                 ARCH_AVR4, NULL,                        0, 0x0060, "m8" },
    { "atmega8",              ARCH_AVR4, "__AVR_ATmega8__",           0, 0x0060, "m8" },
@@ -9,7 +9,7 @@ diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
    { "atmega48",             ARCH_AVR4, "__AVR_ATmega48__",          0, 0x0100, "m48" },
    { "atmega48a",            ARCH_AVR4, "__AVR_ATmega48A__",         0, 0x0100, "m48a" },
    { "atmega48pa",           ARCH_AVR4, "__AVR_ATmega48PA__",        0, 0x0100, "m48pa" },
-@@ -242,8 +243,10 @@ const struct mcu_type_s avr_mcu_types[] 
+@@ -241,8 +242,10 @@ const struct mcu_type_s avr_mcu_types[] 
         { MOVW/LPMX, JMP/CALL, MUL, ELPM, ELPMX }.  */
    { "avr51",                ARCH_AVR51, NULL,                       0, 0x0100, "m128" },
    { "atmega128",            ARCH_AVR51, "__AVR_ATmega128__",        0, 0x0100, "m128" },
@@ -23,7 +23,7 @@ diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 diff -Naurp gcc/config/avr/t-avr gcc/config/avr/t-avr
 --- gcc/config/avr/t-avr	2011-10-28 14:55:08.000000000 +0530
 +++ gcc/config/avr/t-avr	2011-10-28 14:52:10.000000000 +0530
-@@ -157,6 +157,7 @@ MULTILIB_MATCHES = \
+@@ -156,6 +156,7 @@ MULTILIB_MATCHES = \
  	mmcu?avr4=mmcu?atmega48pa \
  	mmcu?avr4=mmcu?atmega48p \
  	mmcu?avr4=mmcu?atmega8 \
@@ -31,7 +31,7 @@ diff -Naurp gcc/config/avr/t-avr gcc/config/avr/t-avr
  	mmcu?avr4=mmcu?atmega8515 \
  	mmcu?avr4=mmcu?atmega8535 \
  	mmcu?avr4=mmcu?atmega88 \
-@@ -263,8 +264,10 @@ MULTILIB_MATCHES = \
+@@ -262,8 +263,10 @@ MULTILIB_MATCHES = \
  	mmcu?avr5=mmcu?at94k \
  	mmcu?avr5=mmcu?m3000 \
  	mmcu?avr51=mmcu?atmega128 \
diff --git a/416-gcc-atxmega64a4u.patch b/416-gcc-atxmega64a4u.patch
index 03dde6b..7c997d1 100644
--- a/416-gcc-atxmega64a4u.patch
+++ b/416-gcc-atxmega64a4u.patch
@@ -1,7 +1,7 @@
 diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 --- gcc/config/avr/avr-devices.c	2011-10-28 14:39:27.000000000 +0530
 +++ gcc/config/avr/avr-devices.c	2011-10-28 14:59:12.000000000 +0530
-@@ -278,6 +278,7 @@ const struct mcu_type_s avr_mcu_types[] 
+@@ -277,6 +277,7 @@ const struct mcu_type_s avr_mcu_types[] 
    { "avrxmega4",    ARCH_AVRXMEGA4, NULL,                           0, 0x2000, "x64d3" },
    { "atxmega64a3",  ARCH_AVRXMEGA4, "__AVR_ATxmega64A3__",          0, 0x2000, "x64a3" },
    { "atxmega64a3u", ARCH_AVRXMEGA4, "__AVR_ATxmega64A3U__",         0, 0x2000, "x64a3u"},
@@ -12,7 +12,7 @@ diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 diff -Naurp gcc/config/avr/t-avr gcc/config/avr/t-avr
 --- gcc/config/avr/t-avr	2011-10-28 14:52:10.000000000 +0530
 +++ gcc/config/avr/t-avr	2011-10-28 14:59:12.000000000 +0530
-@@ -288,6 +288,7 @@ MULTILIB_MATCHES = \
+@@ -287,6 +287,7 @@ MULTILIB_MATCHES = \
  	mmcu?avrxmega2=mmcu?atxmega32x1 \
  	mmcu?avrxmega4=mmcu?atxmega64a3 \
  	mmcu?avrxmega4=mmcu?atxmega64a3u \
@@ -20,3 +20,5 @@ diff -Naurp gcc/config/avr/t-avr gcc/config/avr/t-avr
  	mmcu?avrxmega4=mmcu?atxmega64b1 \
  	mmcu?avrxmega4=mmcu?atxmega64b3 \
  	mmcu?avrxmega4=mmcu?atxmega64d3 \
+
+4
diff --git a/417-gcc-atxmega128d4.patch b/417-gcc-atxmega128d4.patch
index af9222b..0f5d94d 100644
--- a/417-gcc-atxmega128d4.patch
+++ b/417-gcc-atxmega128d4.patch
@@ -1,7 +1,7 @@
 diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 --- gcc/config/avr/avr-devices.c	2011-10-28 14:59:12.000000000 +0530
 +++ gcc/config/avr/avr-devices.c	2011-10-28 15:04:23.000000000 +0530
-@@ -294,6 +294,7 @@ const struct mcu_type_s avr_mcu_types[] 
+@@ -293,6 +293,7 @@ const struct mcu_type_s avr_mcu_types[] 
    { "atxmega128b1", ARCH_AVRXMEGA6, "__AVR_ATxmega128B1__",         0, 0x2000, "x128b1" },
    { "atxmega128b3", ARCH_AVRXMEGA6, "__AVR_ATxmega128B3__",         0, 0x2000, "x128b3" },
    { "atxmega128d3", ARCH_AVRXMEGA6, "__AVR_ATxmega128D3__",         0, 0x2000, "x128d3" },
@@ -12,7 +12,7 @@ diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 diff -Naurp gcc/config/avr/t-avr gcc/config/avr/t-avr
 --- gcc/config/avr/t-avr	2011-10-28 14:59:12.000000000 +0530
 +++ gcc/config/avr/t-avr	2011-10-28 15:04:23.000000000 +0530
-@@ -300,6 +300,7 @@ MULTILIB_MATCHES = \
+@@ -299,6 +299,7 @@ MULTILIB_MATCHES = \
  	mmcu?avrxmega6=mmcu?atxmega128b1 \
  	mmcu?avrxmega6=mmcu?atxmega128b3 \
  	mmcu?avrxmega6=mmcu?atxmega128d3 \
diff --git a/418-gcc-atmxt336s.patch b/418-gcc-atmxt336s.patch
index e906720..f82160b 100644
--- a/418-gcc-atmxt336s.patch
+++ b/418-gcc-atmxt336s.patch
@@ -1,7 +1,7 @@
 diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 --- gcc/config/avr/avr-devices.c	2011-10-28 15:04:23.000000000 +0530
 +++ gcc/config/avr/avr-devices.c	2011-10-28 15:06:36.000000000 +0530
-@@ -265,6 +265,7 @@ const struct mcu_type_s avr_mcu_types[] 
+@@ -264,6 +264,7 @@ const struct mcu_type_s avr_mcu_types[] 
      /* Xmega, <= 8K FLASH.  */
      /* Xmega, > 8K, <= 64K FLASH, <= 64K RAM.  */
    { "avrxmega2",    ARCH_AVRXMEGA2, NULL,                           0, 0x2000, "x32a4" },
@@ -12,7 +12,7 @@ diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 diff -Naurp gcc/config/avr/t-avr gcc/config/avr/t-avr
 --- gcc/config/avr/t-avr	2011-10-28 15:04:23.000000000 +0530
 +++ gcc/config/avr/t-avr	2011-10-28 15:06:36.000000000 +0530
-@@ -279,6 +279,7 @@ MULTILIB_MATCHES = \
+@@ -278,6 +278,7 @@ MULTILIB_MATCHES = \
  	mmcu?avr6=mmcu?atmega256rfr2 \
   	mmcu?avr6=mmcu?atmega2560 \
  	mmcu?avr6=mmcu?atmega2561 \
diff --git a/419-gcc-atxmega16c4_32c4_128c3_256c3.patch b/419-gcc-atxmega16c4_32c4_128c3_256c3.patch
index 46bc2d9..ac09038 100644
--- a/419-gcc-atxmega16c4_32c4_128c3_256c3.patch
+++ b/419-gcc-atxmega16c4_32c4_128c3_256c3.patch
@@ -1,7 +1,7 @@
 diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 --- gcc/config/avr/avr-devices.c	2011-11-08 17:00:35.000000000 +0530
 +++ gcc/config/avr/avr-devices.c	2011-11-08 17:04:10.000000000 +0530
-@@ -268,9 +268,11 @@ const struct mcu_type_s avr_mcu_types[] 
+@@ -267,9 +267,11 @@ const struct mcu_type_s avr_mcu_types[] 
    { "atmxt336s",    ARCH_AVRXMEGA2, "__AVR_ATMXT336S__",            0, 0x2000, "mxt336s"},
    { "atxmega16a4",  ARCH_AVRXMEGA2, "__AVR_ATxmega16A4__",          0, 0x2000, "x16a4" },
    { "atxmega16a4u",  ARCH_AVRXMEGA2, "__AVR_ATxmega16A4U__",        0, 0x2000, "x16a4u" },
@@ -13,7 +13,7 @@ diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
    { "atxmega32d4",  ARCH_AVRXMEGA2, "__AVR_ATxmega32D4__",          0, 0x2000, "x32d4" },
    { "atxmega32x1",  ARCH_AVRXMEGA2, "__AVR_ATxmega32X1__",          0, 0x2000, "x32x1" },
      /* Xmega, > 8K, <= 64K FLASH, > 64K RAM.  */
-@@ -294,6 +296,7 @@ const struct mcu_type_s avr_mcu_types[] 
+@@ -293,6 +295,7 @@ const struct mcu_type_s avr_mcu_types[] 
    { "atxmega128a3u",ARCH_AVRXMEGA6, "__AVR_ATxmega128A3U__",        0, 0x2000, "x128a3u"},
    { "atxmega128b1", ARCH_AVRXMEGA6, "__AVR_ATxmega128B1__",         0, 0x2000, "x128b1" },
    { "atxmega128b3", ARCH_AVRXMEGA6, "__AVR_ATxmega128B3__",         0, 0x2000, "x128b3" },
@@ -21,7 +21,7 @@ diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
    { "atxmega128d3", ARCH_AVRXMEGA6, "__AVR_ATxmega128D3__",         0, 0x2000, "x128d3" },
    { "atxmega128d4", ARCH_AVRXMEGA6, "__AVR_ATxmega128D4__",         0, 0x2000, "x128d4" },
    { "atxmega192a3", ARCH_AVRXMEGA6, "__AVR_ATxmega192A3__",         0, 0x2000, "x192a3" },
-@@ -303,6 +306,7 @@ const struct mcu_type_s avr_mcu_types[] 
+@@ -302,6 +305,7 @@ const struct mcu_type_s avr_mcu_types[] 
    { "atxmega256a3u",ARCH_AVRXMEGA6, "__AVR_ATxmega256A3U__",        0, 0x2000, "x256a3u"},
    { "atxmega256a3b",ARCH_AVRXMEGA6, "__AVR_ATxmega256A3B__",        0, 0x2000, "x256a3b" },
    { "atxmega256a3bu", ARCH_AVRXMEGA6, "__AVR_ATxmega256A3BU__",     0, 0x2000, "x256a3bu" },
@@ -32,7 +32,7 @@ diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 diff -Naurp gcc/config/avr/t-avr gcc/config/avr/t-avr
 --- gcc/config/avr/t-avr	2011-11-08 17:00:35.000000000 +0530
 +++ gcc/config/avr/t-avr	2011-11-08 17:02:00.000000000 +0530
-@@ -282,7 +282,9 @@ MULTILIB_MATCHES = \
+@@ -281,7 +281,9 @@ MULTILIB_MATCHES = \
  	mmcu?avrxmega2=mmcu?atmxt336s \
  	mmcu?avrxmega2=mmcu?atxmega16a4 \
  	mmcu?avrxmega2=mmcu?atxmega16a4u \
@@ -42,7 +42,7 @@ diff -Naurp gcc/config/avr/t-avr gcc/config/avr/t-avr
  	mmcu?avrxmega2=mmcu?atxmega32d4 \
  	mmcu?avrxmega2=mmcu?atxmega32a4 \
  	mmcu?avrxmega2=mmcu?atxmega32a4u \
-@@ -300,6 +302,7 @@ MULTILIB_MATCHES = \
+@@ -299,6 +301,7 @@ MULTILIB_MATCHES = \
  	mmcu?avrxmega6=mmcu?atxmega128a3u \
  	mmcu?avrxmega6=mmcu?atxmega128b1 \
  	mmcu?avrxmega6=mmcu?atxmega128b3 \
@@ -50,7 +50,7 @@ diff -Naurp gcc/config/avr/t-avr gcc/config/avr/t-avr
  	mmcu?avrxmega6=mmcu?atxmega128d3 \
  	mmcu?avrxmega6=mmcu?atxmega128d4 \
  	mmcu?avrxmega6=mmcu?atxmega192a3 \
-@@ -309,6 +312,7 @@ MULTILIB_MATCHES = \
+@@ -308,6 +311,7 @@ MULTILIB_MATCHES = \
  	mmcu?avrxmega6=mmcu?atxmega256a3u \
  	mmcu?avrxmega6=mmcu?atxmega256a3b \
  	mmcu?avrxmega6=mmcu?atxmega256a3bu \
diff --git a/420-gcc-atxmega384d3.patch b/420-gcc-atxmega384d3.patch
index 6e51f55..24adf88 100644
--- a/420-gcc-atxmega384d3.patch
+++ b/420-gcc-atxmega384d3.patch
@@ -1,7 +1,7 @@
 diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 --- gcc/config/avr/avr-devices.c	2011-11-08 17:37:12.000000000 +0530
 +++ gcc/config/avr/avr-devices.c	2011-11-08 17:38:18.000000000 +0530
-@@ -309,6 +309,7 @@ const struct mcu_type_s avr_mcu_types[] 
+@@ -308,6 +308,7 @@ const struct mcu_type_s avr_mcu_types[] 
    { "atxmega256c3", ARCH_AVRXMEGA6, "__AVR_ATxmega256C3__",         0, 0x2000, "x256c3" },
    { "atxmega256d3", ARCH_AVRXMEGA6, "__AVR_ATxmega256D3__",         0, 0x2000, "x256d3" },
    { "atxmega384c3", ARCH_AVRXMEGA6, "__AVR_ATxmega384C3__",         0, 0x2000, "x384c3" },
@@ -12,7 +12,7 @@ diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 diff -Naurp gcc/config/avr/t-avr gcc/config/avr/t-avr
 --- gcc/config/avr/t-avr	2011-11-08 17:37:12.000000000 +0530
 +++ gcc/config/avr/t-avr	2011-11-08 17:38:18.000000000 +0530
-@@ -315,6 +315,7 @@ MULTILIB_MATCHES = \
+@@ -314,6 +314,7 @@ MULTILIB_MATCHES = \
  	mmcu?avrxmega6=mmcu?atxmega256c3 \
  	mmcu?avrxmega6=mmcu?atxmega256d3 \
  	mmcu?avrxmega6=mmcu?atxmega384c3 \
diff --git a/421-gcc-atmega48hvf.patch b/421-gcc-atmega48hvf.patch
index 9ba627e..c05b174 100644
--- a/421-gcc-atmega48hvf.patch
+++ b/421-gcc-atmega48hvf.patch
@@ -1,7 +1,7 @@
 diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 --- gcc/config/avr/avr-devices.c	2011-11-16 18:28:11.000000000 +0530
 +++ gcc/config/avr/avr-devices.c	2011-11-16 18:33:39.000000000 +0530
-@@ -222,6 +222,7 @@ const struct mcu_type_s avr_mcu_types[] 
+@@ -221,6 +221,7 @@ const struct mcu_type_s avr_mcu_types[] 
    { "atmega32hvb",          ARCH_AVR5, "__AVR_ATmega32HVB__",       0, 0x0100, "m32hvb" },
    { "atmega32hvbrevb",      ARCH_AVR5, "__AVR_ATmega32HVBREVB__",   1, 0x0100, "m32hvbrevb" },
    { "atmega16hva2",         ARCH_AVR5, "__AVR_ATmega16HVA2__",      0, 0x0100, "m16hva2" },
@@ -12,7 +12,7 @@ diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 diff -Naurp gcc/config/avr/t-avr gcc/config/avr/t-avr
 --- gcc/config/avr/t-avr	2011-11-16 18:28:11.000000000 +0530
 +++ gcc/config/avr/t-avr	2011-11-16 18:34:34.000000000 +0530
-@@ -245,6 +245,7 @@ MULTILIB_MATCHES = \
+@@ -244,6 +244,7 @@ MULTILIB_MATCHES = \
  	mmcu?avr5=mmcu?atmega32hvb \
  	mmcu?avr5=mmcu?atmega32hvbrevb \
  	mmcu?avr5=mmcu?atmega64hve \
diff --git a/422-gcc-atmega26hvg.patch b/422-gcc-atmega26hvg.patch
index 1df4acc..5af18e7 100644
--- a/422-gcc-atmega26hvg.patch
+++ b/422-gcc-atmega26hvg.patch
@@ -1,7 +1,7 @@
 diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 --- gcc/config/avr/avr-devices.c	2011-12-08 14:24:48.000000000 +0530
 +++ gcc/config/avr/avr-devices.c	2011-12-08 14:38:53.000000000 +0530
-@@ -166,6 +166,7 @@ const struct mcu_type_s avr_mcu_types[] 
+@@ -165,6 +165,7 @@ const struct mcu_type_s avr_mcu_types[] 
    { "atmega16hvbrevb",      ARCH_AVR5, "__AVR_ATmega16HVBREVB__",   1, 0x0100, "m16hvbrevb" },
    { "atmega16m1",           ARCH_AVR5, "__AVR_ATmega16M1__",        0, 0x0100, "m16m1" },
    { "atmega16u4",           ARCH_AVR5, "__AVR_ATmega16U4__",        0, 0x0100, "m16u4" },
@@ -12,7 +12,7 @@ diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 diff -Naurp gcc/config/avr/t-avr gcc/config/avr/t-avr
 --- gcc/config/avr/t-avr	2011-12-08 14:24:48.000000000 +0530
 +++ gcc/config/avr/t-avr	2011-12-08 14:41:10.000000000 +0530
-@@ -192,6 +192,7 @@ MULTILIB_MATCHES = \
+@@ -191,6 +191,7 @@ MULTILIB_MATCHES = \
  	mmcu?avr5=mmcu?atmega169a \
  	mmcu?avr5=mmcu?atmega169p \
  	mmcu?avr5=mmcu?atmega169pa \
diff --git a/423-gcc-atmxt224_224e.patch b/423-gcc-atmxt224_224e.patch
index 5d1f041..f897533 100644
--- a/423-gcc-atmxt224_224e.patch
+++ b/423-gcc-atmxt224_224e.patch
@@ -1,7 +1,7 @@
 diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 --- gcc/config/avr/avr-devices.c	2012-02-10 20:08:47.000000000 +0530
 +++ gcc/config/avr/avr-devices.c	2012-02-10 20:16:45.000000000 +0530
-@@ -267,6 +267,8 @@ const struct mcu_type_s avr_mcu_types[] 
+@@ -266,6 +266,8 @@ const struct mcu_type_s avr_mcu_types[] 
      /* Xmega, <= 8K FLASH.  */
      /* Xmega, > 8K, <= 64K FLASH, <= 64K RAM.  */
    { "avrxmega2",    ARCH_AVRXMEGA2, NULL,                           0, 0x2000, "x32a4" },
@@ -13,7 +13,7 @@ diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 diff -Naurp gcc/config/avr/t-avr gcc/config/avr/t-avr
 --- gcc/config/avr/t-avr	2012-02-10 20:08:47.000000000 +0530
 +++ gcc/config/avr/t-avr	2012-02-10 20:16:45.000000000 +0530
-@@ -281,6 +281,8 @@ MULTILIB_MATCHES = \
+@@ -280,6 +280,8 @@ MULTILIB_MATCHES = \
  	mmcu?avr6=mmcu?atmega256rfr2 \
   	mmcu?avr6=mmcu?atmega2560 \
  	mmcu?avr6=mmcu?atmega2561 \
diff --git a/424-gcc-atxmega192c3.patch b/424-gcc-atxmega192c3.patch
index 5fe2f79..d145ece 100644
--- a/424-gcc-atxmega192c3.patch
+++ b/424-gcc-atxmega192c3.patch
@@ -1,7 +1,7 @@
 diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 --- gcc/config/avr/avr-devices.c	2012-02-10 20:20:51.000000000 +0530
 +++ gcc/config/avr/avr-devices.c	2012-02-10 20:21:25.000000000 +0530
-@@ -305,6 +305,7 @@ const struct mcu_type_s avr_mcu_types[] 
+@@ -304,6 +304,7 @@ const struct mcu_type_s avr_mcu_types[] 
    { "atxmega128d4", ARCH_AVRXMEGA6, "__AVR_ATxmega128D4__",         0, 0x2000, "x128d4" },
    { "atxmega192a3", ARCH_AVRXMEGA6, "__AVR_ATxmega192A3__",         0, 0x2000, "x192a3" },
    { "atxmega192a3u",ARCH_AVRXMEGA6, "__AVR_ATxmega192A3U__",        0, 0x2000, "x192a3u"},
@@ -12,7 +12,7 @@ diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 diff -Naurp gcc/config/avr/t-avr gcc/config/avr/t-avr
 --- gcc/config/avr/t-avr	2012-02-10 20:20:51.000000000 +0530
 +++ gcc/config/avr/t-avr	2012-02-10 20:21:25.000000000 +0530
-@@ -311,6 +311,7 @@ MULTILIB_MATCHES = \
+@@ -310,6 +310,7 @@ MULTILIB_MATCHES = \
  	mmcu?avrxmega6=mmcu?atxmega128d4 \
  	mmcu?avrxmega6=mmcu?atxmega192a3 \
  	mmcu?avrxmega6=mmcu?atxmega192a3u \
diff --git a/425-gcc-atmxt112sl.patch b/425-gcc-atmxt112sl.patch
index 7881478..618d4b3 100644
--- a/425-gcc-atmxt112sl.patch
+++ b/425-gcc-atmxt112sl.patch
@@ -1,7 +1,7 @@
 diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 --- gcc/config/avr/avr-devices.c	2012-02-10 20:23:45.000000000 +0530
 +++ gcc/config/avr/avr-devices.c	2012-02-10 20:24:34.000000000 +0530
-@@ -267,6 +267,7 @@ const struct mcu_type_s avr_mcu_types[] 
+@@ -266,6 +266,7 @@ const struct mcu_type_s avr_mcu_types[] 
      /* Xmega, <= 8K FLASH.  */
      /* Xmega, > 8K, <= 64K FLASH, <= 64K RAM.  */
    { "avrxmega2",    ARCH_AVRXMEGA2, NULL,                           0, 0x2000, "x32a4" },
@@ -12,7 +12,7 @@ diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 diff -Naurp gcc/config/avr/t-avr gcc/config/avr/t-avr
 --- gcc/config/avr/t-avr	2012-02-10 20:23:45.000000000 +0530
 +++ gcc/config/avr/t-avr	2012-02-10 20:24:34.000000000 +0530
-@@ -281,6 +281,7 @@ MULTILIB_MATCHES = \
+@@ -280,6 +280,7 @@ MULTILIB_MATCHES = \
  	mmcu?avr6=mmcu?atmega256rfr2 \
   	mmcu?avr6=mmcu?atmega2560 \
  	mmcu?avr6=mmcu?atmega2561 \
diff --git a/426-gcc-atxmega64c3.patch b/426-gcc-atxmega64c3.patch
index 6810501..41a67b8 100644
--- a/426-gcc-atxmega64c3.patch
+++ b/426-gcc-atxmega64c3.patch
@@ -1,7 +1,7 @@
 diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 --- gcc/config/avr/avr-devices.c	2012-02-10 20:28:58.000000000 +0530
 +++ gcc/config/avr/avr-devices.c	2012-02-10 20:29:40.000000000 +0530
-@@ -289,6 +289,7 @@ const struct mcu_type_s avr_mcu_types[] 
+@@ -288,6 +288,7 @@ const struct mcu_type_s avr_mcu_types[] 
    { "atxmega64a4u", ARCH_AVRXMEGA4, "__AVR_ATxmega64A4U__",         0, 0x2000, "x64a4u"},
    { "atxmega64b1",  ARCH_AVRXMEGA4, "__AVR_ATxmega64B1__",          0, 0x2000, "x64b1" },
    { "atxmega64b3",  ARCH_AVRXMEGA4, "__AVR_ATxmega64B3__",          0, 0x2000, "x64b3"},
@@ -12,7 +12,7 @@ diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 diff -Naurp gcc/config/avr/t-avr gcc/config/avr/t-avr
 --- gcc/config/avr/t-avr	2012-02-10 20:28:58.000000000 +0530
 +++ gcc/config/avr/t-avr	2012-02-10 20:29:40.000000000 +0530
-@@ -299,6 +299,7 @@ MULTILIB_MATCHES = \
+@@ -298,6 +298,7 @@ MULTILIB_MATCHES = \
  	mmcu?avrxmega4=mmcu?atxmega64a4u \
  	mmcu?avrxmega4=mmcu?atxmega64b1 \
  	mmcu?avrxmega4=mmcu?atxmega64b3 \
diff --git a/427-gcc-ata6285_6286.patch b/427-gcc-ata6285_6286.patch
index 857d206..a74328a 100644
--- a/427-gcc-ata6285_6286.patch
+++ b/427-gcc-ata6285_6286.patch
@@ -1,7 +1,7 @@
 diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 --- gcc/config/avr/avr-devices.c	2012-02-15 14:00:53.000000000 +0530
 +++ gcc/config/avr/avr-devices.c	2012-02-17 11:04:27.000000000 +0530
-@@ -117,6 +117,8 @@ const struct mcu_type_s avr_mcu_types[] 
+@@ -116,6 +116,8 @@ const struct mcu_type_s avr_mcu_types[] 
    { "attiny1634",           ARCH_AVR35, "__AVR_ATtiny1634__",       0, 0x0100, "tn1634" },
      /* Enhanced, <= 8K + 2-byte PC + { MOVW/LPMX, MUL }.  */
    { "avr4",                 ARCH_AVR4, NULL,                        0, 0x0060, "m8" },
@@ -13,7 +13,7 @@ diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 diff -Naurp gcc/config/avr/t-avr gcc/config/avr/t-avr
 --- gcc/config/avr/t-avr	2012-02-15 14:00:53.000000000 +0530
 +++ gcc/config/avr/t-avr	2012-02-17 11:30:56.000000000 +0530
-@@ -152,6 +152,8 @@ MULTILIB_MATCHES = \
+@@ -151,6 +151,8 @@ MULTILIB_MATCHES = \
  	mmcu?avr35=mmcu?attiny167 \
  	mmcu?avr35=mmcu?attiny1634 \
  	mmcu?avr35=mmcu?attiny327 \
diff --git a/428-gcc-attiny828.patch b/428-gcc-attiny828.patch
index 907fa03..e8765b9 100644
--- a/428-gcc-attiny828.patch
+++ b/428-gcc-attiny828.patch
@@ -1,21 +1,21 @@
 diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
---- gcc/config/avr/avr-devices.c	2012-02-23 15:24:34.000000000 +0530
-+++ gcc/config/avr/avr-devices.c	2012-02-23 15:28:51.000000000 +0530
-@@ -97,6 +97,7 @@ const struct mcu_type_s avr_mcu_types[] 
+--- gcc/config/avr/avr-devices.c	2012-05-31 14:44:29.000000000 +0530
++++ gcc/config/avr/avr-devices.c	2012-05-31 14:44:40.000000000 +0530
+@@ -96,6 +96,7 @@ const struct mcu_type_s avr_mcu_types[] 
+   { "attiny87",             ARCH_AVR25, "__AVR_ATtiny87__",         0, 0x0100, "tn87" },
    { "attiny48",             ARCH_AVR25, "__AVR_ATtiny48__",         0, 0x0100, "tn48" },
    { "attiny88",             ARCH_AVR25, "__AVR_ATtiny88__",         0, 0x0100, "tn88" },
-   { "attiny80",             ARCH_AVR25, "__AVR_ATtiny80__",         0, 0x0100, "tn80" },
 +  { "attiny828",            ARCH_AVR25, "__AVR_ATtiny828__",        0, 0x0100, "tn828" },
    { "at86rf401",            ARCH_AVR25, "__AVR_AT86RF401__",        1, 0x0060, "86401" },
      /* Classic, > 8K, <= 64K +2-byte PC + { JMP/CALL }.  */
    { "avr3",                 ARCH_AVR3, NULL,                        0, 0x0060, "43355" },
 diff -Naurp gcc/config/avr/t-avr gcc/config/avr/t-avr
---- gcc/config/avr/t-avr	2012-02-23 15:24:34.000000000 +0530
-+++ gcc/config/avr/t-avr	2012-02-23 15:29:11.000000000 +0530
-@@ -139,6 +139,7 @@ MULTILIB_MATCHES = \
+--- gcc/config/avr/t-avr	2012-05-31 14:44:29.000000000 +0530
++++ gcc/config/avr/t-avr	2012-05-31 14:44:40.000000000 +0530
+@@ -138,6 +138,7 @@ MULTILIB_MATCHES = \
+ 	mmcu?avr25=mmcu?attiny87 \
  	mmcu?avr25=mmcu?attiny48 \
  	mmcu?avr25=mmcu?attiny88 \
- 	mmcu?avr25=mmcu?attiny80 \
 +	mmcu?avr25=mmcu?attiny828 \
  	mmcu?avr25=mmcu?at86rf401 \
  	mmcu?avr3=mmcu?at43usb355 \
diff --git a/429-gcc-ata5790_5790n_5795.patch b/429-gcc-ata5790_5790n_5795.patch
index ac4e275..1a5b336 100644
--- a/429-gcc-ata5790_5790n_5795.patch
+++ b/429-gcc-ata5790_5790n_5795.patch
@@ -1,7 +1,7 @@
 diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 --- gcc/config/avr/avr-devices.c	2012-02-27 09:26:40.000000000 +0530
 +++ gcc/config/avr/avr-devices.c	2012-02-27 09:27:37.000000000 +0530
-@@ -144,6 +144,9 @@ const struct mcu_type_s avr_mcu_types[] 
+@@ -143,6 +143,9 @@ const struct mcu_type_s avr_mcu_types[] 
    { "avr5",                 ARCH_AVR5, NULL,                        0, 0x0060, "m16" },
    { "at90pwm161",           ARCH_AVR5, "__AVR_AT90PWM161__",    1, 0x0100, "90pwm161" },
  
@@ -14,7 +14,7 @@ diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
 diff -Naurp gcc/config/avr/t-avr gcc/config/avr/t-avr
 --- gcc/config/avr/t-avr	2012-02-27 09:26:40.000000000 +0530
 +++ gcc/config/avr/t-avr	2012-02-27 09:27:37.000000000 +0530
-@@ -175,6 +175,9 @@ MULTILIB_MATCHES = \
+@@ -174,6 +174,9 @@ MULTILIB_MATCHES = \
  	mmcu?avr4=mmcu?at90pwm3b \
  	mmcu?avr4=mmcu?at90pwm81 \
  	mmcu?avr5=mmcu?at90pwm161 \
diff --git a/430-gcc-ata5272_ata5505.patch b/430-gcc-ata5272_ata5505.patch
index b7deac1..5f53481 100644
--- a/430-gcc-ata5272_ata5505.patch
+++ b/430-gcc-ata5272_ata5505.patch
@@ -9,7 +9,7 @@ diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
    { "attiny13",             ARCH_AVR25, "__AVR_ATtiny13__",         1, 0x0060, "tn13" },
    { "attiny13a",            ARCH_AVR25, "__AVR_ATtiny13A__",        1, 0x0060, "tn13a" },
    { "attiny2313",           ARCH_AVR25, "__AVR_ATtiny2313__",       1, 0x0060, "tn2313" },
-@@ -109,6 +110,7 @@ const struct mcu_type_s avr_mcu_types[] 
+@@ -108,6 +109,7 @@ const struct mcu_type_s avr_mcu_types[] 
    { "at43usb320",           ARCH_AVR31, "__AVR_AT43USB320__",       0, 0x0060, "43320" },
      /* Classic, >=16K, <=64K + 2-byte PC + { MOVW/LPMX + JMP/CALL }.  */
    { "avr35",                ARCH_AVR35, NULL,                       0, 0x0100, "usb162" },
@@ -28,7 +28,7 @@ diff -Naurp gcc/config/avr/t-avr gcc/config/avr/t-avr
  	mmcu?avr25=mmcu?ata6289 \
  	mmcu?avr25=mmcu?attiny13 \
  	mmcu?avr25=mmcu?attiny13a \
-@@ -147,6 +148,7 @@ MULTILIB_MATCHES = \
+@@ -146,6 +147,7 @@ MULTILIB_MATCHES = \
  	mmcu?avr31=mmcu?at43usb320 \
  	mmcu?avr35=mmcu?at90usb82 \
  	mmcu?avr35=mmcu?at90usb162 \
diff --git a/431-gcc-atmxt540s.patch b/431-gcc-atmxt540s.patch
new file mode 100644
index 0000000..d3b8a39
--- /dev/null
+++ b/431-gcc-atmxt540s.patch
@@ -0,0 +1,24 @@
+diff -Naurp gcc/config/avr/avr-devices.c config/avr/avr-devices.c
+--- gcc/config/avr/avr-devices.c	2012-06-28 16:20:39.000000000 +0530
++++ gcc/config/avr/avr-devices.c	2012-06-28 16:23:31.000000000 +0530
+@@ -312,6 +312,8 @@ const struct mcu_type_s avr_mcu_types[] 
+   { "atxmega128c3", ARCH_AVRXMEGA6, "__AVR_ATxmega128C3__",         0, 0x2000, "x128c3" },
+   { "atxmega128d3", ARCH_AVRXMEGA6, "__AVR_ATxmega128D3__",         0, 0x2000, "x128d3" },
+   { "atxmega128d4", ARCH_AVRXMEGA6, "__AVR_ATxmega128D4__",         0, 0x2000, "x128d4" },
++  { "atmxt540s",    ARCH_AVRXMEGA6, "__AVR_ATMXT540S__",            0, 0x2000, "mxt540s"},
++  { "atmxt540sreva", ARCH_AVRXMEGA6, "__AVR_ATMXT540SREVA__",     0, 0x2000, "mxt540sreva"},
+   { "atxmega192a3", ARCH_AVRXMEGA6, "__AVR_ATxmega192A3__",         0, 0x2000, "x192a3" },
+   { "atxmega192a3u",ARCH_AVRXMEGA6, "__AVR_ATxmega192A3U__",        0, 0x2000, "x192a3u"},
+   { "atxmega192c3", ARCH_AVRXMEGA6, "__AVR_ATxmega192C3__",         0, 0x2000, "x192c3" },
+diff -Naurp gcc/config/avr/t-avr gcc/config/avr/t-avr
+--- gcc/config/avr/t-avr	2012-06-28 16:20:39.000000000 +0530
++++ gcc/config/avr/t-avr	2012-06-28 16:37:18.000000000 +0530
+@@ -318,6 +318,8 @@ MULTILIB_MATCHES = \
+ 	mmcu?avrxmega6=mmcu?atxmega128c3 \
+ 	mmcu?avrxmega6=mmcu?atxmega128d3 \
+ 	mmcu?avrxmega6=mmcu?atxmega128d4 \
++	mmcu?avrxmega6=mmcu?atmxt540s \
++	mmcu?avrxmega6=mmcu?atmxt540sreva \
+ 	mmcu?avrxmega6=mmcu?atxmega192a3 \
+ 	mmcu?avrxmega6=mmcu?atxmega192a3u \
+ 	mmcu?avrxmega6=mmcu?atxmega192c3 \
diff --git a/432-gcc-ata5831.patch b/432-gcc-ata5831.patch
new file mode 100644
index 0000000..fadd66b
--- /dev/null
+++ b/432-gcc-ata5831.patch
@@ -0,0 +1,54 @@
+diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
+--- gcc/config/avr/avr-devices.c	2012-04-20 18:52:19.000000000 +0530
++++ gcc/config/avr/avr-devices.c	2012-04-20 18:52:59.000000000 +0530
+@@ -37,6 +37,7 @@ const struct base_arch_s avr_arch_types[
+   { 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0x0060, "__AVR_ARCH__=5",   "avr5" },
+   { 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0x0060, "__AVR_ARCH__=51",  "avr51" },
+   { 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0x0060, "__AVR_ARCH__=6",   "avr6" },
++  { 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0x0200, "__AVR_ARCH__=7",   "avr7" }, 
+   { 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0x2000, "__AVR_ARCH__=101", "avrxmega1" },
+   { 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0x2000, "__AVR_ARCH__=102", "avrxmega2" },
+   { 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0x2000, "__AVR_ARCH__=103", "avrxmega3" },
+@@ -270,6 +271,9 @@ const struct mcu_type_s avr_mcu_types[] 
+   { "atmega2561",           ARCH_AVR6, "__AVR_ATmega2561__",        0, 0x0200, "m2561" },
+   { "atmega256rfa2",        ARCH_AVR6, "__AVR_ATmega256RFA2__",     0, 0x0200, "m256rfa2" },
+   { "atmega256rfr2",        ARCH_AVR6, "__AVR_ATmega256RFR2__",     0, 0x0200, "m256rfr2" },
++    /* Enhanced, == 20K starts at 0x8000 */
++  { "avr7",                 ARCH_AVR7, NULL,                        0, 0x0200, "a5831" },
++  { "ata5831",              ARCH_AVR7, "__AVR_ATA5831__",           0, 0x0200, "a5831" },
+     /* Enhanced, == 256K.  */
+     /* Xmega, <= 8K FLASH.  */
+     /* Xmega, > 8K, <= 64K FLASH, <= 64K RAM.  */
+diff -Naurp gcc/config/avr/avr.h gcc-4.6.2-src/gcc/config/avr/avr.h
+--- gcc/config/avr/avr.h	2012-04-20 18:52:19.000000000 +0530
++++ gcc/config/avr/avr.h	2012-04-20 18:52:59.000000000 +0530
+@@ -79,6 +79,7 @@ enum avr_arch
+   ARCH_AVR5,
+   ARCH_AVR51,
+   ARCH_AVR6,
++  ARCH_AVR7,
+   ARCH_AVRXMEGA1,
+   ARCH_AVRXMEGA2,
+   ARCH_AVRXMEGA3,
+diff -Naurp gcc-4.6.2-base/gcc/config/avr/t-avr gcc-4.6.2-src/gcc/config/avr/t-avr
+--- gcc/config/avr/t-avr	2012-04-20 18:52:19.000000000 +0530
++++ gcc/config/avr/t-avr	2012-04-20 18:52:59.000000000 +0530
+@@ -107,8 +107,8 @@ fp-bit.c: $(srcdir)/config/fp-bit.c $(sr
+ 
+ FPBIT = fp-bit.c
+ 
+-MULTILIB_OPTIONS = mmcu=avr2/mmcu=avr25/mmcu=avr3/mmcu=avr31/mmcu=avr35/mmcu=avr4/mmcu=avr5/mmcu=avr51/mmcu=avr6/mmcu=avrxmega2/mmcu=avrxmega4/mmcu=avrxmega5/mmcu=avrxmega6/mmcu=avrxmega7/mmcu=avrtiny10
+-MULTILIB_DIRNAMES = avr2 avr25 avr3 avr31 avr35 avr4 avr5 avr51 avr6 avrxmega2 avrxmega4 avrxmega5 avrxmega6 avrxmega7 avrtiny10
++MULTILIB_OPTIONS = mmcu=avr2/mmcu=avr25/mmcu=avr3/mmcu=avr31/mmcu=avr35/mmcu=avr4/mmcu=avr5/mmcu=avr51/mmcu=avr6/mmcu=avr7/mmcu=avrxmega2/mmcu=avrxmega4/mmcu=avrxmega5/mmcu=avrxmega6/mmcu=avrxmega7/mmcu=avrtiny10
++MULTILIB_DIRNAMES = avr2 avr25 avr3 avr31 avr35 avr4 avr5 avr51 avr6 avr7 avrxmega2 avrxmega4 avrxmega5 avrxmega6 avrxmega7 avrtiny10
+ 
+ # The many avr2 matches are not listed here - this is the default.
+ MULTILIB_MATCHES = \
+@@ -288,6 +288,7 @@ MULTILIB_MATCHES = \
+ 	mmcu?avr6=mmcu?atmega256rfr2 \
+  	mmcu?avr6=mmcu?atmega2560 \
+ 	mmcu?avr6=mmcu?atmega2561 \
++	mmcu?avr7=mmcu?ata5831 \
+ 	mmcu?avrxmega2=mmcu?atmxt112sl \
+ 	mmcu?avrxmega2=mmcu?atmxt224 \
+ 	mmcu?avrxmega2=mmcu?atmxt224e \
diff --git a/409-gcc-attiny80.patch b/433-gcc-attiny841.patch
similarity index 54%
rename from 409-gcc-attiny80.patch
rename to 433-gcc-attiny841.patch
index c109b09..f846bfd 100644
--- a/409-gcc-attiny80.patch
+++ b/433-gcc-attiny841.patch
@@ -1,22 +1,22 @@
 diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
---- gcc/config/avr/avr-devices.c	2011-10-28 11:44:14.000000000 +0530
-+++ gcc/config/avr/avr-devices.c	2011-10-28 11:55:44.000000000 +0530
-@@ -96,6 +96,7 @@ const struct mcu_type_s avr_mcu_types[] 
-   { "attiny87",             ARCH_AVR25, "__AVR_ATtiny87__",         0, 0x0100, "tn87" },
+--- gcc/config/avr/avr-devices.c	2012-06-12 11:41:02.000000000 +0530
++++ gcc/config/avr/avr-devices.c	2012-06-12 11:48:03.000000000 +0530
+@@ -99,6 +99,7 @@ const struct mcu_type_s avr_mcu_types[] 
    { "attiny48",             ARCH_AVR25, "__AVR_ATtiny48__",         0, 0x0100, "tn48" },
    { "attiny88",             ARCH_AVR25, "__AVR_ATtiny88__",         0, 0x0100, "tn88" },
-+  { "attiny80",             ARCH_AVR25, "__AVR_ATtiny80__",         0, 0x0100, "tn80" },
+   { "attiny828",            ARCH_AVR25, "__AVR_ATtiny828__",        0, 0x0100, "tn828" },
++  { "attiny841",            ARCH_AVR25, "__AVR_ATtiny841__",        0, 0x0100, "tn841" },
    { "at86rf401",            ARCH_AVR25, "__AVR_AT86RF401__",        1, 0x0060, "86401" },
      /* Classic, > 8K, <= 64K +2-byte PC + { JMP/CALL }.  */
    { "avr3",                 ARCH_AVR3, NULL,                        0, 0x0060, "43355" },
 diff -Naurp gcc/config/avr/t-avr gcc/config/avr/t-avr
---- gcc/config/avr/t-avr	2011-10-28 11:40:24.000000000 +0530
-+++ gcc/config/avr/t-avr	2011-10-28 11:55:44.000000000 +0530
-@@ -138,6 +138,7 @@ MULTILIB_MATCHES = \
- 	mmcu?avr25=mmcu?attiny87 \
+--- gcc/config/avr/t-avr	2012-06-12 11:41:02.000000000 +0530
++++ gcc/config/avr/t-avr	2012-06-12 11:45:26.000000000 +0530
+@@ -140,6 +140,7 @@ MULTILIB_MATCHES = \
  	mmcu?avr25=mmcu?attiny48 \
  	mmcu?avr25=mmcu?attiny88 \
-+	mmcu?avr25=mmcu?attiny80 \
+ 	mmcu?avr25=mmcu?attiny828 \
++	mmcu?avr25=mmcu?attiny841 \
  	mmcu?avr25=mmcu?at86rf401 \
  	mmcu?avr3=mmcu?at43usb355 \
  	mmcu?avr3=mmcu?at76c711 \
diff --git a/434-gcc-atxmega32_16_8e5.patch b/434-gcc-atxmega32_16_8e5.patch
new file mode 100644
index 0000000..b66709a
--- /dev/null
+++ b/434-gcc-atxmega32_16_8e5.patch
@@ -0,0 +1,26 @@
+diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
+--- gcc/config/avr/avr-devices.c	2012-10-16 16:56:11.000000000 +0530
++++ gcc/config/avr/avr-devices.c	2012-10-16 16:55:50.000000000 +0530
+@@ -291,6 +291,9 @@ const struct mcu_type_s avr_mcu_types[] 
+   { "atxmega32a4u",  ARCH_AVRXMEGA2, "__AVR_ATxmega32A4U__",        0, 0x2000, "x32a4u" },
+   { "atxmega32c4",  ARCH_AVRXMEGA2, "__AVR_ATxmega32C4__",          0, 0x2000, "x32c4" },
+   { "atxmega32d4",  ARCH_AVRXMEGA2, "__AVR_ATxmega32D4__",          0, 0x2000, "x32d4" },
++  { "atxmega16e5",  ARCH_AVRXMEGA2, "__AVR_ATxmega16E5__",          0, 0x2000, "x16e5" },
++  { "atxmega8e5",   ARCH_AVRXMEGA2, "__AVR_ATxmega8E5__",	     0, 0x2000, "x8e5"  },
++  { "atxmega32e5",  ARCH_AVRXMEGA2, "__AVR_ATxmega32E5__",          0, 0x2000, "x32e5" },
+   { "atxmega32x1",  ARCH_AVRXMEGA2, "__AVR_ATxmega32X1__",          0, 0x2000, "x32x1" },
+     /* Xmega, > 8K, <= 64K FLASH, > 64K RAM.  */
+     /* { "avrxmega3",    ARCH_AVRXMEGA3, NULL }, */
+diff -Naurp gcc/config/avr/t-avr gcc/config/avr/t-avr
+--- gcc/config/avr/t-avr	2012-10-16 16:56:11.000000000 +0530
++++ gcc/config/avr/t-avr	2012-10-16 16:55:50.000000000 +0530
+@@ -300,6 +300,9 @@ MULTILIB_MATCHES = \
+ 	mmcu?avrxmega2=mmcu?atxmega16d4 \
+ 	mmcu?avrxmega2=mmcu?atxmega32c4 \
+ 	mmcu?avrxmega2=mmcu?atxmega32d4 \
++	mmcu?avrxmega2=mmcu?atxmega32e5 \
++	mmcu?avrxmega2=mmcu?atxmega16e5 \
++	mmcu?avrxmega2=mmcu?atxmega8e5 \
+ 	mmcu?avrxmega2=mmcu?atxmega32a4 \
+ 	mmcu?avrxmega2=mmcu?atxmega32a4u \
+ 	mmcu?avrxmega2=mmcu?atxmega32x1 \
diff --git a/501-gcc-avrtiny10-bug-12510.patch b/501-gcc-avrtiny10-bug-12510.patch
index eecd478..36d31f1 100644
--- a/501-gcc-avrtiny10-bug-12510.patch
+++ b/501-gcc-avrtiny10-bug-12510.patch
@@ -1,7 +1,7 @@
 diff -Naurp gcc/config/avr/avr.h gcc/config/avr/avr.h
---- gcc/config/avr/avr.h	2011-06-22 10:28:47.000000000 +0530
-+++ gcc/config/avr/avr.h	2011-06-22 10:35:08.000000000 +0530
-@@ -136,7 +136,7 @@ extern GTY(()) section *progmem_section;
+--- gcc/config/avr/avr.h	2012-04-23 11:17:05.000000000 +0530
++++ gcc/config/avr/avr.h	2012-04-23 11:17:24.000000000 +0530
+@@ -137,7 +137,7 @@ extern GTY(()) section *progmem_section;
  #define AVR_2_BYTE_PC (!AVR_HAVE_EIJMP_EICALL)
  #define AVR_3_BYTE_PC (AVR_HAVE_EIJMP_EICALL)
  
@@ -11,8 +11,8 @@ diff -Naurp gcc/config/avr/avr.h gcc/config/avr/avr.h
  #define AVR_RAMPX_ADDR (AVR_XMEGA ? 0x39 : 0)
  #define AVR_RAMPY_ADDR (AVR_XMEGA ? 0x3A : 0)
 diff -Naurp gcc/config/avr/predicates.md gcc/config/avr/predicates.md
---- gcc/config/avr/predicates.md	2011-06-22 10:25:29.000000000 +0530
-+++ gcc/config/avr/predicates.md	2011-06-22 10:35:08.000000000 +0530
+--- gcc/config/avr/predicates.md	2012-04-23 11:07:59.000000000 +0530
++++ gcc/config/avr/predicates.md	2012-04-23 11:17:24.000000000 +0530
 @@ -50,21 +50,24 @@
  ;; Return true if OP is a valid address for lower half of I/O space.
  (define_predicate "low_io_address_operand"
diff --git a/503-gcc-bug13789.patch b/503-gcc-bug13789.patch
index bfccc05..e488771 100644
--- a/503-gcc-bug13789.patch
+++ b/503-gcc-bug13789.patch
@@ -1,11 +1,11 @@
 diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
---- gcc/config/avr/avr-devices.c	2011-06-22 10:26:14.000000000 +0530
-+++ gcc/config/avr/avr-devices.c	2011-06-22 10:48:05.000000000 +0530
-@@ -37,14 +37,14 @@ const struct base_arch_s avr_arch_types[
-   { 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0x0060, "__AVR_ARCH__=5",   "avr5" },
+--- gcc/config/avr/avr-devices.c	2012-03-27 16:11:43.000000000 +0530
++++ gcc/config/avr/avr-devices.c	2012-03-28 11:36:52.000000000 +0530
+@@ -38,14 +38,14 @@ const struct base_arch_s avr_arch_types[
    { 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0x0060, "__AVR_ARCH__=51",  "avr51" },
    { 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0x0060, "__AVR_ARCH__=6",   "avr6" },
-+  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0x0040, "__AVR_ARCH__=100",  "avrtiny10" },
+   { 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0x0200, "__AVR_ARCH__=7",   "avr7" }, 
++  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0x0040, "__AVR_ARCH__=100", "avrtiny10" },
    { 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0x2000, "__AVR_ARCH__=101", "avrxmega1" },
    { 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0x2000, "__AVR_ARCH__=102", "avrxmega2" },
    { 0, 1, 1, 1, 0, 0, 0, 1, 1, 0, 0x2000, "__AVR_ARCH__=103", "avrxmega3" },
@@ -19,12 +19,12 @@ diff -Naurp gcc/config/avr/avr-devices.c gcc/config/avr/avr-devices.c
  
  /* List of all known AVR MCU types - if updated, it has to be kept
 diff -Naurp gcc/config/avr/avr.h gcc/config/avr/avr.h
---- gcc/config/avr/avr.h	2011-06-22 10:36:29.000000000 +0530
-+++ gcc/config/avr/avr.h	2011-06-22 10:48:05.000000000 +0530
-@@ -79,14 +79,14 @@ enum avr_arch
-   ARCH_AVR5,
+--- gcc/config/avr/avr.h	2012-03-27 16:44:27.000000000 +0530
++++ gcc/config/avr/avr.h	2012-03-28 11:38:15.000000000 +0530
+@@ -80,14 +80,14 @@ enum avr_arch
    ARCH_AVR51,
    ARCH_AVR6,
+   ARCH_AVR7,
 +  ARCH_AVRTINY10,
    ARCH_AVRXMEGA1,
    ARCH_AVRXMEGA2,
diff --git a/504-gcc-conditional-register.patch b/504-gcc-conditional-register.patch
index 1dd01c1..acab4d2 100644
--- a/504-gcc-conditional-register.patch
+++ b/504-gcc-conditional-register.patch
@@ -1,6 +1,6 @@
 diff -Naurp gcc/config/avr/avr.c gcc/config/avr/avr.c
---- gcc/config/avr/avr.c	2011-10-28 16:28:16.000000000 +0530
-+++ gcc/config/avr/avr.c	2011-10-28 16:40:20.000000000 +0530
+--- gcc/config/avr/avr.c	2012-04-23 11:22:39.000000000 +0530
++++ gcc/config/avr/avr.c	2012-04-23 11:26:15.000000000 +0530
 @@ -96,6 +96,7 @@ static struct machine_function * avr_ini
  static void avr_init_builtins (void);
  static rtx avr_expand_builtin (tree, rtx, rtx, enum machine_mode, int);
@@ -39,9 +39,9 @@ diff -Naurp gcc/config/avr/avr.c gcc/config/avr/avr.c
     registers (for a define_peephole2) in the current function.  */
  
 diff -Naurp gcc/config/avr/avr.h gcc/config/avr/avr.h
---- gcc/config/avr/avr.h	2011-10-28 16:29:55.000000000 +0530
-+++ gcc/config/avr/avr.h	2011-10-28 16:40:20.000000000 +0530
-@@ -313,41 +313,6 @@ enum reg_class {
+--- gcc/config/avr/avr.h	2012-04-23 11:25:46.000000000 +0530
++++ gcc/config/avr/avr.h	2012-04-23 11:26:15.000000000 +0530
+@@ -314,41 +314,6 @@ enum reg_class {
    {0xffffffff,0x00000003}	/* ALL_REGS */				\
  }
  
diff --git a/506-gcc-avrtc541.patch b/506-gcc-avrtc541.patch
new file mode 100644
index 0000000..2675251
--- /dev/null
+++ b/506-gcc-avrtc541.patch
@@ -0,0 +1,42 @@
+diff -Naurp gcc/config/avr/libgcc.S gcc/config/avr/libgcc.S
+--- gcc/config/avr/libgcc.S	2012-06-12 12:43:40.000000000 +0530
++++ gcc/config/avr/libgcc.S	2012-06-12 12:44:08.000000000 +0530
+@@ -862,6 +862,12 @@ __do_copy_data:
+ 	cpc	r27, r17
+ 	brne	.L__do_copy_data_loop
+ #endif /* !defined(__AVR_HAVE_ELPMX__) && !defined(__AVR_HAVE_ELPM__) */
++
++;Clear RAMPZ in case it was set during copy_data
++#if defined(__AVR_HAVE_ELPMX__ ) || defined(__AVR_HAVE_ELPM__)
++    out __RAMPZ__, __zero_reg__
++#endif
++
+ #endif /* L_copy_data */
+ #endif
+ 
+@@ -941,6 +947,12 @@ __do_global_ctors:
+ 	cpc	r29, r17
+ 	brne	.L__do_global_ctors_loop
+ #endif /* defined(__AVR_HAVE_RAMPZ__) */
++
++;Clear RAMPZ in case it was set
++#if defined(__AVR_HAVE_RAMPZ__)
++    out __RAMPZ__, __zero_reg__
++#endif
++
+ #endif /* L_ctors */
+ 
+ #ifdef L_dtors
+@@ -992,6 +1004,12 @@ __do_global_dtors:
+ 	cpc	r29, r17
+ 	brne	.L__do_global_dtors_loop
+ #endif /* defined(__AVR_HAVE_RAMPZ__) */
++
++;Clear RAMPZ in case it was set
++#if defined(__AVR_HAVE_RAMPZ__)
++    out __RAMPZ__, __zero_reg__
++#endif
++
+ #endif /* L_dtors */
+ 
+ #if !defined (__AVR_TINY__)
diff --git a/507-gcc-avrtc-518.patch b/507-gcc-avrtc-518.patch
new file mode 100644
index 0000000..07b2a87
--- /dev/null
+++ b/507-gcc-avrtc-518.patch
@@ -0,0 +1,23 @@
+diff -Naurp gcc/config/avr/avr.c gcc/config/avr/avr.c
+--- gcc/config/avr/avr.c	2012-05-31 11:55:38.000000000 +0530
++++ gcc/config/avr/avr.c	2012-06-15 12:10:49.000000000 +0530
+@@ -738,7 +738,8 @@ expand_prologue (void)
+ 	      && !cfun->machine->is_signal
+ 	      && !cfun->machine->is_OS_task
+ 	      && !cfun->machine->is_OS_main
+-	      && live_seq);
++	      && live_seq
++	      && !AVR_TINY);
+ 
+   if (cfun->machine->is_interrupt || cfun->machine->is_signal)
+     {
+@@ -1068,7 +1069,8 @@ expand_epilogue (void)
+ 	      && !cfun->machine->is_signal
+ 	      && !cfun->machine->is_OS_task
+ 	      && !cfun->machine->is_OS_main
+-	      && live_seq);
++	      && live_seq
++	      && !AVR_TINY);
+   
+   if (minimize && (frame_pointer_needed || live_seq > 4))
+     {
diff --git a/508-gcc-avrtc514-tiny.patch b/508-gcc-avrtc514-tiny.patch
new file mode 100644
index 0000000..5e91123
--- /dev/null
+++ b/508-gcc-avrtc514-tiny.patch
@@ -0,0 +1,12 @@
+diff -Naurp gcc/config/avr/avr.h gcc/config/avr/avr.h
+--- gcc/config/avr/avr.h	2012-06-27 15:36:22.000000000 +0530
++++ gcc/config/avr/avr.h	2012-06-27 15:38:34.000000000 +0530
+@@ -369,7 +369,7 @@ enum reg_class {
+ 
+ #define ARG_POINTER_REGNUM 34
+ 
+-#define STATIC_CHAIN_REGNUM 2
++#define STATIC_CHAIN_REGNUM ((AVR_TINY)?18:2)
+ 
+ #define ELIMINABLE_REGS {					\
+       {ARG_POINTER_REGNUM, FRAME_POINTER_REGNUM},		\
diff --git a/509-gcc-AVRTC-544-call-used-registers-tiny10.patch b/509-gcc-AVRTC-544-call-used-registers-tiny10.patch
new file mode 100644
index 0000000..8ef99f7
--- /dev/null
+++ b/509-gcc-AVRTC-544-call-used-registers-tiny10.patch
@@ -0,0 +1,173 @@
+diff -Naurp gcc/config/avr/avr.c gcc/config/avr/avr.c
+--- gcc/config/avr/avr.c	2012-06-22 15:29:05.000000000 +0530
++++ gcc/config/avr/avr.c	2012-06-28 12:50:23.000000000 +0530
+@@ -111,6 +111,9 @@ static void avr_help (void);
+ /* Allocate registers from r25 to r8 for parameters for function calls.  */
+ #define FIRST_CUM_REG 26
+ 
++/* Last call saved register */
++#define LAST_CALLEE_SAVED_REG (AVR_TINY ? 21 : 17)
++
+ /* Temporary register RTX (gen_rtx_REG (QImode, TMP_REGNO)) */
+ static GTY(()) rtx tmp_reg_rtx;
+ 
+@@ -611,7 +614,7 @@ sequent_regs_live (void)
+   int live_seq=0;
+   int cur_seq=0;
+ 
+-  for (reg = 0; reg < 18; ++reg)
++  for (reg = 0; reg <= LAST_CALLEE_SAVED_REG; ++reg)
+     {
+       if (fixed_regs[reg])
+         {
+@@ -838,11 +841,11 @@ expand_prologue (void)
+ 
+       /* Note that live_seq always contains r28+r29, but the other
+ 	 registers to be saved are all below 18.  */
+-      first_reg = 18 - (live_seq - 2);
++      first_reg = (LAST_CALLEE_SAVED_REG + 1) - (live_seq - 2);
+ 
+       for (reg = 29, offset = -live_seq + 1;
+ 	   reg >= first_reg;
+-	   reg = (reg == 28 ? 17 : reg - 1), ++offset)
++	   reg = (reg == 28 ? (LAST_CALLEE_SAVED_REG) : reg - 1), ++offset)
+ 	{
+ 	  rtx m, r;
+ 
+@@ -6375,6 +6378,17 @@ order_regs_for_local_alloc (void)
+     0,1,
+     32,33,34,35
+   };
++  static const int tiny_order_0[] = {
++    24,25,
++    22,23,
++    30,31,
++    26,27,
++    28,29,
++    21,20,19,18,
++    16,17,
++    32,33,34,35,
++    15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
++  };
+   static const int order_1[] = {
+     18,19,
+     20,21,
+@@ -6387,6 +6401,17 @@ order_regs_for_local_alloc (void)
+     0,1,
+     32,33,34,35
+   };
++  static const int tiny_order_1[] = {
++    22,23,
++    24,25,
++    30,31,
++    26,27,
++    28,29,
++    21,20,19,18,
++    16,17,
++    32,33,34,35,
++    15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
++  };
+   static const int order_2[] = {
+     25,24,
+     23,22,
+@@ -6400,10 +6425,15 @@ order_regs_for_local_alloc (void)
+     1,0,
+     32,33,34,35
+   };
+-  
+-  const int *order = (TARGET_ORDER_1 ? order_1 :
+-		      TARGET_ORDER_2 ? order_2 :
+-		      order_0);
++ 
++  /*
++  Select specific register allocation order. Tiny Core (attiny4/5/9/10/20/40)
++  devices has only 16 registers, so different allocation order should be used
++  */ 
++  const int *order = (TARGET_ORDER_1 ? (AVR_TINY ? tiny_order_1 : order_1) :
++		      TARGET_ORDER_2 ? (AVR_TINY ? tiny_order_1 : order_2) :
++                                       (AVR_TINY ? tiny_order_0 : order_0));
++
+   for (i=0; i < ARRAY_SIZE (order_0); ++i)
+       reg_alloc_order[i] = order[i];
+ }
+@@ -7395,15 +7425,45 @@ avr_output_addr_vec_elt (FILE *stream, i
+ 
+ static void
+ avr_conditional_register_usage(void) {
+-   if (AVR_TINY) {                             
+-     int i;                                    
+-     for (i = 0;  i <= 17;  i++) {             
+-       fixed_regs[i] = 1;                      
+-       call_used_regs[i] = 1;                  
+-     }                                         
+-	CLEAR_HARD_REG_SET(reg_class_contents[(int)ADDW_REGS]);           
+-	CLEAR_HARD_REG_SET(reg_class_contents[(int)NO_LD_REGS]);           
+-   }
++  if (AVR_TINY) {
++    int i;
++
++    const int tiny_reg_alloc_order[] = {
++      24,25,
++      22,23,
++      30,31,
++      26,27,
++      28,29,
++      21,20,19,18,
++      16,17,
++      32,33,34,35,
++      15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
++    };
++
++    /* Set R0-R17 as fixed registers. Reset R0-R17 in call used register list
++    - R0-R15 are not available in Tiny Core devices
++    - R16 and R17 are fixed registers
++    */
++    for (i = 0;  i <= 17;  i++) {
++      fixed_regs[i] = 1;
++      call_used_regs[i] = 1;
++    }
++
++    /* Set R18 to R21 as call used register 
++    - R18, R19, R20 and R21 are the call used registers in Tiny Core devices
++    */
++    for (i = 18; i <= LAST_CALLEE_SAVED_REG; i++) {
++      call_used_regs[i] = 0;
++    }
++
++    /*update register allocation order for Tiny Core devices */
++    for (i=0; i < ARRAY_SIZE (tiny_reg_alloc_order); i++) {
++      reg_alloc_order[i] = tiny_reg_alloc_order[i];
++    }
++
++    CLEAR_HARD_REG_SET(reg_class_contents[(int)ADDW_REGS]);
++    CLEAR_HARD_REG_SET(reg_class_contents[(int)NO_LD_REGS]);
++  }
+ }
+ 
+ /* Returns true if SCRATCH are safe to be allocated as a scratch
+@@ -7553,13 +7613,20 @@ avr_asm_out_dtor (rtx symbol, int priori
+ static bool
+ avr_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
+ {
+-  if (TYPE_MODE (type) == BLKmode)
+-    {
+-      HOST_WIDE_INT size = int_size_in_bytes (type);
+-      return (size == -1 || size > 8);
+-    }
++  HOST_WIDE_INT size = int_size_in_bytes (type);
++  HOST_WIDE_INT ret_size_limit = AVR_TINY ? 4 : 8;
++
++  /* In avr, there are 8 return registers. But, for Tiny Core 
++  (attiny4/5/9/10/20/40) devices, only 4 registers available.
++  Return true if size is unknown or greater than the limit */
++  if ((size == -1) || (size > ret_size_limit))
++  {
++    return true;
++  }
+   else
++  {
+     return false;
++  }
+ }
+ 
+ /* Worker function for CASE_VALUES_THRESHOLD.  */
diff --git a/510-gcc-avrtc496-tiny.patch b/510-gcc-avrtc496-tiny.patch
new file mode 100644
index 0000000..2bcc7f6
--- /dev/null
+++ b/510-gcc-avrtc496-tiny.patch
@@ -0,0 +1,42 @@
+diff -Naurp gcc/config/avr/avr.c gcc/config/avr/avr.c
+--- gcc/config/avr/avr.c	2012-06-27 15:41:23.000000000 +0530
++++ gcc/config/avr/avr.c	2012-06-27 15:42:02.000000000 +0530
+@@ -751,15 +751,15 @@ expand_prologue (void)
+ 	emit_insn (gen_enable_interrupt ());
+ 	
+       /* Push zero reg.  */
+-      emit_push_byte (ZERO_REGNO, true);
++      emit_push_byte ((AVR_TINY)?ZERO_REGNO_AVRTINY10:ZERO_REGNO, true);
+ 
+       /* Push tmp reg.  */
+-      emit_push_byte (TMP_REGNO, true);
++      emit_push_byte ((AVR_TINY)?TMP_REGNO_AVRTINY10:TMP_REGNO, true);
+ 
+       /* Push SREG.  */
+       /* ??? There's no dwarf2 column reserved for SREG.  */
+       emit_move_insn (tmp_reg_rtx, gen_rtx_MEM (QImode, GEN_INT (AVR_SREG_ADDR)));
+-      emit_push_byte (TMP_REGNO, false);
++      emit_push_byte ((AVR_TINY)?TMP_REGNO_AVRTINY10:TMP_REGNO, false);
+ 
+       /* Push RAMPD, RAMPX, RAMPY. */
+       /*
+@@ -1217,16 +1217,16 @@ expand_epilogue (void)
+ 		} 
+ 
+           /* Restore SREG using tmp reg as scratch.  */
+-          emit_pop_byte (TMP_REGNO);
++          emit_pop_byte ((AVR_TINY)?TMP_REGNO_AVRTINY10:TMP_REGNO);
+       
+           emit_move_insn (gen_rtx_MEM (QImode, GEN_INT (AVR_SREG_ADDR)), 
+ 			  tmp_reg_rtx);
+ 
+           /* Restore tmp REG.  */
+-          emit_pop_byte (TMP_REGNO);
++          emit_pop_byte ((AVR_TINY)?TMP_REGNO_AVRTINY10:TMP_REGNO);
+ 
+           /* Restore zero REG.  */
+-          emit_pop_byte (ZERO_REGNO);
++          emit_pop_byte ((AVR_TINY)?ZERO_REGNO_AVRTINY10:ZERO_REGNO);
+         }
+ 
+       emit_jump_insn (gen_return ());
diff --git a/511-gcc-avrtc539-backported.patch b/511-gcc-avrtc539-backported.patch
new file mode 100644
index 0000000..20d01db
--- /dev/null
+++ b/511-gcc-avrtc539-backported.patch
@@ -0,0 +1,44 @@
+diff -Naurp gcc/combine.c gcc/combine.c
+--- gcc/combine.c	2011-07-29 14:05:59.000000000 +0530
++++ gcc/combine.c	2012-06-28 15:51:12.000000000 +0530
+@@ -1666,6 +1666,7 @@ can_combine_p (rtx insn, rtx i3, rtx pre
+   rtx link;
+ #endif
+   bool all_adjacent = true;
++  int (*is_volatile_p) (const_rtx);
+ 
+   if (succ)
+     {
+@@ -1914,11 +1915,17 @@ can_combine_p (rtx insn, rtx i3, rtx pre
+       && REG_P (dest) && REGNO (dest) < FIRST_PSEUDO_REGISTER)
+     return 0;
+ 
+-  /* If there are any volatile insns between INSN and I3, reject, because
+-     they might affect machine state.  */
+-
++  /* If INSN contains volatile references (specifically volatile MEMs),
++     we cannot combine across any other volatile references.
++     Even if INSN doesn't contain volatile references, any intervening
++     volatile insn might affect machine state.  */
++
++  is_volatile_p = volatile_refs_p (PATTERN (insn))
++    ? volatile_refs_p
++    : volatile_insn_p;
++    
+   for (p = NEXT_INSN (insn); p != i3; p = NEXT_INSN (p))
+-    if (INSN_P (p) && p != succ && p != succ2 && volatile_insn_p (PATTERN (p)))
++    if (INSN_P (p) && p != succ && p != succ2 && is_volatile_p (PATTERN (p)))
+       return 0;
+ 
+   /* If INSN contains an autoincrement or autodecrement, make sure that
+diff -Naurp gcc/config/avr/avr.c gcc/config/avr/avr.c
+--- gcc/config/avr/avr.c	2012-06-28 15:47:34.000000000 +0530
++++ gcc/config/avr/avr.c	2012-06-28 15:51:12.000000000 +0530
+@@ -6307,6 +6307,7 @@ avr_encode_section_info (tree decl, rtx 
+   if (new_decl_p
+       && decl && DECL_P (decl)
+       && NULL_TREE == DECL_INITIAL (decl)
++      && !DECL_EXTERNAL (decl)
+       && avr_progmem_p (decl, DECL_ATTRIBUTES (decl)))
+     {
+       warning (OPT_Wuninitialized,
diff --git a/512-gcc-avrtc542.patch b/512-gcc-avrtc542.patch
new file mode 100644
index 0000000..9c23ed8
--- /dev/null
+++ b/512-gcc-avrtc542.patch
@@ -0,0 +1,2753 @@
+diff -Naurp gcc/config/avr/avr.c gcc/config/avr/avr.c
+--- gcc/config/avr/avr.c	2012-07-05 14:23:46.000000000 +0530
++++ gcc/config/avr/avr.c	2012-07-06 17:30:38.000000000 +0530
+@@ -2191,19 +2191,28 @@ out_movqi_r_mr (rtx insn, rtx op[], int 
+ 	    fatal_insn ("incorrect insn:",insn);
+ 
+ 	  if (disp <= 63 + MAX_LD_OFFSET (GET_MODE (src)))
+-	    return *l = 3, AVR_TINY ? (AS2 (subi,r28,lo8(-(%o1-63))) CR_TAB 
+-				          AS2 (sbci,r29,hi8(-(%o1-63))) CR_TAB
+-						  AS2 (subi,r28,lo8(-63))       CR_TAB 
+-				          AS2 (sbci,r29,hi8(-63))       CR_TAB
+-			              AS2 (ld,%0,Y)                 CR_TAB
+-						  AS2 (subi,r28,lo8(63))       CR_TAB 
+-				          AS2 (sbci,r29,hi8(63))       CR_TAB
+-						  AS2 (subi,r28,lo8(%o1-63)) CR_TAB 
+-				          AS2 (sbci,r29,hi8(%o1-63)))  
+-		                   : (AS2 (adiw,r28,%o1-63) CR_TAB
+-			    AS2 (ldd,%0,Y+63)     CR_TAB
+-			    AS2 (sbiw,r28,%o1-63));
+-
++	  {
++            if (AVR_TINY)
++            {
++              *l = 9;
++              return (AS2 (subi,r28,lo8(-(%o1-63))) CR_TAB
++                      AS2 (sbci,r29,hi8(-(%o1-63))) CR_TAB
++                      AS2 (subi,r28,lo8(-63))       CR_TAB
++                      AS2 (sbci,r29,hi8(-63))       CR_TAB
++                      AS2 (ld,%0,Y)                 CR_TAB
++                      AS2 (subi,r28,lo8(63))        CR_TAB
++                      AS2 (sbci,r29,hi8(63))        CR_TAB
++                      AS2 (subi,r28,lo8(%o1-63))    CR_TAB
++                      AS2 (sbci,r29,hi8(%o1-63)));
++            }
++            else
++            {
++              *l = 3;
++              return (AS2 (adiw,r28,%o1-63) CR_TAB
++                      AS2 (ldd,%0,Y+63)     CR_TAB
++                      AS2 (sbiw,r28,%o1-63));
++            }
++	  }
+ 
+ 	  return *l = 5, (AS2 (subi,r28,lo8(-%o1)) CR_TAB
+ 			  AS2 (sbci,r29,hi8(-%o1)) CR_TAB
+@@ -2217,38 +2226,75 @@ out_movqi_r_mr (rtx insn, rtx op[], int 
+ 	     it but I have this situation with extremal optimizing options.  */
+ 	  if (reg_overlap_mentioned_p (dest, XEXP (x,0))
+ 	      || reg_unused_after (insn, XEXP (x,0)))
+-	    return *l = 2, AVR_TINY ? (AS2 (subi,r26,lo8(-(%o1))) CR_TAB
+-						  AS2 (sbci,r27,hi8(-(%o1))) CR_TAB
+-						  AS2 (ld,%0,X))
+-						   : (AS2 (adiw,r26,%o1) CR_TAB
+-			    AS2 (ld,%0,X));
+-
+-	    return *l = 3, AVR_TINY ? (AS2 (subi,r26,lo8(-(%o1))) CR_TAB
+-						  AS2 (sbci,r27,hi8(-(%o1))) CR_TAB
+-						  AS2 (ld,%0,X) CR_TAB
+-						  AS2 (subi,r26,lo8(%o1)) CR_TAB 
+-				          AS2 (sbci,r27,hi8(%o1))) 
+-						   : (AS2 (adiw,r26,%o1) CR_TAB
+-			  AS2 (ld,%0,X)      CR_TAB
+-			  AS2 (sbiw,r26,%o1));
++          {
++            if (AVR_TINY)
++            {
++              *l = 3;
++              return (AS2 (subi,r26,lo8(-(%o1))) CR_TAB
++                      AS2 (sbci,r27,hi8(-(%o1))) CR_TAB
++                      AS2 (ld,%0,X));
++            }
++            else
++            {
++              *l = 2;
++              return (AS2 (adiw,r26,%o1) CR_TAB
++                      AS2 (ld,%0,X));
++            }
++          }
++
++          if (AVR_TINY)
++          {
++            *l = 5;
++            return (AS2 (subi,r26,lo8(-(%o1))) CR_TAB
++                    AS2 (sbci,r27,hi8(-(%o1))) CR_TAB
++                    AS2 (ld,%0,X) CR_TAB
++                    AS2 (subi,r26,lo8(%o1)) CR_TAB 
++                    AS2 (sbci,r27,hi8(%o1)));
++          }
++          else
++          {
++            *l = 3;
++            return (AS2 (adiw,r26,%o1) CR_TAB
++                    AS2 (ld,%0,X)      CR_TAB
++                    AS2 (sbiw,r26,%o1));
++          }
+ 	}
+ 
+-      *l = 1;
+ 	  op[2] = XEXP(x, 0);
+ 	  if(REGNO(op[2]) == REG_Y)
+-			  return AVR_TINY ? ( AS2 (subi,%A2,lo8(-(%o1))) CR_TAB
+-						AS2 (sbci,%B2,hi8(-(%o1))) CR_TAB
+-						AS2 (ld,%0,Y)              CR_TAB
+-			            AS2 (subi,%A2,lo8(%o1)) CR_TAB
+-						AS2 (sbci,%B2,hi8(%o1)))
+-						 :   AS2 (ldd,%0,%1);
++          {
++            if (AVR_TINY)
++            {
++              *l = 5;
++              return (AS2 (subi,%A2,lo8(-(%o1))) CR_TAB
++                      AS2 (sbci,%B2,hi8(-(%o1))) CR_TAB
++                      AS2 (ld,%0,Y)              CR_TAB
++                      AS2 (subi,%A2,lo8(%o1)) CR_TAB
++                      AS2 (sbci,%B2,hi8(%o1)));
++            }
++            else
++            {
++              *l = 1;
++              return (AS2 (ldd,%0,%1));
++            }
++          }
+ 	  if(REGNO(op[2]) == REG_Z)
+-			  return AVR_TINY ? ( AS2 (subi,%A2,lo8(-(%o1))) CR_TAB
+-						AS2 (sbci,%B2,hi8(-(%o1))) CR_TAB
+-						AS2 (ld,%0,Z)              CR_TAB
+-			            AS2 (subi,%A2,lo8(%o1)) CR_TAB
+-						AS2 (sbci,%B2,hi8(%o1)))
+-						 :   AS2 (ldd,%0,%1);
++          {
++            if (AVR_TINY)
++            {
++              *l = 5;
++              return (AS2 (subi,%A2,lo8(-(%o1))) CR_TAB
++                      AS2 (sbci,%B2,hi8(-(%o1))) CR_TAB
++                      AS2 (ld,%0,Z)              CR_TAB
++                      AS2 (subi,%A2,lo8(%o1)) CR_TAB
++                      AS2 (sbci,%B2,hi8(%o1)));
++            }
++            else
++            {
++              *l = 1;
++              return (AS2 (ldd,%0,%1));
++            }
++          }
+     }
+   *l = 1;
+   return AS2 (ld,%0,%1);
+@@ -2287,36 +2333,57 @@ out_movhi_r_mr (rtx insn, rtx op[], int 
+ 	      return (AS2 (ld,%A0,X+) CR_TAB
+ 		      AS2 (ld,%B0,X));
+ 	    }
+-	  *l  = 3;
+-	  return AVR_TINY ? (AS2 (ld,%A0,X+) CR_TAB
+-				AS2 (ld,%B0,X)  CR_TAB
+-				AS2 (subi,r26,lo8(1))          CR_TAB
+-				AS2 (sbci,r27,hi8(1))) 
+-		         : (AS2 (ld,%A0,X+) CR_TAB
+-		  AS2 (ld,%B0,X) CR_TAB
+-		  AS2 (sbiw,r26,1));
++
++          if (AVR_TINY)
++          {
++            *l = 4;
++            return (AS2 (ld,%A0,X+)       CR_TAB
++                    AS2 (ld,%B0,X)        CR_TAB
++                    AS2 (subi,r26,lo8(1)) CR_TAB
++                    AS2 (sbci,r27,hi8(1)));
++          }
++          else
++          {
++            *l = 3;
++            return (AS2 (ld,%A0,X+) CR_TAB
++                    AS2 (ld,%B0,X)  CR_TAB
++                    AS2 (sbiw,r26,1));
++          }
+         }
+       else                      /* (R)  */
+ 	{
+-	  *l = 2;
+ 	  if(reg_base == REG_Y)
+-	  return AVR_TINY ? (AS2 (ld,%A0,%1) CR_TAB
+-				AS2 (subi,r28,lo8((-1))) CR_TAB
+-				AS2 (sbci,r29,hi8((-1))) CR_TAB 
+-		        AS2 (ld,%B0,%1) CR_TAB
+-				AS2 (subi,r28,lo8(1)) CR_TAB
+-				AS2 (sbci,r29,hi8(1)))		   
+-		         : (AS2 (ld,%A0,%1) CR_TAB
+-				AS2 (ldd,%B0,%1+1));
++          {
++            if (AVR_TINY) {
++              *l = 6;
++              return (AS2 (ld,%A0,%1) CR_TAB
++                      AS2 (subi,r28,lo8((-1))) CR_TAB
++                      AS2 (sbci,r29,hi8((-1))) CR_TAB 
++                      AS2 (ld,%B0,%1) CR_TAB
++                      AS2 (subi,r28,lo8(1)) CR_TAB
++                      AS2 (sbci,r29,hi8(1)));
++            } else {
++              *l = 2;
++              return (AS2 (ld,%A0,%1) CR_TAB
++                      AS2 (ldd,%B0,%1+1));
++            }
++          }
+ 	  if(reg_base == REG_Z)
+-	  return AVR_TINY ? (AS2 (ld,%A0,%1) CR_TAB
+-				AS2 (subi,r30,lo8((-1))) CR_TAB
+-				AS2 (sbci,r31,hi8((-1))) CR_TAB 
+-		        AS2 (ld,%B0,%1) CR_TAB
+-				AS2 (subi,r30,lo8(1)) CR_TAB
+-				AS2 (sbci,r31,hi8(1)))
+-		         : (AS2 (ld,%A0,%1) CR_TAB
+-		  AS2 (ldd,%B0,%1+1));
++          {
++            if (AVR_TINY) {
++              *l = 6;
++              return (AS2 (ld,%A0,%1) CR_TAB
++                      AS2 (subi,r30,lo8((-1))) CR_TAB
++                      AS2 (sbci,r31,hi8((-1))) CR_TAB 
++                      AS2 (ld,%B0,%1) CR_TAB
++                      AS2 (subi,r30,lo8(1)) CR_TAB
++                      AS2 (sbci,r31,hi8(1)));
++            } else {
++              *l = 2;
++              return (AS2 (ld,%A0,%1) CR_TAB
++                      AS2 (ldd,%B0,%1+1));
++            }
++          }
+ 	}
+     }
+   else if (GET_CODE (base) == PLUS) /* (R + i) */
+@@ -2330,35 +2397,47 @@ out_movhi_r_mr (rtx insn, rtx op[], int 
+ 	    fatal_insn ("incorrect insn:",insn);
+ 	  
+ 	  if (disp <= 63 + MAX_LD_OFFSET (GET_MODE (src)))
+-	    return *l = 4, AVR_TINY ? (AS2 (subi,r28,lo8(-(%o1-62))) CR_TAB 
+-				          AS2 (sbci,r29,hi8(-(%o1-62))) CR_TAB
+-						  AS2 (subi,r28,lo8(-62))       CR_TAB 
+-				          AS2 (sbci,r29,hi8(-62))       CR_TAB
+-			              AS2 (ld,%A0,Y+)                CR_TAB
+-			              AS2 (ld,%B0,Y)                CR_TAB
+-						  AS2 (subi,r28,lo8(63))       CR_TAB 
+-				          AS2 (sbci,r29,hi8(63))       CR_TAB
+-						  AS2 (subi,r28,lo8(%o1-62)) CR_TAB 
+-				          AS2 (sbci,r29,hi8(%o1-62)))  
+-			               : (AS2 (adiw,r28,%o1-62) CR_TAB
+-			    AS2 (ldd,%A0,Y+62)    CR_TAB
+-			    AS2 (ldd,%B0,Y+63)    CR_TAB
+-			    AS2 (sbiw,r28,%o1-62));
+-
+-	  return *l = 6, AVR_TINY ? (AS2 (subi,r28,lo8(-%o1)) CR_TAB
+-						AS2 (sbci,r29,hi8(-%o1)) CR_TAB
+-						AS2 (ld,%A0,Y+)          CR_TAB
+-						AS2 (ld,%B0,Y)           CR_TAB
+-						AS2 (subi,r28,lo8(1))   CR_TAB
+-						AS2 (sbci,r29,hi8(1))   CR_TAB
+-			     		AS2 (subi,r28,lo8(%o1))  CR_TAB
+-						AS2 (sbci,r29,hi8(%o1)))
+-						 : (AS2 (subi,r28,lo8(-%o1)) CR_TAB
+-			  AS2 (sbci,r29,hi8(-%o1)) CR_TAB
+-			  AS2 (ld,%A0,Y)           CR_TAB
+-			  AS2 (ldd,%B0,Y+1)        CR_TAB
+-			  AS2 (subi,r28,lo8(%o1))  CR_TAB
+-			  AS2 (sbci,r29,hi8(%o1)));
++          {
++            if (AVR_TINY) {
++              *l = 10;
++              return (AS2 (subi,r28,lo8(-(%o1-62))) CR_TAB 
++                      AS2 (sbci,r29,hi8(-(%o1-62))) CR_TAB
++                      AS2 (subi,r28,lo8(-62))       CR_TAB 
++                      AS2 (sbci,r29,hi8(-62))       CR_TAB
++                      AS2 (ld,%A0,Y+)               CR_TAB
++                      AS2 (ld,%B0,Y)                CR_TAB
++                      AS2 (subi,r28,lo8(63))        CR_TAB 
++                      AS2 (sbci,r29,hi8(63))        CR_TAB
++                      AS2 (subi,r28,lo8(%o1-62))    CR_TAB 
++                      AS2 (sbci,r29,hi8(%o1-62)));
++            } else {
++              *l = 4;
++              return (AS2 (adiw,r28,%o1-62) CR_TAB
++                      AS2 (ldd,%A0,Y+62)    CR_TAB
++                      AS2 (ldd,%B0,Y+63)    CR_TAB
++                      AS2 (sbiw,r28,%o1-62));
++            }
++          }
++
++	  if (AVR_TINY) {
++            *l = 8;
++            return (AS2 (subi,r28,lo8(-%o1)) CR_TAB
++                    AS2 (sbci,r29,hi8(-%o1)) CR_TAB
++                    AS2 (ld,%A0,Y+)          CR_TAB
++                    AS2 (ld,%B0,Y)           CR_TAB
++                    AS2 (subi,r28,lo8(1))    CR_TAB
++                    AS2 (sbci,r29,hi8(1))    CR_TAB
++                    AS2 (subi,r28,lo8(%o1))  CR_TAB
++                    AS2 (sbci,r29,hi8(%o1)));
++          } else {
++            *l = 6;
++            return (AS2 (subi,r28,lo8(-%o1)) CR_TAB
++                    AS2 (sbci,r29,hi8(-%o1)) CR_TAB
++                    AS2 (ld,%A0,Y)           CR_TAB
++                    AS2 (ldd,%B0,Y+1)        CR_TAB
++                    AS2 (subi,r28,lo8(%o1))  CR_TAB
++                    AS2 (sbci,r29,hi8(%o1)));
++          }
+ 	}
+       if (reg_base == REG_X)
+ 	{
+@@ -2366,80 +2445,114 @@ out_movhi_r_mr (rtx insn, rtx op[], int 
+ 	     it but I have this situation with extremal
+ 	     optimization options.  */
+ 	  
+-	  *l = 4;
+-	  if (reg_base == reg_dest)
+-	    return AVR_TINY ? (AS2 (subi,r26,lo8(-%o1))      CR_TAB
+-				  AS2 (sbci,r27,hi8(-%o1))      CR_TAB
+-		          AS2 (ld,__tmp_reg__,X+)       CR_TAB
+-		          AS2 (ld,%B0,X)                CR_TAB
+-		          AS2 (mov,%A0,__tmp_reg__))
+-			       : (AS2 (adiw,r26,%o1)      CR_TAB
+-		    AS2 (ld,__tmp_reg__,X+) CR_TAB
+-		    AS2 (ld,%B0,X)          CR_TAB
+-		    AS2 (mov,%A0,__tmp_reg__));
+-
+-	    return AVR_TINY ? (AS2 (subi,r26,lo8(-%o1))      CR_TAB
+-	   	          AS2 (sbci,r27,hi8(-%o1))      CR_TAB
+-		          AS2 (ld,%A0,X+)			     CR_TAB
+-		          AS2 (ld,%B0,X)                CR_TAB
+-				  AS2 (subi,r26,lo8(%o1+1))     CR_TAB 
+-				  AS2 (sbci,r27,hi8(%o1+1)))  
+-		           : (AS2 (adiw,r26,%o1) CR_TAB
+-		  AS2 (ld,%A0,X+)    CR_TAB
+-		  AS2 (ld,%B0,X)     CR_TAB
+-		  AS2 (sbiw,r26,%o1+1));
++	  if (reg_base == reg_dest) {
++            if (AVR_TINY) {
++              *l = 5;
++              return (AS2 (subi,r26,lo8(-%o1))      CR_TAB
++                      AS2 (sbci,r27,hi8(-%o1))      CR_TAB
++                      AS2 (ld,__tmp_reg__,X+)       CR_TAB
++                      AS2 (ld,%B0,X)                CR_TAB
++                      AS2 (mov,%A0,__tmp_reg__));
++            } else {
++              *l = 4;
++              return (AS2 (adiw,r26,%o1)      CR_TAB
++                      AS2 (ld,__tmp_reg__,X+) CR_TAB
++                      AS2 (ld,%B0,X)          CR_TAB
++                      AS2 (mov,%A0,__tmp_reg__));
++            }
++          }
++
++          if (AVR_TINY) {
++            *l = 6;
++            return (AS2 (subi,r26,lo8(-%o1))      CR_TAB
++                    AS2 (sbci,r27,hi8(-%o1))      CR_TAB
++                    AS2 (ld,%A0,X+)		  CR_TAB
++                    AS2 (ld,%B0,X)                CR_TAB
++                    AS2 (subi,r26,lo8(%o1+1))     CR_TAB 
++                    AS2 (sbci,r27,hi8(%o1+1)));
++          } else {
++            *l = 4;
++            return (AS2 (adiw,r26,%o1) CR_TAB
++                    AS2 (ld,%A0,X+)    CR_TAB
++                    AS2 (ld,%B0,X)     CR_TAB
++                    AS2 (sbiw,r26,%o1+1));
++          }
+ 	}
+ 
+       if (reg_base == reg_dest)
+ 	{
+-	  *l = 3;
+ 	  op[2] = XEXP(base, 0);
+ 
+-	  if(REGNO(op[2]) == REG_Y)
+-			  return AVR_TINY ? ( AS2 (subi,%A2,lo8(-(%o1))) CR_TAB
+-						AS2 (sbci,%B2,hi8(-(%o1))) CR_TAB
+-						AS2 (ld,__tmp_reg__,Y+)     CR_TAB
+-		                AS2 (ld,%B0,Y)         CR_TAB
+-						AS2 (subi,%A2,lo8(%o1+1)) CR_TAB
+-						AS2 (sbci,%B2,hi8(%o1+1)) CR_TAB
+-						AS2 (mov,%A0,__tmp_reg__))
+-				         :  (AS2 (ldd,__tmp_reg__,%A1) CR_TAB
+-		                AS2 (ldd,%B0,%B1)         CR_TAB
+-		                AS2 (mov,%A0,__tmp_reg__));
+-	  if(REGNO(op[2]) == REG_Z)
+-			  return AVR_TINY ? ( AS2 (subi,%A2,lo8(-(%o1))) CR_TAB
+-						AS2 (sbci,%B2,hi8(-(%o1))) CR_TAB
+-						AS2 (ld,__tmp_reg__,Z+)     CR_TAB
+-		                AS2 (ld,%B0,Z)         CR_TAB
+-						AS2 (subi,%A2,lo8(%o1+1)) CR_TAB
+-						AS2 (sbci,%B2,hi8(%o1+1)) CR_TAB
+-						AS2 (mov,%A0,__tmp_reg__))
+-				         :  (AS2 (ldd,__tmp_reg__,%A1) CR_TAB
+-		  AS2 (ldd,%B0,%B1)         CR_TAB
+-		  AS2 (mov,%A0,__tmp_reg__));
++	  if(REGNO(op[2]) == REG_Y) {
++            if (AVR_TINY) {
++              *l = 7;
++              return (AS2 (subi,%A2,lo8(-(%o1))) CR_TAB
++                      AS2 (sbci,%B2,hi8(-(%o1))) CR_TAB
++                      AS2 (ld,__tmp_reg__,Y+)    CR_TAB
++                      AS2 (ld,%B0,Y)             CR_TAB
++                      AS2 (subi,%A2,lo8(%o1+1))  CR_TAB
++                      AS2 (sbci,%B2,hi8(%o1+1))  CR_TAB
++                      AS2 (mov,%A0,__tmp_reg__));
++            } else {
++              *l = 3;
++              return (AS2 (ldd,__tmp_reg__,%A1) CR_TAB
++                      AS2 (ldd,%B0,%B1)         CR_TAB
++                      AS2 (mov,%A0,__tmp_reg__));
++            }
++          }
++	  if(REGNO(op[2]) == REG_Z) {
++            if (AVR_TINY) {
++              *l = 7;
++              return (AS2 (subi,%A2,lo8(-(%o1))) CR_TAB
++                      AS2 (sbci,%B2,hi8(-(%o1))) CR_TAB
++                      AS2 (ld,__tmp_reg__,Z+)    CR_TAB
++                      AS2 (ld,%B0,Z)             CR_TAB
++                      AS2 (subi,%A2,lo8(%o1+1))  CR_TAB
++                      AS2 (sbci,%B2,hi8(%o1+1))  CR_TAB
++                      AS2 (mov,%A0,__tmp_reg__));
++            } else {
++              *l = 3;
++              return (AS2 (ldd,__tmp_reg__,%A1) CR_TAB
++                      AS2 (ldd,%B0,%B1)         CR_TAB
++                      AS2 (mov,%A0,__tmp_reg__));
++            }
++          }
+ 	}
+-      *l = 2;
+ 
+ 	  op[2] = XEXP(base, 0);
+ 
+ 	  if(REGNO(op[2]) == REG_Y)
+-			  return AVR_TINY ? ( AS2 (subi,%A2,lo8(-(%o1))) CR_TAB
+-						AS2 (sbci,%B2,hi8(-(%o1))) CR_TAB
+-						AS2 (ld,%A0,Y+)             CR_TAB
+-		                AS2 (ld,%B0,Y)               CR_TAB
+-						AS2 (subi,%A2,lo8(%o1+1)) CR_TAB
+-						AS2 (sbci,%B2,hi8(%o1+1)))
+-				         :  (AS2 (ldd,%A0,%A1) CR_TAB
+-		                AS2 (ldd,%B0,%B1));
++          {
++            if (AVR_TINY) {
++              *l = 6;
++              return (AS2 (subi,%A2,lo8(-(%o1))) CR_TAB
++                      AS2 (sbci,%B2,hi8(-(%o1))) CR_TAB
++                      AS2 (ld,%A0,Y+)            CR_TAB
++                      AS2 (ld,%B0,Y)             CR_TAB
++                      AS2 (subi,%A2,lo8(%o1+1))  CR_TAB
++                      AS2 (sbci,%B2,hi8(%o1+1)));
++            } else {
++              *l = 2;
++              return (AS2 (ldd,%A0,%A1) CR_TAB
++                      AS2 (ldd,%B0,%B1));
++            }
++          }
+ 	  if(REGNO(op[2]) == REG_Z)
+-			  return AVR_TINY ? ( AS2 (subi,%A2,lo8(-(%o1))) CR_TAB
+-						AS2 (sbci,%B2,hi8(-(%o1))) CR_TAB
+-						AS2 (ld,%A0,Z+)             CR_TAB
+-		                AS2 (ld,%B0,Z)              CR_TAB
+-						AS2 (subi,%A2,lo8(%o1+1)) CR_TAB
+-						AS2 (sbci,%B2,hi8(%o1+1)))
+-				         :  (AS2 (ldd,%A0,%A1) CR_TAB
+-	      AS2 (ldd,%B0,%B1));
++          {
++            if (AVR_TINY) {
++              *l = 6;
++              return (AS2 (subi,%A2,lo8(-(%o1))) CR_TAB
++                      AS2 (sbci,%B2,hi8(-(%o1))) CR_TAB
++                      AS2 (ld,%A0,Z+)            CR_TAB
++                      AS2 (ld,%B0,Z)             CR_TAB
++                      AS2 (subi,%A2,lo8(%o1+1))  CR_TAB
++                      AS2 (sbci,%B2,hi8(%o1+1)));
++            } else {
++              *l = 2;
++              return (AS2 (ldd,%A0,%A1) CR_TAB
++                      AS2 (ldd,%B0,%B1));
++            }
++          }
+       
+     }
+   else if (GET_CODE (base) == PRE_DEC) /* (--R) */
+@@ -2450,35 +2563,43 @@ out_movhi_r_mr (rtx insn, rtx op[], int 
+       if (mem_volatile_p)
+         {
+           if (REGNO (XEXP (base, 0)) == REG_X)
+-            {
++          {
++            if (AVR_TINY) {
++              *l = 6;
++              return (AS2 (subi,r26,lo8(2))  CR_TAB
++                      AS2 (sbci,r27,hi8(2))  CR_TAB
++                      AS2 (ld,%A0,X+)        CR_TAB
++                      AS2 (ld,%B0,X)         CR_TAB
++                      AS2 (subi,r26,lo8(1))  CR_TAB
++                      AS2 (sbci,r27,hi8(1)));
++            } else {
+               *l = 4;
+-              return AVR_TINY ? (AS2 (subi,r26,lo8(2))  CR_TAB
+-					    AS2 (sbci,r27,hi8(2))   CR_TAB
+-                        AS2 (ld,%A0,X+)            CR_TAB
+-                        AS2 (ld,%B0,X)             CR_TAB
+-						AS2 (subi,r26,lo8(1))  CR_TAB
+-						AS2 (sbci,r27,hi8(1)))
+-				         : (AS2 (sbiw,r26,2)  CR_TAB
++              return (AS2 (sbiw,r26,2)  CR_TAB
+                       AS2 (ld,%A0,X+)   CR_TAB
+                       AS2 (ld,%B0,X)    CR_TAB
+                       AS2 (sbiw,r26,1));
+             }
++          }
+           else
+-            {
++          {
++            //FIXME:check the code once again for AVR_TINY
++            if (AVR_TINY) {
++              *l = 8;
++              return (AS2 (subi,%A1,lo8(3))  CR_TAB
++                      AS2 (sbci,%B1,hi8(3))  CR_TAB
++                      AS2 (ld,%A0,%p1)       CR_TAB
++                      AS2 (subi,%A1,lo8(-1)) CR_TAB
++                      AS2 (sbci,%B1,hi8(-1)) CR_TAB
++                      AS2 (ld,%B0,%p1)       CR_TAB
++                      AS2 (subi,%A1,lo8(1))  CR_TAB
++                      AS2 (sbci,%B1,hi8(1)));
++            } else {
+               *l = 3;
+-			  //FIXME:check the code once again for AVR_TINY
+-              return AVR_TINY ? (AS2 (subi,%A1,lo8(3))  CR_TAB 
+-					    AS2 (sbci,%B1,hi8(3))  CR_TAB
+-                        AS2 (ld,%A0,%p1)       CR_TAB
+-						AS2 (subi,%A1,lo8(-1)) CR_TAB
+-						AS2 (sbci,%B1,hi8(-1)) CR_TAB
+-                        AS2 (ld,%B0,%p1)       CR_TAB
+-						AS2 (subi,%A1,lo8(1)) CR_TAB
+-						AS2 (sbci,%B1,hi8(1)))
+-				         : (AS2 (sbiw,%r1,2)   CR_TAB
+-                      AS2 (ld,%A0,%p1)  CR_TAB
++              return (AS2 (sbiw,%r1,2)   CR_TAB
++                      AS2 (ld,%A0,%p1)   CR_TAB
+                       AS2 (ldd,%B0,%p1+1));
+             }
++          }
+         }
+ 
+       *l = 2;
+@@ -2529,24 +2650,30 @@ out_movsi_r_mr (rtx insn, rtx op[], int 
+     {
+       if (reg_base == REG_X)        /* (R26) */
+         {
+-          if (reg_dest == REG_X)
++          if (reg_dest == REG_X) {
+ 	    /* "ld r26,-X" is undefined */
+-	    return *l=7, AVR_TINY ? (AS2 (subi,r26,lo8(-3))  CR_TAB
+-						AS2 (sbci,r27,hi8(-3))  CR_TAB
+-			            AS2 (ld,r29,X)          CR_TAB
+-			            AS2 (ld,r28,-X)         CR_TAB
+-			            AS2 (ld,__tmp_reg__,-X) CR_TAB
+-			            AS2 (subi,r26,lo8(1))   CR_TAB
+-			            AS2 (sbci,r27,hi8(1))   CR_TAB
+-			            AS2 (ld,r26,X)          CR_TAB
+-			            AS2 (mov,r27,__tmp_reg__))
+-			             : (AS2 (adiw,r26,3)        CR_TAB
+-			  AS2 (ld,r29,X)          CR_TAB
+-			  AS2 (ld,r28,-X)         CR_TAB
+-			  AS2 (ld,__tmp_reg__,-X) CR_TAB
+-			  AS2 (sbiw,r26,1)        CR_TAB
+-			  AS2 (ld,r26,X)          CR_TAB
+-			  AS2 (mov,r27,__tmp_reg__));
++            if (AVR_TINY) {
++              *l = 9;
++              return (AS2 (subi,r26,lo8(-3))  CR_TAB
++                      AS2 (sbci,r27,hi8(-3))  CR_TAB
++         	      AS2 (ld,r29,X)          CR_TAB
++                      AS2 (ld,r28,-X)         CR_TAB
++                      AS2 (ld,__tmp_reg__,-X) CR_TAB
++                      AS2 (subi,r26,lo8(1))   CR_TAB
++                      AS2 (sbci,r27,hi8(1))   CR_TAB
++                      AS2 (ld,r26,X)          CR_TAB
++                      AS2 (mov,r27,__tmp_reg__));
++            } else {
++              *l = 7;
++              return (AS2 (adiw,r26,3)        CR_TAB
++                      AS2 (ld,r29,X)          CR_TAB
++                      AS2 (ld,r28,-X)         CR_TAB
++                      AS2 (ld,__tmp_reg__,-X) CR_TAB
++                      AS2 (sbiw,r26,1)        CR_TAB
++                      AS2 (ld,r26,X)          CR_TAB
++                      AS2 (mov,r27,__tmp_reg__));
++            }
++          }
+ 
+           else if (reg_dest == REG_X - 2)
+             return *l=5, (AS2 (ld,%A0,X+)  CR_TAB
+@@ -2559,113 +2686,154 @@ out_movsi_r_mr (rtx insn, rtx op[], int 
+                            AS2 (ld,%B0,X+) CR_TAB
+                            AS2 (ld,%C0,X+) CR_TAB
+                            AS2 (ld,%D0,X));
+-          else
+-            return  *l=5, AVR_TINY ? (AS2 (ld,%A0,X+) CR_TAB
+-                             AS2 (ld,%B0,X+) CR_TAB
+-                             AS2 (ld,%C0,X+) CR_TAB
+-                             AS2 (ld,%D0,X)  CR_TAB
+-                             AS2 (subi,r26,lo8(3)) CR_TAB
+-                             AS2 (sbci,r27,hi8(3)))
+-					          : (AS2 (ld,%A0,X+) CR_TAB
+-                           AS2 (ld,%B0,X+) CR_TAB
+-                           AS2 (ld,%C0,X+) CR_TAB
+-                           AS2 (ld,%D0,X)  CR_TAB
+-                           AS2 (sbiw,r26,3));
++          else {
++            if (AVR_TINY) {
++              *l = 6;
++              return (AS2 (ld,%A0,X+) CR_TAB
++                      AS2 (ld,%B0,X+) CR_TAB
++                      AS2 (ld,%C0,X+) CR_TAB
++                      AS2 (ld,%D0,X)  CR_TAB
++                      AS2 (subi,r26,lo8(3)) CR_TAB
++                      AS2 (sbci,r27,hi8(3)));
++            } else {
++              *l = 5;
++              return (AS2 (ld,%A0,X+) CR_TAB
++                      AS2 (ld,%B0,X+) CR_TAB
++                      AS2 (ld,%C0,X+) CR_TAB
++                      AS2 (ld,%D0,X)  CR_TAB
++                      AS2 (sbiw,r26,3));
++            }
++          }
+         }
+       else
+         {
+           if (reg_dest == reg_base)
+-		  {
+-			  if(reg_base == REG_Y)
+-            return *l=5, AVR_TINY ? (AS2 (subi,r28,lo8(-3)) CR_TAB
+-							AS2 (sbci,r29,hi8(-3)) CR_TAB
+-				            AS2 (ld,%D0,Y)        CR_TAB
+-                            AS2 (ld,%C0,-Y)        CR_TAB
+-                            AS2 (subi,r28,lo8(1)) CR_TAB
+-                            AS2 (sbci,r29,hi8(1)) CR_TAB
+-                            AS2 (ld,__tmp_reg__,%1)  CR_TAB
+-                            AS2 (subi,r28,lo8(1)) CR_TAB
+-                            AS2 (sbci,r29,hi8(1)) CR_TAB
+-                            AS2 (ld,%A0,%1)  CR_TAB
+-                            AS2 (mov,%B0,__tmp_reg__))
+-				             : (AS2 (ldd,%D0,%1+3) CR_TAB
+-                            AS2 (ldd,%C0,%1+2) CR_TAB
+-                            AS2 (ldd,__tmp_reg__,%1+1)  CR_TAB
+-                            AS2 (ld,%A0,%1)  CR_TAB
+-                            AS2 (mov,%B0,__tmp_reg__));
+-			  if(reg_base == REG_Z)
+-            return *l=5, AVR_TINY ? (AS2 (subi,r30,lo8(-3)) CR_TAB
+-							AS2 (sbci,r31,hi8(-3)) CR_TAB
+-				            AS2 (ld,%D0,Z)        CR_TAB
+-                            AS2 (ld,%C0,-Z)        CR_TAB
+-                            AS2 (subi,r30,lo8(1)) CR_TAB
+-                            AS2 (sbci,r31,hi8(1)) CR_TAB
+-                            AS2 (ld,__tmp_reg__,%1)  CR_TAB
+-                            AS2 (subi,r30,lo8(1)) CR_TAB
+-                            AS2 (sbci,r31,hi8(1)) CR_TAB
+-                            AS2 (ld,%A0,%1)  CR_TAB
+-                            AS2 (mov,%B0,__tmp_reg__))
+-				             : (AS2 (ldd,%D0,%1+3) CR_TAB
+-                          AS2 (ldd,%C0,%1+2) CR_TAB
+-                          AS2 (ldd,__tmp_reg__,%1+1)  CR_TAB
+-                          AS2 (ld,%A0,%1)  CR_TAB
+-                          AS2 (mov,%B0,__tmp_reg__));
+-		  }
++	  {
++            if(reg_base == REG_Y) {
++              if (AVR_TINY) {
++                *l = 11;
++                return (AS2 (subi,r28,lo8(-3)) CR_TAB
++                        AS2 (sbci,r29,hi8(-3)) CR_TAB
++                        AS2 (ld,%D0,Y)         CR_TAB
++                        AS2 (ld,%C0,-Y)        CR_TAB
++                        AS2 (subi,r28,lo8(1))  CR_TAB
++                        AS2 (sbci,r29,hi8(1))  CR_TAB
++                        AS2 (ld,__tmp_reg__,%1)  CR_TAB
++                        AS2 (subi,r28,lo8(1)) CR_TAB
++                        AS2 (sbci,r29,hi8(1)) CR_TAB
++                        AS2 (ld,%A0,%1)  CR_TAB
++                        AS2 (mov,%B0,__tmp_reg__));
++              } else {
++                *l = 5;
++                return (AS2 (ldd,%D0,%1+3) CR_TAB
++                        AS2 (ldd,%C0,%1+2) CR_TAB
++                        AS2 (ldd,__tmp_reg__,%1+1)  CR_TAB
++                        AS2 (ld,%A0,%1)  CR_TAB
++                        AS2 (mov,%B0,__tmp_reg__));
++              }
++            }
+ 
++            if(reg_base == REG_Z) {
++              if (AVR_TINY) {
++                *l = 11;
++                return (AS2 (subi,r30,lo8(-3)) CR_TAB
++                        AS2 (sbci,r31,hi8(-3)) CR_TAB
++                        AS2 (ld,%D0,Z)         CR_TAB
++                        AS2 (ld,%C0,-Z)        CR_TAB
++                        AS2 (subi,r30,lo8(1))  CR_TAB
++                        AS2 (sbci,r31,hi8(1))  CR_TAB
++                        AS2 (ld,__tmp_reg__,%1)  CR_TAB
++                        AS2 (subi,r30,lo8(1)) CR_TAB
++                        AS2 (sbci,r31,hi8(1)) CR_TAB
++                        AS2 (ld,%A0,%1)  CR_TAB
++                        AS2 (mov,%B0,__tmp_reg__));
++              } else {
++                *l = 5;
++                return (AS2 (ldd,%D0,%1+3) CR_TAB
++                        AS2 (ldd,%C0,%1+2) CR_TAB
++                        AS2 (ldd,__tmp_reg__,%1+1)  CR_TAB
++                        AS2 (ld,%A0,%1)  CR_TAB
++                        AS2 (mov,%B0,__tmp_reg__));
++              }
++            }
++          }
+           else if (reg_base == reg_dest + 2)
+-		  {
+-			  if(reg_base == REG_Y)
+-            return *l=5, AVR_TINY ? (AS2 (ld ,%A0,Y+)       CR_TAB
+-                            AS2 (ld,%B0,Y+) CR_TAB
+-                            AS2 (ld,__tmp_reg__,Y+) CR_TAB
+-                            AS2 (ld,%D0,Y) CR_TAB
+-                            AS2 (subi,r28,lo8(3)) CR_TAB
+-                            AS2 (sbci,r29,hi8(3)) CR_TAB
+-                            AS2 (mov,%C0,__tmp_reg__))
+-				             : (AS2 (ld ,%A0,%1)    CR_TAB
+-                            AS2 (ldd,%B0,%1+1) CR_TAB
+-                            AS2 (ldd,__tmp_reg__,%1+2)  CR_TAB
+-                            AS2 (ldd,%D0,%1+3) CR_TAB
+-                            AS2 (mov,%C0,__tmp_reg__));
+-			  if(reg_base == REG_Z)
+-            return *l=5, AVR_TINY ? (AS2 (ld ,%A0,Z+)       CR_TAB
+-                            AS2 (ld,%B0,Z+) CR_TAB
+-                            AS2 (ld,__tmp_reg__,Z+) CR_TAB
+-                            AS2 (ld,%D0,Z) CR_TAB
+-                            AS2 (subi,r30,lo8(3)) CR_TAB
+-                            AS2 (sbci,r31,hi8(3)) CR_TAB
+-                            AS2 (mov,%C0,__tmp_reg__))
+-				             : (AS2 (ld ,%A0,%1)    CR_TAB
+-                          AS2 (ldd,%B0,%1+1) CR_TAB
+-                          AS2 (ldd,__tmp_reg__,%1+2)  CR_TAB
+-                          AS2 (ldd,%D0,%1+3) CR_TAB
+-                          AS2 (mov,%C0,__tmp_reg__));
+-		  }
+-          else
+-		  {
+-			  if(reg_base == REG_Y)
+-            return *l=4, AVR_TINY ? (AS2 (ld ,%A0,Y+)   CR_TAB
+-                            AS2 (ld,%B0,Y+) CR_TAB
+-                            AS2 (ld,%C0,Y+) CR_TAB
+-                            AS2 (ld,%D0,Y)  CR_TAB
+-                            AS2 (subi,r28,lo8(3)) CR_TAB
+-                            AS2 (sbci,r29,hi8(3)))
+-						     : (AS2 (ld ,%A0,%1)   CR_TAB
+-                          AS2 (ldd,%B0,%1+1) CR_TAB
+-                          AS2 (ldd,%C0,%1+2) CR_TAB
+-                          AS2 (ldd,%D0,%1+3));
+-			  if(reg_base == REG_Z)
+-            return *l=4, AVR_TINY ? (AS2 (ld ,%A0,Z+)   CR_TAB
+-                            AS2 (ld,%B0,Z+) CR_TAB
+-                            AS2 (ld,%C0,Z+) CR_TAB
+-                            AS2 (ld,%D0,Z) CR_TAB
+-                            AS2 (subi,r30,lo8(3)) CR_TAB
+-                            AS2 (sbci,r31,hi8(3))) 
+-						     : (AS2 (ld ,%A0,%1)   CR_TAB
+-                            AS2 (ldd,%B0,%1+1) CR_TAB
+-                            AS2 (ldd,%C0,%1+2) CR_TAB
+-                            AS2 (ldd,%D0,%1+3));
+-        }
++          {
++            if(reg_base == REG_Y) {
++              if (AVR_TINY) {
++                *l = 7;
++                return (AS2 (ld ,%A0,Y+)       CR_TAB
++                        AS2 (ld,%B0,Y+) CR_TAB
++                        AS2 (ld,__tmp_reg__,Y+) CR_TAB
++                        AS2 (ld,%D0,Y) CR_TAB
++                        AS2 (subi,r28,lo8(3)) CR_TAB
++                        AS2 (sbci,r29,hi8(3)) CR_TAB
++                        AS2 (mov,%C0,__tmp_reg__));
++              } else {
++                *l = 5;
++                return (AS2 (ld ,%A0,%1)    CR_TAB
++                        AS2 (ldd,%B0,%1+1) CR_TAB
++                        AS2 (ldd,__tmp_reg__,%1+2)  CR_TAB
++                        AS2 (ldd,%D0,%1+3) CR_TAB
++                        AS2 (mov,%C0,__tmp_reg__));
++              }
++            }
++
++            if(reg_base == REG_Z) {
++              if (AVR_TINY) {
++                *l = 7;
++                return (AS2 (ld ,%A0,Z+) CR_TAB
++                        AS2 (ld,%B0,Z+) CR_TAB
++                        AS2 (ld,__tmp_reg__,Z+) CR_TAB
++                        AS2 (ld,%D0,Z) CR_TAB
++                        AS2 (subi,r30,lo8(3)) CR_TAB
++                        AS2 (sbci,r31,hi8(3)) CR_TAB
++                        AS2 (mov,%C0,__tmp_reg__));
++              } else {
++                *l = 5;
++                return (AS2 (ld ,%A0,%1)    CR_TAB
++                        AS2 (ldd,%B0,%1+1) CR_TAB
++                        AS2 (ldd,__tmp_reg__,%1+2)  CR_TAB
++                        AS2 (ldd,%D0,%1+3) CR_TAB
++                        AS2 (mov,%C0,__tmp_reg__));
++              }
++            }
++          } else {
++            if(reg_base == REG_Y) {
++              if (AVR_TINY) {
++                *l = 6;
++                return (AS2 (ld ,%A0,Y+) CR_TAB
++                        AS2 (ld,%B0,Y+) CR_TAB
++                        AS2 (ld,%C0,Y+) CR_TAB
++                        AS2 (ld,%D0,Y) CR_TAB
++                        AS2 (subi,r28,lo8(3)) CR_TAB
++                        AS2 (sbci,r29,hi8(3)));
++              } else {
++                *l = 4;
++                return (AS2 (ld ,%A0,%1)   CR_TAB
++                        AS2 (ldd,%B0,%1+1) CR_TAB
++                        AS2 (ldd,%C0,%1+2) CR_TAB
++                        AS2 (ldd,%D0,%1+3));
++              }
++            }
++            if(reg_base == REG_Z) {
++              if (AVR_TINY) {
++                *l = 6;
++                return (AS2 (ld ,%A0,Z+) CR_TAB
++                        AS2 (ld,%B0,Z+) CR_TAB
++                        AS2 (ld,%C0,Z+) CR_TAB
++                        AS2 (ld,%D0,Z) CR_TAB
++                        AS2 (subi,r30,lo8(3)) CR_TAB
++                        AS2 (sbci,r31,hi8(3)));
++              } else {
++                *l = 4;
++                return (AS2 (ld ,%A0,%1)   CR_TAB
++                        AS2 (ldd,%B0,%1+1) CR_TAB
++                        AS2 (ldd,%C0,%1+2) CR_TAB
++                        AS2 (ldd,%D0,%1+3));
++              }
++            }
++          }
+         }
+     }
+   else if (GET_CODE (base) == PLUS) /* (R + i) */
+@@ -2677,44 +2845,54 @@ out_movsi_r_mr (rtx insn, rtx op[], int 
+ 	  if (REGNO (XEXP (base, 0)) != REG_Y)
+ 	    fatal_insn ("incorrect insn:",insn);
+ 
+-	  if (disp <= 63 + MAX_LD_OFFSET (GET_MODE (src)))
+-	    return *l = 6, AVR_TINY ? (AS2 (subi,r28,lo8(-(%o1-60))) CR_TAB
+-						  AS2 (sbci,r29,hi8(-(%o1-60))) CR_TAB
+-                          AS2 (subi,r28,lo8(-60)) CR_TAB
+-                          AS2 (sbci,r29,hi8(-60)) CR_TAB
+-						  AS2 (ld,%A0,Y+)    CR_TAB
+-						  AS2 (ld,%B0,Y+)    CR_TAB
+-						  AS2 (ld,%C0,Y+)    CR_TAB
+-						  AS2 (ld,%D0,Y)    CR_TAB
+-                          AS2 (subi,r28,lo8(63)) CR_TAB
+-                          AS2 (sbci,r29,hi8(63)) CR_TAB
+-                          AS2 (subi,r28,lo8(%o1-60)) CR_TAB
+-                          AS2 (sbci,r29,hi8(%o1-60)))
+-						   : (AS2 (adiw,r28,%o1-60) CR_TAB
+-			    AS2 (ldd,%A0,Y+60)    CR_TAB
+-			    AS2 (ldd,%B0,Y+61)    CR_TAB
+-			    AS2 (ldd,%C0,Y+62)    CR_TAB
+-			    AS2 (ldd,%D0,Y+63)    CR_TAB
+-			    AS2 (sbiw,r28,%o1-60));
+-
+-	  return *l = 8, AVR_TINY ? (AS2 (subi,r28,lo8(-%o1)) CR_TAB
+-						AS2 (sbci,r29,hi8(-%o1)) CR_TAB
+-						AS2 (ld,%A0,Y+)           CR_TAB
+-						AS2 (ld,%B0,Y+)           CR_TAB
+-						AS2 (ld,%C0,Y+)           CR_TAB
+-						AS2 (ld,%D0,Y)           CR_TAB
+-                        AS2 (subi,r28,lo8(3))   CR_TAB
+-                        AS2 (sbci,r29,hi8(3))   CR_TAB
+-						AS2 (subi,r28,lo8(%o1))  CR_TAB
+-						AS2 (sbci,r29,hi8(%o1)))
+-			             : (AS2 (subi,r28,lo8(-%o1)) CR_TAB
+-			  AS2 (sbci,r29,hi8(-%o1)) CR_TAB
+-			  AS2 (ld,%A0,Y)           CR_TAB
+-			  AS2 (ldd,%B0,Y+1)        CR_TAB
+-			  AS2 (ldd,%C0,Y+2)        CR_TAB
+-			  AS2 (ldd,%D0,Y+3)        CR_TAB
+-			  AS2 (subi,r28,lo8(%o1))  CR_TAB
+-			  AS2 (sbci,r29,hi8(%o1)));
++	  if (disp <= 63 + MAX_LD_OFFSET (GET_MODE (src))) {
++	    if (AVR_TINY) {
++              *l = 12;
++              return (AS2 (subi,r28,lo8(-(%o1-60))) CR_TAB
++                      AS2 (sbci,r29,hi8(-(%o1-60))) CR_TAB
++                      AS2 (subi,r28,lo8(-60)) CR_TAB
++                      AS2 (sbci,r29,hi8(-60)) CR_TAB
++                      AS2 (ld,%A0,Y+)    CR_TAB
++                      AS2 (ld,%B0,Y+)    CR_TAB
++		      AS2 (ld,%C0,Y+)    CR_TAB
++                      AS2 (ld,%D0,Y)    CR_TAB
++                      AS2 (subi,r28,lo8(63)) CR_TAB
++                      AS2 (sbci,r29,hi8(63)) CR_TAB
++                      AS2 (subi,r28,lo8(%o1-60)) CR_TAB
++                      AS2 (sbci,r29,hi8(%o1-60)));
++            } else {
++              *l = 6;
++              return (AS2 (adiw,r28,%o1-60) CR_TAB
++                      AS2 (ldd,%A0,Y+60)    CR_TAB
++                      AS2 (ldd,%B0,Y+61)    CR_TAB
++                      AS2 (ldd,%C0,Y+62)    CR_TAB
++                      AS2 (ldd,%D0,Y+63)    CR_TAB
++                      AS2 (sbiw,r28,%o1-60));
++            }
++          }
++          if (AVR_TINY) {
++            *l = 10;
++            return (AS2 (subi,r28,lo8(-%o1)) CR_TAB
++                    AS2 (sbci,r29,hi8(-%o1)) CR_TAB
++                    AS2 (ld,%A0,Y+)          CR_TAB
++                    AS2 (ld,%B0,Y+)          CR_TAB
++                    AS2 (ld,%C0,Y+)          CR_TAB
++                    AS2 (ld,%D0,Y)           CR_TAB
++                    AS2 (subi,r28,lo8(3))    CR_TAB
++                    AS2 (sbci,r29,hi8(3))    CR_TAB
++                    AS2 (subi,r28,lo8(%o1))  CR_TAB
++                    AS2 (sbci,r29,hi8(%o1)));
++          } else {
++            *l = 8;
++            return (AS2 (subi,r28,lo8(-%o1)) CR_TAB
++                    AS2 (sbci,r29,hi8(-%o1)) CR_TAB
++                    AS2 (ld,%A0,Y)           CR_TAB
++                    AS2 (ldd,%B0,Y+1)        CR_TAB
++                    AS2 (ldd,%C0,Y+2)        CR_TAB
++                    AS2 (ldd,%D0,Y+3)        CR_TAB
++                    AS2 (subi,r28,lo8(%o1))  CR_TAB
++                    AS2 (sbci,r29,hi8(%o1)));
++          }
+ 	}
+ 
+       reg_base = true_regnum (XEXP (base, 0));
+@@ -2722,154 +2900,204 @@ out_movsi_r_mr (rtx insn, rtx op[], int 
+ 	{
+ 	  /* R = (X + d) */
+ 	  if (reg_dest == REG_X)
+-	    {
+-	      *l = 7;
+-	      /* "ld r26,-X" is undefined */
+-	      return AVR_TINY ? (AS2 (subi,r26,lo8(-(%o1+3)))  CR_TAB
+-					AS2 (sbci,r27,hi8(-(%o1+3)))  CR_TAB
+-					AS2 (ld,r29,X)          CR_TAB
+-		            AS2 (ld,r28,-X)         CR_TAB
+-		            AS2 (ld,__tmp_reg__,-X) CR_TAB
+-                    AS2 (subi,r26,lo8(1))   CR_TAB
+-                    AS2 (sbci,r27,hi8(1))   CR_TAB
+-		            AS2 (ld,r26,X)          CR_TAB
+-		            AS2 (mov,r27,__tmp_reg__))
+-		             : (AS2 (adiw,r26,%o1+3)    CR_TAB
+-		      AS2 (ld,r29,X)          CR_TAB
+-		      AS2 (ld,r28,-X)         CR_TAB
+-		      AS2 (ld,__tmp_reg__,-X) CR_TAB
+-		      AS2 (sbiw,r26,1)        CR_TAB
+-		      AS2 (ld,r26,X)          CR_TAB
+-		      AS2 (mov,r27,__tmp_reg__));
+-	    }
+-	  *l = 6;
+-	  if (reg_dest == REG_X - 2)
+-	    return AVR_TINY ? (AS2 (subi,r26,lo8(-(%o1))) CR_TAB
+-				  AS2 (sbci,r27,hi8(-(%o1))) CR_TAB
+-		          AS2 (ld,r24,X+)         CR_TAB
+-		          AS2 (ld,r25,X+)         CR_TAB
+-		          AS2 (ld,__tmp_reg__,X+) CR_TAB
+-		          AS2 (ld,r27,X)          CR_TAB
+-		          AS2 (mov,r26,__tmp_reg__))
+-		           : (AS2 (adiw,r26,%o1)      CR_TAB
+-		    AS2 (ld,r24,X+)         CR_TAB
+-		    AS2 (ld,r25,X+)         CR_TAB
+-		    AS2 (ld,__tmp_reg__,X+) CR_TAB
+-		    AS2 (ld,r27,X)          CR_TAB
+-		    AS2 (mov,r26,__tmp_reg__));
+-
+-	  return AVR_TINY ? (AS2 (subi,r26,lo8(-(%o1))) CR_TAB
+-			    AS2 (sbci,r27,hi8(-(%o1))) CR_TAB
+-		        AS2 (ld,%A0,X+)    CR_TAB
+-		        AS2 (ld,%B0,X+)    CR_TAB
+-		        AS2 (ld,%C0,X+)    CR_TAB
+-		        AS2 (ld,%D0,X)     CR_TAB
+-		        AS2 (subi,r26,lo8(%o1+3)) CR_TAB
+-				AS2 (sbci,r27,hi8(%o1+3)))
+-				 : (AS2 (adiw,r26,%o1) CR_TAB
+-		  AS2 (ld,%A0,X+)    CR_TAB
+-		  AS2 (ld,%B0,X+)    CR_TAB
+-		  AS2 (ld,%C0,X+)    CR_TAB
+-		  AS2 (ld,%D0,X)     CR_TAB
+-		  AS2 (sbiw,r26,%o1+3));
++	  {
++	    /* "ld r26,-X" is undefined */
++            if (AVR_TINY) {
++              *l = 9;
++              return (AS2 (subi,r26,lo8(-(%o1+3)))  CR_TAB
++                      AS2 (sbci,r27,hi8(-(%o1+3)))  CR_TAB
++                      AS2 (ld,r29,X)          CR_TAB
++                      AS2 (ld,r28,-X)         CR_TAB
++                      AS2 (ld,__tmp_reg__,-X) CR_TAB
++                      AS2 (subi,r26,lo8(1))   CR_TAB
++                      AS2 (sbci,r27,hi8(1))   CR_TAB
++                      AS2 (ld,r26,X)          CR_TAB
++                      AS2 (mov,r27,__tmp_reg__));
++            } else {
++              *l = 7;
++              return (AS2 (adiw,r26,%o1+3)    CR_TAB
++                      AS2 (ld,r29,X)          CR_TAB
++                      AS2 (ld,r28,-X)         CR_TAB
++                      AS2 (ld,__tmp_reg__,-X) CR_TAB
++                      AS2 (sbiw,r26,1)        CR_TAB
++                      AS2 (ld,r26,X)          CR_TAB
++                      AS2 (mov,r27,__tmp_reg__));
++            }
++	  }
++
++          if (reg_dest == REG_X - 2) {
++            if (AVR_TINY) {
++              *l = 7;
++              return (AS2 (subi,r26,lo8(-(%o1))) CR_TAB
++                      AS2 (sbci,r27,hi8(-(%o1))) CR_TAB
++                      AS2 (ld,r24,X+)         CR_TAB
++                      AS2 (ld,r25,X+)         CR_TAB
++                      AS2 (ld,__tmp_reg__,X+) CR_TAB
++                      AS2 (ld,r27,X)          CR_TAB
++                      AS2 (mov,r26,__tmp_reg__));
++            } else {
++              *l = 6;
++              return (AS2 (adiw,r26,%o1)      CR_TAB
++		      AS2 (ld,r24,X+)         CR_TAB
++		      AS2 (ld,r25,X+)         CR_TAB
++		      AS2 (ld,__tmp_reg__,X+) CR_TAB
++		      AS2 (ld,r27,X)          CR_TAB
++		      AS2 (mov,r26,__tmp_reg__));
++            }
++          }
++          
++          if (AVR_TINY) {
++            *l = 8;
++            return (AS2 (subi,r26,lo8(-(%o1))) CR_TAB
++                    AS2 (sbci,r27,hi8(-(%o1))) CR_TAB
++                    AS2 (ld,%A0,X+)    CR_TAB
++                    AS2 (ld,%B0,X+)    CR_TAB
++                    AS2 (ld,%C0,X+)    CR_TAB
++                    AS2 (ld,%D0,X)     CR_TAB
++                    AS2 (subi,r26,lo8(%o1+3)) CR_TAB
++                    AS2 (sbci,r27,hi8(%o1+3)));
++          } else {
++            *l = 6;
++            return (AS2 (adiw,r26,%o1) CR_TAB
++                    AS2 (ld,%A0,X+)    CR_TAB
++                    AS2 (ld,%B0,X+)    CR_TAB
++                    AS2 (ld,%C0,X+)    CR_TAB
++                    AS2 (ld,%D0,X)     CR_TAB
++                    AS2 (sbiw,r26,%o1+3));
++          }
+ 	}
+       if (reg_dest == reg_base)
+-	  {
+-			op[2] = XEXP(base, 0);
++      {
++        op[2] = XEXP(base, 0);
+ 
+-		if(REGNO(op[2]) == REG_Y)
+-        return *l=5, AVR_TINY ? (AS2 (subi,%A2,lo8(-(%o1+4))) CR_TAB
+-						AS2 (sbci,%B2,hi8(-(%o1+4))) CR_TAB
+-						AS2 (ld,%D0,-Y)               CR_TAB
+-		                AS2 (ld,%C0,-Y)               CR_TAB
+-		                AS2 (ld,__tmp_reg__,-Y)       CR_TAB
+-		                AS2 (ld,%A0,-Y)               CR_TAB
+-                        AS2 (subi,%A2,lo8(%o1)) CR_TAB
+-						AS2 (sbci,%B2,hi8(%o1)) CR_TAB
+-                        AS2 (mov,%B0,__tmp_reg__))
+-			             : (AS2 (ldd,%D0,%D1) CR_TAB
+-                        AS2 (ldd,%C0,%C1) CR_TAB
+-                        AS2 (ldd,__tmp_reg__,%B1)  CR_TAB
+-                        AS2 (ldd,%A0,%A1) CR_TAB
+-                        AS2 (mov,%B0,__tmp_reg__));
+-		if(REGNO(op[2]) == REG_Z)
+-        return *l=5, AVR_TINY ? (AS2 (subi,%A2,lo8(-(%o1+4))) CR_TAB
+-						AS2 (sbci,%B2,hi8(-(%o1+4))) CR_TAB
+-						AS2 (ld,%D0,-Z)               CR_TAB
+-		                AS2 (ld,%C0,-Z)               CR_TAB
+-		                AS2 (ld,__tmp_reg__,-Z)       CR_TAB
+-		                AS2 (ld,%A0,-Z)               CR_TAB
+-                        AS2 (subi,%A2,lo8(%o1)) CR_TAB
+-						AS2 (sbci,%B2,hi8(%o1)) CR_TAB
+-                        AS2 (mov,%B0,__tmp_reg__))
+-			             : (AS2 (ldd,%D0,%D1)			CR_TAB
+-                      AS2 (ldd,%C0,%C1) CR_TAB
+-                      AS2 (ldd,__tmp_reg__,%B1)  CR_TAB
+-                      AS2 (ldd,%A0,%A1) CR_TAB
+-                      AS2 (mov,%B0,__tmp_reg__));
+-	  }
+-      else if (reg_dest == reg_base - 2)
+-	  {
+-			op[2] = XEXP(base, 0);
++        if(REGNO(op[2]) == REG_Y) {
++          if (AVR_TINY) {
++            *l = 9;
++            return (AS2 (subi,%A2,lo8(-(%o1+4))) CR_TAB
++                    AS2 (sbci,%B2,hi8(-(%o1+4))) CR_TAB
++                    AS2 (ld,%D0,-Y)              CR_TAB
++                    AS2 (ld,%C0,-Y)              CR_TAB
++                    AS2 (ld,__tmp_reg__,-Y)      CR_TAB
++                    AS2 (ld,%A0,-Y)              CR_TAB
++                    AS2 (subi,%A2,lo8(%o1))      CR_TAB
++                    AS2 (sbci,%B2,hi8(%o1)) CR_TAB
++                    AS2 (mov,%B0,__tmp_reg__));
++          } else {
++            *l = 5;
++            return (AS2 (ldd,%D0,%D1) CR_TAB
++                    AS2 (ldd,%C0,%C1) CR_TAB
++                    AS2 (ldd,__tmp_reg__,%B1) CR_TAB
++                    AS2 (ldd,%A0,%A1) CR_TAB
++                    AS2 (mov,%B0,__tmp_reg__));
++          }
++        }
++        if(REGNO(op[2]) == REG_Z) {
++          if (AVR_TINY) {
++            *l = 9;
++            return (AS2 (subi,%A2,lo8(-(%o1+4))) CR_TAB
++                    AS2 (sbci,%B2,hi8(-(%o1+4))) CR_TAB
++                    AS2 (ld,%D0,-Z)              CR_TAB
++                    AS2 (ld,%C0,-Z)              CR_TAB
++                    AS2 (ld,__tmp_reg__,-Z)      CR_TAB
++                    AS2 (ld,%A0,-Z)              CR_TAB
++                    AS2 (subi,%A2,lo8(%o1)) CR_TAB
++                    AS2 (sbci,%B2,hi8(%o1)) CR_TAB
++                    AS2 (mov,%B0,__tmp_reg__));
++          } else {
++            *l = 5;
++            return (AS2 (ldd,%D0,%D1) CR_TAB
++                    AS2 (ldd,%C0,%C1) CR_TAB
++                    AS2 (ldd,__tmp_reg__,%B1) CR_TAB
++                    AS2 (ldd,%A0,%A1) CR_TAB
++                    AS2 (mov,%B0,__tmp_reg__));
++          }
++        }
++      } else if (reg_dest == reg_base - 2) {
++        op[2] = XEXP(base, 0);
+ 
+-		if(REGNO(op[2]) == REG_Y)
+-        return *l=5, AVR_TINY ? (AS2 (subi,%A2,lo8(-(%o1)))   CR_TAB
+-						AS2 (sbci,%B2,hi8(-(%o1)))   CR_TAB
+-		                AS2 (ld,%A0,Y+)               CR_TAB
+-		                AS2 (ld,%B0,Y+)               CR_TAB
+-		                AS2 (ld,__tmp_reg__,Y+)       CR_TAB
+-						AS2 (ld,%D0,Y)               CR_TAB
+-						AS2 (subi,%A2,lo8(%o1+3)) CR_TAB
+-						AS2 (sbci,%B2,hi8(%o1+3)) CR_TAB
+-                        AS2 (mov,%C0,__tmp_reg__)) 
+-			             : (AS2 (ldd,%A0,%A1)          CR_TAB
+-                      AS2 (ldd,%B0,%B1) CR_TAB
+-                      AS2 (ldd,__tmp_reg__,%C1)  CR_TAB
+-                      AS2 (ldd,%D0,%D1) CR_TAB
+-                      AS2 (mov,%C0,__tmp_reg__));
+-		if(REGNO(op[2]) == REG_Z)
+-        return *l=5, AVR_TINY ? (AS2 (subi,%A2,lo8(-(%o1)))   CR_TAB
+-						AS2 (sbci,%B2,hi8(-(%o1)))   CR_TAB
+-		                AS2 (ld,%A0,Z+)              CR_TAB
+-		                AS2 (ld,%B0,Z+)              CR_TAB
+-		                AS2 (ld,__tmp_reg__,Z+)      CR_TAB
+-						AS2 (ld,%D0,Z)               CR_TAB
+-						AS2 (subi,%A2,lo8(%o1+3))    CR_TAB
+-						AS2 (sbci,%B2,hi8(%o1+3))    CR_TAB
+-                        AS2 (mov,%C0,__tmp_reg__)) 
+-			             : (AS2 (ldd,%A0,%A1)          CR_TAB
+-                        AS2 (ldd,%B0,%B1)          CR_TAB
+-                        AS2 (ldd,__tmp_reg__,%C1)  CR_TAB
+-                        AS2 (ldd,%D0,%D1)          CR_TAB
+-                        AS2 (mov,%C0,__tmp_reg__));
+-	  }
+-			op[2] = XEXP(base, 0);
+-		if(REGNO(op[2]) == REG_Y)
+-        return *l=4, AVR_TINY ? (AS2 (subi,%A2,lo8(-(%o1)))   CR_TAB
+-						AS2 (sbci,%B2,hi8(-(%o1)))   CR_TAB
+-		                AS2 (ld,%A0,Y+)               CR_TAB
+-		                AS2 (ld,%B0,Y+)               CR_TAB
+-		                AS2 (ld,%C0,Y+)               CR_TAB
+-						AS2 (ld,%D0,Y)                CR_TAB
+-						AS2 (subi,%A2,lo8(%o1+3)) CR_TAB
+-						AS2 (sbci,%B2,hi8(%o1+3))) 
+-			             : (AS2 (ldd,%A0,%A1) CR_TAB
+-                        AS2 (ldd,%B0,%B1) CR_TAB
+-                        AS2 (ldd,%C0,%C1) CR_TAB
+-                        AS2 (ldd,%D0,%D1));
+-		if(REGNO(op[2]) == REG_Z)
+-        return *l=4, AVR_TINY ? (AS2 (subi,%A2,lo8(-(%o1)))   CR_TAB
+-						AS2 (sbci,%B2,hi8(-(%o1)))   CR_TAB
+-		                AS2 (ld,%A0,Z+)               CR_TAB
+-		                AS2 (ld,%B0,Z+)               CR_TAB
+-		                AS2 (ld,%C0,Z+)               CR_TAB
+-						AS2 (ld,%D0,Z)               CR_TAB
+-						AS2 (subi,%A2,lo8(%o1+3)) CR_TAB
+-						AS2 (sbci,%B2,hi8(%o1+3)))
+-			             : (AS2 (ldd,%A0,%A1) CR_TAB
++        if(REGNO(op[2]) == REG_Y) {
++          if (AVR_TINY) {
++            *l = 9;
++            return (AS2 (subi,%A2,lo8(-(%o1)))   CR_TAB
++                    AS2 (sbci,%B2,hi8(-(%o1)))   CR_TAB
++                    AS2 (ld,%A0,Y+)              CR_TAB
++                    AS2 (ld,%B0,Y+)              CR_TAB
++                    AS2 (ld,__tmp_reg__,Y+)      CR_TAB
++                    AS2 (ld,%D0,Y)               CR_TAB
++                    AS2 (subi,%A2,lo8(%o1+3)) CR_TAB
++                    AS2 (sbci,%B2,hi8(%o1+3)) CR_TAB
++                    AS2 (mov,%C0,__tmp_reg__));
++          } else {
++            *l = 5;
++            return (AS2 (ldd,%A0,%A1) CR_TAB
+                     AS2 (ldd,%B0,%B1) CR_TAB
+-                    AS2 (ldd,%C0,%C1) CR_TAB
+-                    AS2 (ldd,%D0,%D1));
++                    AS2 (ldd,__tmp_reg__,%C1) CR_TAB
++                    AS2 (ldd,%D0,%D1) CR_TAB
++                    AS2 (mov,%C0,__tmp_reg__));
++          }
++        }
++        if(REGNO(op[2]) == REG_Z) {
++          if (AVR_TINY) {
++            *l = 9;
++            return (AS2 (subi,%A2,lo8(-(%o1)))   CR_TAB
++                    AS2 (sbci,%B2,hi8(-(%o1)))   CR_TAB
++                    AS2 (ld,%A0,Z+)              CR_TAB
++                    AS2 (ld,%B0,Z+)              CR_TAB
++                    AS2 (ld,__tmp_reg__,Z+)      CR_TAB
++                    AS2 (ld,%D0,Z)               CR_TAB
++                    AS2 (subi,%A2,lo8(%o1+3))    CR_TAB
++                    AS2 (sbci,%B2,hi8(%o1+3))    CR_TAB
++                    AS2 (mov,%C0,__tmp_reg__));
++          } else {
++            *l = 5;
++            return (AS2 (ldd,%A0,%A1)          CR_TAB
++                    AS2 (ldd,%B0,%B1)          CR_TAB
++                    AS2 (ldd,__tmp_reg__,%C1)  CR_TAB
++                    AS2 (ldd,%D0,%D1)          CR_TAB
++                    AS2 (mov,%C0,__tmp_reg__));
++          }
++        }
++      }
++
++      op[2] = XEXP(base, 0);
++      if(REGNO(op[2]) == REG_Y) {
++        if (AVR_TINY) {
++          *l = 8;
++          return (AS2 (subi,%A2,lo8(-(%o1))) CR_TAB
++                  AS2 (sbci,%B2,hi8(-(%o1))) CR_TAB
++                  AS2 (ld,%A0,Y+)            CR_TAB
++                  AS2 (ld,%B0,Y+)            CR_TAB
++                  AS2 (ld,%C0,Y+)            CR_TAB
++                  AS2 (ld,%D0,Y)             CR_TAB
++                  AS2 (subi,%A2,lo8(%o1+3)) CR_TAB
++                  AS2 (sbci,%B2,hi8(%o1+3)));
++        } else {
++          *l = 4;
++          return (AS2 (ldd,%A0,%A1) CR_TAB
++                  AS2 (ldd,%B0,%B1) CR_TAB
++                  AS2 (ldd,%C0,%C1) CR_TAB
++                  AS2 (ldd,%D0,%D1));
++        }
++      }
++      if(REGNO(op[2]) == REG_Z) {
++        if (AVR_TINY) {
++          *l = 8;
++          return (AS2 (subi,%A2,lo8(-(%o1))) CR_TAB
++                  AS2 (sbci,%B2,hi8(-(%o1))) CR_TAB
++                  AS2 (ld,%A0,Z+)            CR_TAB
++                  AS2 (ld,%B0,Z+)            CR_TAB
++                  AS2 (ld,%C0,Z+)            CR_TAB
++                  AS2 (ld,%D0,Z)             CR_TAB
++                  AS2 (subi,%A2,lo8(%o1+3)) CR_TAB
++                  AS2 (sbci,%B2,hi8(%o1+3)));
++        } else {
++          *l = 4;
++          return (AS2 (ldd,%A0,%A1) CR_TAB
++                  AS2 (ldd,%B0,%B1) CR_TAB
++                  AS2 (ldd,%C0,%C1) CR_TAB
++                  AS2 (ldd,%D0,%D1));
++        }
++      }
+     }
+   else if (GET_CODE (base) == PRE_DEC) /* (--R) */
+     return *l=4, (AS2 (ld,%D0,%1) CR_TAB
+@@ -2916,37 +3144,48 @@ out_movsi_mr_r (rtx insn, rtx op[], int 
+           if (reg_src == REG_X)
+             {
+ 	      /* "st X+,r26" is undefined */
+-              if (reg_unused_after (insn, base))
+-		return *l=6, AVR_TINY ? (AS2 (mov,__tmp_reg__,r27) CR_TAB
+-			            AS2 (st,X,r26)            CR_TAB
+-			            AS2 (subi,r26,lo8(-1))    CR_TAB
+-			            AS2 (sbci,r27,hi8(-1))    CR_TAB
+-			            AS2 (st,X+,__tmp_reg__)   CR_TAB
+-			            AS2 (st,X+,r28)           CR_TAB
+-			            AS2 (st,X,r29))
+-			             : (AS2 (mov,__tmp_reg__,r27) CR_TAB
+-			      AS2 (st,X,r26)            CR_TAB
+-			      AS2 (adiw,r26,1)          CR_TAB
+-			      AS2 (st,X+,__tmp_reg__)   CR_TAB
+-			      AS2 (st,X+,r28)           CR_TAB
+-			      AS2 (st,X,r29));
+-              else
+-        return *l=7, AVR_TINY ? (AS2 (mov,__tmp_reg__,r27) CR_TAB
+-			            AS2 (st,X,r26)            CR_TAB
+-			            AS2 (subi,r26,lo8(-1))    CR_TAB
+-			            AS2 (sbci,r27,hi8(-1))    CR_TAB
+-			            AS2 (st,X+,__tmp_reg__)   CR_TAB
+-			            AS2 (st,X+,r28)           CR_TAB
+-			            AS2 (st,X,r29)            CR_TAB
+-			            AS2 (subi,r26,lo8(3))     CR_TAB
+-			            AS2 (sbci,r27,hi8(3)))
+-				         : (AS2 (mov,__tmp_reg__,r27) CR_TAB
+-			      AS2 (st,X,r26)            CR_TAB
+-			      AS2 (adiw,r26,1)          CR_TAB
+-			      AS2 (st,X+,__tmp_reg__)   CR_TAB
+-			      AS2 (st,X+,r28)           CR_TAB
+-			      AS2 (st,X,r29)            CR_TAB
+-			      AS2 (sbiw,r26,3));
++              if (reg_unused_after (insn, base)) {
++                if (AVR_TINY) {
++                  *l = 7;
++                  return (AS2 (mov,__tmp_reg__,r27) CR_TAB
++                          AS2 (st,X,r26)            CR_TAB
++                          AS2 (subi,r26,lo8(-1))    CR_TAB
++                          AS2 (sbci,r27,hi8(-1))    CR_TAB
++                          AS2 (st,X+,__tmp_reg__)   CR_TAB
++                          AS2 (st,X+,r28)           CR_TAB
++                          AS2 (st,X,r29));
++                } else {
++                  *l = 6;
++                  return (AS2 (mov,__tmp_reg__,r27) CR_TAB
++                          AS2 (st,X,r26)            CR_TAB
++                          AS2 (adiw,r26,1)          CR_TAB
++                          AS2 (st,X+,__tmp_reg__)   CR_TAB
++                          AS2 (st,X+,r28)           CR_TAB
++                          AS2 (st,X,r29));
++                }
++              } else {
++                if (AVR_TINY) {
++                  *l = 9;
++                  return (AS2 (mov,__tmp_reg__,r27) CR_TAB
++                          AS2 (st,X,r26)            CR_TAB
++                          AS2 (subi,r26,lo8(-1))    CR_TAB
++                          AS2 (sbci,r27,hi8(-1))    CR_TAB
++                          AS2 (st,X+,__tmp_reg__)   CR_TAB
++                          AS2 (st,X+,r28)           CR_TAB
++                          AS2 (st,X,r29)            CR_TAB
++                          AS2 (subi,r26,lo8(3))     CR_TAB
++                          AS2 (sbci,r27,hi8(3)));
++                } else {
++                  *l = 7;
++                  return (AS2 (mov,__tmp_reg__,r27) CR_TAB
++                          AS2 (st,X,r26)            CR_TAB
++                          AS2 (adiw,r26,1)          CR_TAB
++                          AS2 (st,X+,__tmp_reg__)   CR_TAB
++                          AS2 (st,X+,r28)           CR_TAB
++                          AS2 (st,X,r29)            CR_TAB
++                          AS2 (sbiw,r26,3));
++                }
++              }
+             }
+           else if (reg_base == reg_src + 2)
+             {
+@@ -2958,61 +3197,84 @@ out_movsi_mr_r (rtx insn, rtx op[], int 
+                               AS2 (st,%0+,__zero_reg__)  CR_TAB
+                               AS2 (st,%0,__tmp_reg__)   CR_TAB
+                               AS1 (clr,__zero_reg__));
+-              else
+-                return *l=8, AVR_TINY ? (AS2 (mov,__zero_reg__,%C1) CR_TAB
+-                                AS2 (mov,__tmp_reg__,%D1)  CR_TAB
+-                                AS2 (st,%0+,%A1)           CR_TAB
+-                                AS2 (st,%0+,%B1)           CR_TAB
+-                                AS2 (st,%0+,__zero_reg__)  CR_TAB
+-                                AS2 (st,%0,__tmp_reg__)    CR_TAB
+-                                AS1 (clr,__zero_reg__)     CR_TAB
+-			                    AS2 (subi,r26,lo8(3))      CR_TAB
+-			                    AS2 (sbci,r27,hi8(3)))
+-					             : (AS2 (mov,__zero_reg__,%C1) CR_TAB
+-                              AS2 (mov,__tmp_reg__,%D1) CR_TAB
+-                              AS2 (st,%0+,%A1) CR_TAB
+-                              AS2 (st,%0+,%B1) CR_TAB
+-                              AS2 (st,%0+,__zero_reg__)  CR_TAB
+-                              AS2 (st,%0,__tmp_reg__)   CR_TAB
+-                              AS1 (clr,__zero_reg__)     CR_TAB
+-                              AS2 (sbiw,r26,3));
++              else {
++                if (AVR_TINY) {
++                  *l = 9;
++                  return (AS2 (mov,__zero_reg__,%C1) CR_TAB
++                          AS2 (mov,__tmp_reg__,%D1)  CR_TAB
++                          AS2 (st,%0+,%A1)           CR_TAB
++                          AS2 (st,%0+,%B1)           CR_TAB
++                          AS2 (st,%0+,__zero_reg__)  CR_TAB
++                          AS2 (st,%0,__tmp_reg__)    CR_TAB
++                          AS1 (clr,__zero_reg__)     CR_TAB
++                          AS2 (subi,r26,lo8(3))      CR_TAB
++                          AS2 (sbci,r27,hi8(3)));
++                } else {
++                  *l = 8;
++                  return (AS2 (mov,__zero_reg__,%C1) CR_TAB
++                          AS2 (mov,__tmp_reg__,%D1) CR_TAB
++                          AS2 (st,%0+,%A1) CR_TAB
++                          AS2 (st,%0+,%B1) CR_TAB
++                          AS2 (st,%0+,__zero_reg__) CR_TAB
++                          AS2 (st,%0,__tmp_reg__)   CR_TAB
++                          AS1 (clr,__zero_reg__)    CR_TAB
++                          AS2 (sbiw,r26,3));
++                }
++              }
+             }
+-          return *l=5, AVR_TINY ? (AS2 (st,%0+,%A1)  CR_TAB
+-                          AS2 (st,%0+,%B1)  CR_TAB
+-                          AS2 (st,%0+,%C1)  CR_TAB
+-                          AS2 (st,%0,%D1)   CR_TAB
+-			              AS2 (subi,r26,lo8(3))      CR_TAB
+-			              AS2 (sbci,r27,hi8(3)))
+-				           : (AS2 (st,%0+,%A1)  CR_TAB
+-                        AS2 (st,%0+,%B1) CR_TAB
+-                        AS2 (st,%0+,%C1) CR_TAB
+-                        AS2 (st,%0,%D1)  CR_TAB
+-                        AS2 (sbiw,r26,3));
++          if (AVR_TINY) {
++            *l = 6;
++            return (AS2 (st,%0+,%A1)  CR_TAB
++                    AS2 (st,%0+,%B1)  CR_TAB
++                    AS2 (st,%0+,%C1)  CR_TAB
++                    AS2 (st,%0,%D1)   CR_TAB
++                    AS2 (subi,r26,lo8(3)) CR_TAB
++                    AS2 (sbci,r27,hi8(3)));
++          } else {
++            *l = 5;
++            return (AS2 (st,%0+,%A1) CR_TAB
++                    AS2 (st,%0+,%B1) CR_TAB
++                    AS2 (st,%0+,%C1) CR_TAB
++                    AS2 (st,%0,%D1)  CR_TAB
++                    AS2 (sbiw,r26,3));
++          }
+         }
+       else
+ 	 {
+-		 if(reg_base == REG_Y)
+-        return *l=4, AVR_TINY ? (AS2 (st,Y+,%A1)        CR_TAB
+-		                AS2 (st,Y+,%B1)        CR_TAB
+-		                AS2 (st,Y+,%C1)        CR_TAB
+-		                AS2 (st,Y,%D1)        CR_TAB
+-				        AS2 (subi,r28,lo8(3)) CR_TAB
+-				        AS2 (sbci,r29,lo8(3)))
+-			             : (AS2 (st,%0,%A1)    CR_TAB
+-		                AS2 (std,%0+1,%B1) CR_TAB
+-		                AS2 (std,%0+2,%C1) CR_TAB
+-		                AS2 (std,%0+3,%D1));
+-		 if(reg_base == REG_Z)
+-        return *l=4, AVR_TINY ? (AS2 (st,Z+,%A1)        CR_TAB
+-		                AS2 (st,Z+,%B1)        CR_TAB
+-		                AS2 (st,Z+,%C1)        CR_TAB
+-		                AS2 (st,Z,%D1)        CR_TAB
+-				        AS2 (subi,r30,lo8(3)) CR_TAB
+-				        AS2 (sbci,r31,lo8(3)))
+-			             : (AS2 (st,%0,%A1)    CR_TAB
+-		      AS2 (std,%0+1,%B1) CR_TAB
+-		      AS2 (std,%0+2,%C1) CR_TAB
+-		      AS2 (std,%0+3,%D1));
++        if(reg_base == REG_Y) {
++          if (AVR_TINY) {
++            *l = 6;
++            return (AS2 (st,Y+,%A1)       CR_TAB
++                    AS2 (st,Y+,%B1)       CR_TAB
++                    AS2 (st,Y+,%C1)       CR_TAB
++                    AS2 (st,Y,%D1)        CR_TAB
++                    AS2 (subi,r28,lo8(3)) CR_TAB
++                    AS2 (sbci,r29,lo8(3)));
++          } else {
++            *l = 4;
++            return (AS2 (st,%0,%A1)    CR_TAB
++                    AS2 (std,%0+1,%B1) CR_TAB
++                    AS2 (std,%0+2,%C1) CR_TAB
++                    AS2 (std,%0+3,%D1));
++          }
++        }
++        if(reg_base == REG_Z) {
++          if (AVR_TINY) {
++            *l = 6;
++            return (AS2 (st,Z+,%A1)       CR_TAB
++                    AS2 (st,Z+,%B1)       CR_TAB
++                    AS2 (st,Z+,%C1)       CR_TAB
++                    AS2 (st,Z,%D1)        CR_TAB
++                    AS2 (subi,r30,lo8(3)) CR_TAB
++                    AS2 (sbci,r31,lo8(3)));
++          } else {
++            *l = 4;
++            return (AS2 (st,%0,%A1)    CR_TAB
++                    AS2 (std,%0+1,%B1) CR_TAB
++                    AS2 (std,%0+2,%C1) CR_TAB
++                    AS2 (std,%0+3,%D1));
++          }
++        }
+     }
+     }
+   else if (GET_CODE (base) == PLUS) /* (R + i) */
+@@ -3024,62 +3286,76 @@ out_movsi_mr_r (rtx insn, rtx op[], int 
+ 	  if (reg_base != REG_Y)
+ 	    fatal_insn ("incorrect insn:",insn);
+ 
+-	  if (disp <= 63 + MAX_LD_OFFSET (GET_MODE (dest)))
+-	    return *l = 6, AVR_TINY ? (AS2 (subi,r28,lo8(-(%o0-60))) CR_TAB
+-				          AS2 (sbci,r29,hi8(-(%o0-60))) CR_TAB
+-				          AS2 (subi,r28,lo8(-60)) CR_TAB
+-				          AS2 (sbci,r29,lo8(-60)) CR_TAB
+-			              AS2 (st,Y+,%A1)          CR_TAB
+-			              AS2 (st,Y+,%B1)          CR_TAB
+-			              AS2 (st,Y+,%C1)          CR_TAB
+-			              AS2 (st,Y,%D1)          CR_TAB
+-				          AS2 (subi,r28,lo8(63)) CR_TAB
+-				          AS2 (sbci,r29,lo8(63)) CR_TAB
+-			              AS2 (subi,r28,lo8(%o0-60)) CR_TAB 
+-			              AS2 (sbci,r29,hi8(%o0-60)))  
+-			               : (AS2 (adiw,r28,%o0-60) CR_TAB
+-			    AS2 (std,Y+60,%A1)    CR_TAB
+-			    AS2 (std,Y+61,%B1)    CR_TAB
+-			    AS2 (std,Y+62,%C1)    CR_TAB
+-			    AS2 (std,Y+63,%D1)    CR_TAB
+-			    AS2 (sbiw,r28,%o0-60));
+-	  return *l = 8, AVR_TINY ? (AS2 (subi,r28,lo8(-%o0)) CR_TAB
+-			            AS2 (sbci,r29,hi8(-%o0)) CR_TAB
+-			            AS2 (st,Y+,%A1)           CR_TAB
+-			            AS2 (st,Y+,%B1)           CR_TAB
+-			            AS2 (st,Y+,%C1)           CR_TAB
+-			            AS2 (st,Y,%D1)           CR_TAB
+-				        AS2 (subi,r28,lo8(3))   CR_TAB
+-				        AS2 (sbci,r29,lo8(3))   CR_TAB
+-			            AS2 (subi,r28,lo8(%o0))  CR_TAB
+-			            AS2 (sbci,r29,hi8(%o0)))
+-			             : (AS2 (subi,r28,lo8(-%o0)) CR_TAB
+-			  AS2 (sbci,r29,hi8(-%o0)) CR_TAB
+-			  AS2 (st,Y,%A1)           CR_TAB
+-			  AS2 (std,Y+1,%B1)        CR_TAB
+-			  AS2 (std,Y+2,%C1)        CR_TAB
+-			  AS2 (std,Y+3,%D1)        CR_TAB
+-			  AS2 (subi,r28,lo8(%o0))  CR_TAB
+-			  AS2 (sbci,r29,hi8(%o0)));
++	  if (disp <= 63 + MAX_LD_OFFSET (GET_MODE (dest))) {
++	    if (AVR_TINY) {
++              *l = 12;
++              return (AS2 (subi,r28,lo8(-(%o0-60))) CR_TAB
++                      AS2 (sbci,r29,hi8(-(%o0-60))) CR_TAB
++                      AS2 (subi,r28,lo8(-60)) CR_TAB
++                      AS2 (sbci,r29,lo8(-60)) CR_TAB
++                      AS2 (st,Y+,%A1)         CR_TAB
++                      AS2 (st,Y+,%B1)         CR_TAB
++                      AS2 (st,Y+,%C1)         CR_TAB
++                      AS2 (st,Y,%D1)          CR_TAB
++                      AS2 (subi,r28,lo8(63)) CR_TAB
++                      AS2 (sbci,r29,lo8(63)) CR_TAB
++                      AS2 (subi,r28,lo8(%o0-60)) CR_TAB 
++                      AS2 (sbci,r29,hi8(%o0-60)));
++            } else {
++              *l = 6;
++              return (AS2 (adiw,r28,%o0-60) CR_TAB
++                      AS2 (std,Y+60,%A1)    CR_TAB
++                      AS2 (std,Y+61,%B1)    CR_TAB
++                      AS2 (std,Y+62,%C1)    CR_TAB
++                      AS2 (std,Y+63,%D1)    CR_TAB
++                      AS2 (sbiw,r28,%o0-60));
++            }
++          }
++          if (AVR_TINY) {
++            *l = 10;
++            return (AS2 (subi,r28,lo8(-%o0)) CR_TAB
++	            AS2 (sbci,r29,hi8(-%o0)) CR_TAB
++	            AS2 (st,Y+,%A1)           CR_TAB
++	            AS2 (st,Y+,%B1)           CR_TAB
++	            AS2 (st,Y+,%C1)           CR_TAB
++	            AS2 (st,Y,%D1)           CR_TAB
++                    AS2 (subi,r28,lo8(3))   CR_TAB
++                    AS2 (sbci,r29,lo8(3))   CR_TAB
++	            AS2 (subi,r28,lo8(%o0))  CR_TAB
++	            AS2 (sbci,r29,hi8(%o0)));
++          } else {
++            *l = 8;
++            return (AS2 (subi,r28,lo8(-%o0)) CR_TAB
++                    AS2 (sbci,r29,hi8(-%o0)) CR_TAB
++		    AS2 (st,Y,%A1)           CR_TAB
++		    AS2 (std,Y+1,%B1)        CR_TAB
++		    AS2 (std,Y+2,%C1)        CR_TAB
++		    AS2 (std,Y+3,%D1)        CR_TAB
++		    AS2 (subi,r28,lo8(%o0))  CR_TAB
++		    AS2 (sbci,r29,hi8(%o0)));
++          }
+ 	}
+       if (reg_base == REG_X)
+ 	{
+ 	  /* (X + d) = R */
+ 	  if (reg_src == REG_X)
+-	    {
+-	      *l = 9;
+-	      return AVR_TINY ? (AS2 (mov,__tmp_reg__,r26)  CR_TAB
+-		            AS2 (mov,__zero_reg__,r27) CR_TAB
+-	                AS2 (subi,r26,lo8(-(%o0))) CR_TAB
+-			        AS2 (sbci,r27,hi8(-(%o0))) CR_TAB
+-		            AS2 (st,X+,__tmp_reg__)    CR_TAB
+-		            AS2 (st,X+,__zero_reg__)   CR_TAB
+-		            AS2 (st,X+,r28)            CR_TAB
+-		            AS2 (st,X,r29)             CR_TAB
+-		            AS1 (clr,__zero_reg__)     CR_TAB
+-					AS2 (subi,r26,lo8(%o0+3))  CR_TAB
+-		            AS2 (sbci,r27,hi8(%o0+3)))
+-			         : (AS2 (mov,__tmp_reg__,r26)  CR_TAB
++	  {
++            if (AVR_TINY) {
++              *l = 11;
++              return (AS2 (mov,__tmp_reg__,r26)  CR_TAB
++		      AS2 (mov,__zero_reg__,r27) CR_TAB
++	              AS2 (subi,r26,lo8(-(%o0))) CR_TAB
++		      AS2 (sbci,r27,hi8(-(%o0))) CR_TAB
++		      AS2 (st,X+,__tmp_reg__)    CR_TAB
++		      AS2 (st,X+,__zero_reg__)   CR_TAB
++		      AS2 (st,X+,r28)            CR_TAB
++		      AS2 (st,X,r29)             CR_TAB
++		      AS1 (clr,__zero_reg__)     CR_TAB
++	              AS2 (subi,r26,lo8(%o0+3))  CR_TAB
++		      AS2 (sbci,r27,hi8(%o0+3)));
++            } else {
++              *l = 9;
++              return (AS2 (mov,__tmp_reg__,r26)  CR_TAB
+ 		      AS2 (mov,__zero_reg__,r27) CR_TAB
+ 		      AS2 (adiw,r26,%o0)         CR_TAB
+ 		      AS2 (st,X+,__tmp_reg__)    CR_TAB
+@@ -3088,22 +3364,26 @@ out_movsi_mr_r (rtx insn, rtx op[], int 
+ 		      AS2 (st,X,r29)             CR_TAB
+ 		      AS1 (clr,__zero_reg__)     CR_TAB
+ 		      AS2 (sbiw,r26,%o0+3));
+-	    }
++            }
++	  }
+ 	  else if (reg_src == REG_X - 2)
+-	    {
+-	      *l = 9;
+-	      return AVR_TINY ? (AS2 (mov,__tmp_reg__,r26)  CR_TAB
+-		            AS2 (mov,__zero_reg__,r27) CR_TAB
+-	                AS2 (subi,r26,lo8(-(%o0))) CR_TAB
+-			        AS2 (sbci,r27,hi8(-(%o0))) CR_TAB
+-		            AS2 (st,X+,r24)            CR_TAB
+-		            AS2 (st,X+,r25)            CR_TAB
+-		            AS2 (st,X+,__tmp_reg__)    CR_TAB
+-		            AS2 (st,X,__zero_reg__)    CR_TAB
+-		            AS1 (clr,__zero_reg__)     CR_TAB
+-					AS2 (subi,r26,lo8(%o0+3)) CR_TAB
+-		            AS2 (sbci,r27,hi8(%o0+3)))
+-			         : (AS2 (mov,__tmp_reg__,r26)  CR_TAB
++	  {
++            if (AVR_TINY) {
++	      *l = 11;
++	      return (AS2 (mov,__tmp_reg__,r26)  CR_TAB
++		      AS2 (mov,__zero_reg__,r27) CR_TAB
++	              AS2 (subi,r26,lo8(-(%o0))) CR_TAB
++		      AS2 (sbci,r27,hi8(-(%o0))) CR_TAB
++		      AS2 (st,X+,r24)            CR_TAB
++		      AS2 (st,X+,r25)            CR_TAB
++		      AS2 (st,X+,__tmp_reg__)    CR_TAB
++		      AS2 (st,X,__zero_reg__)    CR_TAB
++		      AS1 (clr,__zero_reg__)     CR_TAB
++		      AS2 (subi,r26,lo8(%o0+3)) CR_TAB
++		      AS2 (sbci,r27,hi8(%o0+3)));
++            } else {
++              *l = 9;
++              return (AS2 (mov,__tmp_reg__,r26)  CR_TAB
+ 		      AS2 (mov,__zero_reg__,r27) CR_TAB
+ 		      AS2 (adiw,r26,%o0)         CR_TAB
+ 		      AS2 (st,X+,r24)            CR_TAB
+@@ -3112,51 +3392,71 @@ out_movsi_mr_r (rtx insn, rtx op[], int 
+ 		      AS2 (st,X,__zero_reg__)    CR_TAB
+ 		      AS1 (clr,__zero_reg__)     CR_TAB
+ 		      AS2 (sbiw,r26,%o0+3));
+-	    }
+-	  *l = 6;
+-	  return AVR_TINY ? (AS2 (subi,r26,lo8(-(%o0))) CR_TAB
+-			    AS2 (sbci,r27,hi8(-(%o0))) CR_TAB
+-		        AS2 (st,X+,%A1)    CR_TAB
+-		        AS2 (st,X+,%B1)    CR_TAB
+-		        AS2 (st,X+,%C1)    CR_TAB
+-		        AS2 (st,X,%D1)     CR_TAB
+-				AS2 (subi,r26,lo8(%o0+3)) CR_TAB
+-		        AS2 (sbci,r27,hi8(%o0+3)))
+-		         : (AS2 (adiw,r26,%o0) CR_TAB
+-		  AS2 (st,X+,%A1)    CR_TAB
+-		  AS2 (st,X+,%B1)    CR_TAB
+-		  AS2 (st,X+,%C1)    CR_TAB
+-		  AS2 (st,X,%D1)     CR_TAB
+-		  AS2 (sbiw,r26,%o0+3));
+-	}
+-		op[2] = XEXP(base, 0);
+-		if(REGNO(op[2]) == REG_Y)
+-      return *l=4, AVR_TINY ? (AS2 (subi,%A2,lo8(-(%o0)))    CR_TAB
+-					  AS2 (sbci,%B2,hi8(-(%o0)))    CR_TAB
+-		              AS2 (st,Y+,%A1)               CR_TAB
+-		              AS2 (st,Y+,%B1)               CR_TAB
+-		              AS2 (st,Y+,%C1)               CR_TAB
+-		              AS2 (st,Y,%D1)                CR_TAB
+-					  AS2 (subi,%A2,lo8(%o0+3))     CR_TAB
+-					  AS2 (sbci,%B2,hi8(%o0+3)))
+-		               : (AS2 (std,%A0,%A1)    CR_TAB
+-		              AS2 (std,%B0,%B1)    CR_TAB
+-		              AS2 (std,%C0,%C1)    CR_TAB
+-		              AS2 (std,%D0,%D1));
+-
+-		if(REGNO(op[2]) == REG_Z)
+-      return *l=4, AVR_TINY ? (AS2 (subi,%A2,lo8(-(%o0)))    CR_TAB
+-					  AS2 (sbci,%B2,hi8(-(%o0)))    CR_TAB
+-		              AS2 (st,Z+,%A1)              CR_TAB
+-		              AS2 (st,Z+,%B1)             CR_TAB
+-		              AS2 (st,Z+,%C1)             CR_TAB
+-		              AS2 (st,Z,%D1)              CR_TAB
+-					  AS2 (subi,%A2,lo8(%o0+3))    CR_TAB
+-					  AS2 (sbci,%B2,hi8(%o0+3)))
+-		               : (AS2 (std,%A0,%A1)    CR_TAB
+-		    AS2 (std,%B0,%B1) CR_TAB
+-		    AS2 (std,%C0,%C1) CR_TAB
+-		    AS2 (std,%D0,%D1));
++            }
++	  }
++
++          if (AVR_TINY) {
++            *l = 8;
++            return (AS2 (subi,r26,lo8(-(%o0))) CR_TAB
++		    AS2 (sbci,r27,hi8(-(%o0))) CR_TAB
++		    AS2 (st,X+,%A1)    CR_TAB
++		    AS2 (st,X+,%B1)    CR_TAB
++		    AS2 (st,X+,%C1)    CR_TAB
++		    AS2 (st,X,%D1)     CR_TAB
++		    AS2 (subi,r26,lo8(%o0+3)) CR_TAB
++		    AS2 (sbci,r27,hi8(%o0+3)));
++          } else {
++            *l = 6;
++            return (AS2 (adiw,r26,%o0) CR_TAB
++		    AS2 (st,X+,%A1)    CR_TAB
++		    AS2 (st,X+,%B1)    CR_TAB
++		    AS2 (st,X+,%C1)    CR_TAB
++		    AS2 (st,X,%D1)     CR_TAB
++		    AS2 (sbiw,r26,%o0+3));
++          }
++	}
++        op[2] = XEXP(base, 0);
++        if(REGNO(op[2]) == REG_Y)
++        {
++          if (AVR_TINY) {
++            *l = 8;
++            return (AS2 (subi,%A2,lo8(-(%o0)))    CR_TAB
++                    AS2 (sbci,%B2,hi8(-(%o0)))    CR_TAB
++		    AS2 (st,Y+,%A1)               CR_TAB
++		    AS2 (st,Y+,%B1)               CR_TAB
++		    AS2 (st,Y+,%C1)               CR_TAB
++		    AS2 (st,Y,%D1)                CR_TAB
++		    AS2 (subi,%A2,lo8(%o0+3))     CR_TAB
++		    AS2 (sbci,%B2,hi8(%o0+3)));
++	  } else {
++            *l = 4;
++            return (AS2 (std,%A0,%A1)    CR_TAB
++		    AS2 (std,%B0,%B1)    CR_TAB
++		    AS2 (std,%C0,%C1)    CR_TAB
++       		    AS2 (std,%D0,%D1));
++          }
++        }
++
++	if(REGNO(op[2]) == REG_Z)
++        {
++          if (AVR_TINY) {
++            *l = 8;
++            return (AS2 (subi,%A2,lo8(-(%o0))) CR_TAB
++		    AS2 (sbci,%B2,hi8(-(%o0))) CR_TAB
++		    AS2 (st,Z+,%A1)            CR_TAB
++		    AS2 (st,Z+,%B1)            CR_TAB
++		    AS2 (st,Z+,%C1)            CR_TAB
++		    AS2 (st,Z,%D1)             CR_TAB
++		    AS2 (subi,%A2,lo8(%o0+3))  CR_TAB
++		    AS2 (sbci,%B2,hi8(%o0+3)));
++         } else {
++           *l = 4;
++           return (AS2 (std,%A0,%A1) CR_TAB
++		   AS2 (std,%B0,%B1) CR_TAB
++		   AS2 (std,%C0,%C1) CR_TAB
++		   AS2 (std,%D0,%D1));
++         }
++       }
+     }
+   else if (GET_CODE (base) == PRE_DEC) /* (--R) */
+     return *l=4, (AS2 (st,%0,%D1) CR_TAB
+@@ -3370,18 +3670,25 @@ out_movqi_mr_r (rtx insn, rtx op[], int 
+ 	    fatal_insn ("incorrect insn:",insn);
+ 
+ 	  if (disp <= 63 + MAX_LD_OFFSET (GET_MODE (dest)))
+-	    return *l = 3, AVR_TINY ? (AS2 (subi,r28,lo8(-(%o0-63))) CR_TAB
+-				          AS2 (sbci,r29,hi8(-(%o0-63))) CR_TAB
+-						  AS2 (subi,r28,lo8(-63)) CR_TAB
+-						  AS2 (sbci,r29,hi8(-63)) CR_TAB
+-			              AS2 (st,Y,%1)           CR_TAB
+-						  AS2 (subi,r28,lo8(63)) CR_TAB
+-						  AS2 (sbci,r29,hi8(63)) CR_TAB
+-				          AS2 (subi,r28,lo8(%o0-63)) CR_TAB
+-			              AS2 (sbci,r29,hi8(%o0-63)))
+-			               : (AS2 (adiw,r28,%o0-63) CR_TAB
+-			    AS2 (std,Y+63,%1)     CR_TAB
+-			    AS2 (sbiw,r28,%o0-63));
++          {
++	    if (AVR_TINY) {
++              *l = 9;
++              return (AS2 (subi,r28,lo8(-(%o0-63))) CR_TAB
++		      AS2 (sbci,r29,hi8(-(%o0-63))) CR_TAB
++		      AS2 (subi,r28,lo8(-63)) CR_TAB
++		      AS2 (sbci,r29,hi8(-63)) CR_TAB
++		      AS2 (st,Y,%1)           CR_TAB
++		      AS2 (subi,r28,lo8(63)) CR_TAB
++		      AS2 (sbci,r29,hi8(63)) CR_TAB
++		      AS2 (subi,r28,lo8(%o0-63)) CR_TAB
++		      AS2 (sbci,r29,hi8(%o0-63)));
++            } else {
++	      *l = 3;
++              return (AS2 (adiw,r28,%o0-63) CR_TAB
++		      AS2 (std,Y+63,%1)     CR_TAB
++		      AS2 (sbiw,r28,%o0-63));
++            }
++          }
+ 
+ 	  return *l = 5, (AS2 (subi,r28,lo8(-%o0)) CR_TAB
+ 			  AS2 (sbci,r29,hi8(-%o0)) CR_TAB
+@@ -3394,60 +3701,95 @@ out_movqi_mr_r (rtx insn, rtx op[], int 
+ 	  if (reg_overlap_mentioned_p (src, XEXP (x, 0)))
+ 	    {
+ 	      if (reg_unused_after (insn, XEXP (x,0)))
+-		return *l = 3, AVR_TINY ? (AS2 (mov,__tmp_reg__,%1) CR_TAB
+-			              AS2 (subi,r26,lo8(-(%o0)))       CR_TAB
+-			              AS2 (sbci,r27,hi8(-(%o0)))       CR_TAB
+-				          AS2 (st,X,__tmp_reg__))
+-			               : (AS2 (mov,__tmp_reg__,%1) CR_TAB
+-				AS2 (adiw,r26,%o0)       CR_TAB
+-				AS2 (st,X,__tmp_reg__));
+-
+-	      return *l = 4, AVR_TINY ? (AS2 (mov,__tmp_reg__,%1) CR_TAB
+-			                AS2 (subi,r26,lo8(-(%o0)))       CR_TAB
+-			                AS2 (sbci,r27,hi8(-(%o0)))       CR_TAB
+-			                AS2 (st,X,__tmp_reg__)   CR_TAB
+-			                AS2 (subi,r26,lo8(%o0))       CR_TAB
+-			                AS2 (sbci,r27,hi8(%o0)))
+-				             : (AS2 (mov,__tmp_reg__,%1) CR_TAB
+-			      AS2 (adiw,r26,%o0)       CR_TAB
+-			      AS2 (st,X,__tmp_reg__)   CR_TAB
+-			      AS2 (sbiw,r26,%o0));
++              {
++                if (AVR_TINY) {
++                  *l = 4;
++                  return (AS2 (mov,__tmp_reg__,%1) CR_TAB
++			  AS2 (subi,r26,lo8(-(%o0)))       CR_TAB
++			  AS2 (sbci,r27,hi8(-(%o0)))       CR_TAB
++			  AS2 (st,X,__tmp_reg__));
++                } else {
++                  *l = 3;
++                  return (AS2 (mov,__tmp_reg__,%1) CR_TAB
++                          AS2 (adiw,r26,%o0)       CR_TAB
++                       	  AS2 (st,X,__tmp_reg__));
++                }
++              }
++
++	      if (AVR_TINY) {
++                *l = 6;
++                 return (AS2 (mov,__tmp_reg__,%1)   CR_TAB
++			 AS2 (subi,r26,lo8(-(%o0))) CR_TAB
++			 AS2 (sbci,r27,hi8(-(%o0))) CR_TAB
++			 AS2 (st,X,__tmp_reg__)     CR_TAB
++			 AS2 (subi,r26,lo8(%o0))    CR_TAB
++			 AS2 (sbci,r27,hi8(%o0)));
++              } else {
++                *l = 4;
++                return (AS2 (mov,__tmp_reg__,%1) CR_TAB
++                        AS2 (adiw,r26,%o0)       CR_TAB
++                        AS2 (st,X,__tmp_reg__)   CR_TAB
++                        AS2 (sbiw,r26,%o0));
++              }
+ 	    }
+ 	  else
+-	    {
+-	      if (reg_unused_after (insn, XEXP (x,0)))
+-		return *l = 2, AVR_TINY ? (AS2 (subi,r26,lo8(-(%o0)))       CR_TAB
+-			              AS2 (sbci,r27,hi8(-(%o0)))       CR_TAB
+-				          AS2 (st,X,%1))
+-			               : (AS2 (adiw,r26,%o0) CR_TAB
+-				AS2 (st,X,%1));
+-
+-	      return *l = 3, AVR_TINY ? (AS2 (subi,r26,lo8(-(%o0)))       CR_TAB
+-			                AS2 (sbci,r27,hi8(-(%o0)))       CR_TAB
+-			                AS2 (st,X,%1)                    CR_TAB
+-			                AS2 (subi,r26,lo8(%o0))          CR_TAB
+-			                AS2 (sbci,r27,hi8(%o0)))
+-							 : (AS2 (adiw,r26,%o0) CR_TAB
+-			      AS2 (st,X,%1)      CR_TAB
+-			      AS2 (sbiw,r26,%o0));
+-	    }
++	  {
++	    if (reg_unused_after (insn, XEXP (x,0))) {
++              if (AVR_TINY) {
++                 *l = 3;
++                 return (AS2 (subi,r26,lo8(-(%o0))) CR_TAB
++                         AS2 (sbci,r27,hi8(-(%o0))) CR_TAB
++		         AS2 (st,X,%1));
++              } else {
++                *l = 2;
++                return (AS2 (adiw,r26,%o0) CR_TAB
++		        AS2 (st,X,%1));
++              }
++            }
++
++            if (AVR_TINY) {
++              *l = 5;
++              return (AS2 (subi,r26,lo8(-(%o0)))       CR_TAB
++                      AS2 (sbci,r27,hi8(-(%o0)))       CR_TAB
++                      AS2 (st,X,%1)                    CR_TAB
++                      AS2 (subi,r26,lo8(%o0))          CR_TAB
++                      AS2 (sbci,r27,hi8(%o0)));
++            } else {
++              *l = 3;
++              return (AS2 (adiw,r26,%o0) CR_TAB
++                      AS2 (st,X,%1)      CR_TAB
++                      AS2 (sbiw,r26,%o0));
++            }
++	  }
+ 	}
+-      *l = 1;
+-	  op[2] = XEXP(x, 0);
+-	  if(REGNO(op[2]) == REG_Y)
+-      return AVR_TINY ? (AS2 (subi,%A2,lo8(-(%o0))) CR_TAB
+-				AS2 (sbci,%B2,hi8(-(%o0))) CR_TAB
+-		        AS2 (st,Y,%1)              CR_TAB
+-                AS2 (subi,%A2,lo8(%o0)) CR_TAB
+-				AS2 (sbci,%B2,hi8(%o0)))
+-		         :  AS2 (std,%0,%1);
+-	  if(REGNO(op[2]) == REG_Z)
+-      return AVR_TINY ? (AS2 (subi,%A2,lo8(-(%o0))) CR_TAB
+-				AS2 (sbci,%B2,hi8(-(%o0))) CR_TAB
+-		        AS2 (st,Z,%1)              CR_TAB
+-                AS2 (subi,%A2,lo8(%o0)) CR_TAB
+-				AS2 (sbci,%B2,hi8(%o0)))
+-		         :  AS2 (std,%0,%1);
++
++        op[2] = XEXP(x, 0);
++        if(REGNO(op[2]) == REG_Y) {
++          if (AVR_TINY) {
++            *l = 5;
++            return (AS2 (subi,%A2,lo8(-(%o0))) CR_TAB
++		    AS2 (sbci,%B2,hi8(-(%o0))) CR_TAB
++		    AS2 (st,Y,%1)              CR_TAB
++                    AS2 (subi,%A2,lo8(%o0)) CR_TAB
++		    AS2 (sbci,%B2,hi8(%o0)));
++          } else {
++            *l = 1;
++            return (AS2 (std,%0,%1));
++          }
++        }
++        if(REGNO(op[2]) == REG_Z) {
++          if (AVR_TINY) {
++            *l = 5;
++            return (AS2 (subi,%A2,lo8(-(%o0))) CR_TAB
++    	            AS2 (sbci,%B2,hi8(-(%o0))) CR_TAB
++                    AS2 (st,Z,%1)              CR_TAB
++                    AS2 (subi,%A2,lo8(%o0)) CR_TAB
++                    AS2 (sbci,%B2,hi8(%o0)));
++          } else {
++	    *l = 1;
++            return (AS2 (std,%0,%1));
++          }
++        }
+     }
+   *l = 1;
+   return AS2 (st,%0,%1);
+@@ -3493,109 +3835,162 @@ out_movhi_mr_r (rtx insn, rtx op[], int 
+       if (reg_base == REG_X)
+         {
+           if (reg_src == REG_X)
+-            {
+-              /* "st X+,r26" and "st -X,r26" are undefined.  */
+-              if (!mem_volatile_p && reg_unused_after (insn, src))
+-		return *l=4, AVR_TINY ? (AS2 (mov,__tmp_reg__,r27)  CR_TAB
+-			            AS2 (st,X,r26)             CR_TAB
+-			            AS2 (subi,r26,lo8(-1))     CR_TAB
+-			            AS2 (sbci,r27,hi8(-1))     CR_TAB
+-			            AS2 (st,X,__tmp_reg__))
+-			             : (AS2 (mov,__tmp_reg__,r27)  CR_TAB
+-			      AS2 (st,X,r26)            CR_TAB
+-			      AS2 (adiw,r26,1)          CR_TAB
+-			      AS2 (st,X,__tmp_reg__));
+-              else
+-	        {
+-                  if (!AVR_XMEGA)
+-		    return *l=5, AVR_TINY ? (AS2 (mov,__tmp_reg__,r27) CR_TAB
+-							AS2 (subi,r26,lo8(-1))    CR_TAB
+-							AS2 (sbci,r27,hi8(-1))    CR_TAB
+-							AS2 (st,X,__tmp_reg__)    CR_TAB
+-							AS2 (subi,r26,lo8(1))     CR_TAB
+-							AS2 (sbci,r27,hi8(1))     CR_TAB
+-							AS2 (st,X,r26))
+-							 : (AS2 (mov,__tmp_reg__,r27) CR_TAB
+-			      AS2 (adiw,r26,1)          CR_TAB
+-			      AS2 (st,X,__tmp_reg__)    CR_TAB
+-                              AS2 (sbiw,r26,1)          CR_TAB
+-                              AS2 (st,X,r26));
+-		  else
+- 		    return *l=5, AVR_TINY ? (AS2 (mov,__tmp_reg__,r27) CR_TAB
+-			                AS2 (st,X,r26)            CR_TAB
+-						    AS2 (subi,r26,lo8(-1))    CR_TAB
+-						    AS2 (sbci,r27,hi8(-1))    CR_TAB
+- 			                AS2 (st,X,__tmp_reg__)    CR_TAB
+-						    AS2 (subi,r26,lo8(1))     CR_TAB
+-						    AS2 (sbci,r27,hi8(1)))
+-				             : (AS2 (mov,__tmp_reg__,r27) CR_TAB
+-			          AS2 (st,X,r26)            CR_TAB
+- 			          AS2 (adiw,r26,1)          CR_TAB
+- 			          AS2 (st,X,__tmp_reg__)    CR_TAB
+-			          AS2 (sbiw,r26,1));
+-		}
++          {
++            /* "st X+,r26" and "st -X,r26" are undefined.  */
++            if (!mem_volatile_p && reg_unused_after (insn, src)) {
++              if (AVR_TINY) {
++                *l = 5;
++                return  (AS2 (mov,__tmp_reg__,r27)  CR_TAB
++                         AS2 (st,X,r26)             CR_TAB
++                         AS2 (subi,r26,lo8(-1))     CR_TAB
++                         AS2 (sbci,r27,hi8(-1))     CR_TAB
++                         AS2 (st,X,__tmp_reg__));
++              } else {
++                *l = 4;
++                return (AS2 (mov,__tmp_reg__,r27)  CR_TAB
++                        AS2 (st,X,r26)            CR_TAB
++                        AS2 (adiw,r26,1)          CR_TAB
++                        AS2 (st,X,__tmp_reg__));
++              }
++            }
++            else
++	    {
++              if (!AVR_XMEGA) {
++                if (AVR_TINY) {
++                  *l = 7;
++                  return (AS2 (mov,__tmp_reg__,r27) CR_TAB
++                          AS2 (subi,r26,lo8(-1))    CR_TAB
++                          AS2 (sbci,r27,hi8(-1))    CR_TAB
++                          AS2 (st,X,__tmp_reg__)    CR_TAB
++                          AS2 (subi,r26,lo8(1))     CR_TAB
++                          AS2 (sbci,r27,hi8(1))     CR_TAB
++                          AS2 (st,X,r26));
++                } else {
++                  *l = 5;
++                  return (AS2 (mov,__tmp_reg__,r27) CR_TAB
++                          AS2 (adiw,r26,1)          CR_TAB
++                          AS2 (st,X,__tmp_reg__)    CR_TAB
++                          AS2 (sbiw,r26,1)          CR_TAB
++                          AS2 (st,X,r26));
++                }
++              }
++              else {
++                if (AVR_TINY) {
++                  *l = 7;
++                  return (AS2 (mov,__tmp_reg__,r27) CR_TAB
++			  AS2 (st,X,r26)            CR_TAB
++			  AS2 (subi,r26,lo8(-1))    CR_TAB
++			  AS2 (sbci,r27,hi8(-1))    CR_TAB
++ 			  AS2 (st,X,__tmp_reg__)    CR_TAB
++			  AS2 (subi,r26,lo8(1))     CR_TAB
++			  AS2 (sbci,r27,hi8(1)));
++                } else {
++                  *l = 5;
++                  return (AS2 (mov,__tmp_reg__,r27) CR_TAB
++			  AS2 (st,X,r26)            CR_TAB
++ 			  AS2 (adiw,r26,1)          CR_TAB
++ 			  AS2 (st,X,__tmp_reg__)    CR_TAB
++			  AS2 (sbiw,r26,1));
++                }
++              }
+             }
++          }
+           else
+             {
+               if (!mem_volatile_p && reg_unused_after (insn, base))
+                 return *l=2, (AS2 (st,X+,%A1) CR_TAB
+                               AS2 (st,X,%B1));
+               else
+-		{
+-                  if (!AVR_XMEGA)
+-                    return *l=3, AVR_TINY ? (AS2 (subi,r26,lo8(-1)) CR_TAB
+-							        AS2 (sbci,r27,hi8(-1)) CR_TAB
+-                                    AS2 (st,X,%B1)         CR_TAB
+-                                    AS2 (st,-X,%A1))
+-						             : (AS2 (adiw,r26,1) CR_TAB
+-                              AS2 (st,X,%B1)   CR_TAB
+-                              AS2 (st,-X,%A1));
+-	          else
+-                    return *l=3, AVR_TINY ? (AS2 (st,X+,%A1) CR_TAB
+-                                    AS2 (st,X,%B1) CR_TAB
+-						            AS2 (subi,r26,lo8(1))     CR_TAB
+-						            AS2 (sbci,r27,hi8(1)))
+-						             : (AS2 (st,X+,%A1) CR_TAB
+-                                  AS2 (st,X,%B1) CR_TAB
+-                                  AS2 (sbiw,r26,1));
+-		}
++	      {
++                if (!AVR_XMEGA) {
++                  if (AVR_TINY) {
++                    *l = 4;
++                     return (AS2 (subi,r26,lo8(-1)) CR_TAB
++                             AS2 (sbci,r27,hi8(-1)) CR_TAB
++                             AS2 (st,X,%B1)         CR_TAB
++                             AS2 (st,-X,%A1));
++                  } else {
++                    *l = 3;
++                    return (AS2 (adiw,r26,1) CR_TAB
++                            AS2 (st,X,%B1)   CR_TAB
++                            AS2 (st,-X,%A1));
++                  }
++                } else {
++                  if (AVR_TINY) {
++                    *l = 4;
++                    return (AS2 (st,X+,%A1) CR_TAB
++                            AS2 (st,X,%B1) CR_TAB
++       	                    AS2 (subi,r26,lo8(1)) CR_TAB
++                            AS2 (sbci,r27,hi8(1)));
++                  } else {
++                    *l = 3;
++                    return (AS2 (st,X+,%A1) CR_TAB
++                            AS2 (st,X,%B1) CR_TAB
++                            AS2 (sbiw,r26,1));
++                  }
++                }
++	      }
+             }
+         }
+       else
+         {
+ 	  if (!AVR_XMEGA)
+ 	  {
+-		    if(reg_base == REG_Y)
+-            return  *l=2, AVR_TINY ? (AS2 (subi,r28,lo8(-1))  CR_TAB
+-			                 AS2 (sbci,r29,hi8(-1))  CR_TAB
+-                             AS2 (st,Y,%B1)         CR_TAB
+-                             AS2 (st,-Y,%A1))
+-				              : (AS2 (std,%0+1,%B1)      CR_TAB
+-                             AS2 (st,%0,%A1));
+-		    if(reg_base == REG_Z)
+-            return  *l=2, AVR_TINY ? (AS2 (subi,r30,lo8(-1))  CR_TAB
+-			                 AS2 (sbci,r31,hi8(-1))  CR_TAB
+-                             AS2 (st,Z,%B1)         CR_TAB
+-                             AS2 (st,-Z,%A1))
+-				              : (AS2 (std,%0+1,%B1)      CR_TAB
+-                       AS2 (st,%0,%A1));
++            if(reg_base == REG_Y) {
++              if (AVR_TINY) {
++                *l = 4;
++                return (AS2 (subi,r28,lo8(-1)) CR_TAB
++		        AS2 (sbci,r29,hi8(-1)) CR_TAB
++                        AS2 (st,Y,%B1)         CR_TAB
++                        AS2 (st,-Y,%A1));
++              } else {
++		*l = 2;
++                return (AS2 (std,%0+1,%B1)     CR_TAB
++                        AS2 (st,%0,%A1));
++              }
++            }
++	    if(reg_base == REG_Z) {
++              if (AVR_TINY) {
++                *l = 4;
++                return (AS2 (subi,r30,lo8(-1)) CR_TAB
++		        AS2 (sbci,r31,hi8(-1)) CR_TAB
++                        AS2 (st,Z,%B1)         CR_TAB
++                        AS2 (st,-Z,%A1));
++              } else {
++                *l = 2;
++                return (AS2 (std,%0+1,%B1)     CR_TAB
++                        AS2 (st,%0,%A1));
++              }
++            }
+ 	  }
+ 	  else
+ 	  {
+-		    if(reg_base == REG_Y)
+-            return  *l=2, AVR_TINY ? (AS2 (st,Y+,%A1)        CR_TAB
+-                             AS2 (st,Y,%B1)        CR_TAB
+-					         AS2 (subi,r28,lo8(1))  CR_TAB
+-			                 AS2 (sbci,r29,hi8(1)))
+-					          : (AS2 (st,%0,%A1)    CR_TAB
+-                             AS2 (std,%0+1,%B1));
+-		    if(reg_base == REG_Z)
+-            return  *l=2, AVR_TINY ? (AS2 (st,Z+,%A1)         CR_TAB
+-                             AS2 (st,Z,%B1)         CR_TAB
+-					         AS2 (subi,r30,lo8(1))  CR_TAB
+-			                 AS2 (sbci,r31,hi8(1)))
+-					          : (AS2 (st,%0,%A1)    CR_TAB
+-                           AS2 (std,%0+1,%B1));
++	    if(reg_base == REG_Y) {
++              if (AVR_TINY) {
++                *l = 4;
++                return (AS2 (st,Y+,%A1)       CR_TAB
++                        AS2 (st,Y,%B1)        CR_TAB
++		        AS2 (subi,r28,lo8(1)) CR_TAB
++		        AS2 (sbci,r29,hi8(1)));
++              } else {
++		*l = 2;
++                return (AS2 (st,%0,%A1)    CR_TAB
++                        AS2 (std,%0+1,%B1));
++              }
++            }
++	    if(reg_base == REG_Z) {
++              if (AVR_TINY) {
++                *l = 4;
++                return (AS2 (st,Z+,%A1)        CR_TAB
++                        AS2 (st,Z,%B1)         CR_TAB
++		        AS2 (subi,r30,lo8(1))  CR_TAB
++		        AS2 (sbci,r31,hi8(1)));
++              } else {
++                *l = 2;
++                return (AS2 (st,%0,%A1)    CR_TAB
++                        AS2 (std,%0+1,%B1));
++              }
++            }
+         }
+     }
+     }
+@@ -3610,69 +4005,91 @@ out_movhi_mr_r (rtx insn, rtx op[], int 
+ 
+           if (!AVR_XMEGA)
+             {
+-	  if (disp <= 63 + MAX_LD_OFFSET (GET_MODE (dest)))
+-	        return *l = 4, AVR_TINY ? (AS2 (subi,r28,lo8(-(%o0-62))) CR_TAB
+-					          AS2 (sbci,r29,hi8(-(%o0-62))) CR_TAB
+-							  AS2 (subi,r28,lo8(-63))       CR_TAB
+-							  AS2 (sbci,r29,hi8(-63))       CR_TAB
+-			                  AS2 (st,Y,%B1)				 CR_TAB
+-			                  AS2 (st,-Y,%A1)				 CR_TAB
+-							  AS2 (subi,r28,lo8(62))       CR_TAB
+-							  AS2 (sbci,r29,hi8(62))       CR_TAB
+-			                  AS2 (subi,r28,lo8(%o0-62))    CR_TAB
+-			                  AS2 (sbci,r29,hi8(%o0-62)))
+-				               : (AS2 (adiw,r28,%o0-62) CR_TAB
+-			    AS2 (std,Y+63,%B1)    CR_TAB
+-			    AS2 (std,Y+62,%A1)    CR_TAB
+-			    AS2 (sbiw,r28,%o0-62));
+-
+-	      return *l = 6, AVR_TINY ? (AS2 (subi,r28,lo8(-%o0)) CR_TAB
+-			                AS2 (sbci,r29,hi8(-%o0)) CR_TAB
+-							AS2 (subi,r28,lo8(-1))   CR_TAB
+-							AS2 (sbci,r29,hi8(-1))   CR_TAB
+-			                AS2 (st,Y,%B1)           CR_TAB
+-			                AS2 (st,-Y,%A1)           CR_TAB
+-			                AS2 (subi,r28,lo8(%o0))  CR_TAB
+-			                AS2 (sbci,r29,hi8(%o0)))
+-				             : (AS2 (subi,r28,lo8(-%o0)) CR_TAB
+-			  AS2 (sbci,r29,hi8(-%o0)) CR_TAB
+-			  AS2 (std,Y+1,%B1)        CR_TAB
+-			  AS2 (st,Y,%A1)           CR_TAB
+-			  AS2 (subi,r28,lo8(%o0))  CR_TAB
+-			  AS2 (sbci,r29,hi8(%o0)));
++	  if (disp <= 63 + MAX_LD_OFFSET (GET_MODE (dest))) {
++	    if (AVR_TINY) {
++              *l = 10;
++              return (AS2 (subi,r28,lo8(-(%o0-62))) CR_TAB
++		      AS2 (sbci,r29,hi8(-(%o0-62))) CR_TAB
++		      AS2 (subi,r28,lo8(-63))       CR_TAB
++		      AS2 (sbci,r29,hi8(-63))       CR_TAB
++		      AS2 (st,Y,%B1)		    CR_TAB
++		      AS2 (st,-Y,%A1)		    CR_TAB
++		      AS2 (subi,r28,lo8(62))        CR_TAB
++		      AS2 (sbci,r29,hi8(62))        CR_TAB
++		      AS2 (subi,r28,lo8(%o0-62))    CR_TAB
++		      AS2 (sbci,r29,hi8(%o0-62)));
++            } else {
++              *l = 4;
++              return (AS2 (adiw,r28,%o0-62) CR_TAB
++		      AS2 (std,Y+63,%B1)    CR_TAB
++		      AS2 (std,Y+62,%A1)    CR_TAB
++		      AS2 (sbiw,r28,%o0-62));
++            }
++          }
++
++	      if (AVR_TINY) {
++                *l = 8;
++                return (AS2 (subi,r28,lo8(-%o0)) CR_TAB
++	                AS2 (sbci,r29,hi8(-%o0)) CR_TAB
++			AS2 (subi,r28,lo8(-1))   CR_TAB
++			AS2 (sbci,r29,hi8(-1))   CR_TAB
++	                AS2 (st,Y,%B1)           CR_TAB
++	                AS2 (st,-Y,%A1)          CR_TAB
++	                AS2 (subi,r28,lo8(%o0))  CR_TAB
++	                AS2 (sbci,r29,hi8(%o0)));
++              } else {
++		*l = 6;
++                return (AS2 (subi,r28,lo8(-%o0)) CR_TAB
++		        AS2 (sbci,r29,hi8(-%o0)) CR_TAB
++		        AS2 (std,Y+1,%B1)        CR_TAB
++		        AS2 (st,Y,%A1)           CR_TAB
++		        AS2 (subi,r28,lo8(%o0))  CR_TAB
++		        AS2 (sbci,r29,hi8(%o0)));
++              }
+ 	}
+ 	  else
+ 	    {
+- 	      if (disp <= 63 + MAX_LD_OFFSET (GET_MODE (dest)))
+-	        return *l = 4, AVR_TINY ? (AS2 (subi,r28,lo8(-(%o0-62))) CR_TAB
+-					          AS2 (sbci,r29,hi8(-(%o0-62))) CR_TAB
+-							  AS2 (subi,r28,lo8(-62))       CR_TAB
+-							  AS2 (sbci,r29,hi8(-62))       CR_TAB
+-			                  AS2 (st,Y+,%A1)				 CR_TAB
+-			                  AS2 (st,Y,%B1)				 CR_TAB
+-							  AS2 (subi,r28,lo8(63))       CR_TAB
+-							  AS2 (sbci,r29,hi8(63))       CR_TAB
+-			                  AS2 (subi,r28,lo8(%o0-62))    CR_TAB
+-			                  AS2 (sbci,r29,hi8(%o0-62)))
+-				               : (AS2 (adiw,r28,%o0-62) CR_TAB
+-			        AS2 (std,Y+62,%A1)    CR_TAB
+- 			        AS2 (std,Y+63,%B1)    CR_TAB
+- 			        AS2 (sbiw,r28,%o0-62));
++ 	      if (disp <= 63 + MAX_LD_OFFSET (GET_MODE (dest))) {
++	        if (AVR_TINY) {
++                  *l = 10; 
++                  return (AS2 (subi,r28,lo8(-(%o0-62))) CR_TAB
++                          AS2 (sbci,r29,hi8(-(%o0-62))) CR_TAB
++                      	  AS2 (subi,r28,lo8(-62))       CR_TAB
++                      	  AS2 (sbci,r29,hi8(-62))       CR_TAB
++                          AS2 (st,Y+,%A1)		CR_TAB
++                          AS2 (st,Y,%B1)		CR_TAB
++                          AS2 (subi,r28,lo8(63))        CR_TAB
++                       	  AS2 (sbci,r29,hi8(63))        CR_TAB
++                          AS2 (subi,r28,lo8(%o0-62))    CR_TAB
++                          AS2 (sbci,r29,hi8(%o0-62)));
++                } else {
++                  *l = 4;
++                  return (AS2 (adiw,r28,%o0-62) CR_TAB
++                          AS2 (std,Y+62,%A1)    CR_TAB
++                          AS2 (std,Y+63,%B1)    CR_TAB
++                          AS2 (sbiw,r28,%o0-62));
++                }
++              }
+  
+-	      return *l = 6, AVR_TINY ? (AS2 (subi,r28,lo8(-%o0)) CR_TAB
+-			                AS2 (sbci,r29,hi8(-%o0)) CR_TAB
+-			                AS2 (st,Y+,%A1)           CR_TAB
+-			                AS2 (st,Y,%B1)           CR_TAB
+-							AS2 (subi,r28,lo8(1))   CR_TAB
+-							AS2 (sbci,r29,hi8(1))   CR_TAB
+-			                AS2 (subi,r28,lo8(%o0))  CR_TAB
+-			                AS2 (sbci,r29,hi8(%o0)))
+-				             : (AS2 (subi,r28,lo8(-%o0)) CR_TAB
+- 			      AS2 (sbci,r29,hi8(-%o0)) CR_TAB
+-			      AS2 (st,Y,%A1)           CR_TAB
+- 			      AS2 (std,Y+1,%B1)        CR_TAB
+- 			      AS2 (subi,r28,lo8(%o0))  CR_TAB
+- 			      AS2 (sbci,r29,hi8(%o0)));
++	      if (AVR_TINY) {
++                *l = 8;
++                return (AS2 (subi,r28,lo8(-%o0)) CR_TAB
++                        AS2 (sbci,r29,hi8(-%o0)) CR_TAB
++                        AS2 (st,Y+,%A1)          CR_TAB
++                        AS2 (st,Y,%B1)           CR_TAB
++                        AS2 (subi,r28,lo8(1))    CR_TAB
++                        AS2 (sbci,r29,hi8(1))    CR_TAB
++                        AS2 (subi,r28,lo8(%o0))  CR_TAB
++                        AS2 (sbci,r29,hi8(%o0)));
++              } else {
++                *l = 6;
++                return (AS2 (subi,r28,lo8(-%o0)) CR_TAB
++                        AS2 (sbci,r29,hi8(-%o0)) CR_TAB
++                        AS2 (st,Y,%A1)           CR_TAB
++                        AS2 (std,Y+1,%B1)        CR_TAB
++                        AS2 (subi,r28,lo8(%o0))  CR_TAB
++                        AS2 (sbci,r29,hi8(%o0)));
++              }
+  	    }
+ 	}
+       if (reg_base == REG_X)
+@@ -3681,121 +4098,164 @@ out_movhi_mr_r (rtx insn, rtx op[], int 
+ 	  if (reg_src == REG_X)
+             {
+ 	      if (!AVR_XMEGA)
+-	        {
+-	      *l = 7;
+-	          return AVR_TINY ? (AS2 (mov,__tmp_reg__,r26)  CR_TAB
+-		                AS2 (mov,__zero_reg__,r27) CR_TAB
+-                        AS2 (subi,r26,lo8(-(%o0+1)))   CR_TAB
+-                        AS2 (sbci,r27,hi8(-(%o0+1)))   CR_TAB
+-		                AS2 (st,X,__zero_reg__)    CR_TAB
+-		                AS2 (st,-X,__tmp_reg__)    CR_TAB
+-		                AS1 (clr,__zero_reg__)     CR_TAB
+-                        AS2 (subi,r26,lo8(%o0))    CR_TAB
+-                        AS2 (sbci,r27,hi8(%o0))) 
+-				         : (AS2 (mov,__tmp_reg__,r26)  CR_TAB
+-		      AS2 (mov,__zero_reg__,r27) CR_TAB
+-                      AS2 (adiw,r26,%o0+1)       CR_TAB
+-		      AS2 (st,X,__zero_reg__)    CR_TAB
+-		      AS2 (st,-X,__tmp_reg__)    CR_TAB
+-		      AS1 (clr,__zero_reg__)     CR_TAB
+-                      AS2 (sbiw,r26,%o0));
+-	    }
++	      {
++	        if (AVR_TINY) {
++                  *l = 9;
++	          return (AS2 (mov,__tmp_reg__,r26)  CR_TAB
++                          AS2 (mov,__zero_reg__,r27) CR_TAB
++                          AS2 (subi,r26,lo8(-(%o0+1))) CR_TAB
++                          AS2 (sbci,r27,hi8(-(%o0+1))) CR_TAB
++                          AS2 (st,X,__zero_reg__)    CR_TAB
<Skipped 570 lines>
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/crossavr-gcc.git/commitdiff/ab7f78a4a6b0448f315db017e24209b62c772e22



More information about the pld-cvs-commit mailing list