[AMDGPU] Remove s_wakeup_barrier instruction (#122277)
[llvm-project.git] / compiler-rt / test / builtins / Unit / trampoline_setup_test.c
blobd51d35acaa02f1c74dce37a2833118e21561a7fb
1 // RUN: %clang_builtins %s %librt -o %t && %run %t
2 // REQUIRES: librt_has_trampoline_setup
4 #include <stdio.h>
5 #include <string.h>
6 #include <stdint.h>
8 /*
9 * Tests nested functions
10 * The ppc and aarch64 compilers generates a call to __trampoline_setup
11 * The i386 and x86_64 compilers generate a call to ___enable_execute_stack
15 * Note that, nested functions are not ISO C and are not supported in Clang.
18 #if !defined(__clang__)
20 typedef int (*nested_func_t)(int x);
22 nested_func_t proc;
24 int main() {
25 /* Some locals */
26 int c = 10;
27 int d = 7;
29 /* Define a nested function: */
30 int bar(int x) { return x*5 + c*d; };
32 /* Assign global to point to nested function
33 * (really points to trampoline). */
34 proc = bar;
36 /* Invoke nested function: */
37 c = 4;
38 if ( (*proc)(3) != 43 )
39 return 1;
40 d = 5;
41 if ( (*proc)(4) != 40 )
42 return 1;
44 /* Success. */
45 return 0;
48 #else
50 int main() {
51 printf("skipped\n");
52 return 0;
55 #endif