https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128270

--- Comment #5 from Uroš Bizjak <ubizjak at gmail dot com> ---
Testcases:

/* PR target/128270 */
/* { dg-do compile { target lp64 } } */
/* { dg-options "-O2 -mforce-drap -mtune-ctrl=use_leave
-fasynchronous-unwind-tables" } */

void use (void *);

int
f (void)
{
  char buf[64] __attribute__ ((aligned (32)));
  use (buf);
  return buf[0];
}

/* The DRAP prologue saves %rbp with an FP-relative DW_CFA_expression
   rule, so the epilogue must restore it even within the red zone.  */
/* { dg-final { scan-assembler "\\.cfi_restore 6" } } */

==========

/* PR target/128270 */
/* { dg-do compile { target lp64 } } */
/* { dg-options "-O2 -mforce-drap -mtune-ctrl=^use_leave -fasynchronous-unwind
tables" } */

void use (void *);

int
f (void)
{
  char buf[64] __attribute__ ((aligned (32)));
  use (buf);
  return buf[0];
}

/* Same as pr128270-1.c, but exercising the "pop %rbp" epilogue path.  */
/* { dg-final { scan-assembler "\\.cfi_restore 6" } } */

==========

/* PR target/128270 */
/* { dg-do compile { target lp64 } } */
/* { dg-options "-O2 -mforce-drap
-mtune-ctrl=prologue_using_move,epilogue_using_move
-fasynchronous-unwind-tables" } */

void use (void *);

int
f (void)
{
  char buf[64] __attribute__ ((aligned (32)));
  asm volatile ("" ::: "rbx", "r12");
  use (buf);
  return buf[0];
}

/* Registers saved by moves in a DRAP frame use FP-relative expression
   rules, so they must be restored after "leave" as well.  */
/* { dg-final { scan-assembler "\\.cfi_restore 3" } } */
/* { dg-final { scan-assembler "\\.cfi_restore 12" } } */
/* { dg-final { scan-assembler "\\.cfi_restore 6" } } */

Reply via email to