gcc/testsuite/ChangeLog: * gcc.target/aarch64/eh_return-2.c: New test. * gcc.target/aarch64/eh_return-3.c: New test. --- gcc/testsuite/gcc.target/aarch64/eh_return-2.c | 9 +++++++++ gcc/testsuite/gcc.target/aarch64/eh_return-3.c | 14 ++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 gcc/testsuite/gcc.target/aarch64/eh_return-2.c create mode 100644 gcc/testsuite/gcc.target/aarch64/eh_return-3.c
diff --git a/gcc/testsuite/gcc.target/aarch64/eh_return-2.c b/gcc/testsuite/gcc.target/aarch64/eh_return-2.c new file mode 100644 index 00000000000..4a9d124e891 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/eh_return-2.c @@ -0,0 +1,9 @@ +/* { dg-do compile } */ +/* { dg-final { scan-assembler "add\tsp, sp, x5" } } */ +/* { dg-final { scan-assembler "br\tx6" } } */ + +void +foo (unsigned long off, void *handler) +{ + __builtin_eh_return (off, handler); +} diff --git a/gcc/testsuite/gcc.target/aarch64/eh_return-3.c b/gcc/testsuite/gcc.target/aarch64/eh_return-3.c new file mode 100644 index 00000000000..35989eee806 --- /dev/null +++ b/gcc/testsuite/gcc.target/aarch64/eh_return-3.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -mbranch-protection=pac-ret+leaf" } */ +/* { dg-final { scan-assembler "add\tsp, sp, x5" } } */ +/* { dg-final { scan-assembler "br\tx6" } } */ +/* { dg-final { scan-assembler "hint\t25 // paciasp" } } */ +/* { dg-final { scan-assembler "hint\t29 // autiasp" } } */ + +void +foo (unsigned long off, void *handler, int c) +{ + if (c) + return; + __builtin_eh_return (off, handler); +} -- 2.25.1