[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / CodeGen / ifunc.c
blob895141914db65874cb5627818a92ce4e7be81d39
1 // RUN: %clang_cc1 -no-opaque-pointers -triple i386-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s
2 // RUN: %clang_cc1 -no-opaque-pointers -triple i386-unknown-linux-gnu -O2 -emit-llvm -o - %s | FileCheck %s
4 int foo(int) __attribute__ ((ifunc("foo_ifunc")));
6 static int f1(int i) {
7 return i + 1;
10 static int f2(int i) {
11 return i + 2;
14 typedef int (*foo_t)(int);
16 int global;
18 static foo_t foo_ifunc(void) {
19 return global ? f1 : f2;
22 int bar(void) {
23 return foo(1);
26 extern void goo(void);
28 void bar2(void) {
29 goo();
32 extern void goo(void) __attribute__ ((ifunc("goo_ifunc")));
34 void* goo_ifunc(void) {
35 return 0;
37 // CHECK: @foo = ifunc i32 (i32), i32 (i32)* ()* @foo_ifunc
38 // CHECK: @goo = ifunc void (), bitcast (i8* ()* @goo_ifunc to void ()* ()*)
40 // CHECK: call i32 @foo(i32
41 // CHECK: call void @goo()