This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Minor fix to i386.h


kenner@vlsi1.ultra.nyu.edu (Richard Kenner) writes:

> This removes the potential for warnings.  Tested by compilation only on i386.
> Committed only to mainline.
> 
> Wed May  2 13:09:36 2001  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
> 
> 	* config/i386/i386.h (FUNCTION_BOUNDARY): Result is unsigned.

Unfortunately, the result must not be unsigned, and so this also
removes the potential for correct trampoline generation, due to this
line in function.c:

  tramp = expand_binop (Pmode, and_optab, temp,
			GEN_INT (-TRAMPOLINE_ALIGNMENT / BITS_PER_UNIT),
			temp, 0, OPTAB_LIB_WIDEN);

Please, test your patches with a full bootstrap and testrun before
committing them, and even then watch for mail from the automated
tester in case your commit goes awry.  If it wasn't for the fact that
I look at your patches as the first suspect when there's mysterious
breakage, this could have taken a long time to find.

Fixed thusly; all that code is obsolete and buggy and should be
deleted.  I'll commit this when it has passed a bootstrap and
testsuite on x86-linux.

-- 
- Geoffrey Keating <geoffk@geoffk.org>

===File ~/patches/cygnus/gcc-kennerbroketrampoline.patch====
2001-05-03  Geoff Keating  <geoffk@redhat.com>

	* invoke.texi (i386 Options): Delete references to -malign-jumps,
	-malign-loops, -malign-functions.
	* i386.c (ix86_align_funcs): Delete.
	(ix86_align_loops): Delete.
	(ix86_align_jumps): Delete.
	(override_options): Mark -malign-* as obsolete.  Emulate their
	behaviour with the -falign-* options.  Default -falign-* from
	the processor table.
	* i386.h (FUNCTION_BOUNDARY): Define to 8; revert Richard Kenner's
	patch of Wed May 2 13:09:36 2001.
	(LOOP_ALIGN): Delete.
	(LOOP_ALIGN_MAX_SKIP): Delete.
	(LABEL_ALIGN_AFTER_BARRIER): Delete.
	(LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP): Delete.

Index: invoke.texi
===================================================================
RCS file: /cvs/gcc/gcc/gcc/invoke.texi,v
retrieving revision 1.297
diff -p -u -p -r1.297 invoke.texi
--- invoke.texi	2001/05/01 18:51:06	1.297
+++ invoke.texi	2001/05/03 11:57:18
@@ -470,8 +470,7 @@ in the following sections.
 -mintel-syntax -mieee-fp  -mno-fancy-math-387 @gol
 -mno-fp-ret-in-387  -msoft-float  -msvr3-shlib @gol
 -mno-wide-multiply  -mrtd  -malign-double @gol
--malign-jumps=@var{num}  -malign-loops=@var{num} @gol
--malign-functions=@var{num} -mpreferred-stack-boundary=@var{num} @gol
+-mpreferred-stack-boundary=@var{num} @gol
 -mthreads -mno-align-stringops -minline-all-stringops @gol
 -mpush-args -maccumulate-outgoing-args -m128bit-long-double @gol
 -m96bit-long-double -mregparm=@var{num}}
@@ -6864,26 +6863,6 @@ function by using the function attribute
 @var{num} is nonzero, then you must build all modules with the same
 value, including any libraries.  This includes the system libraries and
 startup modules.
-
-@item -malign-loops=@var{num}
-Align loops to a 2 raised to a @var{num} byte boundary.  If
-@samp{-malign-loops} is not specified, the default is 2 unless
-gas 2.8 (or later) is being used in which case the default is
-to align the loop on a 16 byte boundary if it is less than 8
-bytes away.
-
-@item -malign-jumps=@var{num}
-Align instructions that are only jumped to to a 2 raised to a @var{num}
-byte boundary.  If @samp{-malign-jumps} is not specified, the default is
-2 if optimizing for a 386, and 4 if optimizing for a 486 unless
-gas 2.8 (or later) is being used in which case the default is
-to align the instruction on a 16 byte boundary if it is less
-than 8 bytes away.
-
-@item -malign-functions=@var{num}
-Align the start of functions to a 2 raised to @var{num} byte boundary.
-If @samp{-malign-functions} is not specified, the default is 2 if optimizing
-for a 386, and 4 if optimizing for a 486.
 
 @item -mpreferred-stack-boundary=@var{num}
 Attempt to keep the stack boundary aligned to a 2 raised to @var{num}
Index: config/i386/i386.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.c,v
retrieving revision 1.256
diff -p -u -p -r1.256 i386.c
--- i386.c	2001/04/26 18:33:25	1.256
+++ i386.c	2001/05/03 11:57:19
@@ -532,14 +532,7 @@ int ix86_branch_cost;
 const char *ix86_branch_cost_string;
 
 /* Power of two alignment for functions.  */
-int ix86_align_funcs;
 const char *ix86_align_funcs_string;
