View | Details | Return to bug 40838 | Differences between
and this patch

Collapse All | Expand All

(-)gcc/testsuite/gcc.target/i386/incoming-11.c (+16 lines)
Line 0 Link Here
1
/* PR target/40838 */
2
/* { dg-do compile { target { { ! *-*-darwin* } && ilp32 } } } */
3
/* { dg-options "-w -fomit-frame-pointer -O3 -march=barcelona -mpreferred-stack-boundary=4" } */
4
5
void g();
6
7
int p[100];
8
int q[100];
9
10
void f()
11
{
12
	int i;
13
	for (i = 0; i < 100; i++) p[i] = 0;
14
	g();
15
	for (i = 0; i < 100; i++) q[i] = 0;
16
}
(-)gcc/testsuite/gcc.target/i386/incoming-7.c (+16 lines)
Line 0 Link Here
1
/* PR target/40838 */
2
/* { dg-do compile { target { { ! *-*-darwin* } && ilp32 } } } */
3
/* { dg-options "-w -O2 -msse2 -mpreferred-stack-boundary=4" } */
4
5
typedef int v4si __attribute__ ((vector_size (16)));
6
7
extern v4si y(v4si, v4si, v4si, v4si, v4si);
8
9
extern v4si s1, s2;
10
11
v4si x(void)
12
{
13
  return y(s1, s2, s1, s2, s2);
14
}
15
16
/* { dg-final { scan-assembler "andl\[\\t \]*\\$-16,\[\\t \]*%esp" } } */
(-)gcc/testsuite/gcc.target/i386/incoming-9.c (+18 lines)
Line 0 Link Here
1
/* PR target/40838 */
2
/* { dg-do compile { target { { ! *-*-darwin* } && ilp32 } } } */
3
/* { dg-options "-w -O3 -mno-sse -mpreferred-stack-boundary=4" } */
4
5
float
6
foo (float f)
7
{
8
  float array[128];
9
  float x;
10
  int i;
11
  for (i = 0; i < sizeof(array) / sizeof(*array); i++)
12
    array[i] = f;
13
  for (i = 0; i < sizeof(array) / sizeof(*array); i++)
14
    x += array[i];
15
  return x;
16
}
17
18
/* { dg-final { scan-assembler-not "andl\[\\t \]*\\$-16,\[\\t \]*%esp" } } */
(-)gcc/testsuite/gcc.target/i386/incoming-10.c (+19 lines)
Line 0 Link Here
1
/* PR target/40838 */
2
/* { dg-do compile { target { { ! *-*-darwin* } && ilp32 } } } */
3
/* { dg-options "-w -fomit-frame-pointer -O3 -march=barcelona -mpreferred-stack-boundary=4" } */
4
5
struct s {
6
	int x[8];
7
};
8
9
void g(struct s *);
10
11
void f()
12
{
13
	int i;
14
	struct s s;
15
	for (i = 0; i < sizeof(s.x) / sizeof(*s.x); i++) s.x[i] = 0;
16
	g(&s);
17
}
18
19
/* { dg-final { scan-assembler "andl\[\\t \]*\\$-16,\[\\t \]*%esp" } } */
(-)gcc/testsuite/gcc.target/i386/incoming-6.c (+17 lines)
Line 0 Link Here
1
/* PR target/40838 */
2
/* { dg-do compile { target { { ! *-*-darwin* } && ilp32 } } } */
3
/* { dg-options "-w -O2 -msse2 -mpreferred-stack-boundary=4" } */
4
5
typedef int v4si __attribute__ ((vector_size (16)));
6
7
extern v4si y(v4si *s3);
8
9
extern v4si s1, s2;
10
11
v4si x(void)
12
{
13
  v4si s3 = s1 + s2;
14
  return y(&s3);
15
}
16
17
/* { dg-final { scan-assembler "andl\[\\t \]*\\$-16,\[\\t \]*%esp" } } */
(-)gcc/testsuite/gcc.target/i386/incoming-8.c (+18 lines)
Line 0 Link Here
1
/* PR target/40838 */
2
/* { dg-do compile { target { { ! *-*-darwin* } && ilp32 } } } */
3
/* { dg-options "-w -O3 -msse2 -mpreferred-stack-boundary=4" } */
4
5
float
6
foo (float f)
7
{
8
  float array[128];
9
  float x;
10
  int i;
11
  for (i = 0; i < sizeof(array) / sizeof(*array); i++)
12
    array[i] = f;
13
  for (i = 0; i < sizeof(array) / sizeof(*array); i++)
14
    x += array[i];
15
  return x;
16
}
17
18
/* { dg-final { scan-assembler "andl\[\\t \]*\\$-16,\[\\t \]*%esp" } } */
(-)gcc/function.c (+3 lines)
Lines 4133-4138 allocate_struct_function (tree fndecl, b Link Here
4133
      /* Assume all registers in stdarg functions need to be saved.  */
4133
      /* Assume all registers in stdarg functions need to be saved.  */
4134
      cfun->va_list_gpr_size = VA_LIST_MAX_GPR_SIZE;
4134
      cfun->va_list_gpr_size = VA_LIST_MAX_GPR_SIZE;
4135
      cfun->va_list_fpr_size = VA_LIST_MAX_FPR_SIZE;
4135
      cfun->va_list_fpr_size = VA_LIST_MAX_FPR_SIZE;
4136
4137
      cfun->forced_stack_alignment = 0;
4138
      cfun->forced_stack_mode = VOIDmode;
4136
    }
4139
    }
4137
}
4140
}
4138
4141
(-)gcc/function.h (+6 lines)
Lines 535-540 struct function GTY(()) Link Here
535
     per-function in order to allow IPA passes to introduce new functions.  */
