+2017-07-26 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR target/81563
+ * config/i386/i386.c (sp_valid_at): Properly check CFA offset.
+ (fp_valid_at): Likewise.
+
2017-07-26 James Greenhalgh <james.greenhalgh@arm.com>
* config/aarch64/aarch64.c (cortexa57_addrcost_table): Remove.
return len;
}
-/* Determine if the stack pointer is valid for accessing the cfa_offset. */
+/* Determine if the stack pointer is valid for accessing the cfa_offset.
+ The register is saved at CFA - CFA_OFFSET. */
static inline bool
sp_valid_at (HOST_WIDE_INT cfa_offset)
{
const struct machine_frame_state &fs = cfun->machine->fs;
return fs.sp_valid && !(fs.sp_realigned
- && cfa_offset < fs.sp_realigned_offset);
+ && cfa_offset <= fs.sp_realigned_offset);
}
-/* Determine if the frame pointer is valid for accessing the cfa_offset. */
+/* Determine if the frame pointer is valid for accessing the cfa_offset.
+ The register is saved at CFA - CFA_OFFSET. */
static inline bool
fp_valid_at (HOST_WIDE_INT cfa_offset)
{
const struct machine_frame_state &fs = cfun->machine->fs;
return fs.fp_valid && !(fs.sp_valid && fs.sp_realigned
- && cfa_offset >= fs.sp_realigned_offset);
+ && cfa_offset > fs.sp_realigned_offset);
}
/* Choose a base register based upon alignment requested, speed and/or
--- /dev/null
+/* { dg-do compile { target ia32 } } */
+/* { dg-options "-O2 -maccumulate-outgoing-args -mincoming-stack-boundary=2 -mpreferred-stack-boundary=3 -mregparm=3 -mtune-ctrl=epilogue_using_move" } */
+
+extern void bar (long long int, int);
+
+long long int
+fn1 (long long int x)
+{
+ bar (x, 1);
+ return x;
+}
+
+/* { dg-final { scan-assembler-times "movl\[\\t \]*-8\\(%ebp\\),\[\\t \]*%esi" 1 } } */
+/* { dg-final { scan-assembler-times "movl\[\\t \]*-4\\(%ebp\\),\[\\t \]*%edi" 1 } } */