1 // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=LINUX
2 // RUN: %clang_cc1 -triple x86_64-windows-pc -emit-llvm %s -o - | FileCheck %s --check-prefix=WINDOWS
3 int __attribute__((target("sse4.2"))) foo(int i
) { return 0; }
4 int __attribute__((target("arch=sandybridge"))) foo(int);
5 int __attribute__((target("arch=ivybridge"))) foo(int i
) {return 1;}
6 int __attribute__((target("default"))) foo(int i
) { return 2; }
8 typedef int (*FuncPtr
)(int);
17 return Free(1) + Free(2);
20 // LINUX: @foo.ifunc = weak_odr ifunc i32 (i32), ptr @foo.resolver
21 // LINUX: define{{.*}} i32 @foo.sse4.2(
23 // LINUX: define{{.*}} i32 @foo.arch_ivybridge(
25 // LINUX: define{{.*}} i32 @foo(
28 // WINDOWS: define dso_local i32 @foo.sse4.2(
30 // WINDOWS: define dso_local i32 @foo.arch_ivybridge(
32 // WINDOWS: define dso_local i32 @foo(
35 // LINUX: define{{.*}} i32 @bar()
36 // LINUX: call void @func(ptr noundef @foo.ifunc)
37 // LINUX: store ptr @foo.ifunc
38 // LINUX: store ptr @foo.ifunc
40 // WINDOWS: define dso_local i32 @bar()
41 // WINDOWS: call void @func(ptr noundef @foo.resolver)
42 // WINDOWS: store ptr @foo.resolver
43 // WINDOWS: store ptr @foo.resolver
45 // LINUX: declare i32 @foo.arch_sandybridge(
47 // WINDOWS: declare dso_local i32 @foo.arch_sandybridge(