535
     per-function in order to allow IPA passes to introduce new functions.  */
536
  VEC(ipa_opt_pass,heap) * GTY((skip)) ipa_transforms_to_apply;
536
  VEC(ipa_opt_pass,heap) * GTY((skip)) ipa_transforms_to_apply;
537
537
538
  /* The largest alignment forced on the stack.  */
539
  unsigned int forced_stack_alignment;
540
541
  /* The mode of the largest alignment forced on the stack.  */
542
  enum machine_mode forced_stack_mode;
543
538
  /* Collected bit flags.  */
544
  /* Collected bit flags.  */
539
545
540
  /* Number of units of general registers that need saving in stdarg
546
  /* Number of units of general registers that need saving in stdarg
(-)gcc/tree-vect-analyze.c (+6 lines)
Lines 1507-1512 vect_compute_data_ref_alignment (struct Link Here
1507
      DECL_USER_ALIGN (base) = 1;
1507
      DECL_USER_ALIGN (base) = 1;
1508
    }
1508
    }
1509
1509
1510
  if (cfun->forced_stack_alignment < DECL_ALIGN (base))
1511
    {
1512
      cfun->forced_stack_alignment = DECL_ALIGN (base);
1513
      cfun->forced_stack_mode = TYPE_MODE (vectype);
1514
    }
1515
1510
  /* At this point we assume that the base is aligned.  */
1516
  /* At this point we assume that the base is aligned.  */
1511
  gcc_assert (base_aligned
1517
  gcc_assert (base_aligned
1512
	      || (TREE_CODE (base) == VAR_DECL 
1518
	      || (TREE_CODE (base) == VAR_DECL 
(-)gcc/config/i386/i386.c (-2 / +36 lines)
Lines 8034-8049 find_drap_reg (void) Link Here
8034
    }
8034
    }
8035
}
8035
}
8036
8036
8037
#define VALID_SSE_VECTOR_MODE(MODE) \
8038
  ((MODE) == V4SFmode || (MODE) == V4SImode || (MODE) == V2DFmode \
8039
   || (MODE) == V16QImode || (MODE) == V8HImode || (MODE) == V2DImode)
8040
8037
/* Update incoming stack boundary and estimated stack alignment.  */
8041
/* Update incoming stack boundary and estimated stack alignment.  */
8038
8042
8039
static void
8043
static void
8040
ix86_update_stack_boundary (void)
8044
ix86_update_stack_boundary (void)
8041
{
8045
{
8046
  /* Should we use STACK_BOUNDARY for incoming stack boundary?  */
8047
  unsigned int incoming_stack_boundary;
8048
8049
  /* In 32bit, use STACK_BOUNDARY for incoming stack boundary if any
8050
     SSE variables are put on stack. */
8051
  if (!TARGET_64BIT
8052
      && VALID_SSE_VECTOR_MODE (cfun->forced_stack_mode))
8053
    incoming_stack_boundary = STACK_BOUNDARY;
8054
  else
8055
    incoming_stack_boundary = ix86_default_incoming_stack_boundary;
8056
8042
  /* Prefer the one specified at command line. */
8057
  /* Prefer the one specified at command line. */
8043
  ix86_incoming_stack_boundary 
8058
  ix86_incoming_stack_boundary 
8044
    = (ix86_user_incoming_stack_boundary
8059
    = (ix86_user_incoming_stack_boundary
8045
       ? ix86_user_incoming_stack_boundary
8060
       ? ix86_user_incoming_stack_boundary
8046
       : ix86_default_incoming_stack_boundary);
8061
       : incoming_stack_boundary);
8047
8062
8048
  /* Incoming stack alignment can be changed on individual functions
8063
  /* Incoming stack alignment can be changed on individual functions
8049
     via force_align_arg_pointer attribute.  We use the smallest
8064
     via force_align_arg_pointer attribute.  We use the smallest
Lines 19575-19581 ix86_minimum_alignment (tree exp, enum m Link Here
19575
{
19590
{
19576
  tree type, decl;
19591
  tree type, decl;
19577
19592
19578
  if (TARGET_64BIT || align != 64 || ix86_preferred_stack_boundary >= 64)
19593
  if (TARGET_64BIT)
19579
    return align;
19594
    return align;
19580
19595
19581
  if (exp && DECL_P (exp))
19596
  if (exp && DECL_P (exp))
Lines 19589-19594 ix86_minimum_alignment (tree exp, enum m Link Here
19589
      decl = NULL;
19604
      decl = NULL;
19590
    }
19605
    }
19591
19606
19607
  /* In 32bit, update forced_stack_mode if any SSE variables are put
19608
     on stack.  */
19609
  if (cfun->forced_stack_alignment < 128)
19610
    {
19611
      if (VALID_SSE_VECTOR_MODE (mode))
19612
	{
19613
	  cfun->forced_stack_alignment = 128;
19614
	  cfun->forced_stack_mode = mode;
19615
	}
19616
      else if ((type && VALID_SSE_VECTOR_MODE (TYPE_MODE (type))))
19617
	{
19618
	  cfun->forced_stack_alignment = 128;
19619
	  cfun->forced_stack_mode = TYPE_MODE (type);
19620
	}
19621
    }
19622
19623
  if (align != 64 || ix86_preferred_stack_boundary >= 64)
19624
    return align;
19625
19592
  /* Don't do dynamic stack realignment for long long objects with
19626
  /* Don't do dynamic stack realignment for long long objects with
19593
     -mpreferred-stack-boundary=2.  */
19627
     -mpreferred-stack-boundary=2.  */
19594
  if ((mode == DImode || (type && TYPE_MODE (type) == DImode))
19628
  if ((mode == DImode || (type && TYPE_MODE (type) == DImode))

Return to bug 40838