diff options
Diffstat (limited to 'clang/test')
19 files changed, 516 insertions, 323 deletions
diff --git a/clang/test/CodeGen/attr-cpuspecific.c b/clang/test/CodeGen/attr-cpuspecific.c index 9150597..5baa271b 100644 --- a/clang/test/CodeGen/attr-cpuspecific.c +++ b/clang/test/CodeGen/attr-cpuspecific.c @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,LINUX +// RUN: %clang_cc1 -triple x86_64-apple-macosx -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,LINUX // RUN: %clang_cc1 -triple x86_64-windows-pc -fms-compatibility -emit-llvm -o - %s | FileCheck %s --check-prefixes=CHECK,WINDOWS #ifdef _WIN64 diff --git a/clang/test/CodeGen/attr-ifunc.c b/clang/test/CodeGen/attr-ifunc.c index 4f8fe13..2ad41ed 100644 --- a/clang/test/CodeGen/attr-ifunc.c +++ b/clang/test/CodeGen/attr-ifunc.c @@ -1,6 +1,7 @@ // RUN: %clang_cc1 -triple x86_64-windows -fsyntax-only -verify %s // RUN: %clang_cc1 -triple x86_64-linux -fsyntax-only -verify -emit-llvm-only -DCHECK_ALIASES %s // RUN: %clang_cc1 -triple x86_64-linux -fsyntax-only -verify -emit-llvm-only %s +// RUN: %clang_cc1 -triple x86_64-apple-macosx -fsyntax-only -verify -emit-llvm-only %s #if defined(_WIN32) void foo(void) {} @@ -36,6 +37,25 @@ void *f6_resolver(void) __attribute__((ifunc("f6_resolver_resolver"))); void f6(void) __attribute__((ifunc("f6_resolver"))); // expected-error@-1 {{ifunc must point to a defined function}} +#elif defined(__APPLE__) + +// NOTE: aliases are not supported on Darwin, so the above tests are not relevant. + +#define STR2(X) #X +#define STR(X) STR2(X) +#define PREFIX STR(__USER_LABEL_PREFIX__) + +void f1a(void) __asm("f1"); +void f1a(void) {} +// expected-note@-1 {{previous definition is here}} +void f1(void) __attribute__((ifunc(PREFIX "f1_ifunc"))) __asm("f1"); +// expected-error@-1 {{definition with same mangled name '<U+0001>f1' as another definition}} +void *f1_ifunc(void) { return 0; } + +void *f6_ifunc(int i); +void __attribute__((ifunc(PREFIX "f6_ifunc"))) f6(void) {} +// expected-error@-1 {{definition 'f6' cannot also be an ifunc}} + #else void f1a(void) __asm("f1"); void f1a(void) {} diff --git a/clang/test/CodeGen/attr-ifunc.cpp b/clang/test/CodeGen/attr-ifunc.cpp index 5b5b2c1..b6e342d 100644 --- a/clang/test/CodeGen/attr-ifunc.cpp +++ b/clang/test/CodeGen/attr-ifunc.cpp @@ -1,5 +1,9 @@ // RUN: %clang_cc1 -triple x86_64-linux -fsyntax-only -verify -emit-llvm-only %s +// RUN: %clang_cc1 -triple x86_64-apple-macosx -fsyntax-only -verify -emit-llvm-only %s +// RUN: %clang_cc1 -triple arm64-apple-macosx -fsyntax-only -verify -emit-llvm-only %s // RUN: not %clang_cc1 -triple x86_64-linux -emit-llvm-only -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s +// RUN: not %clang_cc1 -triple x86_64-apple-macosx -emit-llvm-only -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s +// RUN: not %clang_cc1 -triple arm64-apple-macosx -emit-llvm-only -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s void *f1_ifunc(void) { return nullptr; } void f1(void) __attribute__((ifunc("f1_ifunc"))); diff --git a/clang/test/CodeGen/attr-target-clones.c b/clang/test/CodeGen/attr-target-clones.c index 98ffea4..32d4d6f 100644 --- a/clang/test/CodeGen/attr-target-clones.c +++ b/clang/test/CodeGen/attr-target-clones.c @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefixes=LINUX,CHECK +// RUN: %clang_cc1 -triple x86_64-apple-macosx -emit-llvm %s -o - | FileCheck %s --check-prefixes=DARWIN,CHECK // RUN: %clang_cc1 -triple x86_64-windows-pc -emit-llvm %s -o - | FileCheck %s --check-prefixes=WINDOWS,CHECK // LINUX: $foo.resolver = comdat any @@ -7,6 +8,8 @@ // LINUX: $foo_inline.resolver = comdat any // LINUX: $foo_inline2.resolver = comdat any +// DARWIN-NOT: comdat any + // WINDOWS: $foo = comdat any // WINDOWS: $foo_dupes = comdat any // WINDOWS: $unused = comdat any @@ -16,6 +19,9 @@ // LINUX: @__cpu_model = external dso_local global { i32, i32, i32, [1 x i32] } // LINUX: @__cpu_features2 = external dso_local global [3 x i32] +// DARWIN: @__cpu_model = external dso_local global { i32, i32, i32, [1 x i32] } +// DARWIN: @__cpu_features2 = external dso_local global [3 x i32] + // LINUX: @internal.ifunc = internal ifunc i32 (), ptr @internal.resolver // LINUX: @foo.ifunc = weak_odr ifunc i32 (), ptr @foo.resolver // LINUX: @foo_dupes.ifunc = weak_odr ifunc void (), ptr @foo_dupes.resolver @@ -28,6 +34,7 @@ static int __attribute__((target_clones("sse4.2, default"))) internal(void) { re int use(void) { return internal(); } /// Internal linkage resolvers do not use comdat. // LINUX: define internal ptr @internal.resolver() { +// DARWIN: define internal ptr @internal.resolver() { // WINDOWS: define internal i32 @internal() { int __attribute__((target_clones("sse4.2, default"))) foo(void) { return 0; } @@ -37,6 +44,12 @@ int __attribute__((target_clones("sse4.2, default"))) foo(void) { return 0; } // LINUX: ret ptr @foo.sse4.2.0 // LINUX: ret ptr @foo.default.1 +// DARWIN: define {{.*}}i32 @foo.sse4.2.0() +// DARWIN: define {{.*}}i32 @foo.default.1() +// DARWIN: define weak_odr ptr @foo.resolver() { +// DARWIN: ret ptr @foo.sse4.2.0 +// DARWIN: ret ptr @foo.default.1 + // WINDOWS: define dso_local i32 @foo.sse4.2.0() // WINDOWS: define dso_local i32 @foo.default.1() // WINDOWS: define weak_odr dso_local i32 @foo() comdat @@ -50,6 +63,12 @@ __attribute__((target_clones("default,default ,sse4.2"))) void foo_dupes(void) { // LINUX: ret ptr @foo_dupes.sse4.2.0 // LINUX: ret ptr @foo_dupes.default.1 +// DARWIN: define {{.*}}void @foo_dupes.default.1() +// DARWIN: define {{.*}}void @foo_dupes.sse4.2.0() +// DARWIN: define weak_odr ptr @foo_dupes.resolver() { +// DARWIN: ret ptr @foo_dupes.sse4.2.0 +// DARWIN: ret ptr @foo_dupes.default.1 + // WINDOWS: define dso_local void @foo_dupes.default.1() // WINDOWS: define dso_local void @foo_dupes.sse4.2.0() // WINDOWS: define weak_odr dso_local void @foo_dupes() comdat @@ -58,17 +77,21 @@ __attribute__((target_clones("default,default ,sse4.2"))) void foo_dupes(void) { void bar2(void) { // LINUX: define {{.*}}void @bar2() + // DARWIN: define {{.*}}void @bar2() // WINDOWS: define dso_local void @bar2() foo_dupes(); // LINUX: call void @foo_dupes.ifunc() + // DARWIN: call void @foo_dupes.ifunc() // WINDOWS: call void @foo_dupes() } int bar(void) { // LINUX: define {{.*}}i32 @bar() #[[DEF:[0-9]+]] + // DARWIN: define {{.*}}i32 @bar() #[[DEF:[0-9]+]] // WINDOWS: define dso_local i32 @bar() #[[DEF:[0-9]+]] return foo(); // LINUX: call i32 @foo.ifunc() + // DARWIN: call i32 @foo.ifunc() // WINDOWS: call i32 @foo() } @@ -79,6 +102,12 @@ void __attribute__((target_clones("default, arch=ivybridge"))) unused(void) {} // LINUX: ret ptr @unused.arch_ivybridge.0 // LINUX: ret ptr @unused.default.1 +// DARWIN: define {{.*}}void @unused.default.1() +// DARWIN: define {{.*}}void @unused.arch_ivybridge.0() +// DARWIN: define weak_odr ptr @unused.resolver() { +// DARWIN: ret ptr @unused.arch_ivybridge.0 +// DARWIN: ret ptr @unused.default.1 + // WINDOWS: define dso_local void @unused.default.1() // WINDOWS: define dso_local void @unused.arch_ivybridge.0() // WINDOWS: define weak_odr dso_local void @unused() comdat @@ -93,10 +122,13 @@ foo_inline2(void); int bar3(void) { // LINUX: define {{.*}}i32 @bar3() + // DARWIN: define {{.*}}i32 @bar3() // WINDOWS: define dso_local i32 @bar3() return foo_inline() + foo_inline2(); // LINUX: call i32 @foo_inline.ifunc() // LINUX: call i32 @foo_inline2.ifunc() + // DARWIN: call i32 @foo_inline.ifunc() + // DARWIN: call i32 @foo_inline2.ifunc() // WINDOWS: call i32 @foo_inline() // WINDOWS: call i32 @foo_inline2() } @@ -106,6 +138,11 @@ int bar3(void) { // LINUX: ret ptr @foo_inline.sse4.2.1 // LINUX: ret ptr @foo_inline.default.2 +// DARWIN: define weak_odr ptr @foo_inline.resolver() { +// DARWIN: ret ptr @foo_inline.arch_sandybridge.0 +// DARWIN: ret ptr @foo_inline.sse4.2.1 +// DARWIN: ret ptr @foo_inline.default.2 + // WINDOWS: define weak_odr dso_local i32 @foo_inline() comdat // WINDOWS: musttail call i32 @foo_inline.arch_sandybridge.0 // WINDOWS: musttail call i32 @foo_inline.sse4.2.1 @@ -118,6 +155,11 @@ foo_inline2(void){ return 0; } // LINUX: ret ptr @foo_inline2.sse4.2.1 // LINUX: ret ptr @foo_inline2.default.2 +// DARWIN: define weak_odr ptr @foo_inline2.resolver() { +// DARWIN: ret ptr @foo_inline2.arch_sandybridge.0 +// DARWIN: ret ptr @foo_inline2.sse4.2.1 +// DARWIN: ret ptr @foo_inline2.default.2 + // WINDOWS: define weak_odr dso_local i32 @foo_inline2() comdat // WINDOWS: musttail call i32 @foo_inline2.arch_sandybridge.0 // WINDOWS: musttail call i32 @foo_inline2.sse4.2.1 @@ -132,9 +174,11 @@ foo_used_no_defn(void); int test_foo_used_no_defn(void) { // LINUX: define {{.*}}i32 @test_foo_used_no_defn() + // DARWIN: 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() + // DARWIN: call i32 @foo_used_no_defn.ifunc() // WINDOWS: call i32 @foo_used_no_defn() } @@ -143,6 +187,10 @@ int test_foo_used_no_defn(void) { // LINUX: ret ptr @foo_used_no_defn.sse4.2.0 // LINUX: ret ptr @foo_used_no_defn.default.1 +// DARWIN: define weak_odr ptr @foo_used_no_defn.resolver() { +// DARWIN: ret ptr @foo_used_no_defn.sse4.2.0 +// DARWIN: ret ptr @foo_used_no_defn.default.1 + // WINDOWS: define weak_odr dso_local i32 @foo_used_no_defn() comdat // WINDOWS: musttail call i32 @foo_used_no_defn.sse4.2.0 // WINDOWS: musttail call i32 @foo_used_no_defn.default.1 @@ -170,12 +218,37 @@ int isa_level(int) { return 0; } // LINUX: ret ptr @isa_level.arch_x86-64.0 // LINUX: ret ptr @isa_level.default.4 +// DARWIN: define{{.*}} i32 @isa_level.default.4( +// DARWIN: define{{.*}} i32 @isa_level.arch_x86-64.0( +// DARWIN: define{{.*}} i32 @isa_level.arch_x86-64-v2.1( +// DARWIN: define{{.*}} i32 @isa_level.arch_x86-64-v3.2( +// DARWIN: define{{.*}} i32 @isa_level.arch_x86-64-v4.3( +// DARWIN: define weak_odr ptr @isa_level.resolver() { +// DARWIN: call void @__cpu_indicator_init() +// DARWIN-NEXT: load i32, ptr getelementptr inbounds ([3 x i32], ptr @__cpu_features2, i32 0, i32 2) +// DARWIN-NEXT: and i32 %[[#]], 4 +// DARWIN: ret ptr @isa_level.arch_x86-64-v4.3 +// DARWIN: load i32, ptr getelementptr inbounds ([3 x i32], ptr @__cpu_features2, i32 0, i32 2) +// DARWIN-NEXT: and i32 %[[#]], 2 +// DARWIN: ret ptr @isa_level.arch_x86-64-v3.2 +// DARWIN: load i32, ptr getelementptr inbounds ([3 x i32], ptr @__cpu_features2, i32 0, i32 2) +// DARWIN-NEXT: and i32 %[[#]], 1 +// DARWIN: ret ptr @isa_level.arch_x86-64-v2.1 +// DARWIN: load i32, ptr getelementptr inbounds ([3 x i32], ptr @__cpu_features2, i32 0, i32 1) +// DARWIN-NEXT: and i32 %[[#]], -2147483648 +// DARWIN: ret ptr @isa_level.arch_x86-64.0 +// DARWIN: ret ptr @isa_level.default.4 + // Deferred emission of inline definitions. // LINUX: define linkonce i32 @foo_inline.arch_sandybridge.0() #[[SB:[0-9]+]] // LINUX: define linkonce i32 @foo_inline.default.2() #[[DEF:[0-9]+]] // LINUX: define linkonce i32 @foo_inline.sse4.2.1() #[[SSE42:[0-9]+]] +// DARWIN: define linkonce i32 @foo_inline.arch_sandybridge.0() #[[SB:[0-9]+]] +// DARWIN: define linkonce i32 @foo_inline.default.2() #[[DEF:[0-9]+]] +// DARWIN: define linkonce i32 @foo_inline.sse4.2.1() #[[SSE42:[0-9]+]] + // WINDOWS: define linkonce_odr dso_local i32 @foo_inline.arch_sandybridge.0() #[[SB:[0-9]+]] // WINDOWS: define linkonce_odr dso_local i32 @foo_inline.default.2() #[[DEF]] // WINDOWS: define linkonce_odr dso_local i32 @foo_inline.sse4.2.1() #[[SSE42:[0-9]+]] @@ -185,6 +258,10 @@ int isa_level(int) { return 0; } // LINUX: define linkonce i32 @foo_inline2.default.2() #[[DEF]] // LINUX: define linkonce i32 @foo_inline2.sse4.2.1() #[[SSE42]] +// DARWIN: define linkonce i32 @foo_inline2.arch_sandybridge.0() #[[SB]] +// DARWIN: define linkonce i32 @foo_inline2.default.2() #[[DEF]] +// DARWIN: define linkonce i32 @foo_inline2.sse4.2.1() #[[SSE42]] + // WINDOWS: define linkonce_odr dso_local i32 @foo_inline2.arch_sandybridge.0() #[[SB]] // 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]] @@ -193,6 +270,9 @@ int isa_level(int) { return 0; } // LINUX: declare i32 @foo_used_no_defn.default.1() // LINUX: declare i32 @foo_used_no_defn.sse4.2.0() +// DARWIN: declare i32 @foo_used_no_defn.default.1() +// DARWIN: declare i32 @foo_used_no_defn.sse4.2.0() + // WINDOWS: declare dso_local i32 @foo_used_no_defn.default.1() // WINDOWS: declare dso_local i32 @foo_used_no_defn.sse4.2.0() diff --git a/clang/test/CodeGen/attr-target-mv-func-ptrs.c b/clang/test/CodeGen/attr-target-mv-func-ptrs.c index b5f3a1b..7792ca5 100644 --- a/clang/test/CodeGen/attr-target-mv-func-ptrs.c +++ b/clang/test/CodeGen/attr-target-mv-func-ptrs.c @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=LINUX +// RUN: %clang_cc1 -triple x86_64-apple-macosx -emit-llvm %s -o - | FileCheck %s --check-prefix=LINUX // RUN: %clang_cc1 -triple x86_64-windows-pc -emit-llvm %s -o - | FileCheck %s --check-prefix=WINDOWS int __attribute__((target("sse4.2"))) foo(int i) { return 0; } int __attribute__((target("arch=sandybridge"))) foo(int); diff --git a/clang/test/CodeGen/attr-target-mv-va-args.c b/clang/test/CodeGen/attr-target-mv-va-args.c index 96821c6..dbf5a74 100644 --- a/clang/test/CodeGen/attr-target-mv-va-args.c +++ b/clang/test/CodeGen/attr-target-mv-va-args.c @@ -3,6 +3,7 @@ // RUN: %clang_cc1 -triple x86_64-windows-pc -emit-llvm %s -o - | FileCheck %s --check-prefixes=NO-IFUNC,WINDOWS // RUN: %clang_cc1 -triple x86_64-linux-musl -emit-llvm %s -o - | FileCheck %s --check-prefixes=NO-IFUNC,NO-IFUNC-ELF // RUN: %clang_cc1 -triple x86_64-fuchsia -emit-llvm %s -o - | FileCheck %s --check-prefixes=NO-IFUNC,NO-IFUNC-ELF +// RUN: %clang_cc1 -triple x86_64-apple-macho -emit-llvm %s -o - | FileCheck %s --check-prefix=IFUNC-MACHO int __attribute__((target("sse4.2"))) foo(int i, ...) { return 0; } int __attribute__((target("arch=sandybridge"))) foo(int i, ...); int __attribute__((target("arch=ivybridge"))) foo(int i, ...) {return 1;} @@ -30,6 +31,24 @@ int bar(void) { // IFUNC-ELF: ret ptr @foo // IFUNC-ELF: declare i32 @foo.arch_sandybridge(i32 noundef, ...) +// IFUNC-MACHO: @foo.ifunc = weak_odr ifunc i32 (i32, ...), ptr @foo.resolver +// IFUNC-MACHO: define{{.*}} i32 @foo.sse4.2(i32 noundef %i, ...) +// IFUNC-MACHO: ret i32 0 +// IFUNC-MACHO: define{{.*}} i32 @foo.arch_ivybridge(i32 noundef %i, ...) +// IFUNC-MACHO: ret i32 1 +// IFUNC-MACHO: define{{.*}} i32 @foo(i32 noundef %i, ...) +// IFUNC-MACHO: ret i32 2 +// IFUNC-MACHO: define{{.*}} i32 @bar() +// IFUNC-MACHO: call i32 (i32, ...) @foo.ifunc(i32 noundef 1, i32 noundef 97, double +// IFUNC-MACHO: call i32 (i32, ...) @foo.ifunc(i32 noundef 2, double noundef 2.2{{[0-9Ee+]+}}, ptr noundef + +// IFUNC-MACHO: define weak_odr ptr @foo.resolver() +// IFUNC-MACHO: ret ptr @foo.arch_sandybridge +// IFUNC-MACHO: ret ptr @foo.arch_ivybridge +// IFUNC-MACHO: ret ptr @foo.sse4.2 +// IFUNC-MACHO: ret ptr @foo +// IFUNC-MACHO: declare i32 @foo.arch_sandybridge(i32 noundef, ...) + // NO-IFUNC: define dso_local i32 @foo.sse4.2(i32 noundef %i, ...) // NO-IFUNC: ret i32 0 // NO-IFUNC: define dso_local i32 @foo.arch_ivybridge(i32 noundef %i, ...) diff --git a/clang/test/CodeGen/attr-target-mv.c b/clang/test/CodeGen/attr-target-mv.c index bdf8c49..67d57b7 100644 --- a/clang/test/CodeGen/attr-target-mv.c +++ b/clang/test/CodeGen/attr-target-mv.c @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=LINUX +// RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefixes=ITANIUM,LINUX +// RUN: %clang_cc1 -triple x86_64-apple-macosx -emit-llvm %s -o - | FileCheck %s --check-prefixes=ITANIUM,DARWIN // RUN: %clang_cc1 -triple x86_64-windows-pc -emit-llvm %s -o - | FileCheck %s --check-prefix=WINDOWS int __attribute__((target("sse4.2"))) foo(void) { return 0; } @@ -107,6 +108,8 @@ void calls_pr50025c(void) { pr50025c(); } // LINUX: $pr50025c.resolver = comdat any // LINUX: $pr50025b.resolver = comdat any +// DARWIN-NOT: comdat + // WINDOWS: $foo.resolver = comdat any // WINDOWS: $foo_inline.resolver = comdat any // WINDOWS: $foo_decls.resolver = comdat any @@ -133,73 +136,74 @@ void calls_pr50025c(void) { pr50025c(); } // LINUX: @llvm.compiler.used = appending global [2 x ptr] [ptr @foo_used, ptr @foo_used2.avx_sse4.2], section "llvm.metadata" +// DARWIN: @llvm.used = appending global [2 x ptr] [ptr @foo_used, ptr @foo_used2.avx_sse4.2], section "llvm.metadata" // WINDOWS: @llvm.used = appending global [2 x ptr] [ptr @foo_used, ptr @foo_used2.avx_sse4.2], section "llvm.metadata" -// LINUX: @foo.ifunc = weak_odr ifunc i32 (), ptr @foo.resolver -// LINUX: @foo_internal.ifunc = internal ifunc i32 (), ptr @foo_internal.resolver -// LINUX: @foo_inline.ifunc = weak_odr ifunc i32 (), ptr @foo_inline.resolver -// LINUX: @foo_decls.ifunc = weak_odr ifunc void (), ptr @foo_decls.resolver -// LINUX: @foo_multi.ifunc = weak_odr ifunc void (i32, double), ptr @foo_multi.resolver -// LINUX: @fwd_decl_default.ifunc = weak_odr ifunc i32 (), ptr @fwd_decl_default.resolver -// LINUX: @fwd_decl_avx.ifunc = weak_odr ifunc i32 (), ptr @fwd_decl_avx.resolver - -// LINUX: define{{.*}} i32 @foo.sse4.2() -// LINUX: ret i32 0 -// LINUX: define{{.*}} i32 @foo.arch_ivybridge() -// LINUX: ret i32 1 -// LINUX: define{{.*}} i32 @foo.arch_goldmont() -// LINUX: ret i32 3 -// LINUX: define{{.*}} i32 @foo.arch_goldmont-plus() -// LINUX: ret i32 4 -// LINUX: define{{.*}} i32 @foo.arch_tremont() -// LINUX: ret i32 5 -// LINUX: define{{.*}} i32 @foo.arch_icelake-client() -// LINUX: ret i32 6 -// LINUX: define{{.*}} i32 @foo.arch_icelake-server() -// LINUX: ret i32 7 -// LINUX: define{{.*}} i32 @foo.arch_cooperlake() -// LINUX: ret i32 8 -// LINUX: define{{.*}} i32 @foo.arch_tigerlake() -// LINUX: ret i32 9 -// LINUX: define{{.*}} i32 @foo.arch_sapphirerapids() -// LINUX: ret i32 10 -// LINUX: define{{.*}} i32 @foo.arch_alderlake() -// LINUX: ret i32 11 -// LINUX: define{{.*}} i32 @foo.arch_rocketlake() -// LINUX: ret i32 12 -// LINUX: define{{.*}} i32 @foo.arch_core2() -// LINUX: ret i32 13 -// LINUX: define{{.*}} i32 @foo.arch_raptorlake() -// LINUX: ret i32 14 -// LINUX: define{{.*}} i32 @foo.arch_meteorlake() -// LINUX: ret i32 15 -// LINUX: define{{.*}} i32 @foo.arch_sierraforest() -// LINUX: ret i32 16 -// LINUX: define{{.*}} i32 @foo.arch_grandridge() -// LINUX: ret i32 17 -// LINUX: define{{.*}} i32 @foo.arch_graniterapids() -// LINUX: ret i32 18 -// LINUX: define{{.*}} i32 @foo.arch_emeraldrapids() -// LINUX: ret i32 19 -// LINUX: define{{.*}} i32 @foo.arch_graniterapids-d() -// LINUX: ret i32 20 -// LINUX: define{{.*}} i32 @foo.arch_arrowlake() -// LINUX: ret i32 21 -// LINUX: define{{.*}} i32 @foo.arch_arrowlake-s() -// LINUX: ret i32 22 -// LINUX: define{{.*}} i32 @foo.arch_lunarlake() -// LINUX: ret i32 23 -// LINUX: define{{.*}} i32 @foo.arch_gracemont() -// LINUX: ret i32 24 -// LINUX: define{{.*}} i32 @foo.arch_pantherlake() -// LINUX: ret i32 25 -// LINUX: define{{.*}} i32 @foo.arch_clearwaterforest() -// LINUX: ret i32 26 -// LINUX: define{{.*}} i32 @foo() -// LINUX: ret i32 2 -// LINUX: define{{.*}} i32 @bar() -// LINUX: call i32 @foo.ifunc() +// ITANIUM: @foo.ifunc = weak_odr ifunc i32 (), ptr @foo.resolver +// ITANIUM: @foo_internal.ifunc = internal ifunc i32 (), ptr @foo_internal.resolver +// ITANIUM: @foo_inline.ifunc = weak_odr ifunc i32 (), ptr @foo_inline.resolver +// ITANIUM: @foo_decls.ifunc = weak_odr ifunc void (), ptr @foo_decls.resolver +// ITANIUM: @foo_multi.ifunc = weak_odr ifunc void (i32, double), ptr @foo_multi.resolver +// ITANIUM: @fwd_decl_default.ifunc = weak_odr ifunc i32 (), ptr @fwd_decl_default.resolver +// ITANIUM: @fwd_decl_avx.ifunc = weak_odr ifunc i32 (), ptr @fwd_decl_avx.resolver + +// ITANIUM: define{{.*}} i32 @foo.sse4.2() +// ITANIUM: ret i32 0 +// ITANIUM: define{{.*}} i32 @foo.arch_ivybridge() +// ITANIUM: ret i32 1 +// ITANIUM: define{{.*}} i32 @foo.arch_goldmont() +// ITANIUM: ret i32 3 +// ITANIUM: define{{.*}} i32 @foo.arch_goldmont-plus() +// ITANIUM: ret i32 4 +// ITANIUM: define{{.*}} i32 @foo.arch_tremont() +// ITANIUM: ret i32 5 +// ITANIUM: define{{.*}} i32 @foo.arch_icelake-client() +// ITANIUM: ret i32 6 +// ITANIUM: define{{.*}} i32 @foo.arch_icelake-server() +// ITANIUM: ret i32 7 +// ITANIUM: define{{.*}} i32 @foo.arch_cooperlake() +// ITANIUM: ret i32 8 +// ITANIUM: define{{.*}} i32 @foo.arch_tigerlake() +// ITANIUM: ret i32 9 +// ITANIUM: define{{.*}} i32 @foo.arch_sapphirerapids() +// ITANIUM: ret i32 10 +// ITANIUM: define{{.*}} i32 @foo.arch_alderlake() +// ITANIUM: ret i32 11 +// ITANIUM: define{{.*}} i32 @foo.arch_rocketlake() +// ITANIUM: ret i32 12 +// ITANIUM: define{{.*}} i32 @foo.arch_core2() +// ITANIUM: ret i32 13 +// ITANIUM: define{{.*}} i32 @foo.arch_raptorlake() +// ITANIUM: ret i32 14 +// ITANIUM: define{{.*}} i32 @foo.arch_meteorlake() +// ITANIUM: ret i32 15 +// ITANIUM: define{{.*}} i32 @foo.arch_sierraforest() +// ITANIUM: ret i32 16 +// ITANIUM: define{{.*}} i32 @foo.arch_grandridge() +// ITANIUM: ret i32 17 +// ITANIUM: define{{.*}} i32 @foo.arch_graniterapids() +// ITANIUM: ret i32 18 +// ITANIUM: define{{.*}} i32 @foo.arch_emeraldrapids() +// ITANIUM: ret i32 19 +// ITANIUM: define{{.*}} i32 @foo.arch_graniterapids-d() +// ITANIUM: ret i32 20 +// ITANIUM: define{{.*}} i32 @foo.arch_arrowlake() +// ITANIUM: ret i32 21 +// ITANIUM: define{{.*}} i32 @foo.arch_arrowlake-s() +// ITANIUM: ret i32 22 +// ITANIUM: define{{.*}} i32 @foo.arch_lunarlake() +// ITANIUM: ret i32 23 +// ITANIUM: define{{.*}} i32 @foo.arch_gracemont() +// ITANIUM: ret i32 24 +// ITANIUM: define{{.*}} i32 @foo.arch_pantherlake() +// ITANIUM: ret i32 25 +// ITANIUM: define{{.*}} i32 @foo.arch_clearwaterforest() +// ITANIUM: ret i32 26 +// ITANIUM: define{{.*}} i32 @foo() +// ITANIUM: ret i32 2 +// ITANIUM: define{{.*}} i32 @bar() +// ITANIUM: call i32 @foo.ifunc() // WINDOWS: define dso_local i32 @foo.sse4.2() // WINDOWS: ret i32 0 @@ -258,12 +262,13 @@ void calls_pr50025c(void) { pr50025c(); } // WINDOWS: define dso_local i32 @bar() // WINDOWS: call i32 @foo.resolver() -// LINUX: define weak_odr ptr @foo.resolver() comdat -// LINUX: call void @__cpu_indicator_init() -// LINUX: ret ptr @foo.arch_sandybridge -// LINUX: ret ptr @foo.arch_ivybridge -// LINUX: ret ptr @foo.sse4.2 -// LINUX: ret ptr @foo +// ITANIUM: define weak_odr ptr @foo.resolver() +// LINUX-SAME: comdat +// ITANIUM: call void @__cpu_indicator_init() +// ITANIUM: ret ptr @foo.arch_sandybridge +// ITANIUM: ret ptr @foo.arch_ivybridge +// ITANIUM: ret ptr @foo.sse4.2 +// ITANIUM: ret ptr @foo // WINDOWS: define weak_odr dso_local i32 @foo.resolver() comdat // WINDOWS: call void @__cpu_indicator_init() @@ -273,22 +278,23 @@ void calls_pr50025c(void) { pr50025c(); } // WINDOWS: call i32 @foo /// Internal linkage resolvers do not use comdat. -// LINUX: define internal ptr @foo_internal.resolver() { +// ITANIUM: define internal ptr @foo_internal.resolver() { // WINDOWS: define internal i32 @foo_internal.resolver() { -// LINUX: define{{.*}} i32 @bar2() -// LINUX: call i32 @foo_inline.ifunc() +// ITANIUM: define{{.*}} i32 @bar2() +// ITANIUM: call i32 @foo_inline.ifunc() // WINDOWS: define dso_local i32 @bar2() // WINDOWS: call i32 @foo_inline.resolver() -// LINUX: define weak_odr ptr @foo_inline.resolver() comdat -// LINUX: call void @__cpu_indicator_init() -// LINUX: ret ptr @foo_inline.arch_sandybridge -// LINUX: ret ptr @foo_inline.arch_ivybridge -// LINUX: ret ptr @foo_inline.sse4.2 -// LINUX: ret ptr @foo_inline +// ITANIUM: define weak_odr ptr @foo_inline.resolver() +// LINUX-SAME: comdat +// ITANIUM: call void @__cpu_indicator_init() +// ITANIUM: ret ptr @foo_inline.arch_sandybridge +// ITANIUM: ret ptr @foo_inline.arch_ivybridge +// ITANIUM: ret ptr @foo_inline.sse4.2 +// ITANIUM: ret ptr @foo_inline // WINDOWS: define weak_odr dso_local i32 @foo_inline.resolver() comdat // WINDOWS: call void @__cpu_indicator_init() @@ -297,38 +303,40 @@ void calls_pr50025c(void) { pr50025c(); } // WINDOWS: call i32 @foo_inline.sse4.2 // WINDOWS: call i32 @foo_inline -// LINUX: define{{.*}} void @bar3() -// LINUX: call void @foo_decls.ifunc() +// ITANIUM: define{{.*}} void @bar3() +// ITANIUM: call void @foo_decls.ifunc() // WINDOWS: define dso_local void @bar3() // WINDOWS: call void @foo_decls.resolver() -// LINUX: define weak_odr ptr @foo_decls.resolver() comdat -// LINUX: ret ptr @foo_decls.sse4.2 -// LINUX: ret ptr @foo_decls +// ITANIUM: define weak_odr ptr @foo_decls.resolver() +// LINUX-SAME: comdat +// ITANIUM: ret ptr @foo_decls.sse4.2 +// ITANIUM: ret ptr @foo_decls // WINDOWS: define weak_odr dso_local void @foo_decls.resolver() comdat // WINDOWS: call void @foo_decls.sse4.2 // WINDOWS: call void @foo_decls -// LINUX: define{{.*}} void @bar4() -// LINUX: call void @foo_multi.ifunc(i32 noundef 1, double noundef 5.{{[0+e]*}}) +// ITANIUM: define{{.*}} void @bar4() +// ITANIUM: call void @foo_multi.ifunc(i32 noundef 1, double noundef 5.{{[0+e]*}}) // WINDOWS: define dso_local void @bar4() // WINDOWS: call void @foo_multi.resolver(i32 noundef 1, double noundef 5.{{[0+e]*}}) -// LINUX: define weak_odr ptr @foo_multi.resolver() comdat -// LINUX: and i32 %{{.*}}, 4352 -// LINUX: icmp eq i32 %{{.*}}, 4352 -// LINUX: ret ptr @foo_multi.fma4_sse4.2 -// LINUX: icmp eq i32 %{{.*}}, 12 -// LINUX: and i32 %{{.*}}, 4352 -// LINUX: icmp eq i32 %{{.*}}, 4352 -// LINUX: ret ptr @foo_multi.arch_ivybridge_fma4_sse4.2 -// LINUX: and i32 %{{.*}}, 768 -// LINUX: icmp eq i32 %{{.*}}, 768 -// LINUX: ret ptr @foo_multi.avx_sse4.2 -// LINUX: ret ptr @foo_multi +// ITANIUM: define weak_odr ptr @foo_multi.resolver() +// LINUX-SAME: comdat +// ITANIUM: and i32 %{{.*}}, 4352 +// ITANIUM: icmp eq i32 %{{.*}}, 4352 +// ITANIUM: ret ptr @foo_multi.fma4_sse4.2 +// ITANIUM: icmp eq i32 %{{.*}}, 12 +// ITANIUM: and i32 %{{.*}}, 4352 +// ITANIUM: icmp eq i32 %{{.*}}, 4352 +// ITANIUM: ret ptr @foo_multi.arch_ivybridge_fma4_sse4.2 +// ITANIUM: and i32 %{{.*}}, 768 +// ITANIUM: icmp eq i32 %{{.*}}, 768 +// ITANIUM: ret ptr @foo_multi.avx_sse4.2 +// ITANIUM: ret ptr @foo_multi // WINDOWS: define weak_odr dso_local void @foo_multi.resolver(i32 %0, double %1) comdat // WINDOWS: and i32 %{{.*}}, 4352 @@ -347,12 +355,12 @@ void calls_pr50025c(void) { pr50025c(); } // WINDOWS: call void @foo_multi(i32 %0, double %1) // WINDOWS-NEXT: ret void -// LINUX: define{{.*}} i32 @fwd_decl_default() -// LINUX: ret i32 2 -// LINUX: define{{.*}} i32 @fwd_decl_avx.avx() -// LINUX: ret i32 2 -// LINUX: define{{.*}} i32 @fwd_decl_avx() -// LINUX: ret i32 2 +// ITANIUM: define{{.*}} i32 @fwd_decl_default() +// ITANIUM: ret i32 2 +// ITANIUM: define{{.*}} i32 @fwd_decl_avx.avx() +// ITANIUM: ret i32 2 +// ITANIUM: define{{.*}} i32 @fwd_decl_avx() +// ITANIUM: ret i32 2 // WINDOWS: define dso_local i32 @fwd_decl_default() // WINDOWS: ret i32 2 @@ -361,21 +369,23 @@ void calls_pr50025c(void) { pr50025c(); } // WINDOWS: define dso_local i32 @fwd_decl_avx() // WINDOWS: ret i32 2 -// LINUX: define{{.*}} void @bar5() -// LINUX: call i32 @fwd_decl_default.ifunc() -// LINUX: call i32 @fwd_decl_avx.ifunc() +// ITANIUM: define{{.*}} void @bar5() +// ITANIUM: call i32 @fwd_decl_default.ifunc() +// ITANIUM: call i32 @fwd_decl_avx.ifunc() // WINDOWS: define dso_local void @bar5() // WINDOWS: call i32 @fwd_decl_default.resolver() // WINDOWS: call i32 @fwd_decl_avx.resolver() -// LINUX: define weak_odr ptr @fwd_decl_default.resolver() comdat -// LINUX: call void @__cpu_indicator_init() -// LINUX: ret ptr @fwd_decl_default -// LINUX: define weak_odr ptr @fwd_decl_avx.resolver() comdat -// LINUX: call void @__cpu_indicator_init() -// LINUX: ret ptr @fwd_decl_avx.avx -// LINUX: ret ptr @fwd_decl_avx +// ITANIUM: define weak_odr ptr @fwd_decl_default.resolver() +// LINUX-SAME: comdat +// ITANIUM: call void @__cpu_indicator_init() +// ITANIUM: ret ptr @fwd_decl_default +// ITANIUM: define weak_odr ptr @fwd_decl_avx.resolver() +// LINUX-SAME: comdat +// ITANIUM: call void @__cpu_indicator_init() +// ITANIUM: ret ptr @fwd_decl_avx.avx +// ITANIUM: ret ptr @fwd_decl_avx // WINDOWS: define weak_odr dso_local i32 @fwd_decl_default.resolver() comdat // WINDOWS: call void @__cpu_indicator_init() @@ -385,55 +395,55 @@ void calls_pr50025c(void) { pr50025c(); } // WINDOWS: call i32 @fwd_decl_avx.avx // WINDOWS: call i32 @fwd_decl_avx -// LINUX: define{{.*}} i32 @changed_to_mv.avx() -// LINUX: define{{.*}} i32 @changed_to_mv.fma4() +// ITANIUM: define{{.*}} i32 @changed_to_mv.avx() +// ITANIUM: define{{.*}} i32 @changed_to_mv.fma4() // WINDOWS: define dso_local i32 @changed_to_mv.avx() // WINDOWS: define dso_local i32 @changed_to_mv.fma4() -// LINUX: define linkonce void @foo_used(i32 noundef %{{.*}}, double noundef %{{.*}}) -// LINUX-NOT: @foo_used.avx_sse4.2( -// LINUX-NOT: @foo_used2( -// LINUX: define linkonce void @foo_used2.avx_sse4.2(i32 noundef %{{.*}}, double noundef %{{.*}}) +// ITANIUM: define linkonce void @foo_used(i32 noundef %{{.*}}, double noundef %{{.*}}) +// ITANIUM-NOT: @foo_used.avx_sse4.2( +// ITANIUM-NOT: @foo_used2( +// ITANIUM: define linkonce void @foo_used2.avx_sse4.2(i32 noundef %{{.*}}, double noundef %{{.*}}) // WINDOWS: define linkonce_odr dso_local void @foo_used(i32 noundef %{{.*}}, double noundef %{{.*}}) // WINDOWS-NOT: @foo_used.avx_sse4.2( // WINDOWS-NOT: @foo_used2( // WINDOWS: define linkonce_odr dso_local void @foo_used2.avx_sse4.2(i32 noundef %{{.*}}, double noundef %{{.*}}) -// LINUX: declare i32 @foo.arch_sandybridge() +// ITANIUM: declare i32 @foo.arch_sandybridge() // WINDOWS: declare dso_local i32 @foo.arch_sandybridge() -// LINUX: define linkonce i32 @foo_inline.sse4.2() -// LINUX: ret i32 0 +// ITANIUM: define linkonce i32 @foo_inline.sse4.2() +// ITANIUM: ret i32 0 // WINDOWS: define linkonce_odr dso_local i32 @foo_inline.sse4.2() // WINDOWS: ret i32 0 -// LINUX: declare i32 @foo_inline.arch_sandybridge() +// ITANIUM: declare i32 @foo_inline.arch_sandybridge() // WINDOWS: declare dso_local i32 @foo_inline.arch_sandybridge() -// LINUX: define linkonce i32 @foo_inline.arch_ivybridge() -// LINUX: ret i32 1 -// LINUX: define linkonce i32 @foo_inline() -// LINUX: ret i32 2 +// ITANIUM: define linkonce i32 @foo_inline.arch_ivybridge() +// ITANIUM: ret i32 1 +// ITANIUM: define linkonce i32 @foo_inline() +// ITANIUM: ret i32 2 // WINDOWS: define linkonce_odr dso_local i32 @foo_inline.arch_ivybridge() // WINDOWS: ret i32 1 // WINDOWS: define linkonce_odr dso_local i32 @foo_inline() // WINDOWS: ret i32 2 -// LINUX: define linkonce void @foo_decls() -// LINUX: define linkonce void @foo_decls.sse4.2() +// ITANIUM: define linkonce void @foo_decls() +// ITANIUM: define linkonce void @foo_decls.sse4.2() // WINDOWS: define linkonce_odr dso_local void @foo_decls() // WINDOWS: define linkonce_odr dso_local void @foo_decls.sse4.2() -// LINUX: define linkonce void @foo_multi(i32 noundef %{{[^,]+}}, double noundef %{{[^\)]+}}) -// LINUX: define linkonce void @foo_multi.avx_sse4.2(i32 noundef %{{[^,]+}}, double noundef %{{[^\)]+}}) -// LINUX: define linkonce void @foo_multi.fma4_sse4.2(i32 noundef %{{[^,]+}}, double noundef %{{[^\)]+}}) -// LINUX: define linkonce void @foo_multi.arch_ivybridge_fma4_sse4.2(i32 noundef %{{[^,]+}}, double noundef %{{[^\)]+}}) +// ITANIUM: define linkonce void @foo_multi(i32 noundef %{{[^,]+}}, double noundef %{{[^\)]+}}) +// ITANIUM: define linkonce void @foo_multi.avx_sse4.2(i32 noundef %{{[^,]+}}, double noundef %{{[^\)]+}}) +// ITANIUM: define linkonce void @foo_multi.fma4_sse4.2(i32 noundef %{{[^,]+}}, double noundef %{{[^\)]+}}) +// ITANIUM: define linkonce void @foo_multi.arch_ivybridge_fma4_sse4.2(i32 noundef %{{[^,]+}}, double noundef %{{[^\)]+}}) // WINDOWS: define linkonce_odr dso_local void @foo_multi(i32 noundef %{{[^,]+}}, double noundef %{{[^\)]+}}) // WINDOWS: define linkonce_odr dso_local void @foo_multi.avx_sse4.2(i32 noundef %{{[^,]+}}, double noundef %{{[^\)]+}}) @@ -441,22 +451,23 @@ void calls_pr50025c(void) { pr50025c(); } // WINDOWS: define linkonce_odr dso_local void @foo_multi.arch_ivybridge_fma4_sse4.2(i32 noundef %{{[^,]+}}, double noundef %{{[^\)]+}}) // Ensure that we emit the 'static' function here. -// LINUX: define linkonce void @pr50025() -// LINUX: call void @must_be_emitted -// LINUX: define internal void @must_be_emitted() +// ITANIUM: define linkonce void @pr50025() +// ITANIUM: call void @must_be_emitted +// ITANIUM: define internal void @must_be_emitted() // WINDOWS: define linkonce_odr dso_local void @pr50025() #{{[0-9]*}} comdat // WINDOWS: call void @must_be_emitted // WINDOWS: define internal void @must_be_emitted() -// LINUX: define linkonce void @pr50025c() -// LINUX: call void @pr50025b.ifunc() +// ITANIUM: define linkonce void @pr50025c() +// ITANIUM: call void @pr50025b.ifunc() // WINDOWS: define linkonce_odr dso_local void @pr50025c() #{{[0-9]*}} comdat // WINDOWS: call void @pr50025b.resolver() -// LINUX: define weak_odr ptr @pr50025b.resolver() comdat -// LINUX: ret ptr @pr50025b -// LINUX: define linkonce void @pr50025b() -// LINUX: call void @must_be_emitted() +// ITANIUM: define weak_odr ptr @pr50025b.resolver() +// LINUX-SAME: comdat +// ITANIUM: ret ptr @pr50025b +// ITANIUM: define linkonce void @pr50025b() +// ITANIUM: call void @must_be_emitted() // WINDOWS: define weak_odr dso_local void @pr50025b.resolver() comdat // WINDOWS: musttail call void @pr50025b() // WINDOWS: define linkonce_odr dso_local void @pr50025b() #{{[0-9]*}} comdat diff --git a/clang/test/CodeGen/ifunc.c b/clang/test/CodeGen/ifunc.c index 0b0a054..a29b500 100644 --- a/clang/test/CodeGen/ifunc.c +++ b/clang/test/CodeGen/ifunc.c @@ -3,6 +3,14 @@ // RUN: %clang_cc1 -triple i386-unknown-linux-gnu -fsanitize=thread -O2 -emit-llvm -o - %s | FileCheck %s --check-prefix=SAN // RUN: %clang_cc1 -triple i386-unknown-linux-gnu -fsanitize=address -O2 -emit-llvm -o - %s | FileCheck %s --check-prefix=SAN // RUN: %clang_cc1 -triple i386-unknown-linux-gnu -fsanitize=memory -O2 -emit-llvm -o - %s | FileCheck %s --check-prefix=SAN +// RUN: %clang_cc1 -triple arm64-apple-macosx -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-macosx -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple arm64-apple-macosx -O2 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-macosx -O2 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple arm64-apple-macosx -fsanitize=thread -O2 -emit-llvm -o - %s | FileCheck %s --check-prefix=MACSAN +// RUN: %clang_cc1 -triple x86_64-apple-macosx -fsanitize=thread -O2 -emit-llvm -o - %s | FileCheck %s --check-prefix=MACSAN +// RUN: %clang_cc1 -triple arm64-apple-macosx -fsanitize=address -O2 -emit-llvm -o - %s | FileCheck %s --check-prefix=MACSAN +// RUN: %clang_cc1 -triple x86_64-apple-macosx -fsanitize=address -O2 -emit-llvm -o - %s | FileCheck %s --check-prefix=MACSAN int foo(int) __attribute__ ((ifunc("foo_ifunc"))); @@ -44,9 +52,13 @@ void* goo_ifunc(void) { // CHECK: call void @goo() // SAN: define internal nonnull ptr @foo_ifunc() #[[#FOO_IFUNC:]] { +// MACSAN: define internal nonnull ptr @foo_ifunc() #[[#FOO_IFUNC:]] { // SAN: define dso_local noalias ptr @goo_ifunc() #[[#GOO_IFUNC:]] { +// MACSAN: define noalias ptr @goo_ifunc() #[[#GOO_IFUNC:]] { // SAN-DAG: attributes #[[#FOO_IFUNC]] = {{{.*}} disable_sanitizer_instrumentation {{.*}} +// MACSAN-DAG: attributes #[[#FOO_IFUNC]] = {{{.*}} disable_sanitizer_instrumentation {{.*}} // SAN-DAG: attributes #[[#GOO_IFUNC]] = {{{.*}} disable_sanitizer_instrumentation {{.*}} +// MACSAN-DAG: attributes #[[#GOO_IFUNC]] = {{{.*}} disable_sanitizer_instrumentation {{.*}} diff --git a/clang/test/CodeGenCXX/attr-cpuspecific.cpp b/clang/test/CodeGenCXX/attr-cpuspecific.cpp index 60cba6d..2294ee4 100644 --- a/clang/test/CodeGenCXX/attr-cpuspecific.cpp +++ b/clang/test/CodeGenCXX/attr-cpuspecific.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s --check-prefix=LINUX +// RUN: %clang_cc1 -triple x86_64-apple-macosx -emit-llvm -o - %s | FileCheck %s --check-prefix=LINUX // RUN: %clang_cc1 -triple x86_64-windows-pc -fms-compatibility -emit-llvm -o - %s | FileCheck %s --check-prefix=WINDOWS struct S { diff --git a/clang/test/CodeGenCXX/attr-target-clones.cpp b/clang/test/CodeGenCXX/attr-target-clones.cpp index 86293b9..d540c8f 100644 --- a/clang/test/CodeGenCXX/attr-target-clones.cpp +++ b/clang/test/CodeGenCXX/attr-target-clones.cpp @@ -1,20 +1,24 @@ -// RUN: %clang_cc1 -std=c++11 -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=LINUX +// RUN: %clang_cc1 -std=c++11 -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefixes=ITANIUM,LINUX +// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-macosx -emit-llvm %s -o - | FileCheck %s --check-prefixes=ITANIUM,DARWIN // RUN: %clang_cc1 -std=c++11 -triple x86_64-windows-pc -emit-llvm %s -o - | FileCheck %s --check-prefix=WINDOWS +// DARWIN-NOT: comdat + // Overloaded ifuncs -// LINUX: @_Z10overloadedi.ifunc = weak_odr ifunc i32 (i32), ptr @_Z10overloadedi.resolver -// LINUX: @_Z10overloadedPKc.ifunc = weak_odr ifunc i32 (ptr), ptr @_Z10overloadedPKc.resolver +// ITANIUM: @_Z10overloadedi.ifunc = weak_odr ifunc i32 (i32), ptr @_Z10overloadedi.resolver +// ITANIUM: @_Z10overloadedPKc.ifunc = weak_odr ifunc i32 (ptr), ptr @_Z10overloadedPKc.resolver // struct 'C' ifuncs, note the 'float, U' one doesn't get one. -// LINUX: @_ZN1CIssE3fooEv.ifunc = weak_odr ifunc i32 (ptr), ptr @_ZN1CIssE3fooEv.resolver -// LINUX: @_ZN1CIisE3fooEv.ifunc = weak_odr ifunc i32 (ptr), ptr @_ZN1CIisE3fooEv.resolver -// LINUX: @_ZN1CIdfE3fooEv.ifunc = weak_odr ifunc i32 (ptr), ptr @_ZN1CIdfE3fooEv.resolver +// ITANIUM: @_ZN1CIssE3fooEv.ifunc = weak_odr ifunc i32 (ptr), ptr @_ZN1CIssE3fooEv.resolver +// ITANIUM: @_ZN1CIisE3fooEv.ifunc = weak_odr ifunc i32 (ptr), ptr @_ZN1CIisE3fooEv.resolver +// ITANIUM: @_ZN1CIdfE3fooEv.ifunc = weak_odr ifunc i32 (ptr), ptr @_ZN1CIdfE3fooEv.resolver int __attribute__((target_clones("sse4.2", "default"))) overloaded(int) { return 1; } -// LINUX: define {{.*}}i32 @_Z10overloadedi.sse4.2.0(i32{{.+}}) -// LINUX: define {{.*}}i32 @_Z10overloadedi.default.1(i32{{.+}}) -// LINUX: define weak_odr ptr @_Z10overloadedi.resolver() comdat -// LINUX: ret ptr @_Z10overloadedi.sse4.2.0 -// LINUX: ret ptr @_Z10overloadedi.default.1 +// ITANIUM: define {{.*}}i32 @_Z10overloadedi.sse4.2.0(i32{{.+}}) +// ITANIUM: define {{.*}}i32 @_Z10overloadedi.default.1(i32{{.+}}) +// ITANIUM: define weak_odr ptr @_Z10overloadedi.resolver() +// LINUX-SAME: comdat +// ITANIUM: ret ptr @_Z10overloadedi.sse4.2.0 +// ITANIUM: ret ptr @_Z10overloadedi.default.1 // WINDOWS: define dso_local noundef i32 @"?overloaded@@YAHH@Z.sse4.2.0"(i32{{.+}}) // WINDOWS: define dso_local noundef i32 @"?overloaded@@YAHH@Z.default.1"(i32{{.+}}) @@ -23,11 +27,12 @@ int __attribute__((target_clones("sse4.2", "default"))) overloaded(int) { return // WINDOWS: call i32 @"?overloaded@@YAHH@Z.default.1" int __attribute__((target_clones("arch=ivybridge", "default"))) overloaded(const char *) { return 2; } -// LINUX: define {{.*}}i32 @_Z10overloadedPKc.arch_ivybridge.0(ptr{{.+}}) -// LINUX: define {{.*}}i32 @_Z10overloadedPKc.default.1(ptr{{.+}}) -// LINUX: define weak_odr ptr @_Z10overloadedPKc.resolver() comdat -// LINUX: ret ptr @_Z10overloadedPKc.arch_ivybridge.0 -// LINUX: ret ptr @_Z10overloadedPKc.default.1 +// ITANIUM: define {{.*}}i32 @_Z10overloadedPKc.arch_ivybridge.0(ptr{{.+}}) +// ITANIUM: define {{.*}}i32 @_Z10overloadedPKc.default.1(ptr{{.+}}) +// ITANIUM: define weak_odr ptr @_Z10overloadedPKc.resolver() +// LINUX-SAME: comdat +// ITANIUM: ret ptr @_Z10overloadedPKc.arch_ivybridge.0 +// ITANIUM: ret ptr @_Z10overloadedPKc.default.1 // WINDOWS: define dso_local noundef i32 @"?overloaded@@YAHPEBD@Z.arch_ivybridge.0"(ptr{{.+}}) // WINDOWS: define dso_local noundef i32 @"?overloaded@@YAHPEBD@Z.default.1"(ptr{{.+}}) @@ -37,10 +42,10 @@ int __attribute__((target_clones("arch=ivybridge", "default"))) overloaded(const void use_overloaded() { overloaded(1); - // LINUX: call noundef i32 @_Z10overloadedi.ifunc + // ITANIUM: call noundef i32 @_Z10overloadedi.ifunc // WINDOWS: call noundef i32 @"?overloaded@@YAHH@Z" overloaded(nullptr); - // LINUX: call noundef i32 @_Z10overloadedPKc.ifunc + // ITANIUM: call noundef i32 @_Z10overloadedPKc.ifunc // WINDOWS: call noundef i32 @"?overloaded@@YAHPEBD@Z" } @@ -64,53 +69,56 @@ int __attribute__((target_clones("sse4.2", "default"))) foo(){ return 3;} void uses_specialized() { C<short, short> c; c.foo(); - // LINUX: call noundef i32 @_ZN1CIssE3fooEv.ifunc(ptr + // ITANIUM: call noundef i32 @_ZN1CIssE3fooEv.ifunc(ptr // WINDOWS: call noundef i32 @"?foo@?$C@FF@@QEAAHXZ"(ptr C<int, short> c2; c2.foo(); - // LINUX: call noundef i32 @_ZN1CIisE3fooEv.ifunc(ptr + // ITANIUM: call noundef i32 @_ZN1CIisE3fooEv.ifunc(ptr // WINDOWS: call noundef i32 @"?foo@?$C@HF@@QEAAHXZ"(ptr C<float, short> c3; c3.foo(); // Note this is not an ifunc/mv - // LINUX: call noundef i32 @_ZN1CIfsE3fooEv(ptr + // ITANIUM: call noundef i32 @_ZN1CIfsE3fooEv(ptr // WINDOWS: call noundef i32 @"?foo@?$C@MF@@QEAAHXZ"(ptr C<double, float> c4; c4.foo(); - // LINUX: call noundef i32 @_ZN1CIdfE3fooEv.ifunc(ptr + // ITANIUM: call noundef i32 @_ZN1CIdfE3fooEv.ifunc(ptr // WINDOWS: call noundef i32 @"?foo@?$C@NM@@QEAAHXZ"(ptr } -// LINUX: define weak_odr ptr @_ZN1CIssE3fooEv.resolver() comdat -// LINUX: ret ptr @_ZN1CIssE3fooEv.sse4.2.0 -// LINUX: ret ptr @_ZN1CIssE3fooEv.default.1 +// ITANIUM: define weak_odr ptr @_ZN1CIssE3fooEv.resolver() +// LINUX-SAME: comdat +// ITANIUM: ret ptr @_ZN1CIssE3fooEv.sse4.2.0 +// ITANIUM: ret ptr @_ZN1CIssE3fooEv.default.1 // WINDOWS: define {{.*}}i32 @"?foo@?$C@FF@@QEAAHXZ"(ptr // WINDOWS: call i32 @"?foo@?$C@FF@@QEAAHXZ.sse4.2.0" // WINDOWS: call i32 @"?foo@?$C@FF@@QEAAHXZ.default.1" -// LINUX: define weak_odr ptr @_ZN1CIisE3fooEv.resolver() comdat -// LINUX: ret ptr @_ZN1CIisE3fooEv.sse4.2.0 -// LINUX: ret ptr @_ZN1CIisE3fooEv.default.1 +// ITANIUM: define weak_odr ptr @_ZN1CIisE3fooEv.resolver() +// LINUX-SAME: comdat +// ITANIUM: ret ptr @_ZN1CIisE3fooEv.sse4.2.0 +// ITANIUM: ret ptr @_ZN1CIisE3fooEv.default.1 // WINDOWS: define {{.*}}i32 @"?foo@?$C@HF@@QEAAHXZ"(ptr // WINDOWS: call i32 @"?foo@?$C@HF@@QEAAHXZ.sse4.2.0" // WINDOWS: call i32 @"?foo@?$C@HF@@QEAAHXZ.default.1" -// LINUX: define weak_odr ptr @_ZN1CIdfE3fooEv.resolver() comdat -// LINUX: ret ptr @_ZN1CIdfE3fooEv.sse4.2.0 -// LINUX: ret ptr @_ZN1CIdfE3fooEv.default.1 +// ITANIUM: define weak_odr ptr @_ZN1CIdfE3fooEv.resolver() +// LINUX-SAME: comdat +// ITANIUM: ret ptr @_ZN1CIdfE3fooEv.sse4.2.0 +// ITANIUM: ret ptr @_ZN1CIdfE3fooEv.default.1 // WINDOWS: define {{.*}}i32 @"?foo@?$C@NM@@QEAAHXZ"(ptr // WINDOWS: call i32 @"?foo@?$C@NM@@QEAAHXZ.sse4.2.0" // WINDOWS: call i32 @"?foo@?$C@NM@@QEAAHXZ.default.1" -// LINUX: define {{.*}}i32 @_ZN1CIssE3fooEv.sse4.2.0(ptr -// LINUX: define {{.*}}i32 @_ZN1CIssE3fooEv.default.1(ptr -// LINUX: define {{.*}}i32 @_ZN1CIisE3fooEv.sse4.2.0(ptr -// LINUX: define {{.*}}i32 @_ZN1CIisE3fooEv.default.1(ptr -// LINUX: define {{.*}}i32 @_ZN1CIdfE3fooEv.sse4.2.0(ptr -// LINUX: define {{.*}}i32 @_ZN1CIdfE3fooEv.default.1(ptr +// ITANIUM: define {{.*}}i32 @_ZN1CIssE3fooEv.sse4.2.0(ptr +// ITANIUM: define {{.*}}i32 @_ZN1CIssE3fooEv.default.1(ptr +// ITANIUM: define {{.*}}i32 @_ZN1CIisE3fooEv.sse4.2.0(ptr +// ITANIUM: define {{.*}}i32 @_ZN1CIisE3fooEv.default.1(ptr +// ITANIUM: define {{.*}}i32 @_ZN1CIdfE3fooEv.sse4.2.0(ptr +// ITANIUM: define {{.*}}i32 @_ZN1CIdfE3fooEv.default.1(ptr // WINDOWS: define {{.*}}i32 @"?foo@?$C@FF@@QEAAHXZ.sse4.2.0"(ptr // WINDOWS: define {{.*}}i32 @"?foo@?$C@FF@@QEAAHXZ.default.1"(ptr diff --git a/clang/test/CodeGenCXX/attr-target-mv-diff-ns.cpp b/clang/test/CodeGenCXX/attr-target-mv-diff-ns.cpp index 1157450..a6ec608 100644 --- a/clang/test/CodeGenCXX/attr-target-mv-diff-ns.cpp +++ b/clang/test/CodeGenCXX/attr-target-mv-diff-ns.cpp @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -std=c++11 -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=LINUX +// RUN: %clang_cc1 -std=c++11 -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefixes=ITANIUM,LINUX +// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-macosx -emit-llvm %s -o - | FileCheck %s --check-prefixes=ITANIUM,DARWIN // RUN: %clang_cc1 -std=c++11 -triple x86_64-windows-pc -emit-llvm %s -o - | FileCheck %s --check-prefix=WINDOWS // Test ensures that this properly differentiates between types in different // namespaces. @@ -18,15 +19,17 @@ int bar() { return foo(1) + ns::foo(2); } -// LINUX: @_Z3fooi.ifunc = weak_odr ifunc i32 (i32), ptr @_Z3fooi.resolver -// LINUX: @_ZN2ns3fooEi.ifunc = weak_odr ifunc i32 (i32), ptr @_ZN2ns3fooEi.resolver +// DARWIN-NOT: comdat -// LINUX: define{{.*}} i32 @_Z3fooi.sse4.2(i32 noundef %0) -// LINUX: ret i32 0 -// LINUX: define{{.*}} i32 @_Z3fooi.arch_ivybridge(i32 noundef %0) -// LINUX: ret i32 1 -// LINUX: define{{.*}} i32 @_Z3fooi(i32 noundef %0) -// LINUX: ret i32 2 +// ITANIUM: @_Z3fooi.ifunc = weak_odr ifunc i32 (i32), ptr @_Z3fooi.resolver +// ITANIUM: @_ZN2ns3fooEi.ifunc = weak_odr ifunc i32 (i32), ptr @_ZN2ns3fooEi.resolver + +// ITANIUM: define{{.*}} i32 @_Z3fooi.sse4.2(i32 noundef %0) +// ITANIUM: ret i32 0 +// ITANIUM: define{{.*}} i32 @_Z3fooi.arch_ivybridge(i32 noundef %0) +// ITANIUM: ret i32 1 +// ITANIUM: define{{.*}} i32 @_Z3fooi(i32 noundef %0) +// ITANIUM: ret i32 2 // WINDOWS: define dso_local noundef i32 @"?foo@@YAHH@Z.sse4.2"(i32 noundef %0) // WINDOWS: ret i32 0 @@ -35,12 +38,12 @@ int bar() { // WINDOWS: define dso_local noundef i32 @"?foo@@YAHH@Z"(i32 noundef %0) // WINDOWS: ret i32 2 -// LINUX: define{{.*}} i32 @_ZN2ns3fooEi.sse4.2(i32 noundef %0) -// LINUX: ret i32 0 -// LINUX: define{{.*}} i32 @_ZN2ns3fooEi.arch_ivybridge(i32 noundef %0) -// LINUX: ret i32 1 -// LINUX: define{{.*}} i32 @_ZN2ns3fooEi(i32 noundef %0) -// LINUX: ret i32 2 +// ITANIUM: define{{.*}} i32 @_ZN2ns3fooEi.sse4.2(i32 noundef %0) +// ITANIUM: ret i32 0 +// ITANIUM: define{{.*}} i32 @_ZN2ns3fooEi.arch_ivybridge(i32 noundef %0) +// ITANIUM: ret i32 1 +// ITANIUM: define{{.*}} i32 @_ZN2ns3fooEi(i32 noundef %0) +// ITANIUM: ret i32 2 // WINDOWS: define dso_local noundef i32 @"?foo@ns@@YAHH@Z.sse4.2"(i32 noundef %0) // WINDOWS: ret i32 0 @@ -49,19 +52,20 @@ int bar() { // WINDOWS: define dso_local noundef i32 @"?foo@ns@@YAHH@Z"(i32 noundef %0) // WINDOWS: ret i32 2 -// LINUX: define{{.*}} i32 @_Z3barv() -// LINUX: call noundef i32 @_Z3fooi.ifunc(i32 noundef 1) -// LINUX: call noundef i32 @_ZN2ns3fooEi.ifunc(i32 noundef 2) +// ITANIUM: define{{.*}} i32 @_Z3barv() +// ITANIUM: call noundef i32 @_Z3fooi.ifunc(i32 noundef 1) +// ITANIUM: call noundef i32 @_ZN2ns3fooEi.ifunc(i32 noundef 2) // WINDOWS: define dso_local noundef i32 @"?bar@@YAHXZ"() // WINDOWS: call noundef i32 @"?foo@@YAHH@Z.resolver"(i32 noundef 1) // WINDOWS: call noundef i32 @"?foo@ns@@YAHH@Z.resolver"(i32 noundef 2) -// LINUX: define weak_odr ptr @_Z3fooi.resolver() comdat -// LINUX: ret ptr @_Z3fooi.arch_sandybridge -// LINUX: ret ptr @_Z3fooi.arch_ivybridge -// LINUX: ret ptr @_Z3fooi.sse4.2 -// LINUX: ret ptr @_Z3fooi +// ITANIUM: define weak_odr ptr @_Z3fooi.resolver() +// LINUX-SAME: comdat +// ITANIUM: ret ptr @_Z3fooi.arch_sandybridge +// ITANIUM: ret ptr @_Z3fooi.arch_ivybridge +// ITANIUM: ret ptr @_Z3fooi.sse4.2 +// ITANIUM: ret ptr @_Z3fooi // WINDOWS: define weak_odr dso_local i32 @"?foo@@YAHH@Z.resolver"(i32 %0) comdat // WINDOWS: call i32 @"?foo@@YAHH@Z.arch_sandybridge"(i32 %0) @@ -69,11 +73,12 @@ int bar() { // WINDOWS: call i32 @"?foo@@YAHH@Z.sse4.2"(i32 %0) // WINDOWS: call i32 @"?foo@@YAHH@Z"(i32 %0) -// LINUX: define weak_odr ptr @_ZN2ns3fooEi.resolver() comdat -// LINUX: ret ptr @_ZN2ns3fooEi.arch_sandybridge -// LINUX: ret ptr @_ZN2ns3fooEi.arch_ivybridge -// LINUX: ret ptr @_ZN2ns3fooEi.sse4.2 -// LINUX: ret ptr @_ZN2ns3fooEi +// ITANIUM: define weak_odr ptr @_ZN2ns3fooEi.resolver() +// LINUX-SAME: comdat +// ITANIUM: ret ptr @_ZN2ns3fooEi.arch_sandybridge +// ITANIUM: ret ptr @_ZN2ns3fooEi.arch_ivybridge +// ITANIUM: ret ptr @_ZN2ns3fooEi.sse4.2 +// ITANIUM: ret ptr @_ZN2ns3fooEi // WINDOWS: define weak_odr dso_local i32 @"?foo@ns@@YAHH@Z.resolver"(i32 %0) comdat // WINDOWS: call i32 @"?foo@ns@@YAHH@Z.arch_sandybridge"(i32 %0) @@ -81,8 +86,8 @@ int bar() { // WINDOWS: call i32 @"?foo@ns@@YAHH@Z.sse4.2"(i32 %0) // WINDOWS: call i32 @"?foo@ns@@YAHH@Z"(i32 %0) -// LINUX: declare noundef i32 @_Z3fooi.arch_sandybridge(i32 noundef) -// LINUX: declare noundef i32 @_ZN2ns3fooEi.arch_sandybridge(i32 noundef) +// ITANIUM: declare noundef i32 @_Z3fooi.arch_sandybridge(i32 noundef) +// ITANIUM: declare noundef i32 @_ZN2ns3fooEi.arch_sandybridge(i32 noundef) // WINDOWS: declare dso_local noundef i32 @"?foo@@YAHH@Z.arch_sandybridge"(i32 noundef) // WINDOWS: declare dso_local noundef i32 @"?foo@ns@@YAHH@Z.arch_sandybridge"(i32 noundef) diff --git a/clang/test/CodeGenCXX/attr-target-mv-func-ptrs.cpp b/clang/test/CodeGenCXX/attr-target-mv-func-ptrs.cpp index 690f44c..111f682 100644 --- a/clang/test/CodeGenCXX/attr-target-mv-func-ptrs.cpp +++ b/clang/test/CodeGenCXX/attr-target-mv-func-ptrs.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=LINUX +// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-macosx -emit-llvm %s -o - | FileCheck %s --check-prefix=LINUX // RUN: %clang_cc1 -std=c++11 -triple x86_64-windows-pc -emit-llvm %s -o - | FileCheck %s --check-prefix=WINDOWS void temp(); void temp(int); diff --git a/clang/test/CodeGenCXX/attr-target-mv-inalloca.cpp b/clang/test/CodeGenCXX/attr-target-mv-inalloca.cpp index 614e44e..f11ac76 100644 --- a/clang/test/CodeGenCXX/attr-target-mv-inalloca.cpp +++ b/clang/test/CodeGenCXX/attr-target-mv-inalloca.cpp @@ -1,5 +1,7 @@ // RUN: %clang_cc1 -std=c++11 -triple i686-windows-msvc -emit-llvm %s -o - | FileCheck %s --check-prefix=WINDOWS // RUN: %clang_cc1 -std=c++11 -triple x86_64-windows-msvc -emit-llvm %s -o - | FileCheck %s --check-prefix=WINDOWS64 +// RUN: %clang_cc1 -std=c++11 -triple x86_64-pc-linux -emit-llvm %s -o - | FileCheck %s --check-prefix=LINUX +// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-macosx -emit-llvm %s -o - | FileCheck %s --check-prefix=DARWIN struct Foo { Foo(); @@ -16,6 +18,9 @@ void usage() { bar(f); } +// DARWIN-NOT: inalloca( +// LINUX-NOT: inalloca( + // WINDOWS: define dso_local noundef i32 @"?bar@@YAHUFoo@@@Z"(ptr inalloca(<{ %struct.Foo }>) %0) // WINDOWS: %[[O:[0-9a-zA-Z]+]] = getelementptr inbounds <{ %struct.Foo }>, ptr %0, i32 0, i32 0 // WINDOWS: %[[X:[0-9a-zA-Z]+]] = getelementptr inbounds %struct.Foo, ptr %[[O]], i32 0, i32 0 diff --git a/clang/test/CodeGenCXX/attr-target-mv-member-funcs.cpp b/clang/test/CodeGenCXX/attr-target-mv-member-funcs.cpp index cf3ba29..35a62ee 100644 --- a/clang/test/CodeGenCXX/attr-target-mv-member-funcs.cpp +++ b/clang/test/CodeGenCXX/attr-target-mv-member-funcs.cpp @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -std=c++11 -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=LINUX +// RUN: %clang_cc1 -std=c++11 -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefixes=ITANIUM,LINUX +// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-macosx -emit-llvm %s -o - | FileCheck %s --check-prefixes=ITANIUM,DARWIN // RUN: %clang_cc1 -std=c++11 -triple x86_64-windows-pc -emit-llvm %s -o - | FileCheck %s --check-prefix=WINDOWS struct S { @@ -65,22 +66,24 @@ int templ_use() { return a.foo(1) + b.foo(2); } -// LINUX: @_ZN1SaSERKS_.ifunc = weak_odr ifunc ptr (ptr, ptr), ptr @_ZN1SaSERKS_.resolver -// LINUX: @_ZNK9ConvertTocv1SEv.ifunc = weak_odr ifunc void (ptr), ptr @_ZNK9ConvertTocv1SEv.resolver -// LINUX: @_ZN1S3fooEi.ifunc = weak_odr ifunc i32 (ptr, i32), ptr @_ZN1S3fooEi.resolver -// LINUX: @_ZN2S23fooEi.ifunc = weak_odr ifunc i32 (ptr, i32), ptr @_ZN2S23fooEi.resolver +// DARWIN-NOT: comdat + +// ITANIUM: @_ZN1SaSERKS_.ifunc = weak_odr ifunc ptr (ptr, ptr), ptr @_ZN1SaSERKS_.resolver +// ITANIUM: @_ZNK9ConvertTocv1SEv.ifunc = weak_odr ifunc void (ptr), ptr @_ZNK9ConvertTocv1SEv.resolver +// ITANIUM: @_ZN1S3fooEi.ifunc = weak_odr ifunc i32 (ptr, i32), ptr @_ZN1S3fooEi.resolver +// ITANIUM: @_ZN2S23fooEi.ifunc = weak_odr ifunc i32 (ptr, i32), ptr @_ZN2S23fooEi.resolver // Templates: -// LINUX: @_ZN5templIiE3fooEi.ifunc = weak_odr ifunc i32 (ptr, i32), ptr @_ZN5templIiE3fooEi.resolver -// LINUX: @_ZN5templIdE3fooEi.ifunc = weak_odr ifunc i32 (ptr, i32), ptr @_ZN5templIdE3fooEi.resolver - -// LINUX: define{{.*}} i32 @_Z3barv() -// LINUX: %s = alloca %struct.S, align 1 -// LINUX: %s2 = alloca %struct.S, align 1 -// LINUX: %C = alloca %struct.ConvertTo, align 1 -// LINUX: call noundef nonnull align 1 dereferenceable(1) ptr @_ZN1SaSERKS_.ifunc(ptr {{[^,]*}} %s2 -// LINUX: call void @_ZNK9ConvertTocv1SEv.ifunc(ptr {{[^,]*}} %C) -// LINUX: call noundef nonnull align 1 dereferenceable(1) ptr @_ZN1SaSERKS_.ifunc(ptr {{[^,]*}} %s2 -// LINUX: call noundef i32 @_ZN1S3fooEi.ifunc(ptr {{[^,]*}} %s, i32 noundef 0) +// ITANIUM: @_ZN5templIiE3fooEi.ifunc = weak_odr ifunc i32 (ptr, i32), ptr @_ZN5templIiE3fooEi.resolver +// ITANIUM: @_ZN5templIdE3fooEi.ifunc = weak_odr ifunc i32 (ptr, i32), ptr @_ZN5templIdE3fooEi.resolver + +// ITANIUM: define{{.*}} i32 @_Z3barv() +// ITANIUM: %s = alloca %struct.S, align 1 +// ITANIUM: %s2 = alloca %struct.S, align 1 +// ITANIUM: %C = alloca %struct.ConvertTo, align 1 +// ITANIUM: call noundef nonnull align 1 dereferenceable(1) ptr @_ZN1SaSERKS_.ifunc(ptr {{[^,]*}} %s2 +// ITANIUM: call void @_ZNK9ConvertTocv1SEv.ifunc(ptr {{[^,]*}} %C) +// ITANIUM: call noundef nonnull align 1 dereferenceable(1) ptr @_ZN1SaSERKS_.ifunc(ptr {{[^,]*}} %s2 +// ITANIUM: call noundef i32 @_ZN1S3fooEi.ifunc(ptr {{[^,]*}} %s, i32 noundef 0) // WINDOWS: define dso_local noundef i32 @"?bar@@YAHXZ"() // WINDOWS: %s = alloca %struct.S, align 1 @@ -91,27 +94,30 @@ int templ_use() { // WINDOWS: call noundef nonnull align 1 dereferenceable(1) ptr @"??4S@@QEAAAEAU0@AEBU0@@Z.resolver"(ptr {{[^,]*}} %s2 // WINDOWS: call noundef i32 @"?foo@S@@QEAAHH@Z.resolver"(ptr {{[^,]*}} %s, i32 noundef 0) -// LINUX: define weak_odr ptr @_ZN1SaSERKS_.resolver() comdat -// LINUX: ret ptr @_ZN1SaSERKS_.arch_ivybridge -// LINUX: ret ptr @_ZN1SaSERKS_ +// ITANIUM: define weak_odr ptr @_ZN1SaSERKS_.resolver() +// LINUX-SAME: comdat +// ITANIUM: ret ptr @_ZN1SaSERKS_.arch_ivybridge +// ITANIUM: ret ptr @_ZN1SaSERKS_ // WINDOWS: define weak_odr dso_local ptr @"??4S@@QEAAAEAU0@AEBU0@@Z.resolver"(ptr %0, ptr %1) // WINDOWS: call ptr @"??4S@@QEAAAEAU0@AEBU0@@Z.arch_ivybridge" // WINDOWS: call ptr @"??4S@@QEAAAEAU0@AEBU0@@Z" -// LINUX: define weak_odr ptr @_ZNK9ConvertTocv1SEv.resolver() comdat -// LINUX: ret ptr @_ZNK9ConvertTocv1SEv.arch_ivybridge -// LINUX: ret ptr @_ZNK9ConvertTocv1SEv +// ITANIUM: define weak_odr ptr @_ZNK9ConvertTocv1SEv.resolver() +// LINUX-SAME: comdat +// ITANIUM: ret ptr @_ZNK9ConvertTocv1SEv.arch_ivybridge +// ITANIUM: ret ptr @_ZNK9ConvertTocv1SEv // WINDOWS: define weak_odr dso_local void @"??BConvertTo@@QEBA?AUS@@XZ.resolver"(ptr %0, ptr %1) // WINDOWS: call void @"??BConvertTo@@QEBA?AUS@@XZ.arch_ivybridge" // WINDOWS: call void @"??BConvertTo@@QEBA?AUS@@XZ" -// LINUX: define weak_odr ptr @_ZN1S3fooEi.resolver() comdat -// LINUX: ret ptr @_ZN1S3fooEi.arch_sandybridge -// LINUX: ret ptr @_ZN1S3fooEi.arch_ivybridge -// LINUX: ret ptr @_ZN1S3fooEi.sse4.2 -// LINUX: ret ptr @_ZN1S3fooEi +// ITANIUM: define weak_odr ptr @_ZN1S3fooEi.resolver() +// LINUX-SAME: comdat +// ITANIUM: ret ptr @_ZN1S3fooEi.arch_sandybridge +// ITANIUM: ret ptr @_ZN1S3fooEi.arch_ivybridge +// ITANIUM: ret ptr @_ZN1S3fooEi.sse4.2 +// ITANIUM: ret ptr @_ZN1S3fooEi // WINDOWS: define weak_odr dso_local i32 @"?foo@S@@QEAAHH@Z.resolver"(ptr %0, i32 %1) // WINDOWS: call i32 @"?foo@S@@QEAAHH@Z.arch_sandybridge" @@ -119,17 +125,18 @@ int templ_use() { // WINDOWS: call i32 @"?foo@S@@QEAAHH@Z.sse4.2" // WINDOWS: call i32 @"?foo@S@@QEAAHH@Z" -// LINUX: define{{.*}} i32 @_Z4bar2v() -// LINUX: call noundef i32 @_ZN2S23fooEi.ifunc +// ITANIUM: define{{.*}} i32 @_Z4bar2v() +// ITANIUM: call noundef i32 @_ZN2S23fooEi.ifunc // WINDOWS: define dso_local noundef i32 @"?bar2@@YAHXZ"() // WINDOWS: call noundef i32 @"?foo@S2@@QEAAHH@Z.resolver" -// LINUX: define weak_odr ptr @_ZN2S23fooEi.resolver() comdat -// LINUX: ret ptr @_ZN2S23fooEi.arch_sandybridge -// LINUX: ret ptr @_ZN2S23fooEi.arch_ivybridge -// LINUX: ret ptr @_ZN2S23fooEi.sse4.2 -// LINUX: ret ptr @_ZN2S23fooEi +// ITANIUM: define weak_odr ptr @_ZN2S23fooEi.resolver() +// LINUX-SAME: comdat +// ITANIUM: ret ptr @_ZN2S23fooEi.arch_sandybridge +// ITANIUM: ret ptr @_ZN2S23fooEi.arch_ivybridge +// ITANIUM: ret ptr @_ZN2S23fooEi.sse4.2 +// ITANIUM: ret ptr @_ZN2S23fooEi // WINDOWS: define weak_odr dso_local i32 @"?foo@S2@@QEAAHH@Z.resolver"(ptr %0, i32 %1) // WINDOWS: call i32 @"?foo@S2@@QEAAHH@Z.arch_sandybridge" @@ -137,27 +144,28 @@ int templ_use() { // WINDOWS: call i32 @"?foo@S2@@QEAAHH@Z.sse4.2" // WINDOWS: call i32 @"?foo@S2@@QEAAHH@Z" -// LINUX: define{{.*}} i32 @_ZN2S23fooEi.sse4.2(ptr {{[^,]*}} %this, i32 noundef %0) -// LINUX: define{{.*}} i32 @_ZN2S23fooEi.arch_ivybridge(ptr {{[^,]*}} %this, i32 noundef %0) -// LINUX: define{{.*}} i32 @_ZN2S23fooEi(ptr {{[^,]*}} %this, i32 noundef %0) +// ITANIUM: define{{.*}} i32 @_ZN2S23fooEi.sse4.2(ptr {{[^,]*}} %this, i32 noundef %0) +// ITANIUM: define{{.*}} i32 @_ZN2S23fooEi.arch_ivybridge(ptr {{[^,]*}} %this, i32 noundef %0) +// ITANIUM: define{{.*}} i32 @_ZN2S23fooEi(ptr {{[^,]*}} %this, i32 noundef %0) // WINDOWS: define dso_local noundef i32 @"?foo@S2@@QEAAHH@Z.sse4.2"(ptr {{[^,]*}} %this, i32 noundef %0) // WINDOWS: define dso_local noundef i32 @"?foo@S2@@QEAAHH@Z.arch_ivybridge"(ptr {{[^,]*}} %this, i32 noundef %0) // WINDOWS: define dso_local noundef i32 @"?foo@S2@@QEAAHH@Z"(ptr {{[^,]*}} %this, i32 noundef %0) -// LINUX: define{{.*}} i32 @_Z9templ_usev() -// LINUX: call noundef i32 @_ZN5templIiE3fooEi.ifunc -// LINUX: call noundef i32 @_ZN5templIdE3fooEi.ifunc +// ITANIUM: define{{.*}} i32 @_Z9templ_usev() +// ITANIUM: call noundef i32 @_ZN5templIiE3fooEi.ifunc +// ITANIUM: call noundef i32 @_ZN5templIdE3fooEi.ifunc // WINDOWS: define dso_local noundef i32 @"?templ_use@@YAHXZ"() // WINDOWS: call noundef i32 @"?foo@?$templ@H@@QEAAHH@Z.resolver" // WINDOWS: call noundef i32 @"?foo@?$templ@N@@QEAAHH@Z.resolver" -// LINUX: define weak_odr ptr @_ZN5templIiE3fooEi.resolver() comdat -// LINUX: ret ptr @_ZN5templIiE3fooEi.arch_sandybridge -// LINUX: ret ptr @_ZN5templIiE3fooEi.arch_ivybridge -// LINUX: ret ptr @_ZN5templIiE3fooEi.sse4.2 -// LINUX: ret ptr @_ZN5templIiE3fooEi +// ITANIUM: define weak_odr ptr @_ZN5templIiE3fooEi.resolver() +// LINUX-SAME: comdat +// ITANIUM: ret ptr @_ZN5templIiE3fooEi.arch_sandybridge +// ITANIUM: ret ptr @_ZN5templIiE3fooEi.arch_ivybridge +// ITANIUM: ret ptr @_ZN5templIiE3fooEi.sse4.2 +// ITANIUM: ret ptr @_ZN5templIiE3fooEi // WINDOWS: define weak_odr dso_local i32 @"?foo@?$templ@H@@QEAAHH@Z.resolver"(ptr %0, i32 %1) // WINDOWS: call i32 @"?foo@?$templ@H@@QEAAHH@Z.arch_sandybridge" @@ -165,11 +173,12 @@ int templ_use() { // WINDOWS: call i32 @"?foo@?$templ@H@@QEAAHH@Z.sse4.2" // WINDOWS: call i32 @"?foo@?$templ@H@@QEAAHH@Z" -// LINUX: define weak_odr ptr @_ZN5templIdE3fooEi.resolver() comdat -// LINUX: ret ptr @_ZN5templIdE3fooEi.arch_sandybridge -// LINUX: ret ptr @_ZN5templIdE3fooEi.arch_ivybridge -// LINUX: ret ptr @_ZN5templIdE3fooEi.sse4.2 -// LINUX: ret ptr @_ZN5templIdE3fooEi +// ITANIUM: define weak_odr ptr @_ZN5templIdE3fooEi.resolver() +// LINUX-SAME: comdat +// ITANIUM: ret ptr @_ZN5templIdE3fooEi.arch_sandybridge +// ITANIUM: ret ptr @_ZN5templIdE3fooEi.arch_ivybridge +// ITANIUM: ret ptr @_ZN5templIdE3fooEi.sse4.2 +// ITANIUM: ret ptr @_ZN5templIdE3fooEi // WINDOWS: define weak_odr dso_local i32 @"?foo@?$templ@N@@QEAAHH@Z.resolver"(ptr %0, i32 %1) comdat // WINDOWS: call i32 @"?foo@?$templ@N@@QEAAHH@Z.arch_sandybridge" @@ -177,42 +186,42 @@ int templ_use() { // WINDOWS: call i32 @"?foo@?$templ@N@@QEAAHH@Z.sse4.2" // WINDOWS: call i32 @"?foo@?$templ@N@@QEAAHH@Z" -// LINUX: define linkonce_odr noundef i32 @_ZN1S3fooEi.sse4.2(ptr {{[^,]*}} %this, i32 noundef %0) -// LINUX: ret i32 0 +// ITANIUM: define linkonce_odr noundef i32 @_ZN1S3fooEi.sse4.2(ptr {{[^,]*}} %this, i32 noundef %0) +// ITANIUM: ret i32 0 // WINDOWS: define linkonce_odr dso_local noundef i32 @"?foo@S@@QEAAHH@Z.sse4.2"(ptr {{[^,]*}} %this, i32 noundef %0) // WINDOWS: ret i32 0 -// LINUX: declare noundef i32 @_ZN1S3fooEi.arch_sandybridge(ptr {{[^,]*}}, i32 noundef) +// ITANIUM: declare noundef i32 @_ZN1S3fooEi.arch_sandybridge(ptr {{[^,]*}}, i32 noundef) // WINDOWS: declare dso_local noundef i32 @"?foo@S@@QEAAHH@Z.arch_sandybridge"(ptr {{[^,]*}}, i32 noundef) -// LINUX: define linkonce_odr noundef i32 @_ZN1S3fooEi.arch_ivybridge(ptr {{[^,]*}} %this, i32 noundef %0) -// LINUX: ret i32 1 +// ITANIUM: define linkonce_odr noundef i32 @_ZN1S3fooEi.arch_ivybridge(ptr {{[^,]*}} %this, i32 noundef %0) +// ITANIUM: ret i32 1 // WINDOWS: define linkonce_odr dso_local noundef i32 @"?foo@S@@QEAAHH@Z.arch_ivybridge"(ptr {{[^,]*}} %this, i32 noundef %0) // WINDOWS: ret i32 1 -// LINUX: define linkonce_odr noundef i32 @_ZN1S3fooEi(ptr {{[^,]*}} %this, i32 noundef %0) -// LINUX: ret i32 2 +// ITANIUM: define linkonce_odr noundef i32 @_ZN1S3fooEi(ptr {{[^,]*}} %this, i32 noundef %0) +// ITANIUM: ret i32 2 // WINDOWS: define linkonce_odr dso_local noundef i32 @"?foo@S@@QEAAHH@Z"(ptr {{[^,]*}} %this, i32 noundef %0) // WINDOWS: ret i32 2 -// LINUX: define linkonce_odr noundef i32 @_ZN5templIiE3fooEi.sse4.2 -// LINUX: declare noundef i32 @_ZN5templIiE3fooEi.arch_sandybridge -// LINUX: define linkonce_odr noundef i32 @_ZN5templIiE3fooEi.arch_ivybridge -// LINUX: define linkonce_odr noundef i32 @_ZN5templIiE3fooEi +// ITANIUM: define linkonce_odr noundef i32 @_ZN5templIiE3fooEi.sse4.2 +// ITANIUM: declare noundef i32 @_ZN5templIiE3fooEi.arch_sandybridge +// ITANIUM: define linkonce_odr noundef i32 @_ZN5templIiE3fooEi.arch_ivybridge +// ITANIUM: define linkonce_odr noundef i32 @_ZN5templIiE3fooEi // WINDOWS: define linkonce_odr dso_local noundef i32 @"?foo@?$templ@H@@QEAAHH@Z.sse4.2" // WINDOWS: declare dso_local noundef i32 @"?foo@?$templ@H@@QEAAHH@Z.arch_sandybridge" // WINDOWS: define linkonce_odr dso_local noundef i32 @"?foo@?$templ@H@@QEAAHH@Z.arch_ivybridge" // WINDOWS: define linkonce_odr dso_local noundef i32 @"?foo@?$templ@H@@QEAAHH@Z" -// LINUX: define linkonce_odr noundef i32 @_ZN5templIdE3fooEi.sse4.2 -// LINUX: declare noundef i32 @_ZN5templIdE3fooEi.arch_sandybridge -// LINUX: define linkonce_odr noundef i32 @_ZN5templIdE3fooEi.arch_ivybridge -// LINUX: define linkonce_odr noundef i32 @_ZN5templIdE3fooEi +// ITANIUM: define linkonce_odr noundef i32 @_ZN5templIdE3fooEi.sse4.2 +// ITANIUM: declare noundef i32 @_ZN5templIdE3fooEi.arch_sandybridge +// ITANIUM: define linkonce_odr noundef i32 @_ZN5templIdE3fooEi.arch_ivybridge +// ITANIUM: define linkonce_odr noundef i32 @_ZN5templIdE3fooEi // WINDOWS: define linkonce_odr dso_local noundef i32 @"?foo@?$templ@N@@QEAAHH@Z.sse4.2" // WINDOWS: declare dso_local noundef i32 @"?foo@?$templ@N@@QEAAHH@Z.arch_sandybridge" diff --git a/clang/test/CodeGenCXX/attr-target-mv-modules.cpp b/clang/test/CodeGenCXX/attr-target-mv-modules.cpp index c91cf71..3a70e27 100644 --- a/clang/test/CodeGenCXX/attr-target-mv-modules.cpp +++ b/clang/test/CodeGenCXX/attr-target-mv-modules.cpp @@ -1,4 +1,5 @@ // RUN: %clang_cc1 -std=c++11 -triple x86_64-linux-gnu -fmodules -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-macosx -fmodules -emit-llvm %s -o - | FileCheck %s #pragma clang module build A module A {} #pragma clang module contents diff --git a/clang/test/CodeGenCXX/attr-target-mv-out-of-line-defs.cpp b/clang/test/CodeGenCXX/attr-target-mv-out-of-line-defs.cpp index dda7de0..b81897a 100644 --- a/clang/test/CodeGenCXX/attr-target-mv-out-of-line-defs.cpp +++ b/clang/test/CodeGenCXX/attr-target-mv-out-of-line-defs.cpp @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -std=c++11 -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=LINUX +// RUN: %clang_cc1 -std=c++11 -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefixes=ITANIUM,LINUX +// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-macosx -emit-llvm %s -o - | FileCheck %s --check-prefixes=ITANIUM,DARWIN // RUN: %clang_cc1 -std=c++11 -triple x86_64-windows-pc -emit-llvm %s -o - | FileCheck %s --check-prefix=WINDOWS struct S { int __attribute__((target("sse4.2"))) foo(int); @@ -16,39 +17,42 @@ int bar() { return s.foo(0); } -// LINUX: @_ZN1S3fooEi.ifunc = weak_odr ifunc i32 (ptr, i32), ptr @_ZN1S3fooEi.resolver +// DARWIN-NOT: comdat -// LINUX: define{{.*}} i32 @_ZN1S3fooEi(ptr {{[^,]*}} %this, i32 noundef %0) -// LINUX: ret i32 2 +// ITANIUM: @_ZN1S3fooEi.ifunc = weak_odr ifunc i32 (ptr, i32), ptr @_ZN1S3fooEi.resolver + +// ITANIUM: define{{.*}} i32 @_ZN1S3fooEi(ptr {{[^,]*}} %this, i32 noundef %0) +// ITANIUM: ret i32 2 // WINDOWS: define dso_local noundef i32 @"?foo@S@@QEAAHH@Z"(ptr {{[^,]*}} %this, i32 noundef %0) // WINDOWS: ret i32 2 -// LINUX: define{{.*}} i32 @_ZN1S3fooEi.sse4.2(ptr {{[^,]*}} %this, i32 noundef %0) -// LINUX: ret i32 0 +// ITANIUM: define{{.*}} i32 @_ZN1S3fooEi.sse4.2(ptr {{[^,]*}} %this, i32 noundef %0) +// ITANIUM: ret i32 0 // WINDOWS: define dso_local noundef i32 @"?foo@S@@QEAAHH@Z.sse4.2"(ptr {{[^,]*}} %this, i32 noundef %0) // WINDOWS: ret i32 0 -// LINUX: define{{.*}} i32 @_ZN1S3fooEi.arch_ivybridge(ptr {{[^,]*}} %this, i32 noundef %0) -// LINUX: ret i32 1 +// ITANIUM: define{{.*}} i32 @_ZN1S3fooEi.arch_ivybridge(ptr {{[^,]*}} %this, i32 noundef %0) +// ITANIUM: ret i32 1 // WINDOWS: define dso_local noundef i32 @"?foo@S@@QEAAHH@Z.arch_ivybridge"(ptr {{[^,]*}} %this, i32 noundef %0) // WINDOWS: ret i32 1 -// LINUX: define{{.*}} i32 @_Z3barv() -// LINUX: %s = alloca %struct.S, align 1 -// LINUX: %call = call noundef i32 @_ZN1S3fooEi.ifunc(ptr {{[^,]*}} %s, i32 noundef 0) +// ITANIUM: define{{.*}} i32 @_Z3barv() +// ITANIUM: %s = alloca %struct.S, align 1 +// ITANIUM: %call = call noundef i32 @_ZN1S3fooEi.ifunc(ptr {{[^,]*}} %s, i32 noundef 0) // WINDOWS: define dso_local noundef i32 @"?bar@@YAHXZ"() // WINDOWS: %s = alloca %struct.S, align 1 // WINDOWS: %call = call noundef i32 @"?foo@S@@QEAAHH@Z.resolver"(ptr {{[^,]*}} %s, i32 noundef 0) -// LINUX: define weak_odr ptr @_ZN1S3fooEi.resolver() comdat -// LINUX: ret ptr @_ZN1S3fooEi.arch_sandybridge -// LINUX: ret ptr @_ZN1S3fooEi.arch_ivybridge -// LINUX: ret ptr @_ZN1S3fooEi.sse4.2 -// LINUX: ret ptr @_ZN1S3fooEi +// ITANIUM: define weak_odr ptr @_ZN1S3fooEi.resolver() +// LINUX-SAME: comdat +// ITANIUM: ret ptr @_ZN1S3fooEi.arch_sandybridge +// ITANIUM: ret ptr @_ZN1S3fooEi.arch_ivybridge +// ITANIUM: ret ptr @_ZN1S3fooEi.sse4.2 +// ITANIUM: ret ptr @_ZN1S3fooEi // WINDOWS: define weak_odr dso_local i32 @"?foo@S@@QEAAHH@Z.resolver"(ptr %0, i32 %1) comdat // WINDOWS: call i32 @"?foo@S@@QEAAHH@Z.arch_sandybridge"(ptr %0, i32 %1) @@ -56,6 +60,6 @@ int bar() { // WINDOWS: call i32 @"?foo@S@@QEAAHH@Z.sse4.2"(ptr %0, i32 %1) // WINDOWS: call i32 @"?foo@S@@QEAAHH@Z"(ptr %0, i32 %1) -// LINUX: declare noundef i32 @_ZN1S3fooEi.arch_sandybridge(ptr {{[^,]*}}, i32 noundef) +// ITANIUM: declare noundef i32 @_ZN1S3fooEi.arch_sandybridge(ptr {{[^,]*}}, i32 noundef) // WINDOWS: declare dso_local noundef i32 @"?foo@S@@QEAAHH@Z.arch_sandybridge"(ptr {{[^,]*}}, i32 noundef) diff --git a/clang/test/CodeGenCXX/attr-target-mv-overloads.cpp b/clang/test/CodeGenCXX/attr-target-mv-overloads.cpp index 49a05e7..dddd898 100644 --- a/clang/test/CodeGenCXX/attr-target-mv-overloads.cpp +++ b/clang/test/CodeGenCXX/attr-target-mv-overloads.cpp @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -std=c++11 -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix=LINUX +// RUN: %clang_cc1 -std=c++11 -triple x86_64-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefixes=ITANIUM,LINUX +// RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-macosx -emit-llvm %s -o - | FileCheck %s --check-prefixes=ITANIUM,DARWIN // RUN: %clang_cc1 -std=c++11 -triple x86_64-windows-pc -emit-llvm %s -o - | FileCheck %s --check-prefix=WINDOWS int __attribute__((target("sse4.2"))) foo_overload(int) { return 0; } @@ -14,21 +15,23 @@ int bar2() { return foo_overload() + foo_overload(1); } -// LINUX: @_Z12foo_overloadv.ifunc = weak_odr ifunc i32 (), ptr @_Z12foo_overloadv.resolver -// LINUX: @_Z12foo_overloadi.ifunc = weak_odr ifunc i32 (i32), ptr @_Z12foo_overloadi.resolver +// DARWIN-NOT: comdat -// LINUX: define{{.*}} i32 @_Z12foo_overloadi.sse4.2(i32 noundef %0) -// LINUX: ret i32 0 -// LINUX: define{{.*}} i32 @_Z12foo_overloadi.arch_ivybridge(i32 noundef %0) -// LINUX: ret i32 1 -// LINUX: define{{.*}} i32 @_Z12foo_overloadi(i32 noundef %0) -// LINUX: ret i32 2 -// LINUX: define{{.*}} i32 @_Z12foo_overloadv.sse4.2() -// LINUX: ret i32 0 -// LINUX: define{{.*}} i32 @_Z12foo_overloadv.arch_ivybridge() -// LINUX: ret i32 1 -// LINUX: define{{.*}} i32 @_Z12foo_overloadv() -// LINUX: ret i32 2 +// ITANIUM: @_Z12foo_overloadv.ifunc = weak_odr ifunc i32 (), ptr @_Z12foo_overloadv.resolver +// ITANIUM: @_Z12foo_overloadi.ifunc = weak_odr ifunc i32 (i32), ptr @_Z12foo_overloadi.resolver + +// ITANIUM: define{{.*}} i32 @_Z12foo_overloadi.sse4.2(i32 noundef %0) +// ITANIUM: ret i32 0 +// ITANIUM: define{{.*}} i32 @_Z12foo_overloadi.arch_ivybridge(i32 noundef %0) +// ITANIUM: ret i32 1 +// ITANIUM: define{{.*}} i32 @_Z12foo_overloadi(i32 noundef %0) +// ITANIUM: ret i32 2 +// ITANIUM: define{{.*}} i32 @_Z12foo_overloadv.sse4.2() +// ITANIUM: ret i32 0 +// ITANIUM: define{{.*}} i32 @_Z12foo_overloadv.arch_ivybridge() +// ITANIUM: ret i32 1 +// ITANIUM: define{{.*}} i32 @_Z12foo_overloadv() +// ITANIUM: ret i32 2 // WINDOWS: define dso_local noundef i32 @"?foo_overload@@YAHH@Z.sse4.2"(i32 noundef %0) // WINDOWS: ret i32 0 @@ -43,19 +46,20 @@ int bar2() { // WINDOWS: define dso_local noundef i32 @"?foo_overload@@YAHXZ"() // WINDOWS: ret i32 2 -// LINUX: define{{.*}} i32 @_Z4bar2v() -// LINUX: call noundef i32 @_Z12foo_overloadv.ifunc() -// LINUX: call noundef i32 @_Z12foo_overloadi.ifunc(i32 noundef 1) +// ITANIUM: define{{.*}} i32 @_Z4bar2v() +// ITANIUM: call noundef i32 @_Z12foo_overloadv.ifunc() +// ITANIUM: call noundef i32 @_Z12foo_overloadi.ifunc(i32 noundef 1) // WINDOWS: define dso_local noundef i32 @"?bar2@@YAHXZ"() // WINDOWS: call noundef i32 @"?foo_overload@@YAHXZ.resolver"() // WINDOWS: call noundef i32 @"?foo_overload@@YAHH@Z.resolver"(i32 noundef 1) -// LINUX: define weak_odr ptr @_Z12foo_overloadv.resolver() comdat -// LINUX: ret ptr @_Z12foo_overloadv.arch_sandybridge -// LINUX: ret ptr @_Z12foo_overloadv.arch_ivybridge -// LINUX: ret ptr @_Z12foo_overloadv.sse4.2 -// LINUX: ret ptr @_Z12foo_overloadv +// ITANIUM: define weak_odr ptr @_Z12foo_overloadv.resolver() +// LINUX-SAME: comdat +// ITANIUM: ret ptr @_Z12foo_overloadv.arch_sandybridge +// ITANIUM: ret ptr @_Z12foo_overloadv.arch_ivybridge +// ITANIUM: ret ptr @_Z12foo_overloadv.sse4.2 +// ITANIUM: ret ptr @_Z12foo_overloadv // WINDOWS: define weak_odr dso_local i32 @"?foo_overload@@YAHXZ.resolver"() comdat // WINDOWS: call i32 @"?foo_overload@@YAHXZ.arch_sandybridge" @@ -63,11 +67,12 @@ int bar2() { // WINDOWS: call i32 @"?foo_overload@@YAHXZ.sse4.2" // WINDOWS: call i32 @"?foo_overload@@YAHXZ" -// LINUX: define weak_odr ptr @_Z12foo_overloadi.resolver() comdat -// LINUX: ret ptr @_Z12foo_overloadi.arch_sandybridge -// LINUX: ret ptr @_Z12foo_overloadi.arch_ivybridge -// LINUX: ret ptr @_Z12foo_overloadi.sse4.2 -// LINUX: ret ptr @_Z12foo_overloadi +// ITANIUM: define weak_odr ptr @_Z12foo_overloadi.resolver() +// LINUX-SAME: comdat +// ITANIUM: ret ptr @_Z12foo_overloadi.arch_sandybridge +// ITANIUM: ret ptr @_Z12foo_overloadi.arch_ivybridge +// ITANIUM: ret ptr @_Z12foo_overloadi.sse4.2 +// ITANIUM: ret ptr @_Z12foo_overloadi // WINDOWS: define weak_odr dso_local i32 @"?foo_overload@@YAHH@Z.resolver"(i32 %0) comdat // WINDOWS: call i32 @"?foo_overload@@YAHH@Z.arch_sandybridge" @@ -75,8 +80,8 @@ int bar2() { // WINDOWS: call i32 @"?foo_overload@@YAHH@Z.sse4.2" // WINDOWS: call i32 @"?foo_overload@@YAHH@Z" -// LINUX: declare noundef i32 @_Z12foo_overloadv.arch_sandybridge() -// LINUX: declare noundef i32 @_Z12foo_overloadi.arch_sandybridge(i32 noundef) +// ITANIUM: declare noundef i32 @_Z12foo_overloadv.arch_sandybridge() +// ITANIUM: declare noundef i32 @_Z12foo_overloadi.arch_sandybridge(i32 noundef) // WINDOWS: declare dso_local noundef i32 @"?foo_overload@@YAHXZ.arch_sandybridge"() // WINDOWS: declare dso_local noundef i32 @"?foo_overload@@YAHH@Z.arch_sandybridge"(i32 noundef) diff --git a/clang/test/CodeGenCXX/externc-ifunc-resolver.cpp b/clang/test/CodeGenCXX/externc-ifunc-resolver.cpp index 0518a8d..be4453ae 100644 --- a/clang/test/CodeGenCXX/externc-ifunc-resolver.cpp +++ b/clang/test/CodeGenCXX/externc-ifunc-resolver.cpp @@ -1,4 +1,6 @@ // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-macosx -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple arm64-apple-macosx -emit-llvm -o - %s | FileCheck %s extern "C" { __attribute__((used)) static void *resolve_foo() { return 0; } diff --git a/clang/test/SemaCXX/externc-ifunc-resolver.cpp b/clang/test/SemaCXX/externc-ifunc-resolver.cpp index aa44525..6c6c262 100644 --- a/clang/test/SemaCXX/externc-ifunc-resolver.cpp +++ b/clang/test/SemaCXX/externc-ifunc-resolver.cpp @@ -1,5 +1,9 @@ // RUN: %clang_cc1 -emit-llvm-only -triple x86_64-linux-gnu -verify %s +// RUN: %clang_cc1 -emit-llvm-only -triple x86_64-apple-macosx -verify %s +// RUN: %clang_cc1 -emit-llvm-only -triple arm64-apple-macosx -verify %s // RUN: not %clang_cc1 -triple x86_64-linux -emit-llvm-only -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s +// RUN: not %clang_cc1 -triple x86_64-apple-macosx -emit-llvm-only -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s +// RUN: not %clang_cc1 -triple arm64-apple-macosx -emit-llvm-only -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s extern "C" { __attribute__((used)) static void *resolve_foo() { return 0; } |