[Patch,AVR]: Fix PR53448: ignored aligned(2)

2012-05-23 Thread Georg-Johann Lay
Sometimes, even on AVR there is the need to align data.

However, alignments of 2 are ignored at the moment because of

#define ASM_OUTPUT_ALIGN(STREAM, POWER) \
  do {  \
if ((POWER)  1)\
  fprintf (STREAM, \t.p2align\t%d\n, POWER);  \
  } while (0)

The fix is to use POWER  0 instead.

Maybe someone knows why the restriction to POWER = 2 is
there at all?

Ok to install?

Johann

PR target/53448
* config/avr/avr.h (ASM_OUTPUT_ALIGN): Don't inhibit .p2align 1.
* config/avr/elf.h (ASM_OUTPUT_BEFORE_CASE_LABEL): Use
ASM_OUTPUT_ALIGN.
Index: config/avr/elf.h
===
--- config/avr/elf.h	(revision 187704)
+++ config/avr/elf.h	(working copy)
@@ -35,7 +35,7 @@
 /* Output alignment 2**1 for jump tables.  */
 #undef ASM_OUTPUT_BEFORE_CASE_LABEL
 #define ASM_OUTPUT_BEFORE_CASE_LABEL(FILE, PREFIX, NUM, TABLE) \
-  fprintf (FILE, \t.p2align\t1\n);
+  ASM_OUTPUT_ALIGN (FILE, 1);
 
 /* Be conservative in crtstuff.c.  */
 #undef INIT_SECTION_ASM_OP
Index: config/avr/avr.h
===
--- config/avr/avr.h	(revision 187704)
+++ config/avr/avr.h	(working copy)
@@ -557,10 +557,10 @@ typedef struct avr_args {
 #define ASM_OUTPUT_ADDR_VEC_ELT(STREAM, VALUE)		\
   avr_output_addr_vec_elt(STREAM, VALUE)
 
-#define ASM_OUTPUT_ALIGN(STREAM, POWER)			\
-  do {			\
-  if ((POWER)  1)	\
-  fprintf (STREAM, \t.p2align\t%d\n, POWER);	\
+#define ASM_OUTPUT_ALIGN(STREAM, POWER) \
+  do {  \
+if ((POWER)  0)\
+  fprintf (STREAM, \t.p2align\t%d\n, POWER);  \
   } while (0)
 
 #define CASE_VECTOR_MODE HImode


Re: [Patch,AVR]: Fix PR53448: ignored aligned(2)

2012-05-23 Thread Denis Chertykov
2012/5/23 Georg-Johann Lay a...@gjlay.de:
 Sometimes, even on AVR there is the need to align data.

 However, alignments of 2 are ignored at the moment because of

 #define ASM_OUTPUT_ALIGN(STREAM, POWER)                 \
  do {                                                  \
    if ((POWER)  1)                                    \
      fprintf (STREAM, \t.p2align\t%d\n, POWER);      \
  } while (0)

 The fix is to use POWER  0 instead.

 Maybe someone knows why the restriction to POWER = 2 is
 there at all?

 Ok to install?

 Johann

        PR target/53448
        * config/avr/avr.h (ASM_OUTPUT_ALIGN): Don't inhibit .p2align 1.
        * config/avr/elf.h (ASM_OUTPUT_BEFORE_CASE_LABEL): Use
        ASM_OUTPUT_ALIGN.

Approved.

Denis.