__AVR_HAVE_LPMX__
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@185583
138bc75d-0d04-0410-961f-
82ee72b054a4
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
* gcc.target/avr/torture/addr-space-2.h: New file.
* gcc.target/avr/torture/addr-space-2-g.h: New test.
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