+2017-07-09 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/81313
+ * config/i386/i386.c (ix86_function_arg_advance): Set
+ outgoing_args_on_stack to true if there are outgoing arguments
+ on stack.
+ (ix86_function_arg): Likewise.
+ (ix86_get_drap_rtx): Use DRAP only if there are outgoing
+ arguments on stack and ACCUMULATE_OUTGOING_ARGS is false.
+ * config/i386/i386.h (machine_function): Add
+ outgoing_args_on_stack.
+
2017-07-09 Krister Walfridsson <krister.walfridsson@gmail.com>
* config.gcc (*-*-netbsd*): Remove check for NetBSD versions not
/* For pointers passed in memory we expect bounds passed in Bounds
Table. */
if (!nregs)
- cum->bnds_in_bt = chkp_type_bounds_count (type);
+ {
+ /* Track if there are outgoing arguments on stack. */
+ if (cum->caller)
+ cfun->machine->outgoing_args_on_stack = true;
+
+ cum->bnds_in_bt = chkp_type_bounds_count (type);
+ }
}
/* Define where to put the arguments to a function.
else
arg = function_arg_32 (cum, mode, omode, type, bytes, words);
+ /* Track if there are outgoing arguments on stack. */
+ if (arg == NULL_RTX && cum->caller)
+ cfun->machine->outgoing_args_on_stack = true;
+
return arg;
}
static rtx
ix86_get_drap_rtx (void)
{
- if (ix86_force_drap || !ACCUMULATE_OUTGOING_ARGS)
+ /* We must use DRAP if there are outgoing arguments on stack and
+ ACCUMULATE_OUTGOING_ARGS is false. */
+ if (ix86_force_drap
+ || (cfun->machine->outgoing_args_on_stack
+ && !ACCUMULATE_OUTGOING_ARGS))
crtl->need_drap = true;
if (stack_realign_drap)
frame pointer.) */
unsigned int call_ms2sysv_extra_regs:3;
+ /* Nonzero if the function places outgoing arguments on stack. */
+ BOOL_BITFIELD outgoing_args_on_stack : 1;
+
/* During prologue/epilogue generation, the current frame state.
Otherwise, the frame state at the end of the prologue. */
struct machine_frame_state fs;
+2017-07-09 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/81313
+ * gcc.target/i386/pr81313-1.c: New test.
+ * gcc.target/i386/pr81313-2.c: Likewise.
+ * gcc.target/i386/pr81313-3.c: Likewise.
+ * gcc.target/i386/pr81313-4.c: Likewise.
+ * gcc.target/i386/pr81313-5.c: Likewise.
+
2017-07-08 Richard Sandiford <richard.sandiford@linaro.org>
* gnat.dg/vect15.ads (Sarray): Increase range to 1 .. 5.
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-accumulate-outgoing-args -mincoming-stack-boundary=4 -mpreferred-stack-boundary=6" } */
+
+extern void foo (void);
+
+void
+bar (void)
+{
+ foo ();
+}
+
+/* { dg-final { scan-assembler-not "lea\[lq\]?\[\\t \]*\[0-9\]*\\(%\[er\]sp\\)" } } */
--- /dev/null
+/* { dg-do compile { target ia32 } } */
+/* { dg-options "-O2 -mno-accumulate-outgoing-args -mincoming-stack-boundary=4 -mpreferred-stack-boundary=6 -mno-iamcu" } */
+
+extern void foo (int, int, int);
+
+void
+bar (void)
+{
+ foo (1, 2, 3);
+}
+
+/* { dg-final { scan-assembler "lea\[l\]?\[\\t \]*\[0-9\]*\\(%esp\\)" } } */
--- /dev/null
+/* { dg-do compile { target ia32 } } */
+/* { dg-options "-O2 -mno-accumulate-outgoing-args -mincoming-stack-boundary=4 -mpreferred-stack-boundary=6" } */
+
+extern void foo (int, int, int) __attribute__ ((regparm(3)));
+
+void
+bar (int i1, int i2, int i3, int i4)
+{
+ foo (i1, i2, i3);
+}
+
+/* { dg-final { scan-assembler-not "lea\[l\]?\[\\t \]*\[0-9\]*\\(%esp\\)" } } */
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O2 -mno-accumulate-outgoing-args -mincoming-stack-boundary=4 -mpreferred-stack-boundary=6" } */
+
+extern void foo (int, int, int, int, int, int, int);
+
+void
+bar (void)
+{
+ foo (1, 2, 3, 4, 5, 6, 7);
+}
+
+/* { dg-final { scan-assembler "lea\[lq\]?\[\\t \]*\[0-9\]*\\(%\[er\]sp\\)" } } */
--- /dev/null
+/* { dg-do compile { target { ! ia32 } } } */
+/* { dg-options "-O2 -mno-accumulate-outgoing-args -mincoming-stack-boundary=4 -mpreferred-stack-boundary=6" } */
+
+extern void foo (int, int, int, int, int, int);
+
+void
+bar (int i1, int i2, int i3, int i4, int i5, int i6, int i7)
+{
+ foo (i1, i2, i3, i4, i5, i6);
+}
+
+/* { dg-final { scan-assembler-not "lea\[lq\]?\[\\t \]*\[0-9\]*\\(%\[er\]sp\\)" } } */