template <class T>
__attribute__((noinline, noclone, noipa))
-T g1() { [[gnu::musttail]] return f<T>(); } /* { dg-error "target is not able" "" { target powerpc*-*-* } } */
+T g1() { [[gnu::musttail]] return f<T>(); } /* { dg-error "target is not able" "" { target { external_tail_call } } } */
template <class T>
__attribute__((noinline, noclone, noipa))
/* { dg-do compile { target { struct_tail_call } } } */
+/* { dg-require-effective-target external_tail_call } */
/* A lot of architectures will not build this due to PR115606 and PR115607 */
-/* { dg-skip-if "powerpc does not support sibcall to templates" { powerpc*-*-* } } */
/* { dg-options "-std=gnu++11" } */
/* { dg-additional-options "-fdelayed-branch" { target sparc*-*-* } } */
return [check_no_messages_and_pattern tail_call ",SIBCALL" rtl-expand {
__attribute__((__noipa__)) void foo (void) { }
__attribute__((__noipa__)) void bar (void) { foo(); }
- } {-O2 -fdump-rtl-expand-all}] ;# The "SIBCALL" note requires a detailed dump.
+ } {-fdump-rtl-expand-all}] ;# The "SIBCALL" note requires a detailed dump.
+}
+
+# Return 1 if the target can perform tail-calls for externals
+proc check_effective_target_external_tail_call { } {
+ return [check_no_messages_and_pattern tail_call ",SIBCALL" rtl-expand {
+ extern __attribute__((__noipa__)) void foo (void);
+ __attribute__((__noipa__)) void bar (void) { foo(); }
+ } {-fdump-rtl-expand-all}] ;# The "SIBCALL" note requires a detailed dump.
}
# Return 1 if the target can perform tail-call optimizations for structures
return [check_no_messages_and_pattern tail_call ",SIBCALL" rtl-expand {
// C++
struct foo { int a, b; };
- __attribute__((__noipa__)) struct foo foo (void) { return {}; }
+ extern __attribute__((__noipa__)) struct foo foo (void);
__attribute__((__noipa__)) struct foo bar (void) { return foo(); }
- } {-O2 -fdump-rtl-expand-all}] ;# The "SIBCALL" note requires a detailed dump.
+ } {-fdump-rtl-expand-all}] ;# The "SIBCALL" note requires a detailed dump.
}
# Return 1 if the target's calling sequence or its ABI