[patch] h8300.*: Fix formatting.

Kazu Hirata kazu@hxi.com
Mon Aug 7 07:22:00 GMT 2000


Hi,

Attached is a patch to fix formatting of h8300.*.

The patch also fixes formatting of the resulting assembly code.  Some
opcodes are followed by a space, not a tab.  These changes are only in
h8300.md.

Thanks,

Kazu Hirata

2000-08-07  Kazu Hirata  <kazu@hxi.com>

	* h8300.c: Fix formatting.
	* h8300.h: Likewise.
	* h8300.md: Likewise.
	(movsi_h8300hs): Fix formatting of the resulting assembly code.

============================================================

Index: h8300.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/h8300/h8300.c,v
retrieving revision 1.37
diff -u -r1.37 h8300.c
--- h8300.c	2000/08/06 18:03:58	1.37
+++ h8300.c	2000/08/07 07:26:21
@@ -167,7 +167,7 @@
 	   amount > 0;
 	   amount /= 2)
 	{
-	  for(; size >= amount; size -= amount)
+	  for (; size >= amount; size -= amount)
 	    fprintf (file, "\t%ss\t#%d,sp\n", op, amount);
 	}
     }
@@ -612,7 +612,7 @@
        amount > 0;
        amount /= 2)
     {
-      for(; val >= amount; val -= amount)
+      for (; val >= amount; val -= amount)
 	{
 	  rtx tmp = gen_rtx_PLUS (mode, reg, GEN_INT (sign * amount));
 	  emit_insn (gen_rtx_SET (VOIDmode, reg, tmp));
@@ -1773,16 +1773,16 @@
 /* Symbols of the various shifts which can be used as indices.  */
 
 enum shift_type
-  {
-    SHIFT_ASHIFT, SHIFT_LSHIFTRT, SHIFT_ASHIFTRT
-  };
+{
+  SHIFT_ASHIFT, SHIFT_LSHIFTRT, SHIFT_ASHIFTRT
+};
 
 /* Symbols of the various modes which can be used as indices.  */
 
 enum shift_mode
-  {
-    QIshift, HIshift, SIshift
-  };
+{
+  QIshift, HIshift, SIshift
+};
 
 /* For single bit shift insns, record assembler and what bits of the
    condition code are valid afterwards (represented as various CC_FOO
@@ -2680,7 +2680,8 @@
       if (CONST_OK_FOR_LETTER_P (INTVAL (operands[2]), what))
 	{
 	  /* Ok to have a memory dest.  */
-	  if (GET_CODE (operands[0]) == MEM && !EXTRA_CONSTRAINT (operands[0], 'U'))
+	  if (GET_CODE (operands[0]) == MEM
+	      && !EXTRA_CONSTRAINT (operands[0], 'U'))
 	    {
 	      rtx mem = gen_rtx_MEM (GET_MODE (operands[0]),
 				     copy_to_mode_reg (Pmode,
@@ -2689,7 +2690,8 @@
 	      operands[0] = mem;
 	    }
 
-	  if (GET_CODE (operands[1]) == MEM && !EXTRA_CONSTRAINT (operands[1], 'U'))
+	  if (GET_CODE (operands[1]) == MEM
+	      && !EXTRA_CONSTRAINT (operands[1], 'U'))
 	    {
 	      rtx mem = gen_rtx_MEM (GET_MODE (operands[1]),
 				     copy_to_mode_reg (Pmode,
Index: h8300.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/h8300/h8300.h,v
retrieving revision 1.29
diff -u -r1.29 h8300.h
--- h8300.h	2000/08/04 07:07:55	1.29
+++ h8300.h	2000/08/07 07:26:23
@@ -410,27 +410,27 @@
 #define CONST_OK_FOR_I(VALUE) ((VALUE) == 0)
 #define CONST_OK_FOR_J(VALUE) ((unsigned HOST_WIDE_INT) (VALUE) < 256)
 #define CONST_OK_FOR_K(VALUE) ((VALUE) == 1 || (VALUE) == 2)
-#define CONST_OK_FOR_L(VALUE) \
-  (TARGET_H8300H || TARGET_H8300S \
-   ? (VALUE) == 1 || (VALUE) == 2 || (VALUE) == 4 \
+#define CONST_OK_FOR_L(VALUE)				\
+  (TARGET_H8300H || TARGET_H8300S			\
+   ? (VALUE) == 1 || (VALUE) == 2 || (VALUE) == 4	\
    : (VALUE) == 1 || (VALUE) == 2)
 #define CONST_OK_FOR_M(VALUE) ((VALUE) == 3 || (VALUE) == 4)
-#define CONST_OK_FOR_N(VALUE) \
-  (TARGET_H8300H || TARGET_H8300S \
-   ? (VALUE) == -1 || (VALUE) == -2 || (VALUE) == -4 \
+#define CONST_OK_FOR_N(VALUE)				\
+  (TARGET_H8300H || TARGET_H8300S			\
+   ? (VALUE) == -1 || (VALUE) == -2 || (VALUE) == -4	\
    : (VALUE) == -1 || (VALUE) == -2)
 #define CONST_OK_FOR_O(VALUE) (ok_for_bclr (VALUE))
 #define CONST_OK_FOR_P(VALUE) (small_power_of_two (VALUE))
 
-#define CONST_OK_FOR_LETTER_P(VALUE, C) \
-  ((C) == 'I' ? CONST_OK_FOR_I (VALUE) : \
-   (C) == 'J' ? CONST_OK_FOR_J (VALUE) : \
-   (C) == 'K' ? CONST_OK_FOR_K (VALUE) : \
-   (C) == 'L' ? CONST_OK_FOR_L (VALUE) : \
-   (C) == 'M' ? CONST_OK_FOR_M (VALUE) : \
-   (C) == 'N' ? CONST_OK_FOR_N (VALUE) : \
-   (C) == 'O' ? CONST_OK_FOR_O (VALUE) : \
-   (C) == 'P' ? CONST_OK_FOR_P (VALUE) : \
+#define CONST_OK_FOR_LETTER_P(VALUE, C)		\
+  ((C) == 'I' ? CONST_OK_FOR_I (VALUE) :	\
+   (C) == 'J' ? CONST_OK_FOR_J (VALUE) :	\
+   (C) == 'K' ? CONST_OK_FOR_K (VALUE) :	\
+   (C) == 'L' ? CONST_OK_FOR_L (VALUE) :	\
+   (C) == 'M' ? CONST_OK_FOR_M (VALUE) :	\
+   (C) == 'N' ? CONST_OK_FOR_N (VALUE) :	\
+   (C) == 'O' ? CONST_OK_FOR_O (VALUE) :	\
+   (C) == 'P' ? CONST_OK_FOR_P (VALUE) :	\
    0)
 
 /* Similar, but for floating constants, and defining letters G and H.
@@ -438,7 +438,7 @@
      
   `G' is a floating-point zero.  */
 
-#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C) \
+#define CONST_DOUBLE_OK_FOR_LETTER_P(VALUE, C)	\
   ((C) == 'G' ? (VALUE) == CONST0_RTX (DFmode)	\
    : 0)
 
@@ -629,8 +629,8 @@
    of mode MODE and data type TYPE.
    (TYPE is null for libcalls where that information may not be available.)  */
 
-#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED)	\
- ((CUM).nbytes += ((MODE) != BLKmode			\
+#define FUNCTION_ARG_ADVANCE(CUM, MODE, TYPE, NAMED)			\
+ ((CUM).nbytes += ((MODE) != BLKmode					\
   ? (GET_MODE_SIZE (MODE) + UNITS_PER_WORD - 1) & -UNITS_PER_WORD	\
   : (int_size_in_bytes (TYPE) + UNITS_PER_WORD - 1) & -UNITS_PER_WORD))
 
@@ -734,7 +734,7 @@
     else						\
       {							\
 	fprintf (FILE, "\tmov.l	#0x12345678,er3\n");	\
-	fprintf (FILE, "\tjmp	@0x123456\n");	\
+	fprintf (FILE, "\tjmp	@0x123456\n");		\
       }							\
   } while (0)
 
@@ -783,7 +783,7 @@
 
 /* 1 if X is an rtx for a constant that is a valid address.  */
 
-#define CONSTANT_ADDRESS_P(X)   \
+#define CONSTANT_ADDRESS_P(X)					\
   (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF	\
    || (GET_CODE (X) == CONST_INT				\
        /* We handle signed and unsigned offsets here.  */	\
@@ -1021,18 +1021,18 @@
    switch on CODE.  */
 /* ??? Shifts need to have a *much* higher cost than this.  */
 
-#define RTX_COSTS(RTX,CODE,OUTER_CODE) \
-  case MOD:		\
-  case DIV:		\
-    return 60;		\
-  case MULT:		\
-    return 20;		\
-  case ASHIFT:		\
-  case ASHIFTRT:	\
-  case LSHIFTRT:	\
-  case ROTATE:		\
-  case ROTATERT:	\
-    if (GET_MODE (RTX) == HImode) return 2; \
+#define RTX_COSTS(RTX,CODE,OUTER_CODE)		\
+  case MOD:					\
+  case DIV:					\
+    return 60;					\
+  case MULT:					\
+    return 20;					\
+  case ASHIFT:					\
+  case ASHIFTRT:				\
+  case LSHIFTRT:				\
+  case ROTATE:					\
+  case ROTATERT:				\
+    if (GET_MODE (RTX) == HImode) return 2;	\
     return 8;
 
 /* Tell final.c how to eliminate redundant test instructions.  */
@@ -1336,14 +1336,14 @@
    that says to advance the location counter
    to a multiple of 2**LOG bytes.  */
 
-#define ASM_OUTPUT_ALIGN(FILE,LOG)	\
-  if ((LOG) != 0)			\
+#define ASM_OUTPUT_ALIGN(FILE,LOG)		\
+  if ((LOG) != 0)				\
     fprintf (FILE, "\t.align %d\n", (LOG))
 
 /* This is how to output an assembler line
    that says to advance the location counter by SIZE bytes.  */
 
-#define ASM_OUTPUT_IDENT(FILE, NAME) \
+#define ASM_OUTPUT_IDENT(FILE, NAME)			\
   fprintf(FILE, "%s\t \"%s\"\n", IDENT_ASM_OP, NAME)
 
 #define ASM_OUTPUT_SKIP(FILE, SIZE) \
@@ -1352,16 +1352,16 @@
 /* This says how to output an assembler line
    to define a global common symbol.  */
 
-#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED) \
-( fputs ("\t.comm ", (FILE)),			\
-  assemble_name ((FILE), (NAME)),		\
+#define ASM_OUTPUT_COMMON(FILE, NAME, SIZE, ROUNDED)	\
+( fputs ("\t.comm ", (FILE)),				\
+  assemble_name ((FILE), (NAME)),			\
   fprintf ((FILE), ",%d\n", (SIZE)))
 
 /* This says how to output the assembler to define a global
    uninitialized but not common symbol.
    Try to use asm_output_bss to implement this macro.  */
 
-#define ASM_OUTPUT_BSS(FILE, DECL, NAME, SIZE, ROUNDED) \
+#define ASM_OUTPUT_BSS(FILE, DECL, NAME, SIZE, ROUNDED)		\
   asm_output_bss ((FILE), (DECL), (NAME), (SIZE), (ROUNDED))
 
 /* This says how to output an assembler line
@@ -1437,18 +1437,18 @@
 
 /* Perform target dependent optabs initialization.  */
 
-#define INIT_TARGET_OPTABS \
-  do { \
-    smul_optab->handlers[(int) HImode].libfunc		\
-      = init_one_libfunc (MULHI3_LIBCALL);		\
-    sdiv_optab->handlers[(int) HImode].libfunc		\
-      = init_one_libfunc (DIVHI3_LIBCALL);		\
-    udiv_optab->handlers[(int) HImode].libfunc		\
-      = init_one_libfunc (UDIVHI3_LIBCALL);		\
-    smod_optab->handlers[(int) HImode].libfunc		\
-      = init_one_libfunc (MODHI3_LIBCALL);		\
-    umod_optab->handlers[(int) HImode].libfunc		\
-      = init_one_libfunc (UMODHI3_LIBCALL);		\
+#define INIT_TARGET_OPTABS			\
+  do {						\
+    smul_optab->handlers[(int) HImode].libfunc	\
+      = init_one_libfunc (MULHI3_LIBCALL);	\
+    sdiv_optab->handlers[(int) HImode].libfunc	\
+      = init_one_libfunc (DIVHI3_LIBCALL);	\
+    udiv_optab->handlers[(int) HImode].libfunc	\
+      = init_one_libfunc (UDIVHI3_LIBCALL);	\
+    smod_optab->handlers[(int) HImode].libfunc	\
+      = init_one_libfunc (MODHI3_LIBCALL);	\
+    umod_optab->handlers[(int) HImode].libfunc	\
+      = init_one_libfunc (UMODHI3_LIBCALL);	\
   } while (0)
 
 #define MOVE_RATIO 3
Index: h8300.md
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/h8300/h8300.md,v
retrieving revision 1.14
diff -u -r1.14 h8300.md
--- h8300.md	2000/08/01 03:05:52	1.14
+++ h8300.md	2000/08/07 07:26:25
@@ -144,11 +144,11 @@
   ""
   "
 {
-  /* One of the ops has to be in a register */
-  if (!register_operand(operand0, QImode)
-      && !register_operand(operand1, QImode))
+  /* One of the ops has to be in a register.  */
+  if (!register_operand (operand0, QImode)
+      && !register_operand (operand1, QImode))
     {
-      operands[1] = copy_to_mode_reg(QImode, operand1);
+      operands[1] = copy_to_mode_reg (QImode, operand1);
     }
 }")
 
@@ -208,11 +208,11 @@
   ""
   "
 {
-  /* One of the ops has to be in a register */
-  if (!register_operand(operand1, HImode)
-      && !register_operand(operand0, HImode))
+  /* One of the ops has to be in a register.  */
+  if (!register_operand (operand1, HImode)
+      && !register_operand (operand0, HImode))
     {
-      operands[1] = copy_to_mode_reg(HImode, operand1);
+      operands[1] = copy_to_mode_reg (HImode, operand1);
     }
 }")
 
@@ -426,13 +426,13 @@
 	  if (val == (val & 0xff))
 	    {
 	      operands[1] = GEN_INT ((char) val & 0xff);
-	      return \"sub.l %S0,%S0\;add.b %1,%w0\";
+	      return \"sub.l\\t%S0,%S0\;add.b\\t%1,%w0\";
 	    }
 
 	  if (val == (val & 0xff00))
 	    {
 	      operands[1] = GEN_INT ((char) (val >> 8) & 0xff);
-	      return \"sub.l %S0,%S0\;add.b %1,%x0\";
+	      return \"sub.l\\t%S0,%S0\;add.b\\t%1,%x0\";
 	    }
 
 	  /* Now look for small negative numbers.  We can subtract them
@@ -440,7 +440,7 @@
 	  if (val == -4 || val == -2 || val == -1)
 	    {
 	      operands[1] = GEN_INT (-INTVAL (operands[1]));
-	      return \"sub.l %S0,%S0\;subs %1,%S0\";
+	      return \"sub.l\\t%S0,%S0\;subs\\t%1,%S0\";
 	    }
 	}
     }
@@ -2257,4 +2257,3 @@
   "mov.w	%T0,@-%T1"
   [(set_attr "length" "2")
    (set_attr "cc" "set_znv")])
-
============================================================



More information about the Gcc-patches mailing list