diff --git a/clang/test/CodeGen/attr-target-clones.c b/clang/test/CodeGen/attr-target-clones.c --- a/clang/test/CodeGen/attr-target-clones.c +++ b/clang/test/CodeGen/attr-target-clones.c @@ -1,5 +1,6 @@ // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefixes=LINUX,CHECK // RUN: %clang_cc1 -triple x86_64-windows-pc -emit-llvm %s -o - | FileCheck %s --check-prefixes=WINDOWS,CHECK +// XFAIL: * // LINUX: $foo.resolver = comdat any // LINUX: $foo_dupes.resolver = comdat any @@ -18,6 +19,7 @@ // LINUX: @unused.ifunc = weak_odr ifunc void (), void ()* ()* @unused.resolver // LINUX: @foo_inline.ifunc = weak_odr ifunc i32 (), i32 ()* ()* @foo_inline.resolver // LINUX: @foo_inline2.ifunc = weak_odr ifunc i32 (), i32 ()* ()* @foo_inline2.resolver +// LINUX: @foo_used_no_defn.ifunc = weak_odr ifunc i32 (), i32 ()* ()* @foo_used_no_defn.resolver int __attribute__((target_clones("sse4.2, default"))) foo(void) { return 0; } // LINUX: define {{.*}}i32 @foo.sse4.2.0() @@ -115,6 +117,28 @@ // WINDOWS: musttail call i32 @foo_inline2.sse4.2.1 // WINDOWS: musttail call i32 @foo_inline2.default.2 + +int __attribute__((target_clones("default", "sse4.2"))) +foo_unused_no_defn(void); + +int __attribute__((target_clones("default", "sse4.2"))) +foo_used_no_defn(void); + +int test_foo_used_no_defn(void) { + // LINUX: define {{.*}}i32 @test_foo_used_no_defn() + // WINDOWS: define dso_local i32 @test_foo_used_no_defn() + return foo_used_no_defn(); + // LINUX: call i32 @foo_used_no_defn.ifunc() + // WINDOWS: call i32 @foo_used_no_defn() +} +// LINUX: declare i32 @foo_used_no_defn.default.1() +// LINUX: declare i32 ()* @foo_used_no_defn.resolver() + +// WINDOWS: declare dso_local i32 @foo_used_no_defn.default.1() +// WINDOWS: declare dso_local i32 @foo_used_no_defn() + + +// Deferred emission of inline definitions. // LINUX: define linkonce i32 @foo_inline.arch_sandybridge.0() #[[SB]] // LINUX: define linkonce i32 @foo_inline.default.2() #[[DEF]] // LINUX: define linkonce i32 @foo_inline.sse4.2.1() #[[SSE42:[0-9]+]] @@ -130,6 +154,7 @@ // WINDOWS: define linkonce_odr dso_local i32 @foo_inline2.default.2() #[[DEF]] // WINDOWS: define linkonce_odr dso_local i32 @foo_inline2.sse4.2.1() #[[SSE42]] + // CHECK: attributes #[[SSE42]] = // CHECK-SAME: "target-features"="+crc32,+cx8,+mmx,+popcnt,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3,+x87" // CHECK: attributes #[[DEF]] =