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

Collapse All | Expand All

(-)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" } } */
(-)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" } } */
(-)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" } } */
(-)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" } } */
(-)config/i386/i386.h (+2 lines)
Lines 2404-2409 struct machine_function GTY(()) Link Here
2404
  /* This value is used for amd64 targets and specifies the current abi
2404
  /* This value is used for amd64 targets and specifies the current abi
2405
     to be used. MS_ABI means ms abi. Otherwise SYSV_ABI means sysv abi.  */
2405
     to be used. MS_ABI means ms abi. Otherwise SYSV_ABI means sysv abi.  */
2406
  int call_abi;
2406
  int call_abi;
2407
  /* Use STACK_BOUNDARY for incoming stack boundary.  */
2408
  int use_stack_boundary_for_incoming_stack_boundary;
2407
};
2409
};
2408
2410
2409
#define ix86_stack_locals (cfun->machine->stack_locals)
2411
#define ix86_stack_locals (cfun->machine->stack_locals)
(-)config/i386/i386.c (-2 / +31 lines)
Lines 8038-8048 find_drap_reg (void) Link Here
8038
static void
8038
static void
8039
ix86_update_stack_boundary (void)
8039
ix86_update_stack_boundary (void)
8040
{
8040
{
8041
  /* Should we use STACK_BOUNDARY for incoming stack boundary?  */
8042
  unsigned int incoming_stack_boundary;
8043
8044
  if (cfun->machine->use_stack_boundary_for_incoming_stack_boundary)
8045
    incoming_stack_boundary = STACK_BOUNDARY;
8046
  else
8047
    incoming_stack_boundary = ix86_default_incoming_stack_boundary;
8048
8041
  /* Prefer the one specified at command line. */
8049
  /* Prefer the one specified at command line. */
8042
  ix86_incoming_stack_boundary 
8050
  ix86_incoming_stack_boundary 
8043
    = (ix86_user_incoming_stack_boundary
8051
    = (ix86_user_incoming_stack_boundary
8044
       ? ix86_user_incoming_stack_boundary
8052
       ? ix86_user_incoming_stack_boundary
8045
       : ix86_default_incoming_stack_boundary);
8053
       : incoming_stack_boundary);
8046
8054
8047
  /* Incoming stack alignment can be changed on individual functions
8055
  /* Incoming stack alignment can be changed on individual functions
8048
     via force_align_arg_pointer attribute.  We use the smallest
8056
     via force_align_arg_pointer attribute.  We use the smallest
Lines 19560-19565 ix86_local_alignment (tree exp, enum mac Link Here
19560
  return align;
19568
  return align;
19561
}
19569
}
19562
19570
19571
#define VALID_SSE_VECTOR_MODE(MODE) \
19572
  ((MODE) == V4SFmode || (MODE) == V4SImode || (MODE) == V2DFmode \
19573
   || (MODE) == V16QImode || (MODE) == V8HImode || (MODE) == V2DImode)
19574
19563
/* Compute the minimum required alignment for dynamic stack realignment
19575
/* Compute the minimum required alignment for dynamic stack realignment
19564
   purposes for a local variable, parameter or a stack slot.  EXP is
19576
   purposes for a local variable, parameter or a stack slot.  EXP is
19565
   the data type or decl itself, MODE is its mode and ALIGN is the
19577
   the data type or decl itself, MODE is its mode and ALIGN is the
Lines 19571-19577 ix86_minimum_alignment (tree exp, enum m Link Here
19571
{
19583
{
19572
  tree type, decl;
19584
  tree type, decl;
19573
19585
19574
  if (TARGET_64BIT || align != 64 || ix86_preferred_stack_boundary >= 64)
19586
  if (TARGET_64BIT)
19575
    return align;
19587
    return align;
19576
19588
19577
  if (exp && DECL_P (exp))
19589
  if (exp && DECL_P (exp))
Lines 19585-19590 ix86_minimum_alignment (tree exp, enum m Link Here
19585
      decl = NULL;
19597
      decl = NULL;
19586
    }
19598
    }
19587
19599
19600
  /* In 32bit, use STACK_BOUNDARY for incoming stack boundary if any
19601
     SSE variables are put on stack.  Since gcc 4.4 may not generate
19602
     local vector variables for vectorizer, we also check array with
19603
     128bit user alignment set by vectorizer.  */
19604
  if (VALID_SSE_VECTOR_MODE (mode)
19605
      || (type
19606
	  && (VALID_SSE_VECTOR_MODE (TYPE_MODE (type))
19607
	      || (flag_tree_vectorize != 0
19608
		  && TREE_CODE (type) == ARRAY_TYPE
19609
		  && decl
19610
		  && DECL_USER_ALIGN (decl)
19611
		  && DECL_ALIGN (decl) == 128))))
19612
     cfun->machine->use_stack_boundary_for_incoming_stack_boundary = 1;
19613
19614
  if (align != 64 || ix86_preferred_stack_boundary >= 64)
19615
    return align;
19616
19588
  /* Don't do dynamic stack realignment for long long objects with
19617
  /* Don't do dynamic stack realignment for long long objects with
19589
     -mpreferred-stack-boundary=2.  */
19618
     -mpreferred-stack-boundary=2.  */
19590
  if ((mode == DImode || (type && TYPE_MODE (type) == DImode))
19619
  if ((mode == DImode || (type && TYPE_MODE (type) == DImode))

Return to bug 40838