]> gcc.gnu.org Git - gcc.git/commitdiff
progmem.h (pgm_read_char): Define depending on __AVR_HAVE_LPMX__
authorGeorg-Johann Lay <avr@gjlay.de>
Tue, 20 Mar 2012 17:38:29 +0000 (17:38 +0000)
committerGeorg-Johann Lay <gjl@gcc.gnu.org>
Tue, 20 Mar 2012 17:38:29 +0000 (17:38 +0000)
* gcc.target/avr/progmem.h (pgm_read_char): Define depending on
__AVR_HAVE_LPMX__

From-SVN: r185583

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/avr/progmem.h

index dfdee374764268b038b7cddade615bccce9feefa..124ea7234f95c19ae542fbff7e1e0268e37d4ba8 100644 (file)
@@ -1,3 +1,8 @@
+2012-03-20  Georg-Johann Lay  <avr@gjlay.de>
+
+       * gcc.target/avr/progmem.h (pgm_read_char): Define depending on
+       __AVR_HAVE_LPMX__
+
 2012-03-20  Georg-Johann Lay  <avr@gjlay.de>
 
        PR target/49868
index d5e86c9fe3cde89fed992095d7a92d1a027add82..17bb771537474acb713505e14e606a5ecf76668a 100644 (file)
@@ -5,6 +5,7 @@
             static const char __c[] PROGMEM = (s);          \
             &__c[0];}))
 
+#ifdef __AVR_HAVE_LPMX__
 #define pgm_read_char(addr)                                 \
     (__extension__({                                        \
             unsigned int __addr16 = (unsigned int)(addr);   \
             __asm__ ("lpm %0, %a1"                          \
                      : "=r" (__result) : "z" (__addr16));   \
             __result; }))
+#else
+#define pgm_read_char(addr)                                 \
+    (__extension__({                                        \
+            unsigned int __addr16 = (unsigned int)(addr);   \
+            char __result;                                  \
+            __asm__ ("lpm" "\n\t"                           \
+                     "mov %0, r0"                           \
+                     : "=r" (__result) : "z" (__addr16));   \
+            __result; }))
+#endif
This page took 0.073586 seconds and 5 git commands to generate.