-
-/* Power of two alignment for loops.  */
-int ix86_align_loops;
-
-/* Power of two alignment for non-loop jumps.  */
-int ix86_align_jumps;
 
 static void output_pic_addr_const PARAMS ((FILE *, rtx, int));
 static void put_condition_code PARAMS ((enum rtx_code, enum machine_mode,
@@ -751,39 +744,56 @@ override_options ()
    if (TARGET_64BIT)
      ix86_regparm = REGPARM_MAX;
 
-  /* Validate -malign-loops= value, or provide default.  */
-  ix86_align_loops = processor_target_table[ix86_cpu].align_loop;
+  /* If the user has provided any of the -malign-* options,
+     warn and use that value only if -falign-* is not set.  
+     Remove this code in GCC 3.2 or later.  */
   if (ix86_align_loops_string)
     {
-      i = atoi (ix86_align_loops_string);
-      if (i < 0 || i > MAX_CODE_ALIGN)
-	error ("-malign-loops=%d is not between 0 and %d", i, MAX_CODE_ALIGN);
-      else
-	ix86_align_loops = i;
+      warning ("-malign-loops is obsolete, use -falign-loops");
+      if (align_loops == 0)
+	{
+	  i = atoi (ix86_align_loops_string);
+	  if (i < 0 || i > MAX_CODE_ALIGN)
+	    error ("-malign-loops=%d is not between 0 and %d", i, MAX_CODE_ALIGN);
+	  else
+	    align_loops = 1 << i;
+	}
     }
 
-  /* Validate -malign-jumps= value, or provide default.  */
-  ix86_align_jumps = processor_target_table[ix86_cpu].align_jump;
   if (ix86_align_jumps_string)
     {
-      i = atoi (ix86_align_jumps_string);
-      if (i < 0 || i > MAX_CODE_ALIGN)
-	error ("-malign-jumps=%d is not between 0 and %d", i, MAX_CODE_ALIGN);
-      else
-	ix86_align_jumps = i;
+      warning ("-malign-jumps is obsolete, use -falign-jumps");
+      if (align_jumps == 0)
+	{
+	  i = atoi (ix86_align_jumps_string);
+	  if (i < 0 || i > MAX_CODE_ALIGN)
+	    error ("-malign-loops=%d is not between 0 and %d", i, MAX_CODE_ALIGN);
+	  else
+	    align_jumps = 1 << i;
+	}
     }
 
-  /* Validate -malign-functions= value, or provide default.  */
-  ix86_align_funcs = processor_target_table[ix86_cpu].align_func;
   if (ix86_align_funcs_string)
     {
-      i = atoi (ix86_align_funcs_string);
-      if (i < 0 || i > MAX_CODE_ALIGN)
-	error ("-malign-functions=%d is not between 0 and %d",
-	       i, MAX_CODE_ALIGN);
-      else
-	ix86_align_funcs = i;
+      warning ("-malign-functions is obsolete, use -falign-functions");
+      if (align_functions == 0)
+	{
+	  i = atoi (ix86_align_funcs_string);
+	  if (i < 0 || i > MAX_CODE_ALIGN)
+	    error ("-malign-loops=%d is not between 0 and %d", i, MAX_CODE_ALIGN);
+	  else
+	    align_functions = 1 << i;
+	}
     }
+
+  /* Default align_* from the processor table.  */
+#define abs(n) (n < 0 ? -n : n)
+  if (align_loops == 0)
+    align_loops = 8 << abs (processor_target_table[ix86_cpu].align_loop);
+  if (align_jumps == 0)
+    align_jumps = 8 << abs (processor_target_table[ix86_cpu].align_jump);
+  if (align_functions == 0)
+    align_functions = 8 << abs (processor_target_table[ix86_cpu].align_func);
 
   /* Validate -mpreferred-stack-boundary= value, or provide default.
      The default of 128 bits is for Pentium III's SSE __m128.  */
Index: config/i386/i386.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/i386/i386.h,v
retrieving revision 1.179
diff -p -u -p -r1.179 i386.h
--- i386.h	2001/05/02 17:37:26	1.179
+++ i386.h	2001/05/03 11:57:19
@@ -587,10 +587,7 @@ extern int ix86_arch;
 #define PREFERRED_STACK_BOUNDARY ix86_preferred_stack_boundary
 
 /* Allocation boundary for the code of a function. */
-#define FUNCTION_BOUNDARY \
-   ((unsigned int) 1 << ((ix86_align_funcs >= 0				\
-			  ? ix86_align_funcs : -ix86_align_funcs)	\
-			 + 3))
+#define FUNCTION_BOUNDARY 8
 
 /* Alignment of field after `int : 0' in a structure. */
 
@@ -670,18 +667,6 @@ extern int ix86_arch;
    and give entire struct the alignment of an int.  */
 /* Required on the 386 since it doesn't have bitfield insns.  */
 #define PCC_BITFIELD_TYPE_MATTERS 1
-
-/* Align loop starts for optimal branching.  */
-#define LOOP_ALIGN(LABEL) \
-	(ix86_align_loops < 0 ? -ix86_align_loops : ix86_align_loops)
-#define LOOP_ALIGN_MAX_SKIP \
-	(ix86_align_loops < -3 ? (1<<(-ix86_align_loops-1))-1 : 0)
-
-/* This is how to align an instruction for optimal branching.  */
-#define LABEL_ALIGN_AFTER_BARRIER(LABEL) \
-	(ix86_align_jumps < 0 ? -ix86_align_jumps : ix86_align_jumps)
-#define LABEL_ALIGN_AFTER_BARRIER_MAX_SKIP \
-	(ix86_align_jumps < -3 ? (1<<(-ix86_align_jumps-1))-1 : 0)
 
 /* Standard register usage.  */
 
@@ -3138,9 +3123,6 @@ extern const char *ix86_align_funcs_stri
 extern const char *ix86_preferred_stack_boundary_string;/* power of two alignment for stack boundary */
 extern const char *ix86_branch_cost_string;	/* values 1-5: see jump.c */
 extern int ix86_regparm;			/* ix86_regparm_string as a number */
-extern int ix86_align_loops;			/* power of two alignment for loops */
-extern int ix86_align_jumps;			/* power of two alignment for non-loop jumps */
-extern int ix86_align_funcs;			/* power of two alignment for functions */
 extern int ix86_preferred_stack_boundary;	/* preferred stack boundary alignment in bits */
 extern int ix86_branch_cost;			/* values 1-5: see jump.c */
 extern const char * const hi_reg_name[];	/* names for 16 bit regs */
============================================================


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]