diff options
Diffstat (limited to 'test')
245 files changed, 4394 insertions, 842 deletions
diff --git a/test/Analysis/division-by-zero.c b/test/Analysis/division-by-zero.c new file mode 100644 index 0000000..d3c228e --- /dev/null +++ b/test/Analysis/division-by-zero.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -analyze -analyzer-checker=unix.Malloc %s +// Do not crash due to division by zero + +int f(unsigned int a) { + if (a <= 0) return 1 / a; + return a; +} diff --git a/test/Analysis/retain-release.m b/test/Analysis/retain-release.m index 1dbcda5..f0d91e3 100644 --- a/test/Analysis/retain-release.m +++ b/test/Analysis/retain-release.m @@ -2165,7 +2165,7 @@ void testCFReturnsNotRetained() { } void testCFReturnsNotRetainedAnnotated() { - extern void getViaParam2(CFTypeRef * __nonnull CF_RETURNS_NOT_RETAINED outObj); + extern void getViaParam2(CFTypeRef * _Nonnull CF_RETURNS_NOT_RETAINED outObj); CFTypeRef obj; getViaParam2(&obj); CFRelease(obj); // // expected-warning {{Incorrect decrement of the reference count of an object that is not owned at this point by the caller}} diff --git a/test/Analysis/test-include-cpp.cpp b/test/Analysis/test-include-cpp.cpp new file mode 100644 index 0000000..2ac5e11 --- /dev/null +++ b/test/Analysis/test-include-cpp.cpp @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -analyze -analyzer-checker=core -verify %s + +#include "test-include-cpp.h" + +int TestIncludeClass::test1(int *p) { + p = 0; + return *p; // expected-warning{{Dereference of null pointer}} +} + +int TestIncludeClass::test2(int *p) { + p = 0; + return *p; // expected-warning{{Dereference of null pointer}} +} diff --git a/test/Analysis/test-include-cpp.h b/test/Analysis/test-include-cpp.h new file mode 100644 index 0000000..90ec27a --- /dev/null +++ b/test/Analysis/test-include-cpp.h @@ -0,0 +1,9 @@ +#ifndef TEST_INCLUDE_CPP_H +#define TEST_INCLUDE_CPP_H + +class TestIncludeClass { + int test1(int *); + static int test2(int *); +}; + +#endif diff --git a/test/Analysis/test-include.c b/test/Analysis/test-include.c new file mode 100644 index 0000000..6aa80b9 --- /dev/null +++ b/test/Analysis/test-include.c @@ -0,0 +1,21 @@ +// RUN: %clang_cc1 -analyze -analyzer-checker=core -verify %s + +#include "test-include.h" +#define DIVYX(X,Y) Y/X + +void test_01(int *data) { + data = 0; + *data = 1; // expected-warning{{Dereference of null pointer}} +} + +int test_02() { + int res = DIVXY(1,0); // expected-warning{{Division by zero}} + // expected-warning@-1{{division by zero is undefined}} + return res; +} + +int test_03() { + int res = DIVYX(0,1); // expected-warning{{Division by zero}} + // expected-warning@-1{{division by zero is undefined}} + return res; +}
\ No newline at end of file diff --git a/test/Analysis/test-include.h b/test/Analysis/test-include.h new file mode 100644 index 0000000..07cd1c9 --- /dev/null +++ b/test/Analysis/test-include.h @@ -0,0 +1,2 @@ +void test_01(int * data); +#define DIVXY(X,Y) X/Y diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p7-1y.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p7-1y.cpp index f7b3e8e..c3dc1de 100644 --- a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p7-1y.cpp +++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p7-1y.cpp @@ -11,6 +11,9 @@ namespace std { int i; int &&f(); +template <typename T> +void overloaded_fn(T); // expected-note {{possible target}} + using Int = int; using IntLRef = int&; using IntRRef = int&&; @@ -57,6 +60,7 @@ decltype(auto) ((((((v1)))))) = 0; // ok decltype(auto) v2[1] = { 0 }; // expected-error {{cannot form array of 'decltype(auto)'}} decltype(auto) &v3 = { 0 }; // expected-error {{cannot form reference to 'decltype(auto)'}} decltype(auto) *v4 = { 0 }; // expected-error {{cannot form pointer to 'decltype(auto)'}} +decltype(auto) v5 = &overloaded_fn; // expected-error {{could not be resolved}} auto multi1a = 0, &multi1b = multi1a; auto multi1c = multi1a, multi1d = multi1b; diff --git a/test/CXX/drs/dr9xx.cpp b/test/CXX/drs/dr9xx.cpp index 4bcd656..b37e17d 100644 --- a/test/CXX/drs/dr9xx.cpp +++ b/test/CXX/drs/dr9xx.cpp @@ -44,3 +44,32 @@ namespace dr990 { // dr990: 3.5 D d{}; #endif } + +namespace dr948 { // dr948: 3.7 +#if __cplusplus >= 201103L + class A { + public: + constexpr A(int v) : v(v) { } + constexpr operator int() const { return v; } + private: + int v; + }; + + constexpr int id(int x) + { + return x; + } + + void f() { + if (constexpr int i = id(101)) { } + switch (constexpr int i = id(2)) { default: break; case 2: break; } + for (; constexpr int i = id(0); ) { } + while (constexpr int i = id(0)) { } + + if (constexpr A i = 101) { } + switch (constexpr A i = 2) { default: break; case 2: break; } + for (; constexpr A i = 0; ) { } + while (constexpr A i = 0) { } + } +#endif +} diff --git a/test/CodeCompletion/macros-in-modules.c b/test/CodeCompletion/macros-in-modules.c new file mode 100644 index 0000000..82ffaae --- /dev/null +++ b/test/CodeCompletion/macros-in-modules.c @@ -0,0 +1,11 @@ +// RUN: rm -rf %t && mkdir %t +// RUN: echo 'module Foo { header "foo.h" }' > %t/module.modulemap +// RUN: echo '#define FOO_MACRO 42' > %t/foo.h +// RUN: c-index-test -code-completion-at=%s:9:1 -I %t %s | FileCheck %s +// RUN: c-index-test -code-completion-at=%s:9:1 -I %t -fmodules %s | FileCheck %s + +#include "foo.h" +int x = +/*here*/1; + +// CHECK: FOO_MACRO diff --git a/test/CodeCompletion/macros-in-modules.m b/test/CodeCompletion/macros-in-modules.m new file mode 100644 index 0000000..8d6b375 --- /dev/null +++ b/test/CodeCompletion/macros-in-modules.m @@ -0,0 +1,10 @@ +// RUN: rm -rf %t && mkdir %t +// RUN: echo 'module Foo { header "foo.h" }' > %t/module.modulemap +// RUN: echo '#define FOO_MACRO 42' > %t/foo.h +// RUN: c-index-test -code-completion-at=%s:8:1 -I %t -fmodules %s | FileCheck %s + +@import Foo; +int x = +/*here*/1; + +// CHECK: FOO_MACRO diff --git a/test/CodeGen/2004-11-27-StaticFunctionRedeclare.c b/test/CodeGen/2004-11-27-StaticFunctionRedeclare.c index 9ceee4c..f6ce552 100644 --- a/test/CodeGen/2004-11-27-StaticFunctionRedeclare.c +++ b/test/CodeGen/2004-11-27-StaticFunctionRedeclare.c @@ -6,7 +6,7 @@ // This is PR244 -// CHECK-LABEL: define void @bar( +// CHECK-LABEL: define {{.*}}void @bar( // CHECK: call {{.*}} @func // CHECK: define internal {{.*}}i32 @func( static int func(); diff --git a/test/CodeGen/2007-04-14-FNoBuiltin.c b/test/CodeGen/2007-04-14-FNoBuiltin.c index 25ae01c..4d194b1 100644 --- a/test/CodeGen/2007-04-14-FNoBuiltin.c +++ b/test/CodeGen/2007-04-14-FNoBuiltin.c @@ -3,7 +3,7 @@ extern int printf(const char*, ...); -// CHECK: define void {{.*}}foo( +// CHECK: define {{.*}}void {{.*}}foo( void foo(const char *msg) { // CHECK: call {{.*}}printf printf("%s\n",msg); diff --git a/test/CodeGen/PR8880.c b/test/CodeGen/PR8880.c index e03d2a4..ff8491e 100644 --- a/test/CodeGen/PR8880.c +++ b/test/CodeGen/PR8880.c @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -Wno-gcc-compat -emit-llvm -o - %s | FileCheck %s void pr8880_cg_1(int *iptr) { -// CHECK-LABEL: define void @pr8880_cg_1( +// CHECK-LABEL: define {{.*}}void @pr8880_cg_1( int i, j; // CHECK: br label %[[OUTER_COND:[0-9A-Za-z$._]+]] for (i = 2; i != 10 ; i++ ) @@ -31,7 +31,7 @@ void pr8880_cg_1(int *iptr) { } void pr8880_cg_2(int *iptr) { -// CHECK-LABEL: define void @pr8880_cg_2( +// CHECK-LABEL: define {{.*}}void @pr8880_cg_2( int i, j; // CHECK: br label %[[OUTER_COND:[0-9A-Za-z$._]+]] for (i = 2; i != 10 ; i++ ) @@ -61,7 +61,7 @@ void pr8880_cg_2(int *iptr) { } void pr8880_cg_3(int *iptr) { -// CHECK-LABEL: define void @pr8880_cg_3( +// CHECK-LABEL: define {{.*}}void @pr8880_cg_3( int i, j; // CHECK: br label %[[OUTER_COND:[0-9A-Za-z$._]+]] for (i = 2 ; i != 10 ; i++ ) @@ -92,7 +92,7 @@ void pr8880_cg_3(int *iptr) { } void pr8880_cg_4(int *iptr) { -// CHECK-LABEL: define void @pr8880_cg_4( +// CHECK-LABEL: define {{.*}}void @pr8880_cg_4( int i, j; // CHECK: br label %[[OUTER_COND:[0-9A-Za-z$._]+]] for (i = 2 ; i != 10 ; i++ ) @@ -123,7 +123,7 @@ void pr8880_cg_4(int *iptr) { } void pr8880_cg_5(int x, int *iptr) { -// CHECK-LABEL: define void @pr8880_cg_5( +// CHECK-LABEL: define {{.*}}void @pr8880_cg_5( int y = 5; // CHECK: br label %[[OUTER_COND:[0-9A-Za-z$._]+]] // CHECK: [[OUTER_COND]] @@ -148,7 +148,7 @@ void pr8880_cg_5(int x, int *iptr) { } void pr8880_cg_6(int x, int *iptr) { -// CHECK-LABEL: define void @pr8880_cg_6( +// CHECK-LABEL: define {{.*}}void @pr8880_cg_6( int y = 5; // CHECK: br label %[[OUTER_COND:[0-9A-Za-z$._]+]] // CHECK: [[OUTER_COND]] diff --git a/test/CodeGen/arm-microsoft-intrinsics.c b/test/CodeGen/arm-microsoft-intrinsics.c index 5f19e5e..e073cc2 100644 --- a/test/CodeGen/arm-microsoft-intrinsics.c +++ b/test/CodeGen/arm-microsoft-intrinsics.c @@ -47,17 +47,17 @@ unsigned int check_MoveFromCoprocessor2(void) { // CHECK-MSVC: @llvm.arm.mrc2(i32 0, i32 0, i32 0, i32 0, i32 0) // CHECK-EABI: error: implicit declaration of function '_MoveFromCoprocessor2' -void check_MoveToCoprocessor(void) { - _MoveToCoprocessor(0, 0, 0, 0, 0, 0); +void check_MoveToCoprocessor(unsigned int value) { + _MoveToCoprocessor(value, 10, 7, 1, 0, 0); } -// CHECK-MSVC: @llvm.arm.mcr(i32 0, i32 0, i32 0, i32 0, i32 0, i32 0) +// CHECK-MSVC: @llvm.arm.mcr(i32 10, i32 7, i32 %{{[^,]*}}, i32 1, i32 0, i32 0) // CHECK-EABI: error: implicit declaration of function '_MoveToCoprocessor' -void check_MoveToCoprocessor2(void) { - _MoveToCoprocessor2(0, 0, 0, 0, 0, 0); +void check_MoveToCoprocessor2(unsigned int value) { + _MoveToCoprocessor2(value, 10, 7, 1, 0, 0); } -// CHECK-MSVC: @llvm.arm.mcr2(i32 0, i32 0, i32 0, i32 0, i32 0, i32 0) +// CHECK-MSVC: @llvm.arm.mcr2(i32 10, i32 7, i32 %{{[^,]*}}, i32 1, i32 0, i32 0) // CHECK-EABI: error: implicit declaration of function '_MoveToCoprocessor2' diff --git a/test/CodeGen/arm-target-features.c b/test/CodeGen/arm-target-features.c index ece8bdf..36804b4 100644 --- a/test/CodeGen/arm-target-features.c +++ b/test/CodeGen/arm-target-features.c @@ -6,7 +6,7 @@ // RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu cortex-a5 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4 -// CHECK-VFP4: "target-features"="+vfp4,+neon" +// CHECK-VFP4: "target-features"="+neon,+vfp4" // RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu cortex-a7 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV @@ -15,14 +15,14 @@ // RUN: %clang_cc1 -triple armv7-linux-gnueabihf -target-cpu cortex-a17 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV // RUN: %clang_cc1 -triple thumbv7s-linux-gnueabi -target-cpu swift -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV // RUN: %clang_cc1 -triple thumbv7-linux-gnueabihf -target-cpu krait -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-VFP4-DIV -// CHECK-VFP4-DIV: "target-features"="+vfp4,+neon,+hwdiv,+hwdiv-arm" +// CHECK-VFP4-DIV: "target-features"="+hwdiv,+hwdiv-arm,+neon,+vfp4" // RUN: %clang_cc1 -triple thumbv7s-apple-ios7.0 -target-cpu cyclone -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8 // RUN: %clang_cc1 -triple armv8-linux-gnueabi -target-cpu cortex-a53 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8 // RUN: %clang_cc1 -triple thumbv8-linux-gnueabihf -target-cpu cortex-a57 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8 // RUN: %clang_cc1 -triple thumbv8-linux-gnueabihf -target-cpu cortex-a72 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-BASIC-V8 -// CHECK-BASIC-V8: "target-features"="+neon,+fp-armv8,+hwdiv,+crypto,+crc,+hwdiv-arm" +// CHECK-BASIC-V8: "target-features"="+crc,+crypto,+fp-armv8,+hwdiv,+hwdiv-arm,+neon" // RUN: %clang_cc1 -triple thumbv7-linux-gnueabi -target-cpu cortex-r5 -emit-llvm -o - %s | FileCheck %s --check-prefix=CHECK-DIV diff --git a/test/CodeGen/attr-nodebug.c b/test/CodeGen/attr-nodebug.c index 66caa2b..07a4aa3 100644 --- a/test/CodeGen/attr-nodebug.c +++ b/test/CodeGen/attr-nodebug.c @@ -1,12 +1,32 @@ -// RUN: %clang_cc1 -g -emit-llvm -o %t %s -// RUN: not grep 'call void @llvm.dbg.func.start' %t +// RUN: %clang_cc1 -g -emit-llvm -o - %s | FileCheck %s void t1() __attribute__((nodebug)); void t1() { int a = 10; - a++; } +void t2() +{ + int b = 10; + b++; +} + +// With nodebug, IR should have no llvm.dbg.* calls, or !dbg annotations. +// CHECK-LABEL: @t1 +// CHECK-NOT: dbg +// CHECK: } + +// For sanity, check those things do occur normally. +// CHECK-LABEL: @t2 +// CHECK: call{{.*}}llvm.dbg +// CHECK: !dbg +// CHECK: } + +// We should see a function description for t2 but not t1. +// CHECK-NOT: DISubprogram(name: "t1" +// CHECK: DISubprogram(name: "t2" +// CHECK-NOT: DISubprogram(name: "t1" + diff --git a/test/CodeGen/attr-target.c b/test/CodeGen/attr-target.c index 8c0f335..7ea5fe5 100644 --- a/test/CodeGen/attr-target.c +++ b/test/CodeGen/attr-target.c @@ -9,6 +9,8 @@ int __attribute__((target("fpmath=387"))) koala(int a) { return 4; } int __attribute__((target("mno-sse2"))) echidna(int a) { return 4; } +int __attribute__((target("sse4"))) panda(int a) { return 4; } + int bar(int a) { return baz(a) + foo(a); } // Check that we emit the additional subtarget and cpu features for foo and not for baz or bar. @@ -21,5 +23,6 @@ int bar(int a) { return baz(a) + foo(a); } // CHECK: echidna{{.*}} #2 // CHECK: bar{{.*}} #0 // CHECK: #0 = {{.*}}"target-cpu"="x86-64" "target-features"="+sse,+sse2" -// CHECK: #1 = {{.*}}"target-cpu"="ivybridge" "target-features"="+sse,+sse2,+avx,+sse4.2" -// CHECK: #2 = {{.*}}"target-cpu"="x86-64" "target-features"="+sse,+sse2,-sse2" +// CHECK: #1 = {{.*}}"target-cpu"="ivybridge" "target-features"="+avx,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3" +// CHECK: #2 = {{.*}}"target-cpu"="x86-64" "target-features"="+sse,-aes,-avx,-avx2,-avx512bw,-avx512cd,-avx512dq,-avx512er,-avx512f,-avx512pf,-avx512vl,-f16c,-fma,-fma4,-pclmul,-sha,-sse2,-sse3,-sse4.1,-sse4.2,-sse4a,-ssse3,-xop" +// CHECK: #3 = {{.*}}"target-cpu"="x86-64" "target-features"="+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3" diff --git a/test/CodeGen/avx512bw-builtins.c b/test/CodeGen/avx512bw-builtins.c index 452d737..6cc02ef 100644 --- a/test/CodeGen/avx512bw-builtins.c +++ b/test/CodeGen/avx512bw-builtins.c @@ -427,3 +427,409 @@ __m512i test_mm512_maskz_mullo_epi16 (__mmask32 __U, __m512i __A, __m512i __B) { //CHECK: @llvm.x86.avx512.mask.pmull.w.512 return _mm512_maskz_mullo_epi16(__U, __A, __B); } + +__m512i test_mm512_mask_blend_epi8(__mmask64 __U, __m512i __A, __m512i __W) { + // CHECK-LABEL: @test_mm512_mask_blend_epi8 + // CHECK: @llvm.x86.avx512.mask.blend.b.512 + return _mm512_mask_blend_epi8(__U,__A,__W); +} +__m512i test_mm512_mask_blend_epi16(__mmask32 __U, __m512i __A, __m512i __W) { + // CHECK-LABEL: @test_mm512_mask_blend_epi16 + // CHECK: @llvm.x86.avx512.mask.blend.w.512 + return _mm512_mask_blend_epi16(__U,__A,__W); +} +__m512i test_mm512_abs_epi8(__m512i __A) { + // CHECK-LABEL: @test_mm512_abs_epi8 + // CHECK: @llvm.x86.avx512.mask.pabs.b.512 + return _mm512_abs_epi8(__A); +} +__m512i test_mm512_mask_abs_epi8(__m512i __W, __mmask64 __U, __m512i __A) { + // CHECK-LABEL: @test_mm512_mask_abs_epi8 + // CHECK: @llvm.x86.avx512.mask.pabs.b.512 + return _mm512_mask_abs_epi8(__W,__U,__A); +} +__m512i test_mm512_maskz_abs_epi8(__mmask64 __U, __m512i __A) { + // CHECK-LABEL: @test_mm512_maskz_abs_epi8 + // CHECK: @llvm.x86.avx512.mask.pabs.b.512 + return _mm512_maskz_abs_epi8(__U,__A); +} +__m512i test_mm512_abs_epi16(__m512i __A) { + // CHECK-LABEL: @test_mm512_abs_epi16 + // CHECK: @llvm.x86.avx512.mask.pabs.w.512 + return _mm512_abs_epi16(__A); +} +__m512i test_mm512_mask_abs_epi16(__m512i __W, __mmask32 __U, __m512i __A) { + // CHECK-LABEL: @test_mm512_mask_abs_epi16 + // CHECK: @llvm.x86.avx512.mask.pabs.w.512 + return _mm512_mask_abs_epi16(__W,__U,__A); +} +__m512i test_mm512_maskz_abs_epi16(__mmask32 __U, __m512i __A) { + // CHECK-LABEL: @test_mm512_maskz_abs_epi16 + // CHECK: @llvm.x86.avx512.mask.pabs.w.512 + return _mm512_maskz_abs_epi16(__U,__A); +} +__m512i test_mm512_packs_epi32(__m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_packs_epi32 + // CHECK: @llvm.x86.avx512.mask.packssdw.512 + return _mm512_packs_epi32(__A,__B); +} +__m512i test_mm512_maskz_packs_epi32(__mmask32 __M, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_maskz_packs_epi32 + // CHECK: @llvm.x86.avx512.mask.packssdw.512 + return _mm512_maskz_packs_epi32(__M,__A,__B); +} +__m512i test_mm512_mask_packs_epi32(__m512i __W, __mmask32 __M, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_mask_packs_epi32 + // CHECK: @llvm.x86.avx512.mask.packssdw.512 + return _mm512_mask_packs_epi32(__W,__M,__A,__B); +} +__m512i test_mm512_packs_epi16(__m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_packs_epi16 + // CHECK: @llvm.x86.avx512.mask.packsswb.512 + return _mm512_packs_epi16(__A,__B); +} +__m512i test_mm512_mask_packs_epi16(__m512i __W, __mmask64 __M, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_mask_packs_epi16 + // CHECK: @llvm.x86.avx512.mask.packsswb.512 + return _mm512_mask_packs_epi16(__W,__M,__A,__B); +} +__m512i test_mm512_maskz_packs_epi16(__mmask64 __M, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_maskz_packs_epi16 + // CHECK: @llvm.x86.avx512.mask.packsswb.512 + return _mm512_maskz_packs_epi16(__M,__A,__B); +} +__m512i test_mm512_packus_epi32(__m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_packus_epi32 + // CHECK: @llvm.x86.avx512.mask.packusdw.512 + return _mm512_packus_epi32(__A,__B); +} +__m512i test_mm512_maskz_packus_epi32(__mmask32 __M, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_maskz_packus_epi32 + // CHECK: @llvm.x86.avx512.mask.packusdw.512 + return _mm512_maskz_packus_epi32(__M,__A,__B); +} +__m512i test_mm512_mask_packus_epi32(__m512i __W, __mmask32 __M, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_mask_packus_epi32 + // CHECK: @llvm.x86.avx512.mask.packusdw.512 + return _mm512_mask_packus_epi32(__W,__M,__A,__B); +} +__m512i test_mm512_packus_epi16(__m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_packus_epi16 + // CHECK: @llvm.x86.avx512.mask.packuswb.512 + return _mm512_packus_epi16(__A,__B); +} +__m512i test_mm512_mask_packus_epi16(__m512i __W, __mmask64 __M, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_mask_packus_epi16 + // CHECK: @llvm.x86.avx512.mask.packuswb.512 + return _mm512_mask_packus_epi16(__W,__M,__A,__B); +} +__m512i test_mm512_maskz_packus_epi16(__mmask64 __M, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_maskz_packus_epi16 + // CHECK: @llvm.x86.avx512.mask.packuswb.512 + return _mm512_maskz_packus_epi16(__M,__A,__B); +} +__m512i test_mm512_adds_epi8(__m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_adds_epi8 + // CHECK: @llvm.x86.avx512.mask.padds.b.512 + return _mm512_adds_epi8(__A,__B); +} +__m512i test_mm512_mask_adds_epi8(__m512i __W, __mmask64 __U, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_mask_adds_epi8 + // CHECK: @llvm.x86.avx512.mask.padds.b.512 + return _mm512_mask_adds_epi8(__W,__U,__A,__B); +} +__m512i test_mm512_maskz_adds_epi8(__mmask64 __U, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_maskz_adds_epi8 + // CHECK: @llvm.x86.avx512.mask.padds.b.512 + return _mm512_maskz_adds_epi8(__U,__A,__B); +} +__m512i test_mm512_adds_epi16(__m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_adds_epi16 + // CHECK: @llvm.x86.avx512.mask.padds.w.512 + return _mm512_adds_epi16(__A,__B); +} +__m512i test_mm512_mask_adds_epi16(__m512i __W, __mmask32 __U, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_mask_adds_epi16 + // CHECK: @llvm.x86.avx512.mask.padds.w.512 + return _mm512_mask_adds_epi16(__W,__U,__A,__B); +} +__m512i test_mm512_maskz_adds_epi16(__mmask32 __U, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_maskz_adds_epi16 + // CHECK: @llvm.x86.avx512.mask.padds.w.512 + return _mm512_maskz_adds_epi16(__U,__A,__B); +} +__m512i test_mm512_adds_epu8(__m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_adds_epu8 + // CHECK: @llvm.x86.avx512.mask.paddus.b.512 + return _mm512_adds_epu8(__A,__B); +} +__m512i test_mm512_mask_adds_epu8(__m512i __W, __mmask64 __U, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_mask_adds_epu8 + // CHECK: @llvm.x86.avx512.mask.paddus.b.512 + return _mm512_mask_adds_epu8(__W,__U,__A,__B); +} +__m512i test_mm512_maskz_adds_epu8(__mmask64 __U, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_maskz_adds_epu8 + // CHECK: @llvm.x86.avx512.mask.paddus.b.512 + return _mm512_maskz_adds_epu8(__U,__A,__B); +} +__m512i test_mm512_adds_epu16(__m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_adds_epu16 + // CHECK: @llvm.x86.avx512.mask.paddus.w.512 + return _mm512_adds_epu16(__A,__B); +} +__m512i test_mm512_mask_adds_epu16(__m512i __W, __mmask32 __U, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_mask_adds_epu16 + // CHECK: @llvm.x86.avx512.mask.paddus.w.512 + return _mm512_mask_adds_epu16(__W,__U,__A,__B); +} +__m512i test_mm512_maskz_adds_epu16(__mmask32 __U, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_maskz_adds_epu16 + // CHECK: @llvm.x86.avx512.mask.paddus.w.512 + return _mm512_maskz_adds_epu16(__U,__A,__B); +} +__m512i test_mm512_avg_epu8(__m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_avg_epu8 + // CHECK: @llvm.x86.avx512.mask.pavg.b.512 + return _mm512_avg_epu8(__A,__B); +} +__m512i test_mm512_mask_avg_epu8(__m512i __W, __mmask64 __U, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_mask_avg_epu8 + // CHECK: @llvm.x86.avx512.mask.pavg.b.512 + return _mm512_mask_avg_epu8(__W,__U,__A,__B); +} +__m512i test_mm512_maskz_avg_epu8(__mmask64 __U, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_maskz_avg_epu8 + // CHECK: @llvm.x86.avx512.mask.pavg.b.512 + return _mm512_maskz_avg_epu8(__U,__A,__B); +} +__m512i test_mm512_avg_epu16(__m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_avg_epu16 + // CHECK: @llvm.x86.avx512.mask.pavg.w.512 + return _mm512_avg_epu16(__A,__B); +} +__m512i test_mm512_mask_avg_epu16(__m512i __W, __mmask32 __U, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_mask_avg_epu16 + // CHECK: @llvm.x86.avx512.mask.pavg.w.512 + return _mm512_mask_avg_epu16(__W,__U,__A,__B); +} +__m512i test_mm512_maskz_avg_epu16(__mmask32 __U, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_maskz_avg_epu16 + // CHECK: @llvm.x86.avx512.mask.pavg.w.512 + return _mm512_maskz_avg_epu16(__U,__A,__B); +} +__m512i test_mm512_max_epi8(__m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_max_epi8 + // CHECK: @llvm.x86.avx512.mask.pmaxs.b.512 + return _mm512_max_epi8(__A,__B); +} +__m512i test_mm512_maskz_max_epi8(__mmask64 __M, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_maskz_max_epi8 + // CHECK: @llvm.x86.avx512.mask.pmaxs.b.512 + return _mm512_maskz_max_epi8(__M,__A,__B); +} +__m512i test_mm512_mask_max_epi8(__m512i __W, __mmask64 __M, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_mask_max_epi8 + // CHECK: @llvm.x86.avx512.mask.pmaxs.b.512 + return _mm512_mask_max_epi8(__W,__M,__A,__B); +} +__m512i test_mm512_max_epi16(__m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_max_epi16 + // CHECK: @llvm.x86.avx512.mask.pmaxs.w.512 + return _mm512_max_epi16(__A,__B); +} +__m512i test_mm512_maskz_max_epi16(__mmask32 __M, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_maskz_max_epi16 + // CHECK: @llvm.x86.avx512.mask.pmaxs.w.512 + return _mm512_maskz_max_epi16(__M,__A,__B); +} +__m512i test_mm512_mask_max_epi16(__m512i __W, __mmask32 __M, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_mask_max_epi16 + // CHECK: @llvm.x86.avx512.mask.pmaxs.w.512 + return _mm512_mask_max_epi16(__W,__M,__A,__B); +} +__m512i test_mm512_max_epu8(__m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_max_epu8 + // CHECK: @llvm.x86.avx512.mask.pmaxu.b.512 + return _mm512_max_epu8(__A,__B); +} +__m512i test_mm512_maskz_max_epu8(__mmask64 __M, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_maskz_max_epu8 + // CHECK: @llvm.x86.avx512.mask.pmaxu.b.512 + return _mm512_maskz_max_epu8(__M,__A,__B); +} +__m512i test_mm512_mask_max_epu8(__m512i __W, __mmask64 __M, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_mask_max_epu8 + // CHECK: @llvm.x86.avx512.mask.pmaxu.b.512 + return _mm512_mask_max_epu8(__W,__M,__A,__B); +} +__m512i test_mm512_max_epu16(__m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_max_epu16 + // CHECK: @llvm.x86.avx512.mask.pmaxu.w.512 + return _mm512_max_epu16(__A,__B); +} +__m512i test_mm512_maskz_max_epu16(__mmask32 __M, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_maskz_max_epu16 + // CHECK: @llvm.x86.avx512.mask.pmaxu.w.512 + return _mm512_maskz_max_epu16(__M,__A,__B); +} +__m512i test_mm512_mask_max_epu16(__m512i __W, __mmask32 __M, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_mask_max_epu16 + // CHECK: @llvm.x86.avx512.mask.pmaxu.w.512 + return _mm512_mask_max_epu16(__W,__M,__A,__B); +} +__m512i test_mm512_min_epi8(__m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_min_epi8 + // CHECK: @llvm.x86.avx512.mask.pmins.b.512 + return _mm512_min_epi8(__A,__B); +} +__m512i test_mm512_maskz_min_epi8(__mmask64 __M, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_maskz_min_epi8 + // CHECK: @llvm.x86.avx512.mask.pmins.b.512 + return _mm512_maskz_min_epi8(__M,__A,__B); +} +__m512i test_mm512_mask_min_epi8(__m512i __W, __mmask64 __M, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_mask_min_epi8 + // CHECK: @llvm.x86.avx512.mask.pmins.b.512 + return _mm512_mask_min_epi8(__W,__M,__A,__B); +} +__m512i test_mm512_min_epi16(__m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_min_epi16 + // CHECK: @llvm.x86.avx512.mask.pmins.w.512 + return _mm512_min_epi16(__A,__B); +} +__m512i test_mm512_maskz_min_epi16(__mmask32 __M, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_maskz_min_epi16 + // CHECK: @llvm.x86.avx512.mask.pmins.w.512 + return _mm512_maskz_min_epi16(__M,__A,__B); +} +__m512i test_mm512_mask_min_epi16(__m512i __W, __mmask32 __M, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_mask_min_epi16 + // CHECK: @llvm.x86.avx512.mask.pmins.w.512 + return _mm512_mask_min_epi16(__W,__M,__A,__B); +} +__m512i test_mm512_min_epu8(__m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_min_epu8 + // CHECK: @llvm.x86.avx512.mask.pminu.b.512 + return _mm512_min_epu8(__A,__B); +} +__m512i test_mm512_maskz_min_epu8(__mmask64 __M, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_maskz_min_epu8 + // CHECK: @llvm.x86.avx512.mask.pminu.b.512 + return _mm512_maskz_min_epu8(__M,__A,__B); +} +__m512i test_mm512_mask_min_epu8(__m512i __W, __mmask64 __M, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_mask_min_epu8 + // CHECK: @llvm.x86.avx512.mask.pminu.b.512 + return _mm512_mask_min_epu8(__W,__M,__A,__B); +} +__m512i test_mm512_min_epu16(__m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_min_epu16 + // CHECK: @llvm.x86.avx512.mask.pminu.w.512 + return _mm512_min_epu16(__A,__B); +} +__m512i test_mm512_maskz_min_epu16(__mmask32 __M, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_maskz_min_epu16 + // CHECK: @llvm.x86.avx512.mask.pminu.w.512 + return _mm512_maskz_min_epu16(__M,__A,__B); +} +__m512i test_mm512_mask_min_epu16(__m512i __W, __mmask32 __M, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_mask_min_epu16 + // CHECK: @llvm.x86.avx512.mask.pminu.w.512 + return _mm512_mask_min_epu16(__W,__M,__A,__B); +} +__m512i test_mm512_shuffle_epi8(__m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_shuffle_epi8 + // CHECK: @llvm.x86.avx512.mask.pshuf.b.512 + return _mm512_shuffle_epi8(__A,__B); +} +__m512i test_mm512_mask_shuffle_epi8(__m512i __W, __mmask64 __U, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_mask_shuffle_epi8 + // CHECK: @llvm.x86.avx512.mask.pshuf.b.512 + return _mm512_mask_shuffle_epi8(__W,__U,__A,__B); +} +__m512i test_mm512_maskz_shuffle_epi8(__mmask64 __U, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_maskz_shuffle_epi8 + // CHECK: @llvm.x86.avx512.mask.pshuf.b.512 + return _mm512_maskz_shuffle_epi8(__U,__A,__B); +} +__m512i test_mm512_subs_epi8(__m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_subs_epi8 + // CHECK: @llvm.x86.avx512.mask.psubs.b.512 + return _mm512_subs_epi8(__A,__B); +} +__m512i test_mm512_mask_subs_epi8(__m512i __W, __mmask64 __U, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_mask_subs_epi8 + // CHECK: @llvm.x86.avx512.mask.psubs.b.512 + return _mm512_mask_subs_epi8(__W,__U,__A,__B); +} +__m512i test_mm512_maskz_subs_epi8(__mmask64 __U, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_maskz_subs_epi8 + // CHECK: @llvm.x86.avx512.mask.psubs.b.512 + return _mm512_maskz_subs_epi8(__U,__A,__B); +} +__m512i test_mm512_subs_epi16(__m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_subs_epi16 + // CHECK: @llvm.x86.avx512.mask.psubs.w.512 + return _mm512_subs_epi16(__A,__B); +} +__m512i test_mm512_mask_subs_epi16(__m512i __W, __mmask32 __U, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_mask_subs_epi16 + // CHECK: @llvm.x86.avx512.mask.psubs.w.512 + return _mm512_mask_subs_epi16(__W,__U,__A,__B); +} +__m512i test_mm512_maskz_subs_epi16(__mmask32 __U, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_maskz_subs_epi16 + // CHECK: @llvm.x86.avx512.mask.psubs.w.512 + return _mm512_maskz_subs_epi16(__U,__A,__B); +} +__m512i test_mm512_subs_epu8(__m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_subs_epu8 + // CHECK: @llvm.x86.avx512.mask.psubus.b.512 + return _mm512_subs_epu8(__A,__B); +} +__m512i test_mm512_mask_subs_epu8(__m512i __W, __mmask64 __U, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_mask_subs_epu8 + // CHECK: @llvm.x86.avx512.mask.psubus.b.512 + return _mm512_mask_subs_epu8(__W,__U,__A,__B); +} +__m512i test_mm512_maskz_subs_epu8(__mmask64 __U, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_maskz_subs_epu8 + // CHECK: @llvm.x86.avx512.mask.psubus.b.512 + return _mm512_maskz_subs_epu8(__U,__A,__B); +} +__m512i test_mm512_subs_epu16(__m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_subs_epu16 + // CHECK: @llvm.x86.avx512.mask.psubus.w.512 + return _mm512_subs_epu16(__A,__B); +} +__m512i test_mm512_mask_subs_epu16(__m512i __W, __mmask32 __U, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_mask_subs_epu16 + // CHECK: @llvm.x86.avx512.mask.psubus.w.512 + return _mm512_mask_subs_epu16(__W,__U,__A,__B); +} +__m512i test_mm512_maskz_subs_epu16(__mmask32 __U, __m512i __A, __m512i __B) { + // CHECK-LABEL: @test_mm512_maskz_subs_epu16 + // CHECK: @llvm.x86.avx512.mask.psubus.w.512 + return _mm512_maskz_subs_epu16(__U,__A,__B); +} +__m512i test_mm512_mask2_permutex2var_epi16(__m512i __A, __m512i __I, __mmask32 __U, __m512i __B) { + // CHECK-LABEL: @test_mm512_mask2_permutex2var_epi16 + // CHECK: @llvm.x86.avx512.mask.vpermi2var.hi.512 + return _mm512_mask2_permutex2var_epi16(__A,__I,__U,__B); +} +__m512i test_mm512_permutex2var_epi16(__m512i __A, __m512i __I, __m512i __B) { + // CHECK-LABEL: @test_mm512_permutex2var_epi16 + // CHECK: @llvm.x86.avx512.mask.vpermt2var.hi.512 + return _mm512_permutex2var_epi16(__A,__I,__B); +} +__m512i test_mm512_mask_permutex2var_epi16(__m512i __A, __mmask32 __U, __m512i __I, __m512i __B) { + // CHECK-LABEL: @test_mm512_mask_permutex2var_epi16 + // CHECK: @llvm.x86.avx512.mask.vpermt2var.hi.512 + return _mm512_mask_permutex2var_epi16(__A,__U,__I,__B); +} +__m512i test_mm512_maskz_permutex2var_epi16(__mmask32 __U, __m512i __A, __m512i __I, __m512i __B) { + // CHECK-LABEL: @test_mm512_maskz_permutex2var_epi16 + // CHECK: @llvm.x86.avx512.mask.vpermt2var.hi.512 + return _mm512_maskz_permutex2var_epi16(__U,__A,__I,__B); +} diff --git a/test/CodeGen/avx512cdintrin.c b/test/CodeGen/avx512cdintrin.c new file mode 100644 index 0000000..1b4860a --- /dev/null +++ b/test/CodeGen/avx512cdintrin.c @@ -0,0 +1,62 @@ +// RUN: %clang_cc1 %s -O0 -triple=x86_64-apple-darwin -ffreestanding -target-feature +avx512cd -emit-llvm -o - -Werror | FileCheck %s +#include <immintrin.h> +__m512i test_mm512_conflict_epi64(__m512i __A) { + // CHECK-LABEL: @test_mm512_conflict_epi64 + // CHECK: @llvm.x86.avx512.mask.conflict.q.512 + return _mm512_conflict_epi64(__A); +} +__m512i test_mm512_mask_conflict_epi64(__m512i __W, __mmask8 __U, __m512i __A) { + // CHECK-LABEL: @test_mm512_mask_conflict_epi64 + // CHECK: @llvm.x86.avx512.mask.conflict.q.512 + return _mm512_mask_conflict_epi64(__W,__U,__A); +} +__m512i test_mm512_maskz_conflict_epi64(__mmask8 __U, __m512i __A) { + // CHECK-LABEL: @test_mm512_maskz_conflict_epi64 + // CHECK: @llvm.x86.avx512.mask.conflict.q.512 + return _mm512_maskz_conflict_epi64(__U,__A); +} +__m512i test_mm512_conflict_epi32(__m512i __A) { + // CHECK-LABEL: @test_mm512_conflict_epi32 + // CHECK: @llvm.x86.avx512.mask.conflict.d.512 + return _mm512_conflict_epi32(__A); +} +__m512i test_mm512_mask_conflict_epi32(__m512i __W, __mmask16 __U, __m512i __A) { + // CHECK-LABEL: @test_mm512_mask_conflict_epi32 + // CHECK: @llvm.x86.avx512.mask.conflict.d.512 + return _mm512_mask_conflict_epi32(__W,__U,__A); +} +__m512i test_mm512_maskz_conflict_epi32(__mmask16 __U, __m512i __A) { + // CHECK-LABEL: @test_mm512_maskz_conflict_epi32 + // CHECK: @llvm.x86.avx512.mask.conflict.d.512 + return _mm512_maskz_conflict_epi32(__U,__A); +} +__m512i test_mm512_lzcnt_epi32(__m512i __A) { + // CHECK-LABEL: @test_mm512_lzcnt_epi32 + // CHECK: @llvm.x86.avx512.mask.lzcnt.d.512 + return _mm512_lzcnt_epi32(__A); +} +__m512i test_mm512_mask_lzcnt_epi32(__m512i __W, __mmask16 __U, __m512i __A) { + // CHECK-LABEL: @test_mm512_mask_lzcnt_epi32 + // CHECK: @llvm.x86.avx512.mask.lzcnt.d.512 + return _mm512_mask_lzcnt_epi32(__W,__U,__A); +} +__m512i test_mm512_maskz_lzcnt_epi32(__mmask16 __U, __m512i __A) { + // CHECK-LABEL: @test_mm512_maskz_lzcnt_epi32 + // CHECK: @llvm.x86.avx512.mask.lzcnt.d.512 + return _mm512_maskz_lzcnt_epi32(__U,__A); +} +__m512i test_mm512_lzcnt_epi64(__m512i __A) { + // CHECK-LABEL: @test_mm512_lzcnt_epi64 + // CHECK: @llvm.x86.avx512.mask.lzcnt.q.512 + return _mm512_lzcnt_epi64(__A); +} +__m512i test_mm512_mask_lzcnt_epi64(__m512i __W, __mmask8 __U, __m512i __A) { + // CHECK-LABEL: @test_mm512_mask_lzcnt_epi64 + // CHECK: @llvm.x86.avx512.mask.lzcnt.q.512 + return _mm512_mask_lzcnt_epi64(__W,__U,__A); +} +__m512i test_mm512_maskz_lzcnt_epi64(__mmask8 __U, __m512i __A) { + // CHECK-LABEL: @test_mm512_maskz_lzcnt_epi64 + // CHECK: @llvm.x86.avx512.mask.lzcnt.q.512 + return _mm512_maskz_lzcnt_epi64(__U,__A); +} diff --git a/test/CodeGen/avx512f-builtins.c b/test/CodeGen/avx512f-builtins.c index a49a198..112dfd8 100644 --- a/test/CodeGen/avx512f-builtins.c +++ b/test/CodeGen/avx512f-builtins.c @@ -201,11 +201,486 @@ __m512d test_mm512_broadcastsd_pd(__m128d a) return _mm512_broadcastsd_pd(a); } -__m512i test_mm512_fmadd_pd(__m512d a, __m512d b, __m512d c) -{ +__m512d test_mm512_fmadd_round_pd(__m512d __A, __m512d __B, __m512d __C) { + // CHECK-LABEL: @test_mm512_fmadd_round_pd + // CHECK: @llvm.x86.avx512.mask.vfmadd.pd.512 + return _mm512_fmadd_round_pd(__A, __B, __C, _MM_FROUND_TO_NEAREST_INT); +} + +__m512d test_mm512_mask_fmadd_round_pd(__m512d __A, __mmask8 __U, __m512d __B, __m512d __C) { + // CHECK-LABEL: @test_mm512_mask_fmadd_round_pd + // CHECK: @llvm.x86.avx512.mask.vfmadd.pd.512 + return _mm512_mask_fmadd_round_pd(__A, __U, __B, __C, _MM_FROUND_TO_NEAREST_INT); +} +__m512d test_mm512_mask3_fmadd_round_pd(__m512d __A, __m512d __B, __m512d __C, __mmask8 __U) { + // CHECK-LABEL: @test_mm512_mask3_fmadd_round_pd + // CHECK: @llvm.x86.avx512.mask3.vfmadd.pd.512 + return _mm512_mask3_fmadd_round_pd(__A, __B, __C, __U, _MM_FROUND_TO_NEAREST_INT); +} +__m512d test_mm512_maskz_fmadd_round_pd(__mmask8 __U, __m512d __A, __m512d __B, __m512d __C) { + // CHECK-LABEL: @test_mm512_maskz_fmadd_round_pd + // CHECK: @llvm.x86.avx512.maskz.vfmadd.pd.512 + return _mm512_maskz_fmadd_round_pd(__U, __A, __B, __C, _MM_FROUND_TO_NEAREST_INT); +} +__m512d test_mm512_fmsub_round_pd(__m512d __A, __m512d __B, __m512d __C) { + // CHECK-LABEL: @test_mm512_fmsub_round_pd + // CHECK: @llvm.x86.avx512.mask.vfmadd.pd.512 + return _mm512_fmsub_round_pd(__A, __B, __C, _MM_FROUND_TO_NEAREST_INT); +} +__m512d test_mm512_mask_fmsub_round_pd(__m512d __A, __mmask8 __U, __m512d __B, __m512d __C) { + // CHECK-LABEL: @test_mm512_mask_fmsub_round_pd + // CHECK: @llvm.x86.avx512.mask.vfmadd.pd.512 + return _mm512_mask_fmsub_round_pd(__A, __U, __B, __C, _MM_FROUND_TO_NEAREST_INT); +} +__m512d test_mm512_maskz_fmsub_round_pd(__mmask8 __U, __m512d __A, __m512d __B, __m512d __C) { + // CHECK-LABEL: @test_mm512_maskz_fmsub_round_pd + // CHECK: @llvm.x86.avx512.maskz.vfmadd.pd.512 + return _mm512_maskz_fmsub_round_pd(__U, __A, __B, __C, _MM_FROUND_TO_NEAREST_INT); +} +__m512d test_mm512_fnmadd_round_pd(__m512d __A, __m512d __B, __m512d __C) { + // CHECK-LABEL: @test_mm512_fnmadd_round_pd + // CHECK: @llvm.x86.avx512.mask.vfmadd.pd.512 + return _mm512_fnmadd_round_pd(__A, __B, __C, _MM_FROUND_TO_NEAREST_INT); +} +__m512d test_mm512_mask3_fnmadd_round_pd(__m512d __A, __m512d __B, __m512d __C, __mmask8 __U) { + // CHECK-LABEL: @test_mm512_mask3_fnmadd_round_pd + // CHECK: @llvm.x86.avx512.mask3.vfmadd.pd.512 + return _mm512_mask3_fnmadd_round_pd(__A, __B, __C, __U, _MM_FROUND_TO_NEAREST_INT); +} +__m512d test_mm512_maskz_fnmadd_round_pd(__mmask8 __U, __m512d __A, __m512d __B, __m512d __C) { + // CHECK-LABEL: @test_mm512_maskz_fnmadd_round_pd + // CHECK: @llvm.x86.avx512.maskz.vfmadd.pd.512 + return _mm512_maskz_fnmadd_round_pd(__U, __A, __B, __C, _MM_FROUND_TO_NEAREST_INT); +} +__m512d test_mm512_fnmsub_round_pd(__m512d __A, __m512d __B, __m512d __C) { + // CHECK-LABEL: @test_mm512_fnmsub_round_pd + // CHECK: @llvm.x86.avx512.mask.vfmadd.pd.512 + return _mm512_fnmsub_round_pd(__A, __B, __C, _MM_FROUND_TO_NEAREST_INT); +} +__m512d test_mm512_maskz_fnmsub_round_pd(__mmask8 __U, __m512d __A, __m512d __B, __m512d __C) { + // CHECK-LABEL: @test_mm512_maskz_fnmsub_round_pd + // CHECK: @llvm.x86.avx512.maskz.vfmadd.pd.512 + return _mm512_maskz_fnmsub_round_pd(__U, __A, __B, __C, _MM_FROUND_TO_NEAREST_INT); +} +__m512d test_mm512_fmadd_pd(__m512d __A, __m512d __B, __m512d __C) { // CHECK-LABEL: @test_mm512_fmadd_pd - // CHECK: @llvm.x86.fma.mask.vfmadd.pd.512 - return _mm512_fmadd_pd(a, b, c); + // CHECK: @llvm.x86.avx512.mask.vfmadd.pd.512 + return _mm512_fmadd_pd(__A, __B, __C); +} +__m512d test_mm512_mask_fmadd_pd(__m512d __A, __mmask8 __U, __m512d __B, __m512d __C) { + // CHECK-LABEL: @test_mm512_mask_fmadd_pd + // CHECK: @llvm.x86.avx512.mask.vfmadd.pd.512 + return _mm512_mask_fmadd_pd(__A, __U, __B, __C); +} +__m512d test_mm512_mask3_fmadd_pd(__m512d __A, __m512d __B, __m512d __C, __mmask8 __U) { + // CHECK-LABEL: @test_mm512_mask3_fmadd_pd + // CHECK: @llvm.x86.avx512.mask3.vfmadd.pd.512 + return _mm512_mask3_fmadd_pd(__A, __B, __C, __U); +} +__m512d test_mm512_maskz_fmadd_pd(__mmask8 __U, __m512d __A, __m512d __B, __m512d __C) { + // CHECK-LABEL: @test_mm512_maskz_fmadd_pd + // CHECK: @llvm.x86.avx512.maskz.vfmadd.pd.512 + return _mm512_maskz_fmadd_pd(__U, __A, __B, __C); +} +__m512d test_mm512_fmsub_pd(__m512d __A, __m512d __B, __m512d __C) { + // CHECK-LABEL: @test_mm512_fmsub_pd + // CHECK: @llvm.x86.avx512.mask.vfmadd.pd.512 + return _mm512_fmsub_pd(__A, __B, __C); +} +__m512d test_mm512_mask_fmsub_pd(__m512d __A, __mmask8 __U, __m512d __B, __m512d __C) { + // CHECK-LABEL: @test_mm512_mask_fmsub_pd + // CHECK: @llvm.x86.avx512.mask.vfmadd.pd.512 + return _mm512_mask_fmsub_pd(__A, __U, __B, __C); +} +__m512d test_mm512_maskz_fmsub_pd(__mmask8 __U, __m512d __A, __m512d __B, __m512d __C) { + // CHECK-LABEL: @test_mm512_maskz_fmsub_pd + // CHECK: @llvm.x86.avx512.maskz.vfmadd.pd.512 + return _mm512_maskz_fmsub_pd(__U, __A, __B, __C); +} +__m512d test_mm512_fnmadd_pd(__m512d __A, __m512d __B, __m512d __C) { + // CHECK-LABEL: @test_mm512_fnmadd_pd + // CHECK: @llvm.x86.avx512.mask.vfmadd.pd.512 + return _mm512_fnmadd_pd(__A, __B, __C); +} +__m512d test_mm512_mask3_fnmadd_pd(__m512d __A, __m512d __B, __m512d __C, __mmask8 __U) { + // CHECK-LABEL: @test_mm512_mask3_fnmadd_pd + // CHECK: @llvm.x86.avx512.mask3.vfmadd.pd.512 + return _mm512_mask3_fnmadd_pd(__A, __B, __C, __U); +} +__m512d test_mm512_maskz_fnmadd_pd(__mmask8 __U, __m512d __A, __m512d __B, __m512d __C) { + // CHECK-LABEL: @test_mm512_maskz_fnmadd_pd + // CHECK: @llvm.x86.avx512.maskz.vfmadd.pd.512 + return _mm512_maskz_fnmadd_pd(__U, __A, __B, __C); +} +__m512d test_mm512_fnmsub_pd(__m512d __A, __m512d __B, __m512d __C) { + // CHECK-LABEL: @test_mm512_fnmsub_pd + // CHECK: @llvm.x86.avx512.mask.vfmadd.pd.512 + return _mm512_fnmsub_pd(__A, __B, __C); +} +__m512d test_mm512_maskz_fnmsub_pd(__mmask8 __U, __m512d __A, __m512d __B, __m512d __C) { + // CHECK-LABEL: @test_mm512_maskz_fnmsub_pd + // CHECK: @llvm.x86.avx512.maskz.vfmadd.pd.512 + return _mm512_maskz_fnmsub_pd(__U, __A, __B, __C); +} +__m512 test_mm512_fmadd_round_ps(__m512 __A, __m512 __B, __m512 __C) { + // CHECK-LABEL: @test_mm512_fmadd_round_ps + // CHECK: @llvm.x86.avx512.mask.vfmadd.ps.512 + return _mm512_fmadd_round_ps(__A, __B, __C, _MM_FROUND_TO_NEAREST_INT); +} +__m512 test_mm512_mask_fmadd_round_ps(__m512 __A, __mmask16 __U, __m512 __B, __m512 __C) { + // CHECK-LABEL: @test_mm512_mask_fmadd_round_ps + // CHECK: @llvm.x86.avx512.mask.vfmadd.ps.512 + return _mm512_mask_fmadd_round_ps(__A, __U, __B, __C, _MM_FROUND_TO_NEAREST_INT); +} +__m512 test_mm512_mask3_fmadd_round_ps(__m512 __A, __m512 __B, __m512 __C, __mmask16 __U) { + // CHECK-LABEL: @test_mm512_mask3_fmadd_round_ps + // CHECK: @llvm.x86.avx512.mask3.vfmadd.ps.512 + return _mm512_mask3_fmadd_round_ps(__A, __B, __C, __U, _MM_FROUND_TO_NEAREST_INT); +} +__m512 test_mm512_maskz_fmadd_round_ps(__mmask16 __U, __m512 __A, __m512 __B, __m512 __C) { + // CHECK-LABEL: @test_mm512_maskz_fmadd_round_ps + // CHECK: @llvm.x86.avx512.maskz.vfmadd.ps.512 + return _mm512_maskz_fmadd_round_ps(__U, __A, __B, __C, _MM_FROUND_TO_NEAREST_INT); +} +__m512 test_mm512_fmsub_round_ps(__m512 __A, __m512 __B, __m512 __C) { + // CHECK-LABEL: @test_mm512_fmsub_round_ps + // CHECK: @llvm.x86.avx512.mask.vfmadd.ps.512 + return _mm512_fmsub_round_ps(__A, __B, __C, _MM_FROUND_TO_NEAREST_INT); +} +__m512 test_mm512_mask_fmsub_round_ps(__m512 __A, __mmask16 __U, __m512 __B, __m512 __C) { + // CHECK-LABEL: @test_mm512_mask_fmsub_round_ps + // CHECK: @llvm.x86.avx512.mask.vfmadd.ps.512 + return _mm512_mask_fmsub_round_ps(__A, __U, __B, __C, _MM_FROUND_TO_NEAREST_INT); +} +__m512 test_mm512_maskz_fmsub_round_ps(__mmask16 __U, __m512 __A, __m512 __B, __m512 __C) { + // CHECK-LABEL: @test_mm512_maskz_fmsub_round_ps + // CHECK: @llvm.x86.avx512.maskz.vfmadd.ps.512 + return _mm512_maskz_fmsub_round_ps(__U, __A, __B, __C, _MM_FROUND_TO_NEAREST_INT); +} +__m512 test_mm512_fnmadd_round_ps(__m512 __A, __m512 __B, __m512 __C) { + // CHECK-LABEL: @test_mm512_fnmadd_round_ps + // CHECK: @llvm.x86.avx512.mask.vfmadd.ps.512 + return _mm512_fnmadd_round_ps(__A, __B, __C, _MM_FROUND_TO_NEAREST_INT); +} +__m512 test_mm512_mask3_fnmadd_round_ps(__m512 __A, __m512 __B, __m512 __C, __mmask16 __U) { + // CHECK-LABEL: @test_mm512_mask3_fnmadd_round_ps + // CHECK: @llvm.x86.avx512.mask3.vfmadd.ps.512 + return _mm512_mask3_fnmadd_round_ps(__A, __B, __C, __U, _MM_FROUND_TO_NEAREST_INT); +} +__m512 test_mm512_maskz_fnmadd_round_ps(__mmask16 __U, __m512 __A, __m512 __B, __m512 __C) { + // CHECK-LABEL: @test_mm512_maskz_fnmadd_round_ps + // CHECK: @llvm.x86.avx512.maskz.vfmadd.ps.512 + return _mm512_maskz_fnmadd_round_ps(__U, __A, __B, __C, _MM_FROUND_TO_NEAREST_INT); +} +__m512 test_mm512_fnmsub_round_ps(__m512 __A, __m512 __B, __m512 __C) { + // CHECK-LABEL: @test_mm512_fnmsub_round_ps + // CHECK: @llvm.x86.avx512.mask.vfmadd.ps.512 + return _mm512_fnmsub_round_ps(__A, __B, __C, _MM_FROUND_TO_NEAREST_INT); +} +__m512 test_mm512_maskz_fnmsub_round_ps(__mmask16 __U, __m512 __A, __m512 __B, __m512 __C) { + // CHECK-LABEL: @test_mm512_maskz_fnmsub_round_ps + // CHECK: @llvm.x86.avx512.maskz.vfmadd.ps.512 + return _mm512_maskz_fnmsub_round_ps(__U, __A, __B, __C, _MM_FROUND_TO_NEAREST_INT); +} +__m512 test_mm512_fmadd_ps(__m512 __A, __m512 __B, __m512 __C) { + // CHECK-LABEL: @test_mm512_fmadd_ps + // CHECK: @llvm.x86.avx512.mask.vfmadd.ps.512 + return _mm512_fmadd_ps(__A, __B, __C); +} +__m512 test_mm512_mask_fmadd_ps(__m512 __A, __mmask16 __U, __m512 __B, __m512 __C) { + // CHECK-LABEL: @test_mm512_mask_fmadd_ps + // CHECK: @llvm.x86.avx512.mask.vfmadd.ps.512 + return _mm512_mask_fmadd_ps(__A, __U, __B, __C); +} +__m512 test_mm512_mask3_fmadd_ps(__m512 __A, __m512 __B, __m512 __C, __mmask16 __U) { + // CHECK-LABEL: @test_mm512_mask3_fmadd_ps + // CHECK: @llvm.x86.avx512.mask3.vfmadd.ps.512 + return _mm512_mask3_fmadd_ps(__A, __B, __C, __U); +} +__m512 test_mm512_maskz_fmadd_ps(__mmask16 __U, __m512 __A, __m512 __B, __m512 __C) { + // CHECK-LABEL: @test_mm512_maskz_fmadd_ps + // CHECK: @llvm.x86.avx512.maskz.vfmadd.ps.512 + return _mm512_maskz_fmadd_ps(__U, __A, __B, __C); +} +__m512 test_mm512_fmsub_ps(__m512 __A, __m512 __B, __m512 __C) { + // CHECK-LABEL: @test_mm512_fmsub_ps + // CHECK: @llvm.x86.avx512.mask.vfmadd.ps.512 + return _mm512_fmsub_ps(__A, __B, __C); +} +__m512 test_mm512_mask_fmsub_ps(__m512 __A, __mmask16 __U, __m512 __B, __m512 __C) { + // CHECK-LABEL: @test_mm512_mask_fmsub_ps + // CHECK: @llvm.x86.avx512.mask.vfmadd.ps.512 + return _mm512_mask_fmsub_ps(__A, __U, __B, __C); +} +__m512 test_mm512_maskz_fmsub_ps(__mmask16 __U, __m512 __A, __m512 __B, __m512 __C) { + // CHECK-LABEL: @test_mm512_maskz_fmsub_ps + // CHECK: @llvm.x86.avx512.maskz.vfmadd.ps.512 + return _mm512_maskz_fmsub_ps(__U, __A, __B, __C); +} +__m512 test_mm512_fnmadd_ps(__m512 __A, __m512 __B, __m512 __C) { + // CHECK-LABEL: @test_mm512_fnmadd_ps + // CHECK: @llvm.x86.avx512.mask.vfmadd.ps.512 + return _mm512_fnmadd_ps(__A, __B, __C); +} +__m512 test_mm512_mask3_fnmadd_ps(__m512 __A, __m512 __B, __m512 __C, __mmask16 __U) { + // CHECK-LABEL: @test_mm512_mask3_fnmadd_ps + // CHECK: @llvm.x86.avx512.mask3.vfmadd.ps.512 + return _mm512_mask3_fnmadd_ps(__A, __B, __C, __U); +} +__m512 test_mm512_maskz_fnmadd_ps(__mmask16 __U, __m512 __A, __m512 __B, __m512 __C) { + // CHECK-LABEL: @test_mm512_maskz_fnmadd_ps + // CHECK: @llvm.x86.avx512.maskz.vfmadd.ps.512 + return _mm512_maskz_fnmadd_ps(__U, __A, __B, __C); +} +__m512 test_mm512_fnmsub_ps(__m512 __A, __m512 __B, __m512 __C) { + // CHECK-LABEL: @test_mm512_fnmsub_ps + // CHECK: @llvm.x86.avx512.mask.vfmadd.ps.512 + return _mm512_fnmsub_ps(__A, __B, __C); +} +__m512 test_mm512_maskz_fnmsub_ps(__mmask16 __U, __m512 __A, __m512 __B, __m512 __C) { + // CHECK-LABEL: @test_mm512_maskz_fnmsub_ps + // CHECK: @llvm.x86.avx512.maskz.vfmadd.ps.512 + return _mm512_maskz_fnmsub_ps(__U, __A, __B, __C); +} +__m512d test_mm512_fmaddsub_round_pd(__m512d __A, __m512d __B, __m512d __C) { + // CHECK-LABEL: @test_mm512_fmaddsub_round_pd + // CHECK: @llvm.x86.avx512.mask.vfmaddsub.pd.512 + return _mm512_fmaddsub_round_pd(__A, __B, __C, _MM_FROUND_TO_NEAREST_INT); +} +__m512d test_mm512_mask_fmaddsub_round_pd(__m512d __A, __mmask8 __U, __m512d __B, __m512d __C) { + // CHECK-LABEL: @test_mm512_mask_fmaddsub_round_pd + // CHECK: @llvm.x86.avx512.mask.vfmaddsub.pd.512 + return _mm512_mask_fmaddsub_round_pd(__A, __U, __B, __C, _MM_FROUND_TO_NEAREST_INT); +} +__m512d test_mm512_mask3_fmaddsub_round_pd(__m512d __A, __m512d __B, __m512d __C, __mmask8 __U) { + // CHECK-LABEL: @test_mm512_mask3_fmaddsub_round_pd + // CHECK: @llvm.x86.avx512.mask3.vfmaddsub.pd.512 + return _mm512_mask3_fmaddsub_round_pd(__A, __B, __C, __U, _MM_FROUND_TO_NEAREST_INT); +} +__m512d test_mm512_maskz_fmaddsub_round_pd(__mmask8 __U, __m512d __A, __m512d __B, __m512d __C) { + // CHECK-LABEL: @test_mm512_maskz_fmaddsub_round_pd + // CHECK: @llvm.x86.avx512.maskz.vfmaddsub.pd.512 + return _mm512_maskz_fmaddsub_round_pd(__U, __A, __B, __C, _MM_FROUND_TO_NEAREST_INT); +} +__m512d test_mm512_fmsubadd_round_pd(__m512d __A, __m512d __B, __m512d __C) { + // CHECK-LABEL: @test_mm512_fmsubadd_round_pd + // CHECK: @llvm.x86.avx512.mask.vfmaddsub.pd.512 + return _mm512_fmsubadd_round_pd(__A, __B, __C, _MM_FROUND_TO_NEAREST_INT); +} +__m512d test_mm512_mask_fmsubadd_round_pd(__m512d __A, __mmask8 __U, __m512d __B, __m512d __C) { + // CHECK-LABEL: @test_mm512_mask_fmsubadd_round_pd + // CHECK: @llvm.x86.avx512.mask.vfmaddsub.pd.512 + return _mm512_mask_fmsubadd_round_pd(__A, __U, __B, __C, _MM_FROUND_TO_NEAREST_INT); +} +__m512d test_mm512_maskz_fmsubadd_round_pd(__mmask8 __U, __m512d __A, __m512d __B, __m512d __C) { + // CHECK-LABEL: @test_mm512_maskz_fmsubadd_round_pd + // CHECK: @llvm.x86.avx512.maskz.vfmaddsub.pd.512 + return _mm512_maskz_fmsubadd_round_pd(__U, __A, __B, __C, _MM_FROUND_TO_NEAREST_INT); +} +__m512d test_mm512_fmaddsub_pd(__m512d __A, __m512d __B, __m512d __C) { + // CHECK-LABEL: @test_mm512_fmaddsub_pd + // CHECK: @llvm.x86.avx512.mask.vfmaddsub.pd.512 + return _mm512_fmaddsub_pd(__A, __B, __C); +} +__m512d test_mm512_mask_fmaddsub_pd(__m512d __A, __mmask8 __U, __m512d __B, __m512d __C) { + // CHECK-LABEL: @test_mm512_mask_fmaddsub_pd + // CHECK: @llvm.x86.avx512.mask.vfmaddsub.pd.512 + return _mm512_mask_fmaddsub_pd(__A, __U, __B, __C); +} +__m512d test_mm512_mask3_fmaddsub_pd(__m512d __A, __m512d __B, __m512d __C, __mmask8 __U) { + // CHECK-LABEL: @test_mm512_mask3_fmaddsub_pd + // CHECK: @llvm.x86.avx512.mask3.vfmaddsub.pd.512 + return _mm512_mask3_fmaddsub_pd(__A, __B, __C, __U); +} +__m512d test_mm512_maskz_fmaddsub_pd(__mmask8 __U, __m512d __A, __m512d __B, __m512d __C) { + // CHECK-LABEL: @test_mm512_maskz_fmaddsub_pd + // CHECK: @llvm.x86.avx512.maskz.vfmaddsub.pd.512 + return _mm512_maskz_fmaddsub_pd(__U, __A, __B, __C); +} +__m512d test_mm512_fmsubadd_pd(__m512d __A, __m512d __B, __m512d __C) { + // CHECK-LABEL: @test_mm512_fmsubadd_pd + // CHECK: @llvm.x86.avx512.mask.vfmaddsub.pd.512 + return _mm512_fmsubadd_pd(__A, __B, __C); +} +__m512d test_mm512_mask_fmsubadd_pd(__m512d __A, __mmask8 __U, __m512d __B, __m512d __C) { + // CHECK-LABEL: @test_mm512_mask_fmsubadd_pd + // CHECK: @llvm.x86.avx512.mask.vfmaddsub.pd.512 + return _mm512_mask_fmsubadd_pd(__A, __U, __B, __C); +} +__m512d test_mm512_maskz_fmsubadd_pd(__mmask8 __U, __m512d __A, __m512d __B, __m512d __C) { + // CHECK-LABEL: @test_mm512_maskz_fmsubadd_pd + // CHECK: @llvm.x86.avx512.maskz.vfmaddsub.pd.512 + return _mm512_maskz_fmsubadd_pd(__U, __A, __B, __C); +} +__m512 test_mm512_fmaddsub_round_ps(__m512 __A, __m512 __B, __m512 __C) { + // CHECK-LABEL: @test_mm512_fmaddsub_round_ps + // CHECK: @llvm.x86.avx512.mask.vfmaddsub.ps.512 + return _mm512_fmaddsub_round_ps(__A, __B, __C, _MM_FROUND_TO_NEAREST_INT); +} +__m512 test_mm512_mask_fmaddsub_round_ps(__m512 __A, __mmask16 __U, __m512 __B, __m512 __C) { + // CHECK-LABEL: @test_mm512_mask_fmaddsub_round_ps + // CHECK: @llvm.x86.avx512.mask.vfmaddsub.ps.512 + return _mm512_mask_fmaddsub_round_ps(__A, __U, __B, __C, _MM_FROUND_TO_NEAREST_INT); +} +__m512 test_mm512_mask3_fmaddsub_round_ps(__m512 __A, __m512 __B, __m512 __C, __mmask16 __U) { + // CHECK-LABEL: @test_mm512_mask3_fmaddsub_round_ps + // CHECK: @llvm.x86.avx512.mask3.vfmaddsub.ps.512 + return _mm512_mask3_fmaddsub_round_ps(__A, __B, __C, __U, _MM_FROUND_TO_NEAREST_INT); +} +__m512 test_mm512_maskz_fmaddsub_round_ps(__mmask16 __U, __m512 __A, __m512 __B, __m512 __C) { + // CHECK-LABEL: @test_mm512_maskz_fmaddsub_round_ps + // CHECK: @llvm.x86.avx512.maskz.vfmaddsub.ps.512 + return _mm512_maskz_fmaddsub_round_ps(__U, __A, __B, __C, _MM_FROUND_TO_NEAREST_INT); +} +__m512 test_mm512_fmsubadd_round_ps(__m512 __A, __m512 __B, __m512 __C) { + // CHECK-LABEL: @test_mm512_fmsubadd_round_ps + // CHECK: @llvm.x86.avx512.mask.vfmaddsub.ps.512 + return _mm512_fmsubadd_round_ps(__A, __B, __C, _MM_FROUND_TO_NEAREST_INT); +} +__m512 test_mm512_mask_fmsubadd_round_ps(__m512 __A, __mmask16 __U, __m512 __B, __m512 __C) { + // CHECK-LABEL: @test_mm512_mask_fmsubadd_round_ps + // CHECK: @llvm.x86.avx512.mask.vfmaddsub.ps.512 + return _mm512_mask_fmsubadd_round_ps(__A, __U, __B, __C, _MM_FROUND_TO_NEAREST_INT); +} +__m512 test_mm512_maskz_fmsubadd_round_ps(__mmask16 __U, __m512 __A, __m512 __B, __m512 __C) { + // CHECK-LABEL: @test_mm512_maskz_fmsubadd_round_ps + // CHECK: @llvm.x86.avx512.maskz.vfmaddsub.ps.512 + return _mm512_maskz_fmsubadd_round_ps(__U, __A, __B, __C, _MM_FROUND_TO_NEAREST_INT); +} +__m512 test_mm512_fmaddsub_ps(__m512 __A, __m512 __B, __m512 __C) { + // CHECK-LABEL: @test_mm512_fmaddsub_ps + // CHECK: @llvm.x86.avx512.mask.vfmaddsub.ps.512 + return _mm512_fmaddsub_ps(__A, __B, __C); +} +__m512 test_mm512_mask_fmaddsub_ps(__m512 __A, __mmask16 __U, __m512 __B, __m512 __C) { + // CHECK-LABEL: @test_mm512_mask_fmaddsub_ps + // CHECK: @llvm.x86.avx512.mask.vfmaddsub.ps.512 + return _mm512_mask_fmaddsub_ps(__A, __U, __B, __C); +} +__m512 test_mm512_mask3_fmaddsub_ps(__m512 __A, __m512 __B, __m512 __C, __mmask16 __U) { + // CHECK-LABEL: @test_mm512_mask3_fmaddsub_ps + // CHECK: @llvm.x86.avx512.mask3.vfmaddsub.ps.512 + return _mm512_mask3_fmaddsub_ps(__A, __B, __C, __U); +} +__m512 test_mm512_maskz_fmaddsub_ps(__mmask16 __U, __m512 __A, __m512 __B, __m512 __C) { + // CHECK-LABEL: @test_mm512_maskz_fmaddsub_ps + // CHECK: @llvm.x86.avx512.maskz.vfmaddsub.ps.512 + return _mm512_maskz_fmaddsub_ps(__U, __A, __B, __C); +} +__m512 test_mm512_fmsubadd_ps(__m512 __A, __m512 __B, __m512 __C) { + // CHECK-LABEL: @test_mm512_fmsubadd_ps + // CHECK: @llvm.x86.avx512.mask.vfmaddsub.ps.512 + return _mm512_fmsubadd_ps(__A, __B, __C); +} +__m512 test_mm512_mask_fmsubadd_ps(__m512 __A, __mmask16 __U, __m512 __B, __m512 __C) { + // CHECK-LABEL: @test_mm512_mask_fmsubadd_ps + // CHECK: @llvm.x86.avx512.mask.vfmaddsub.ps.512 + return _mm512_mask_fmsubadd_ps(__A, __U, __B, __C); +} +__m512 test_mm512_maskz_fmsubadd_ps(__mmask16 __U, __m512 __A, __m512 __B, __m512 __C) { + // CHECK-LABEL: @test_mm512_maskz_fmsubadd_ps + // CHECK: @llvm.x86.avx512.maskz.vfmaddsub.ps.512 + return _mm512_maskz_fmsubadd_ps(__U, __A, __B, __C); +} +__m512d test_mm512_mask3_fmsub_round_pd(__m512d __A, __m512d __B, __m512d __C, __mmask8 __U) { + // CHECK-LABEL: @test_mm512_mask3_fmsub_round_pd + // CHECK: @llvm.x86.avx512.mask3.vfmsub.pd.512 + return _mm512_mask3_fmsub_round_pd(__A, __B, __C, __U, _MM_FROUND_TO_NEAREST_INT); +} +__m512d test_mm512_mask3_fmsub_pd(__m512d __A, __m512d __B, __m512d __C, __mmask8 __U) { + // CHECK-LABEL: @test_mm512_mask3_fmsub_pd + // CHECK: @llvm.x86.avx512.mask3.vfmsub.pd.512 + return _mm512_mask3_fmsub_pd(__A, __B, __C, __U); +} +__m512 test_mm512_mask3_fmsub_round_ps(__m512 __A, __m512 __B, __m512 __C, __mmask16 __U) { + // CHECK-LABEL: @test_mm512_mask3_fmsub_round_ps + // CHECK: @llvm.x86.avx512.mask3.vfmsub.ps.512 + return _mm512_mask3_fmsub_round_ps(__A, __B, __C, __U, _MM_FROUND_TO_NEAREST_INT); +} +__m512 test_mm512_mask3_fmsub_ps(__m512 __A, __m512 __B, __m512 __C, __mmask16 __U) { + // CHECK-LABEL: @test_mm512_mask3_fmsub_ps + // CHECK: @llvm.x86.avx512.mask3.vfmsub.ps.512 + return _mm512_mask3_fmsub_ps(__A, __B, __C, __U); +} +__m512d test_mm512_mask3_fmsubadd_round_pd(__m512d __A, __m512d __B, __m512d __C, __mmask8 __U) { + // CHECK-LABEL: @test_mm512_mask3_fmsubadd_round_pd + // CHECK: @llvm.x86.avx512.mask3.vfmsubadd.pd.512 + return _mm512_mask3_fmsubadd_round_pd(__A, __B, __C, __U, _MM_FROUND_TO_NEAREST_INT); +} +__m512d test_mm512_mask3_fmsubadd_pd(__m512d __A, __m512d __B, __m512d __C, __mmask8 __U) { + // CHECK-LABEL: @test_mm512_mask3_fmsubadd_pd + // CHECK: @llvm.x86.avx512.mask3.vfmsubadd.pd.512 + return _mm512_mask3_fmsubadd_pd(__A, __B, __C, __U); +} +__m512 test_mm512_mask3_fmsubadd_round_ps(__m512 __A, __m512 __B, __m512 __C, __mmask16 __U) { + // CHECK-LABEL: @test_mm512_mask3_fmsubadd_round_ps + // CHECK: @llvm.x86.avx512.mask3.vfmsubadd.ps.512 + return _mm512_mask3_fmsubadd_round_ps(__A, __B, __C, __U, _MM_FROUND_TO_NEAREST_INT); +} +__m512 test_mm512_mask3_fmsubadd_ps(__m512 __A, __m512 __B, __m512 __C, __mmask16 __U) { + // CHECK-LABEL: @test_mm512_mask3_fmsubadd_ps + // CHECK: @llvm.x86.avx512.mask3.vfmsubadd.ps.512 + return _mm512_mask3_fmsubadd_ps(__A, __B, __C, __U); +} +__m512d test_mm512_mask_fnmadd_round_pd(__m512d __A, __mmask8 __U, __m512d __B, __m512d __C) { + // CHECK-LABEL: @test_mm512_mask_fnmadd_round_pd + // CHECK: @llvm.x86.avx512.mask.vfnmadd.pd.512 + return _mm512_mask_fnmadd_round_pd(__A, __U, __B, __C, _MM_FROUND_TO_NEAREST_INT); +} +__m512d test_mm512_mask_fnmadd_pd(__m512d __A, __mmask8 __U, __m512d __B, __m512d __C) { + // CHECK-LABEL: @test_mm512_mask_fnmadd_pd + // CHECK: @llvm.x86.avx512.mask.vfnmadd.pd.512 + return _mm512_mask_fnmadd_pd(__A, __U, __B, __C); +} +__m512 test_mm512_mask_fnmadd_round_ps(__m512 __A, __mmask16 __U, __m512 __B, __m512 __C) { + // CHECK-LABEL: @test_mm512_mask_fnmadd_round_ps + // CHECK: @llvm.x86.avx512.mask.vfnmadd.ps.512 + return _mm512_mask_fnmadd_round_ps(__A, __U, __B, __C, _MM_FROUND_TO_NEAREST_INT); +} +__m512 test_mm512_mask_fnmadd_ps(__m512 __A, __mmask16 __U, __m512 __B, __m512 __C) { + // CHECK-LABEL: @test_mm512_mask_fnmadd_ps + // CHECK: @llvm.x86.avx512.mask.vfnmadd.ps.512 + return _mm512_mask_fnmadd_ps(__A, __U, __B, __C); +} +__m512d test_mm512_mask_fnmsub_round_pd(__m512d __A, __mmask8 __U, __m512d __B, __m512d __C) { + // CHECK-LABEL: @test_mm512_mask_fnmsub_round_pd + // CHECK: @llvm.x86.avx512.mask.vfnmsub.pd.512 + return _mm512_mask_fnmsub_round_pd(__A, __U, __B, __C, _MM_FROUND_TO_NEAREST_INT); +} +__m512d test_mm512_mask3_fnmsub_round_pd(__m512d __A, __m512d __B, __m512d __C, __mmask8 __U) { + // CHECK-LABEL: @test_mm512_mask3_fnmsub_round_pd + // CHECK: @llvm.x86.avx512.mask3.vfnmsub.pd.512 + return _mm512_mask3_fnmsub_round_pd(__A, __B, __C, __U, _MM_FROUND_TO_NEAREST_INT); +} +__m512d test_mm512_mask_fnmsub_pd(__m512d __A, __mmask8 __U, __m512d __B, __m512d __C) { + // CHECK-LABEL: @test_mm512_mask_fnmsub_pd + // CHECK: @llvm.x86.avx512.mask.vfnmsub.pd.512 + return _mm512_mask_fnmsub_pd(__A, __U, __B, __C); +} +__m512d test_mm512_mask3_fnmsub_pd(__m512d __A, __m512d __B, __m512d __C, __mmask8 __U) { + // CHECK-LABEL: @test_mm512_mask3_fnmsub_pd + // CHECK: @llvm.x86.avx512.mask3.vfnmsub.pd.512 + return _mm512_mask3_fnmsub_pd(__A, __B, __C, __U); +} +__m512 test_mm512_mask_fnmsub_round_ps(__m512 __A, __mmask16 __U, __m512 __B, __m512 __C) { + // CHECK-LABEL: @test_mm512_mask_fnmsub_round_ps + // CHECK: @llvm.x86.avx512.mask.vfnmsub.ps.512 + return _mm512_mask_fnmsub_round_ps(__A, __U, __B, __C, _MM_FROUND_TO_NEAREST_INT); +} +__m512 test_mm512_mask3_fnmsub_round_ps(__m512 __A, __m512 __B, __m512 __C, __mmask16 __U) { + // CHECK-LABEL: @test_mm512_mask3_fnmsub_round_ps + // CHECK: @llvm.x86.avx512.mask3.vfnmsub.ps.512 + return _mm512_mask3_fnmsub_round_ps(__A, __B, __C, __U, _MM_FROUND_TO_NEAREST_INT); +} +__m512 test_mm512_mask_fnmsub_ps(__m512 __A, __mmask16 __U, __m512 __B, __m512 __C) { + // CHECK-LABEL: @test_mm512_mask_fnmsub_ps + // CHECK: @llvm.x86.avx512.mask.vfnmsub.ps.512 + return _mm512_mask_fnmsub_ps(__A, __U, __B, __C); +} +__m512 test_mm512_mask3_fnmsub_ps(__m512 __A, __m512 __B, __m512 __C, __mmask16 __U) { + // CHECK-LABEL: @test_mm512_mask3_fnmsub_ps + // CHECK: @llvm.x86.avx512.mask3.vfnmsub.ps.512 + return _mm512_mask3_fnmsub_ps(__A, __B, __C, __U); } __mmask16 test_mm512_cmpeq_epi32_mask(__m512i __a, __m512i __b) { diff --git a/test/CodeGen/avx512vl-builtins.c b/test/CodeGen/avx512vl-builtins.c index 9446d46..00b0d5d 100644 --- a/test/CodeGen/avx512vl-builtins.c +++ b/test/CodeGen/avx512vl-builtins.c @@ -1121,3 +1121,439 @@ __mmask8 test_mm128_mask_cmp_pd_mask(__mmask8 m, __m128d __A, __m128d __B) { // CHECK: @llvm.x86.avx512.mask.cmp.pd.128 return _mm128_mask_cmp_pd_mask(m, __A, __B, 0); } + + +//igorb + +__m128d test_mm_mask_fmadd_pd(__m128d __A, __mmask8 __U, __m128d __B, __m128d __C) { + // CHECK-LABEL: @test_mm_mask_fmadd_pd + // CHECK: @llvm.x86.avx512.mask.vfmadd.pd.128 + return _mm_mask_fmadd_pd(__A, __U, __B, __C); +} + +__m128d test_mm_mask_fmsub_pd(__m128d __A, __mmask8 __U, __m128d __B, __m128d __C) { + // CHECK-LABEL: @test_mm_mask_fmsub_pd + // CHECK: @llvm.x86.avx512.mask.vfmadd.pd.128 + return _mm_mask_fmsub_pd(__A, __U, __B, __C); +} + +__m128d test_mm_mask3_fmadd_pd(__m128d __A, __m128d __B, __m128d __C, __mmask8 __U) { + // CHECK-LABEL: @test_mm_mask3_fmadd_pd + // CHECK: @llvm.x86.avx512.mask3.vfmadd.pd.128 + return _mm_mask3_fmadd_pd(__A, __B, __C, __U); +} + +__m128d test_mm_mask3_fnmadd_pd(__m128d __A, __m128d __B, __m128d __C, __mmask8 __U) { + // CHECK-LABEL: @test_mm_mask3_fnmadd_pd + // CHECK: @llvm.x86.avx512.mask3.vfmadd.pd.128 + return _mm_mask3_fnmadd_pd(__A, __B, __C, __U); +} + +__m128d test_mm_maskz_fmadd_pd(__mmask8 __U, __m128d __A, __m128d __B, __m128d __C) { + // CHECK-LABEL: @test_mm_maskz_fmadd_pd + // CHECK: @llvm.x86.avx512.maskz.vfmadd.pd.128 + return _mm_maskz_fmadd_pd(__U, __A, __B, __C); +} + +__m128d test_mm_maskz_fmsub_pd(__mmask8 __U, __m128d __A, __m128d __B, __m128d __C) { + // CHECK-LABEL: @test_mm_maskz_fmsub_pd + // CHECK: @llvm.x86.avx512.maskz.vfmadd.pd.128 + return _mm_maskz_fmsub_pd(__U, __A, __B, __C); +} + +__m128d test_mm_maskz_fnmadd_pd(__mmask8 __U, __m128d __A, __m128d __B, __m128d __C) { + // CHECK-LABEL: @test_mm_maskz_fnmadd_pd + // CHECK: @llvm.x86.avx512.maskz.vfmadd.pd.128 + return _mm_maskz_fnmadd_pd(__U, __A, __B, __C); +} + +__m128d test_mm_maskz_fnmsub_pd(__mmask8 __U, __m128d __A, __m128d __B, __m128d __C) { + // CHECK-LABEL: @test_mm_maskz_fnmsub_pd + // CHECK: @llvm.x86.avx512.maskz.vfmadd.pd.128 + return _mm_maskz_fnmsub_pd(__U, __A, __B, __C); +} + +__m256d test_mm256_mask_fmadd_pd(__m256d __A, __mmask8 __U, __m256d __B, __m256d __C) { + // CHECK-LABEL: @test_mm256_mask_fmadd_pd + // CHECK: @llvm.x86.avx512.mask.vfmadd.pd.256 + return _mm256_mask_fmadd_pd(__A, __U, __B, __C); +} + +__m256d test_mm256_mask_fmsub_pd(__m256d __A, __mmask8 __U, __m256d __B, __m256d __C) { + // CHECK-LABEL: @test_mm256_mask_fmsub_pd + // CHECK: @llvm.x86.avx512.mask.vfmadd.pd.256 + return _mm256_mask_fmsub_pd(__A, __U, __B, __C); +} + +__m256d test_mm256_mask3_fmadd_pd(__m256d __A, __m256d __B, __m256d __C, __mmask8 __U) { + // CHECK-LABEL: @test_mm256_mask3_fmadd_pd + // CHECK: @llvm.x86.avx512.mask3.vfmadd.pd.256 + return _mm256_mask3_fmadd_pd(__A, __B, __C, __U); +} + +__m256d test_mm256_mask3_fnmadd_pd(__m256d __A, __m256d __B, __m256d __C, __mmask8 __U) { + // CHECK-LABEL: @test_mm256_mask3_fnmadd_pd + // CHECK: @llvm.x86.avx512.mask3.vfmadd.pd.256 + return _mm256_mask3_fnmadd_pd(__A, __B, __C, __U); +} + +__m256d test_mm256_maskz_fmadd_pd(__mmask8 __U, __m256d __A, __m256d __B, __m256d __C) { + // CHECK-LABEL: @test_mm256_maskz_fmadd_pd + // CHECK: @llvm.x86.avx512.maskz.vfmadd.pd.256 + return _mm256_maskz_fmadd_pd(__U, __A, __B, __C); +} + +__m256d test_mm256_maskz_fmsub_pd(__mmask8 __U, __m256d __A, __m256d __B, __m256d __C) { + // CHECK-LABEL: @test_mm256_maskz_fmsub_pd + // CHECK: @llvm.x86.avx512.maskz.vfmadd.pd.256 + return _mm256_maskz_fmsub_pd(__U, __A, __B, __C); +} + +__m256d test_mm256_maskz_fnmadd_pd(__mmask8 __U, __m256d __A, __m256d __B, __m256d __C) { + // CHECK-LABEL: @test_mm256_maskz_fnmadd_pd + // CHECK: @llvm.x86.avx512.maskz.vfmadd.pd.256 + return _mm256_maskz_fnmadd_pd(__U, __A, __B, __C); +} + +__m256d test_mm256_maskz_fnmsub_pd(__mmask8 __U, __m256d __A, __m256d __B, __m256d __C) { + // CHECK-LABEL: @test_mm256_maskz_fnmsub_pd + // CHECK: @llvm.x86.avx512.maskz.vfmadd.pd.256 + return _mm256_maskz_fnmsub_pd(__U, __A, __B, __C); +} + +__m128 test_mm_mask_fmadd_ps(__m128 __A, __mmask8 __U, __m128 __B, __m128 __C) { + // CHECK-LABEL: @test_mm_mask_fmadd_ps + // CHECK: @llvm.x86.avx512.mask.vfmadd.ps.128 + return _mm_mask_fmadd_ps(__A, __U, __B, __C); +} + +__m128 test_mm_mask_fmsub_ps(__m128 __A, __mmask8 __U, __m128 __B, __m128 __C) { + // CHECK-LABEL: @test_mm_mask_fmsub_ps + // CHECK: @llvm.x86.avx512.mask.vfmadd.ps.128 + return _mm_mask_fmsub_ps(__A, __U, __B, __C); +} + +__m128 test_mm_mask3_fmadd_ps(__m128 __A, __m128 __B, __m128 __C, __mmask8 __U) { + // CHECK-LABEL: @test_mm_mask3_fmadd_ps + // CHECK: @llvm.x86.avx512.mask3.vfmadd.ps.128 + return _mm_mask3_fmadd_ps(__A, __B, __C, __U); +} + +__m128 test_mm_mask3_fnmadd_ps(__m128 __A, __m128 __B, __m128 __C, __mmask8 __U) { + // CHECK-LABEL: @test_mm_mask3_fnmadd_ps + // CHECK: @llvm.x86.avx512.mask3.vfmadd.ps.128 + return _mm_mask3_fnmadd_ps(__A, __B, __C, __U); +} + +__m128 test_mm_maskz_fmadd_ps(__mmask8 __U, __m128 __A, __m128 __B, __m128 __C) { + // CHECK-LABEL: @test_mm_maskz_fmadd_ps + // CHECK: @llvm.x86.avx512.maskz.vfmadd.ps.128 + return _mm_maskz_fmadd_ps(__U, __A, __B, __C); +} + +__m128 test_mm_maskz_fmsub_ps(__mmask8 __U, __m128 __A, __m128 __B, __m128 __C) { + // CHECK-LABEL: @test_mm_maskz_fmsub_ps + // CHECK: @llvm.x86.avx512.maskz.vfmadd.ps.128 + return _mm_maskz_fmsub_ps(__U, __A, __B, __C); +} + +__m128 test_mm_maskz_fnmadd_ps(__mmask8 __U, __m128 __A, __m128 __B, __m128 __C) { + // CHECK-LABEL: @test_mm_maskz_fnmadd_ps + // CHECK: @llvm.x86.avx512.maskz.vfmadd.ps.128 + return _mm_maskz_fnmadd_ps(__U, __A, __B, __C); +} + +__m128 test_mm_maskz_fnmsub_ps(__mmask8 __U, __m128 __A, __m128 __B, __m128 __C) { + // CHECK-LABEL: @test_mm_maskz_fnmsub_ps + // CHECK: @llvm.x86.avx512.maskz.vfmadd.ps.128 + return _mm_maskz_fnmsub_ps(__U, __A, __B, __C); +} + +__m256 test_mm256_mask_fmadd_ps(__m256 __A, __mmask8 __U, __m256 __B, __m256 __C) { + // CHECK-LABEL: @test_mm256_mask_fmadd_ps + // CHECK: @llvm.x86.avx512.mask.vfmadd.ps.256 + return _mm256_mask_fmadd_ps(__A, __U, __B, __C); +} + +__m256 test_mm256_mask_fmsub_ps(__m256 __A, __mmask8 __U, __m256 __B, __m256 __C) { + // CHECK-LABEL: @test_mm256_mask_fmsub_ps + // CHECK: @llvm.x86.avx512.mask.vfmadd.ps.256 + return _mm256_mask_fmsub_ps(__A, __U, __B, __C); +} + +__m256 test_mm256_mask3_fmadd_ps(__m256 __A, __m256 __B, __m256 __C, __mmask8 __U) { + // CHECK-LABEL: @test_mm256_mask3_fmadd_ps + // CHECK: @llvm.x86.avx512.mask3.vfmadd.ps.256 + return _mm256_mask3_fmadd_ps(__A, __B, __C, __U); +} + +__m256 test_mm256_mask3_fnmadd_ps(__m256 __A, __m256 __B, __m256 __C, __mmask8 __U) { + // CHECK-LABEL: @test_mm256_mask3_fnmadd_ps + // CHECK: @llvm.x86.avx512.mask3.vfmadd.ps.256 + return _mm256_mask3_fnmadd_ps(__A, __B, __C, __U); +} + +__m256 test_mm256_maskz_fmadd_ps(__mmask8 __U, __m256 __A, __m256 __B, __m256 __C) { + // CHECK-LABEL: @test_mm256_maskz_fmadd_ps + // CHECK: @llvm.x86.avx512.maskz.vfmadd.ps.256 + return _mm256_maskz_fmadd_ps(__U, __A, __B, __C); +} + +__m256 test_mm256_maskz_fmsub_ps(__mmask8 __U, __m256 __A, __m256 __B, __m256 __C) { + // CHECK-LABEL: @test_mm256_maskz_fmsub_ps + // CHECK: @llvm.x86.avx512.maskz.vfmadd.ps.256 + return _mm256_maskz_fmsub_ps(__U, __A, __B, __C); +} + +__m256 test_mm256_maskz_fnmadd_ps(__mmask8 __U, __m256 __A, __m256 __B, __m256 __C) { + // CHECK-LABEL: @test_mm256_maskz_fnmadd_ps + // CHECK: @llvm.x86.avx512.maskz.vfmadd.ps.256 + return _mm256_maskz_fnmadd_ps(__U, __A, __B, __C); +} + +__m256 test_mm256_maskz_fnmsub_ps(__mmask8 __U, __m256 __A, __m256 __B, __m256 __C) { + // CHECK-LABEL: @test_mm256_maskz_fnmsub_ps + // CHECK: @llvm.x86.avx512.maskz.vfmadd.ps.256 + return _mm256_maskz_fnmsub_ps(__U, __A, __B, __C); +} + +__m128d test_mm_mask_fmaddsub_pd(__m128d __A, __mmask8 __U, __m128d __B, __m128d __C) { + // CHECK-LABEL: @test_mm_mask_fmaddsub_pd + // CHECK: @llvm.x86.avx512.mask.vfmaddsub.pd.128 + return _mm_mask_fmaddsub_pd(__A, __U, __B, __C); +} + +__m128d test_mm_mask_fmsubadd_pd(__m128d __A, __mmask8 __U, __m128d __B, __m128d __C) { + // CHECK-LABEL: @test_mm_mask_fmsubadd_pd + // CHECK: @llvm.x86.avx512.mask.vfmaddsub.pd.128 + return _mm_mask_fmsubadd_pd(__A, __U, __B, __C); +} + +__m128d test_mm_mask3_fmaddsub_pd(__m128d __A, __m128d __B, __m128d __C, __mmask8 __U) { + // CHECK-LABEL: @test_mm_mask3_fmaddsub_pd + // CHECK: @llvm.x86.avx512.mask3.vfmaddsub.pd.128 + return _mm_mask3_fmaddsub_pd(__A, __B, __C, __U); +} + +__m128d test_mm_maskz_fmaddsub_pd(__mmask8 __U, __m128d __A, __m128d __B, __m128d __C) { + // CHECK-LABEL: @test_mm_maskz_fmaddsub_pd + // CHECK: @llvm.x86.avx512.maskz.vfmaddsub.pd.128 + return _mm_maskz_fmaddsub_pd(__U, __A, __B, __C); +} + +__m128d test_mm_maskz_fmsubadd_pd(__mmask8 __U, __m128d __A, __m128d __B, __m128d __C) { + // CHECK-LABEL: @test_mm_maskz_fmsubadd_pd + // CHECK: @llvm.x86.avx512.maskz.vfmaddsub.pd.128 + return _mm_maskz_fmsubadd_pd(__U, __A, __B, __C); +} + +__m256d test_mm256_mask_fmaddsub_pd(__m256d __A, __mmask8 __U, __m256d __B, __m256d __C) { + // CHECK-LABEL: @test_mm256_mask_fmaddsub_pd + // CHECK: @llvm.x86.avx512.mask.vfmaddsub.pd.256 + return _mm256_mask_fmaddsub_pd(__A, __U, __B, __C); +} + +__m256d test_mm256_mask_fmsubadd_pd(__m256d __A, __mmask8 __U, __m256d __B, __m256d __C) { + // CHECK-LABEL: @test_mm256_mask_fmsubadd_pd + // CHECK: @llvm.x86.avx512.mask.vfmaddsub.pd.256 + return _mm256_mask_fmsubadd_pd(__A, __U, __B, __C); +} + +__m256d test_mm256_mask3_fmaddsub_pd(__m256d __A, __m256d __B, __m256d __C, __mmask8 __U) { + // CHECK-LABEL: @test_mm256_mask3_fmaddsub_pd + // CHECK: @llvm.x86.avx512.mask3.vfmaddsub.pd.256 + return _mm256_mask3_fmaddsub_pd(__A, __B, __C, __U); +} + +__m256d test_mm256_maskz_fmaddsub_pd(__mmask8 __U, __m256d __A, __m256d __B, __m256d __C) { + // CHECK-LABEL: @test_mm256_maskz_fmaddsub_pd + // CHECK: @llvm.x86.avx512.maskz.vfmaddsub.pd.256 + return _mm256_maskz_fmaddsub_pd(__U, __A, __B, __C); +} + +__m256d test_mm256_maskz_fmsubadd_pd(__mmask8 __U, __m256d __A, __m256d __B, __m256d __C) { + // CHECK-LABEL: @test_mm256_maskz_fmsubadd_pd + // CHECK: @llvm.x86.avx512.maskz.vfmaddsub.pd.256 + return _mm256_maskz_fmsubadd_pd(__U, __A, __B, __C); +} + +__m128 test_mm_mask_fmaddsub_ps(__m128 __A, __mmask8 __U, __m128 __B, __m128 __C) { + // CHECK-LABEL: @test_mm_mask_fmaddsub_ps + // CHECK: @llvm.x86.avx512.mask.vfmaddsub.ps.128 + return _mm_mask_fmaddsub_ps(__A, __U, __B, __C); +} + +__m128 test_mm_mask_fmsubadd_ps(__m128 __A, __mmask8 __U, __m128 __B, __m128 __C) { + // CHECK-LABEL: @test_mm_mask_fmsubadd_ps + // CHECK: @llvm.x86.avx512.mask.vfmaddsub.ps.128 + return _mm_mask_fmsubadd_ps(__A, __U, __B, __C); +} + +__m128 test_mm_mask3_fmaddsub_ps(__m128 __A, __m128 __B, __m128 __C, __mmask8 __U) { + // CHECK-LABEL: @test_mm_mask3_fmaddsub_ps + // CHECK: @llvm.x86.avx512.mask3.vfmaddsub.ps.128 + return _mm_mask3_fmaddsub_ps(__A, __B, __C, __U); +} + +__m128 test_mm_maskz_fmaddsub_ps(__mmask8 __U, __m128 __A, __m128 __B, __m128 __C) { + // CHECK-LABEL: @test_mm_maskz_fmaddsub_ps + // CHECK: @llvm.x86.avx512.maskz.vfmaddsub.ps.128 + return _mm_maskz_fmaddsub_ps(__U, __A, __B, __C); +} + +__m128 test_mm_maskz_fmsubadd_ps(__mmask8 __U, __m128 __A, __m128 __B, __m128 __C) { + // CHECK-LABEL: @test_mm_maskz_fmsubadd_ps + // CHECK: @llvm.x86.avx512.maskz.vfmaddsub.ps.128 + return _mm_maskz_fmsubadd_ps(__U, __A, __B, __C); +} + +__m256 test_mm256_mask_fmaddsub_ps(__m256 __A, __mmask8 __U, __m256 __B, __m256 __C) { + // CHECK-LABEL: @test_mm256_mask_fmaddsub_ps + // CHECK: @llvm.x86.avx512.mask.vfmaddsub.ps.256 + return _mm256_mask_fmaddsub_ps(__A, __U, __B, __C); +} + +__m256 test_mm256_mask_fmsubadd_ps(__m256 __A, __mmask8 __U, __m256 __B, __m256 __C) { + // CHECK-LABEL: @test_mm256_mask_fmsubadd_ps + // CHECK: @llvm.x86.avx512.mask.vfmaddsub.ps.256 + return _mm256_mask_fmsubadd_ps(__A, __U, __B, __C); +} + +__m256 test_mm256_mask3_fmaddsub_ps(__m256 __A, __m256 __B, __m256 __C, __mmask8 __U) { + // CHECK-LABEL: @test_mm256_mask3_fmaddsub_ps + // CHECK: @llvm.x86.avx512.mask3.vfmaddsub.ps.256 + return _mm256_mask3_fmaddsub_ps(__A, __B, __C, __U); +} + +__m256 test_mm256_maskz_fmaddsub_ps(__mmask8 __U, __m256 __A, __m256 __B, __m256 __C) { + // CHECK-LABEL: @test_mm256_maskz_fmaddsub_ps + // CHECK: @llvm.x86.avx512.maskz.vfmaddsub.ps.256 + return _mm256_maskz_fmaddsub_ps(__U, __A, __B, __C); +} + +__m256 test_mm256_maskz_fmsubadd_ps(__mmask8 __U, __m256 __A, __m256 __B, __m256 __C) { + // CHECK-LABEL: @test_mm256_maskz_fmsubadd_ps + // CHECK: @llvm.x86.avx512.maskz.vfmaddsub.ps.256 + return _mm256_maskz_fmsubadd_ps(__U, __A, __B, __C); +} + +__m128d test_mm_mask3_fmsub_pd(__m128d __A, __m128d __B, __m128d __C, __mmask8 __U) { + // CHECK-LABEL: @test_mm_mask3_fmsub_pd + // CHECK: @llvm.x86.avx512.mask3.vfmsub.pd.128 + return _mm_mask3_fmsub_pd(__A, __B, __C, __U); +} + +__m256d test_mm256_mask3_fmsub_pd(__m256d __A, __m256d __B, __m256d __C, __mmask8 __U) { + // CHECK-LABEL: @test_mm256_mask3_fmsub_pd + // CHECK: @llvm.x86.avx512.mask3.vfmsub.pd.256 + return _mm256_mask3_fmsub_pd(__A, __B, __C, __U); +} + +__m128 test_mm_mask3_fmsub_ps(__m128 __A, __m128 __B, __m128 __C, __mmask8 __U) { + // CHECK-LABEL: @test_mm_mask3_fmsub_ps + // CHECK: @llvm.x86.avx512.mask3.vfmsub.ps.128 + return _mm_mask3_fmsub_ps(__A, __B, __C, __U); +} + +__m256 test_mm256_mask3_fmsub_ps(__m256 __A, __m256 __B, __m256 __C, __mmask8 __U) { + // CHECK-LABEL: @test_mm256_mask3_fmsub_ps + // CHECK: @llvm.x86.avx512.mask3.vfmsub.ps.256 + return _mm256_mask3_fmsub_ps(__A, __B, __C, __U); +} + +__m128d test_mm_mask3_fmsubadd_pd(__m128d __A, __m128d __B, __m128d __C, __mmask8 __U) { + // CHECK-LABEL: @test_mm_mask3_fmsubadd_pd + // CHECK: @llvm.x86.avx512.mask3.vfmsubadd.pd.128 + return _mm_mask3_fmsubadd_pd(__A, __B, __C, __U); +} + +__m256d test_mm256_mask3_fmsubadd_pd(__m256d __A, __m256d __B, __m256d __C, __mmask8 __U) { + // CHECK-LABEL: @test_mm256_mask3_fmsubadd_pd + // CHECK: @llvm.x86.avx512.mask3.vfmsubadd.pd.256 + return _mm256_mask3_fmsubadd_pd(__A, __B, __C, __U); +} + +__m128 test_mm_mask3_fmsubadd_ps(__m128 __A, __m128 __B, __m128 __C, __mmask8 __U) { + // CHECK-LABEL: @test_mm_mask3_fmsubadd_ps + // CHECK: @llvm.x86.avx512.mask3.vfmsubadd.ps.128 + return _mm_mask3_fmsubadd_ps(__A, __B, __C, __U); +} + +__m256 test_mm256_mask3_fmsubadd_ps(__m256 __A, __m256 __B, __m256 __C, __mmask8 __U) { + // CHECK-LABEL: @test_mm256_mask3_fmsubadd_ps + // CHECK: @llvm.x86.avx512.mask3.vfmsubadd.ps.256 + return _mm256_mask3_fmsubadd_ps(__A, __B, __C, __U); +} + +__m128d test_mm_mask_fnmadd_pd(__m128d __A, __mmask8 __U, __m128d __B, __m128d __C) { + // CHECK-LABEL: @test_mm_mask_fnmadd_pd + // CHECK: @llvm.x86.avx512.mask.vfnmadd.pd.128 + return _mm_mask_fnmadd_pd(__A, __U, __B, __C); +} + +__m256d test_mm256_mask_fnmadd_pd(__m256d __A, __mmask8 __U, __m256d __B, __m256d __C) { + // CHECK-LABEL: @test_mm256_mask_fnmadd_pd + // CHECK: @llvm.x86.avx512.mask.vfnmadd.pd.256 + return _mm256_mask_fnmadd_pd(__A, __U, __B, __C); +} + +__m128 test_mm_mask_fnmadd_ps(__m128 __A, __mmask8 __U, __m128 __B, __m128 __C) { + // CHECK-LABEL: @test_mm_mask_fnmadd_ps + // CHECK: @llvm.x86.avx512.mask.vfnmadd.ps.128 + return _mm_mask_fnmadd_ps(__A, __U, __B, __C); +} + +__m256 test_mm256_mask_fnmadd_ps(__m256 __A, __mmask8 __U, __m256 __B, __m256 __C) { + // CHECK-LABEL: @test_mm256_mask_fnmadd_ps + // CHECK: @llvm.x86.avx512.mask.vfnmadd.ps.256 + return _mm256_mask_fnmadd_ps(__A, __U, __B, __C); +} + +__m128d test_mm_mask_fnmsub_pd(__m128d __A, __mmask8 __U, __m128d __B, __m128d __C) { + // CHECK-LABEL: @test_mm_mask_fnmsub_pd + // CHECK: @llvm.x86.avx512.mask.vfnmsub.pd.128 + return _mm_mask_fnmsub_pd(__A, __U, __B, __C); +} + +__m128d test_mm_mask3_fnmsub_pd(__m128d __A, __m128d __B, __m128d __C, __mmask8 __U) { + // CHECK-LABEL: @test_mm_mask3_fnmsub_pd + // CHECK: @llvm.x86.avx512.mask3.vfnmsub.pd.128 + return _mm_mask3_fnmsub_pd(__A, __B, __C, __U); +} + +__m256d test_mm256_mask_fnmsub_pd(__m256d __A, __mmask8 __U, __m256d __B, __m256d __C) { + // CHECK-LABEL: @test_mm256_mask_fnmsub_pd + // CHECK: @llvm.x86.avx512.mask.vfnmsub.pd.256 + return _mm256_mask_fnmsub_pd(__A, __U, __B, __C); +} + +__m256d test_mm256_mask3_fnmsub_pd(__m256d __A, __m256d __B, __m256d __C, __mmask8 __U) { + // CHECK-LABEL: @test_mm256_mask3_fnmsub_pd + // CHECK: @llvm.x86.avx512.mask3.vfnmsub.pd.256 + return _mm256_mask3_fnmsub_pd(__A, __B, __C, __U); +} + +__m128 test_mm_mask_fnmsub_ps(__m128 __A, __mmask8 __U, __m128 __B, __m128 __C) { + // CHECK-LABEL: @test_mm_mask_fnmsub_ps + // CHECK: @llvm.x86.avx512.mask.vfnmsub.ps.128 + return _mm_mask_fnmsub_ps(__A, __U, __B, __C); +} + +__m128 test_mm_mask3_fnmsub_ps(__m128 __A, __m128 __B, __m128 __C, __mmask8 __U) { + // CHECK-LABEL: @test_mm_mask3_fnmsub_ps + // CHECK: @llvm.x86.avx512.mask3.vfnmsub.ps.128 + return _mm_mask3_fnmsub_ps(__A, __B, __C, __U); +} + +__m256 test_mm256_mask_fnmsub_ps(__m256 __A, __mmask8 __U, __m256 __B, __m256 __C) { + // CHECK-LABEL: @test_mm256_mask_fnmsub_ps + // CHECK: @llvm.x86.avx512.mask.vfnmsub.ps.256 + return _mm256_mask_fnmsub_ps(__A, __U, __B, __C); +} + +__m256 test_mm256_mask3_fnmsub_ps(__m256 __A, __m256 __B, __m256 __C, __mmask8 __U) { + // CHECK-LABEL: @test_mm256_mask3_fnmsub_ps + // CHECK: @llvm.x86.avx512.mask3.vfnmsub.ps.256 + return _mm256_mask3_fnmsub_ps(__A, __B, __C, __U); +} + diff --git a/test/CodeGen/builtin-cpu-supports.c b/test/CodeGen/builtin-cpu-supports.c new file mode 100644 index 0000000..2252b3e --- /dev/null +++ b/test/CodeGen/builtin-cpu-supports.c @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm < %s| FileCheck %s + +// Test that we have the structure definition, the gep offsets, the name of the +// global, the bit grab, and the icmp correct. +extern void a(const char *); + +int main() { + if (__builtin_cpu_supports("sse4.2")) + a("sse4.2"); + + // CHECK: [[LOAD:%[^ ]+]] = load i32, i32* getelementptr inbounds ({ i32, i32, i32, [1 x i32] }, { i32, i32, i32, [1 x i32] }* @__cpu_model, i32 0, i32 3, i32 0) + // CHECK: [[AND:%[^ ]+]] = and i32 [[LOAD]], 256 + // CHECK = icmp ne i32 [[AND]], 0 + + return 0; +} diff --git a/test/CodeGen/builtins-nvptx.c b/test/CodeGen/builtins-nvptx.c index 5f91f7ad..ebf2067 100644 --- a/test/CodeGen/builtins-nvptx.c +++ b/test/CodeGen/builtins-nvptx.c @@ -1,8 +1,13 @@ // REQUIRES: nvptx-registered-target -// RUN: %clang_cc1 -triple nvptx-unknown-unknown -S -emit-llvm -o - %s | FileCheck %s -// RUN: %clang_cc1 -triple nvptx64-unknown-unknown -S -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple nvptx-unknown-unknown -fcuda-is-device -S -emit-llvm -o - -x cuda %s | FileCheck %s +// RUN: %clang_cc1 -triple nvptx64-unknown-unknown -fcuda-is-device -S -emit-llvm -o - -x cuda %s | FileCheck %s -int read_tid() { +#define __device__ __attribute__((device)) +#define __global__ __attribute__((global)) +#define __shared__ __attribute__((shared)) +#define __constant__ __attribute__((constant)) + +__device__ int read_tid() { // CHECK: call i32 @llvm.ptx.read.tid.x() // CHECK: call i32 @llvm.ptx.read.tid.y() @@ -18,7 +23,7 @@ int read_tid() { } -int read_ntid() { +__device__ int read_ntid() { // CHECK: call i32 @llvm.ptx.read.ntid.x() // CHECK: call i32 @llvm.ptx.read.ntid.y() @@ -34,7 +39,7 @@ int read_ntid() { } -int read_ctaid() { +__device__ int read_ctaid() { // CHECK: call i32 @llvm.ptx.read.ctaid.x() // CHECK: call i32 @llvm.ptx.read.ctaid.y() @@ -50,7 +55,7 @@ int read_ctaid() { } -int read_nctaid() { +__device__ int read_nctaid() { // CHECK: call i32 @llvm.ptx.read.nctaid.x() // CHECK: call i32 @llvm.ptx.read.nctaid.y() @@ -66,7 +71,7 @@ int read_nctaid() { } -int read_ids() { +__device__ int read_ids() { // CHECK: call i32 @llvm.ptx.read.laneid() // CHECK: call i32 @llvm.ptx.read.warpid() @@ -86,7 +91,7 @@ int read_ids() { } -int read_lanemasks() { +__device__ int read_lanemasks() { // CHECK: call i32 @llvm.ptx.read.lanemask.eq() // CHECK: call i32 @llvm.ptx.read.lanemask.le() @@ -104,8 +109,7 @@ int read_lanemasks() { } - -long read_clocks() { +__device__ long read_clocks() { // CHECK: call i32 @llvm.ptx.read.clock() // CHECK: call i64 @llvm.ptx.read.clock64() @@ -117,7 +121,7 @@ long read_clocks() { } -int read_pms() { +__device__ int read_pms() { // CHECK: call i32 @llvm.ptx.read.pm0() // CHECK: call i32 @llvm.ptx.read.pm1() @@ -133,7 +137,7 @@ int read_pms() { } -void sync() { +__device__ void sync() { // CHECK: call void @llvm.ptx.bar.sync(i32 0) @@ -146,7 +150,7 @@ void sync() { // The idea is not to test all intrinsics, just that Clang is recognizing the // builtins defined in BuiltinsNVPTX.def -void nvvm_math(float f1, float f2, double d1, double d2) { +__device__ void nvvm_math(float f1, float f2, double d1, double d2) { // CHECK: call float @llvm.nvvm.fmax.f float t1 = __nvvm_fmax_f(f1, f2); // CHECK: call float @llvm.nvvm.fmin.f @@ -176,3 +180,95 @@ void nvvm_math(float f1, float f2, double d1, double d2) { // CHECK: call void @llvm.nvvm.barrier0() __nvvm_bar0(); } + +__device__ int di; +__shared__ int si; +__device__ long dl; +__shared__ long sl; +__device__ long long dll; +__shared__ long long sll; + +// Check for atomic intrinsics +// CHECK-LABEL: nvvm_atom +__device__ void nvvm_atom(float *fp, float f, int *ip, int i, long *lp, long l, + long long *llp, long long ll) { + // CHECK: atomicrmw add + __nvvm_atom_add_gen_i(ip, i); + // CHECK: atomicrmw add + __nvvm_atom_add_gen_l(&dl, l); + // CHECK: atomicrmw add + __nvvm_atom_add_gen_ll(&sll, ll); + + // CHECK: atomicrmw sub + __nvvm_atom_sub_gen_i(ip, i); + // CHECK: atomicrmw sub + __nvvm_atom_sub_gen_l(&dl, l); + // CHECK: atomicrmw sub + __nvvm_atom_sub_gen_ll(&sll, ll); + + // CHECK: atomicrmw and + __nvvm_atom_and_gen_i(ip, i); + // CHECK: atomicrmw and + __nvvm_atom_and_gen_l(&dl, l); + // CHECK: atomicrmw and + __nvvm_atom_and_gen_ll(&sll, ll); + + // CHECK: atomicrmw or + __nvvm_atom_or_gen_i(ip, i); + // CHECK: atomicrmw or + __nvvm_atom_or_gen_l(&dl, l); + // CHECK: atomicrmw or + __nvvm_atom_or_gen_ll(&sll, ll); + + // CHECK: atomicrmw xor + __nvvm_atom_xor_gen_i(ip, i); + // CHECK: atomicrmw xor + __nvvm_atom_xor_gen_l(&dl, l); + // CHECK: atomicrmw xor + __nvvm_atom_xor_gen_ll(&sll, ll); + + // CHECK: atomicrmw xchg + __nvvm_atom_xchg_gen_i(ip, i); + // CHECK: atomicrmw xchg + __nvvm_atom_xchg_gen_l(&dl, l); + // CHECK: atomicrmw xchg + __nvvm_atom_xchg_gen_ll(&sll, ll); + + // CHECK: atomicrmw max + __nvvm_atom_max_gen_i(ip, i); + // CHECK: atomicrmw max + __nvvm_atom_max_gen_ui((unsigned int *)ip, i); + // CHECK: atomicrmw max + __nvvm_atom_max_gen_l(&dl, l); + // CHECK: atomicrmw max + __nvvm_atom_max_gen_ul((unsigned long *)&dl, l); + // CHECK: atomicrmw max + __nvvm_atom_max_gen_ll(&sll, ll); + // CHECK: atomicrmw max + __nvvm_atom_max_gen_ull((unsigned long long *)&sll, ll); + + // CHECK: atomicrmw min + __nvvm_atom_min_gen_i(ip, i); + // CHECK: atomicrmw min + __nvvm_atom_min_gen_ui((unsigned int *)ip, i); + // CHECK: atomicrmw min + __nvvm_atom_min_gen_l(&dl, l); + // CHECK: atomicrmw min + __nvvm_atom_min_gen_ul((unsigned long *)&dl, l); + // CHECK: atomicrmw min + __nvvm_atom_min_gen_ll(&sll, ll); + // CHECK: atomicrmw min + __nvvm_atom_min_gen_ull((unsigned long long *)&sll, ll); + + // CHECK: cmpxchg + __nvvm_atom_cas_gen_i(ip, 0, i); + // CHECK: cmpxchg + __nvvm_atom_cas_gen_l(&dl, 0, l); + // CHECK: cmpxchg + __nvvm_atom_cas_gen_ll(&sll, 0, ll); + + // CHECK: call float @llvm.nvvm.atomic.load.add.f32.p0f32 + __nvvm_atom_add_gen_f(fp, f); + + // CHECK: ret +} diff --git a/test/CodeGen/builtins-ppc-p8vector.c b/test/CodeGen/builtins-ppc-p8vector.c index ac40790..61e14ba 100644 --- a/test/CodeGen/builtins-ppc-p8vector.c +++ b/test/CodeGen/builtins-ppc-p8vector.c @@ -1,7 +1,11 @@ // REQUIRES: powerpc-registered-target // RUN: %clang_cc1 -faltivec -target-feature +power8-vector -triple powerpc64-unknown-unknown -emit-llvm %s -o - | FileCheck %s // RUN: %clang_cc1 -faltivec -target-feature +power8-vector -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK-LE -// RUN: not %clang_cc1 -faltivec -triple powerpc64-unknown-unknown -emit-llvm %s -o - 2>&1 | FileCheck %s -check-prefix=CHECK-PPC +// RUN: not %clang_cc1 -faltivec -target-feature +vsx -triple powerpc64-unknown-unknown -emit-llvm %s -o - 2>&1 | FileCheck %s -check-prefix=CHECK-PPC +// Added -target-feature +vsx above to avoid errors about "vector double" and to +// generate the correct errors for functions that are only overloaded with VSX +// (vec_cmpge, vec_cmple). Without this option, there is only one overload so +// it is selected. vector signed char vsc = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 }; vector unsigned char vuc = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5 }; @@ -11,6 +15,7 @@ vector bool int vbi = {0, -1, -1, 0}; vector bool long long vbll = { 1, 0 }; vector signed long long vsll = { 1, 2 }; vector unsigned long long vull = { 1, 2 }; +vector double vda = { 1.e-11, -132.23e10 }; int res_i; vector signed char res_vsc; @@ -21,10 +26,63 @@ vector bool int res_vbi; vector bool long long res_vbll; vector signed long long res_vsll; vector unsigned long long res_vull; +vector double res_vd; // CHECK-LABEL: define void @test1 void test1() { + /* vec_abs */ + res_vsll = vec_abs(vsll); +// CHECK: call <2 x i64> @llvm.ppc.altivec.vmaxsd(<2 x i64> %{{[0-9]*}}, <2 x i64> +// CHECK-LE: call <2 x i64> @llvm.ppc.altivec.vmaxsd(<2 x i64> %{{[0-9]*}}, <2 x i64> +// CHECK-PPC: error: call to 'vec_abs' is ambiguous + + res_vd = vec_abs(vda); +// CHECK: store <2 x i64> <i64 9223372036854775807, i64 9223372036854775807>, <2 x i64>* +// CHECK: and <2 x i64> +// CHECK-LE: store <2 x i64> <i64 9223372036854775807, i64 9223372036854775807>, <2 x i64>* +// CHECK-LE: and <2 x i64> +// CHECK-PPC: error: call to 'vec_abs' is ambiguous + + /* vec_add */ + res_vsll = vec_add(vsll, vsll); +// CHECK: add <2 x i64> +// CHECK-LE: add <2 x i64> +// CHECK-PPC: error: call to 'vec_add' is ambiguous + + res_vull = vec_add(vull, vull); +// CHECK: add <2 x i64> +// CHECK-LE: add <2 x i64> +// CHECK-PPC: error: call to 'vec_add' is ambiguous + + /* vec_mergee */ + res_vbi = vec_mergee(vbi, vbi); +// CHECK: @llvm.ppc.altivec.vperm +// CHECK-LE: @llvm.ppc.altivec.vperm + + res_vi = vec_mergee(vi, vi); +// CHECK: @llvm.ppc.altivec.vperm +// CHECK-LE: @llvm.ppc.altivec.vperm + + res_vui = vec_mergee(vui, vui); +// CHECK: @llvm.ppc.altivec.vperm +// CHECK-LE: @llvm.ppc.altivec.vperm +// CHECK-PPC: warning: implicit declaration of function 'vec_mergee' + + /* vec_mergeo */ + res_vbi = vec_mergeo(vbi, vbi); +// CHECK: @llvm.ppc.altivec.vperm +// CHECK-LE: @llvm.ppc.altivec.vperm + + res_vi = vec_mergeo(vi, vi); +// CHECK: @llvm.ppc.altivec.vperm +// CHECK-LE: @llvm.ppc.altivec.vperm + + res_vui = vec_mergeo(vui, vui); +// CHECK: @llvm.ppc.altivec.vperm +// CHECK-LE: @llvm.ppc.altivec.vperm +// CHECK-PPC: warning: implicit declaration of function 'vec_mergeo' + /* vec_cmpeq */ res_vbll = vec_cmpeq(vsll, vsll); // CHECK: @llvm.ppc.altivec.vcmpequd @@ -36,6 +94,28 @@ void test1() { // CHECK-LE: @llvm.ppc.altivec.vcmpequd // CHECK-PPC: error: call to 'vec_cmpeq' is ambiguous + /* vec_cmpge */ + res_vbll = vec_cmpge(vsll, vsll); +// CHECK: @llvm.ppc.altivec.vcmpgtsd +// CHECK-LE: @llvm.ppc.altivec.vcmpgtsd +// CHECK-PPC: error: call to 'vec_cmpge' is ambiguous + + res_vbll = vec_cmpge(vull, vull); +// CHECK: @llvm.ppc.altivec.vcmpgtud +// CHECK-LE: @llvm.ppc.altivec.vcmpgtud +// CHECK-PPC: error: call to 'vec_cmpge' is ambiguous + + /* vec_cmple */ + res_vbll = vec_cmple(vsll, vsll); +// CHECK: @llvm.ppc.altivec.vcmpgtsd +// CHECK-LE: @llvm.ppc.altivec.vcmpgtsd +// CHECK-PPC: error: call to 'vec_cmple' is ambiguous + + res_vbll = vec_cmple(vull, vull); +// CHECK: @llvm.ppc.altivec.vcmpgtud +// CHECK-LE: @llvm.ppc.altivec.vcmpgtud +// CHECK-PPC: error: call to 'vec_cmple' is ambiguous + /* vec_cmpgt */ res_vbll = vec_cmpgt(vsll, vsll); // CHECK: @llvm.ppc.altivec.vcmpgtsd @@ -47,6 +127,17 @@ void test1() { // CHECK-LE: @llvm.ppc.altivec.vcmpgtud // CHECK-PPC: error: call to 'vec_cmpgt' is ambiguous + /* vec_cmplt */ + res_vbll = vec_cmplt(vsll, vsll); +// CHECK: call <2 x i64> @llvm.ppc.altivec.vcmpgtsd(<2 x i64> %{{[0-9]*}}, <2 x i64> %{{[0-9]*}}) +// CHECK-LE: call <2 x i64> @llvm.ppc.altivec.vcmpgtsd(<2 x i64> %{{[0-9]*}}, <2 x i64> %{{[0-9]*}}) +// CHECK-PPC: error: call to 'vec_cmplt' is ambiguous + + res_vbll = vec_cmplt(vull, vull); +// CHECK: call <2 x i64> @llvm.ppc.altivec.vcmpgtud(<2 x i64> %{{[0-9]*}}, <2 x i64> %{{[0-9]*}}) +// CHECK-LE: call <2 x i64> @llvm.ppc.altivec.vcmpgtud(<2 x i64> %{{[0-9]*}}, <2 x i64> %{{[0-9]*}}) +// CHECK-PPC: error: call to 'vec_cmplt' is ambiguous + /* ----------------------- predicates --------------------------- */ /* vec_all_eq */ res_i = vec_all_eq(vsll, vsll); diff --git a/test/CodeGen/builtins-ppc-vsx.c b/test/CodeGen/builtins-ppc-vsx.c index 631cb6c..9936213 100644 --- a/test/CodeGen/builtins-ppc-vsx.c +++ b/test/CodeGen/builtins-ppc-vsx.c @@ -1,5 +1,6 @@ // REQUIRES: powerpc-registered-target // RUN: %clang_cc1 -faltivec -target-feature +vsx -triple powerpc64-unknown-unknown -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -faltivec -target-feature +vsx -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s vector unsigned char vuc = { 8, 9, 10, 11, 12, 13, 14, 15, 0, 1, 2, 3, 4, 5, 6, 7}; @@ -16,14 +17,98 @@ vector float res_vf; vector double res_vd; vector signed int res_vsi; vector unsigned int res_vui; +vector bool int res_vbi; vector bool long long res_vbll; vector signed long long res_vsll; vector unsigned long long res_vull; double res_d; +void dummy() { } + void test1() { // CHECK-LABEL: define void @test1 + res_vd = vec_add(vd, vd); +// CHECK: fadd <2 x double> + + res_vd = vec_and(vbll, vd); +// CHECK: and <2 x i64> +// CHECK: bitcast <2 x i64> %{{[0-9]*}} to <2 x double> + + res_vd = vec_and(vd, vbll); +// CHECK: and <2 x i64> +// CHECK: bitcast <2 x i64> %{{[0-9]*}} to <2 x double> + + res_vd = vec_and(vd, vd); +// CHECK: and <2 x i64> +// CHECK: bitcast <2 x i64> %{{[0-9]*}} to <2 x double> + + dummy(); +// CHECK: call void @dummy() + + res_vd = vec_andc(vbll, vd); +// CHECK: bitcast <2 x double> %{{[0-9]*}} to <2 x i64> +// CHECK: xor <2 x i64> %{{[0-9]*}}, <i64 -1, i64 -1> +// CHECK: and <2 x i64> +// CHECK: bitcast <2 x i64> %{{[0-9]*}} to <2 x double> + + dummy(); +// CHECK: call void @dummy() + + res_vd = vec_andc(vd, vbll); +// CHECK: bitcast <2 x double> %{{[0-9]*}} to <2 x i64> +// CHECK: xor <2 x i64> %{{[0-9]*}}, <i64 -1, i64 -1> +// CHECK: and <2 x i64> +// CHECK: bitcast <2 x i64> %{{[0-9]*}} to <2 x double> + + dummy(); +// CHECK: call void @dummy() + + res_vd = vec_andc(vd, vd); +// CHECK: bitcast <2 x double> %{{[0-9]*}} to <2 x i64> +// CHECK: xor <2 x i64> %{{[0-9]*}}, <i64 -1, i64 -1> +// CHECK: and <2 x i64> +// CHECK: bitcast <2 x i64> %{{[0-9]*}} to <2 x double> + + dummy(); +// CHECK: call void @dummy() + + res_vd = vec_ceil(vd); +// CHECK: call <2 x double> @llvm.ceil.v2f64(<2 x double> %{{[0-9]*}}) + + res_vf = vec_ceil(vf); +// CHECK: call <4 x float> @llvm.ceil.v4f32(<4 x float> %{{[0-9]*}}) + + res_vbll = vec_cmpeq(vd, vd); +// CHECK: call <2 x i64> @llvm.ppc.vsx.xvcmpeqdp(<2 x double> %{{[0-9]*}}, <2 x double> %{{[0-9]*}}) + + res_vbi = vec_cmpeq(vf, vf); +// CHECK: call <4 x i32> @llvm.ppc.vsx.xvcmpeqsp(<4 x float> %{{[0-9]*}}, <4 x float> %{{[0-9]*}}) + + res_vbll = vec_cmpge(vd, vd); +// CHECK: call <2 x i64> @llvm.ppc.vsx.xvcmpgedp(<2 x double> %{{[0-9]*}}, <2 x double> %{{[0-9]*}}) + + res_vbi = vec_cmpge(vf, vf); +// CHECK: call <4 x i32> @llvm.ppc.vsx.xvcmpgesp(<4 x float> %{{[0-9]*}}, <4 x float> %{{[0-9]*}}) + + res_vbll = vec_cmpgt(vd, vd); +// CHECK: call <2 x i64> @llvm.ppc.vsx.xvcmpgtdp(<2 x double> %{{[0-9]*}}, <2 x double> %{{[0-9]*}}) + + res_vbi = vec_cmpgt(vf, vf); +// CHECK: call <4 x i32> @llvm.ppc.vsx.xvcmpgtsp(<4 x float> %{{[0-9]*}}, <4 x float> %{{[0-9]*}}) + + res_vbll = vec_cmple(vd, vd); +// CHECK: call <2 x i64> @llvm.ppc.vsx.xvcmpgedp(<2 x double> %{{[0-9]*}}, <2 x double> %{{[0-9]*}}) + + res_vbi = vec_cmple(vf, vf); +// CHECK: call <4 x i32> @llvm.ppc.vsx.xvcmpgesp(<4 x float> %{{[0-9]*}}, <4 x float> %{{[0-9]*}}) + + res_vbll = vec_cmplt(vd, vd); +// CHECK: call <2 x i64> @llvm.ppc.vsx.xvcmpgtdp(<2 x double> %{{[0-9]*}}, <2 x double> %{{[0-9]*}}) + + res_vbi = vec_cmplt(vf, vf); +// CHECK: call <4 x i32> @llvm.ppc.vsx.xvcmpgtsp(<4 x float> %{{[0-9]*}}, <4 x float> %{{[0-9]*}}) + /* vec_div */ res_vf = vec_div(vf, vf); // CHECK: @llvm.ppc.vsx.xvdivsp diff --git a/test/CodeGen/builtins-x86.c b/test/CodeGen/builtins-x86.c index 8a5b5a2..a239889 100644 --- a/test/CodeGen/builtins-x86.c +++ b/test/CodeGen/builtins-x86.c @@ -260,6 +260,10 @@ void f0() { (void) __builtin_ia32_ldmxcsr(tmp_Ui); tmp_Ui = __builtin_ia32_stmxcsr(); + (void)__builtin_ia32_fxsave(tmp_vp); + (void)__builtin_ia32_fxsave64(tmp_vp); + (void)__builtin_ia32_fxrstor(tmp_vp); + (void)__builtin_ia32_fxrstor64(tmp_vp); tmp_V4f = __builtin_ia32_cvtpi2ps(tmp_V4f, tmp_V2i); tmp_V2i = __builtin_ia32_cvtps2pi(tmp_V4f); tmp_i = __builtin_ia32_cvtss2si(tmp_V4f); diff --git a/test/CodeGen/builtinshufflevector2.c b/test/CodeGen/builtinshufflevector2.c index 8712c99..0e7b2ec 100644 --- a/test/CodeGen/builtinshufflevector2.c +++ b/test/CodeGen/builtinshufflevector2.c @@ -3,7 +3,7 @@ typedef float float4 __attribute__((ext_vector_type(4))); typedef unsigned int uint4 __attribute__((ext_vector_type(4))); -// CHECK-LABEL: define void @clang_shufflevector_v_v( +// CHECK-LABEL: define {{.*}}void @clang_shufflevector_v_v( void clang_shufflevector_v_v( float4* A, float4 x, uint4 mask ) { // CHECK: [[MASK:%.*]] = and <4 x i32> {{%.*}}, <i32 3, i32 3, i32 3, i32 3> // CHECK: [[I:%.*]] = extractelement <4 x i32> [[MASK]], i{{[0-9]+}} 0 @@ -27,14 +27,14 @@ void clang_shufflevector_v_v( float4* A, float4 x, uint4 mask ) { *A = __builtin_shufflevector( x, mask ); } -// CHECK-LABEL: define void @clang_shufflevector_v_v_c( +// CHECK-LABEL: define {{.*}}void @clang_shufflevector_v_v_c( void clang_shufflevector_v_v_c( float4* A, float4 x, float4 y) { // CHECK: [[V:%.*]] = shufflevector <4 x float> {{%.*}}, <4 x float> {{%.*}}, <4 x i32> <i32 0, i32 4, i32 1, i32 5> // CHECK: store <4 x float> [[V]], <4 x float>* {{%.*}} *A = __builtin_shufflevector( x, y, 0, 4, 1, 5 ); } -// CHECK-LABEL: define void @clang_shufflevector_v_v_undef( +// CHECK-LABEL: define {{.*}}void @clang_shufflevector_v_v_undef( void clang_shufflevector_v_v_undef( float4* A, float4 x, float4 y) { // CHECK: [[V:%.*]] = shufflevector <4 x float> {{%.*}}, <4 x float> {{%.*}}, <4 x i32> <i32 0, i32 4, i32 undef, i32 5> // CHECK: store <4 x float> [[V]], <4 x float>* {{%.*}} diff --git a/test/CodeGen/c-strings.c b/test/CodeGen/c-strings.c index 588a716..974eeea 100644 --- a/test/CodeGen/c-strings.c +++ b/test/CodeGen/c-strings.c @@ -23,44 +23,44 @@ unsigned char align = 1; void bar(const char *); -// CHECK-LABEL: define void @f0() +// CHECK-LABEL: define {{.*}}void @f0() void f0() { bar("hello"); - // ITANIUM: call void @bar({{.*}} @.str - // MSABI: call void @bar({{.*}} @"\01??_C@_05CJBACGMB@hello?$AA@" + // ITANIUM: call {{.*}}void @bar({{.*}} @.str + // MSABI: call {{.*}}void @bar({{.*}} @"\01??_C@_05CJBACGMB@hello?$AA@" } -// CHECK-LABEL: define void @f1() +// CHECK-LABEL: define {{.*}}void @f1() void f1() { static char *x = "hello"; bar(x); // CHECK: [[T1:%.*]] = load i8*, i8** @f1.x - // CHECK: call void @bar(i8* [[T1:%.*]]) + // CHECK: call {{.*}}void @bar(i8* [[T1:%.*]]) } -// CHECK-LABEL: define void @f2() +// CHECK-LABEL: define {{.*}}void @f2() void f2() { static char x[] = "hello"; bar(x); - // CHECK: call void @bar({{.*}} @f2.x + // CHECK: call {{.*}}void @bar({{.*}} @f2.x } -// CHECK-LABEL: define void @f3() +// CHECK-LABEL: define {{.*}}void @f3() void f3() { static char x[8] = "hello"; bar(x); - // CHECK: call void @bar({{.*}} @f3.x + // CHECK: call {{.*}}void @bar({{.*}} @f3.x } void gaz(void *); -// CHECK-LABEL: define void @f4() +// CHECK-LABEL: define {{.*}}void @f4() void f4() { static struct s { char *name; } x = { "hello" }; gaz(&x); - // CHECK: call void @gaz({{.*}} @f4.x + // CHECK: call {{.*}}void @gaz({{.*}} @f4.x } char x[3] = "ola"; diff --git a/test/CodeGen/c11atomics.c b/test/CodeGen/c11atomics.c index a35eef9..d1e4478 100644 --- a/test/CodeGen/c11atomics.c +++ b/test/CodeGen/c11atomics.c @@ -12,8 +12,24 @@ // they're sufficiently rare that it's not worth making sure that the semantics // are correct. -// CHECK: @testStructGlobal = global {{.*}} { i16 1, i16 2, i16 3, i16 4 } -// CHECK: @testPromotedStructGlobal = global {{.*}} { %{{.*}} { i16 1, i16 2, i16 3 }, [2 x i8] zeroinitializer } +struct elem; + +struct ptr { + struct elem *ptr; +}; +// CHECK-DAG: %struct.ptr = type { %struct.elem* } + +struct elem { + _Atomic(struct ptr) link; +}; +// CHECK-DAG: %struct.elem = type { %struct.ptr } + +struct ptr object; +// CHECK-DAG: @object = common global %struct.ptr zeroinitializer + +// CHECK-DAG: @testStructGlobal = global {{.*}} { i16 1, i16 2, i16 3, i16 4 } +// CHECK-DAG: @testPromotedStructGlobal = global {{.*}} { %{{.*}} { i16 1, i16 2, i16 3 }, [2 x i8] zeroinitializer } + typedef int __attribute__((vector_size(16))) vector; diff --git a/test/CodeGen/call.c b/test/CodeGen/call.c index 7239111..eec6e52 100644 --- a/test/CodeGen/call.c +++ b/test/CodeGen/call.c @@ -18,7 +18,7 @@ void JS_ReportErrorNumber(JSErrorCallback errorCallback, ...); void Interpret() { JS_ReportErrorNumber(js_GetErrorMessage, 0); - // CHECK: call void ({{.*}}, ...) @JS_ReportErrorNumber({{.*}}@js_GetErrorMessage + // CHECK: call {{.*}}void ({{.*}}, ...) @JS_ReportErrorNumber({{.*}}@js_GetErrorMessage } diff --git a/test/CodeGen/captured-statements-nested.c b/test/CodeGen/captured-statements-nested.c index 6464243..b81705b 100644 --- a/test/CodeGen/captured-statements-nested.c +++ b/test/CodeGen/captured-statements-nested.c @@ -30,7 +30,7 @@ void test_nest_captured_stmt(int param, int size, int param_arr[size]) { param_arr[size - 1] = 2; arr[10][z.a] = 12; - // CHECK1: define internal void @__captured_stmt{{.*}}([[T]] + // CHECK1: define internal {{.*}}void @__captured_stmt{{.*}}([[T]] // CHECK1: [[PARAM_ARR_SIZE_REF:%.+]] = getelementptr inbounds [[T]], [[T]]* {{.+}}, i{{[0-9]+}} 0, i{{[0-9]+}} 5 // CHECK1: [[PARAM_ARR_SIZE:%.+]] = load [[SIZE_TYPE]], [[SIZE_TYPE]]* [[PARAM_ARR_SIZE_REF]] // CHECK1: [[ARR_SIZE1_REF:%.+]] = getelementptr inbounds [[T]], [[T]]* {{.+}}, i{{[0-9]+}} 0, i{{[0-9]+}} 8 @@ -106,7 +106,7 @@ void test_nest_block() { } }(); - // CHECK2: define internal void @{{.*}}test_nest_block_block_invoke + // CHECK2: define internal {{.*}}void @{{.*}}test_nest_block_block_invoke // // CHECK2: [[Z:%[0-9a-z_]*]] = alloca i{{[0-9]+}}, // CHECK2: alloca %struct.anon{{.*}} diff --git a/test/CodeGen/captured-statements.c b/test/CodeGen/captured-statements.c index b4fbfd4..53632ac 100644 --- a/test/CodeGen/captured-statements.c +++ b/test/CodeGen/captured-statements.c @@ -28,7 +28,7 @@ void test1() { // CHECK-1: call void @[[HelperName:__captured_stmt[\.0-9]+]] } -// CHECK-1: define internal void @[[HelperName]](%struct.anon +// CHECK-1: define internal {{.*}}void @[[HelperName]](%struct.anon // CHECK-1: getelementptr inbounds %struct.anon{{.*}}, i32 0, i32 0 // CHECK-1: load i32*, i32** // CHECK-1: load i32, i32* @@ -48,7 +48,7 @@ void test2(int x) { // CHECK-2: call void @[[HelperName:__captured_stmt[\.0-9]+]] } -// CHECK-2: define internal void @[[HelperName]] +// CHECK-2: define internal {{.*}}void @[[HelperName]] // CHECK-2-NOT: } // CHECK-2: %i = alloca i32 @@ -93,7 +93,7 @@ void dont_capture_global() { // CHECK-GLOBALS: call void @__captured_stmt[[HelperName:[\.0-9]+]](%[[Capture]] } -// CHECK-GLOBALS: define internal void @__captured_stmt[[HelperName]] +// CHECK-GLOBALS: define internal {{.*}}void @__captured_stmt[[HelperName]] // CHECK-GLOBALS-NOT: ret // CHECK-GLOBALS: load i32, i32* @global // CHECK-GLOBALS: load i32, i32* @ diff --git a/test/CodeGen/complex-convert.c b/test/CodeGen/complex-convert.c index 0db2588..c65a98c 100644 --- a/test/CodeGen/complex-convert.c +++ b/test/CodeGen/complex-convert.c @@ -21,7 +21,7 @@ void foo(signed char sc, unsigned char uc, signed long long sll, _Complex unsigned char cuc1; _Complex signed long long csll1; _Complex unsigned long long cull1; - // CHECK-LABEL: define void @foo( + // CHECK-LABEL: define {{.*}}void @foo( // Match the prototype to pick up the size of sc and sll. // CHECK: i[[CHSIZE:[0-9]+]]{{[^,]*}}, // CHECK: i[[CHSIZE]]{{[^,]*}}, diff --git a/test/CodeGen/debug-info-packed-struct.c b/test/CodeGen/debug-info-packed-struct.c new file mode 100644 index 0000000..0b5226b --- /dev/null +++ b/test/CodeGen/debug-info-packed-struct.c @@ -0,0 +1,91 @@ +// RUN: %clang_cc1 -x c -g -emit-llvm -triple x86_64-apple-darwin -o - %s | FileCheck %s + +// CHECK: %struct.layout0 = type { i8, %struct.size8, i8 } +// CHECK: %struct.layout1 = type <{ i8, %struct.size8_anon, i8, [2 x i8] }> +// CHECK: %struct.layout2 = type <{ i8, %struct.size8_pack1, i8 }> +// CHECK: %struct.layout3 = type <{ i8, [3 x i8], %struct.size8_pack4, i8, [3 x i8] }> + +// --------------------------------------------------------------------- +// Not packed. +// --------------------------------------------------------------------- +struct size8 { + int i : 4; + long long l : 60; +}; +struct layout0 { + char l0_ofs0; + struct size8 l0_ofs8; + int l0_ofs16 : 1; +}; +// CHECK: l0_ofs0 +// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l0_ofs8", +// CHECK-SAME: {{.*}}size: 64, align: 64, offset: 64) +// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l0_ofs16", +// CHECK-SAME: {{.*}}size: 1, align: 32, offset: 128) + + +// --------------------------------------------------------------------- +// Implicitly packed. +// --------------------------------------------------------------------- +struct size8_anon { + int : 4; + long long : 60; +}; +struct layout1 { + char l1_ofs0; + struct size8_anon l1_ofs1; + int l1_ofs9 : 1; +}; +// CHECK: l1_ofs0 +// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l1_ofs1", +// CHECK-SAME: {{.*}}size: 64, align: 8, offset: 8) +// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l1_ofs9", +// CHECK-SAME: {{.*}}size: 1, align: 32, offset: 72) + + +// --------------------------------------------------------------------- +// Explicitly packed. +// --------------------------------------------------------------------- +#pragma pack(1) +struct size8_pack1 { + int i : 4; + long long l : 60; +}; +struct layout2 { + char l2_ofs0; + struct size8_pack1 l2_ofs1; + int l2_ofs9 : 1; +}; +#pragma pack() +// CHECK: l2_ofs0 +// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l2_ofs1", +// CHECK-SAME: {{.*}}size: 64, align: 8, offset: 8) +// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l2_ofs9", +// CHECK-SAME: {{.*}}size: 1, align: 32, offset: 72) + + + +// --------------------------------------------------------------------- +// Explicitly packed with different alignment. +// --------------------------------------------------------------------- +#pragma pack(4) +struct size8_pack4 { + int i : 4; + long long l : 60; +}; +struct layout3 { + char l3_ofs0; + struct size8_pack4 l3_ofs4; + int l3_ofs12 : 1; +}; +#pragma pack() +// CHECK: l3_ofs0 +// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l3_ofs4", +// CHECK-SAME: {{.*}}size: 64, align: 32, offset: 32) +// CHECK: !DIDerivedType(tag: DW_TAG_member, name: "l3_ofs12", +// CHECK-SAME: {{.*}}size: 1, align: 32, offset: 96) + +struct layout0 l0; +struct layout1 l1; +struct layout2 l2; +struct layout3 l3; diff --git a/test/CodeGen/dostmt.c b/test/CodeGen/dostmt.c index 54973dc..67ef64e 100644 --- a/test/CodeGen/dostmt.c +++ b/test/CodeGen/dostmt.c @@ -71,6 +71,6 @@ void test6f(void); void test6() { do { } while (test6f(), 0); - // CHECK: call void @test6f() + // CHECK: call {{.*}}void @test6f() } diff --git a/test/CodeGen/fast-math.c b/test/CodeGen/fast-math.c index 4a51358..6f98b84 100644 --- a/test/CodeGen/fast-math.c +++ b/test/CodeGen/fast-math.c @@ -2,7 +2,7 @@ float f0, f1, f2; void foo(void) { - // CHECK-LABEL: define void @foo() + // CHECK-LABEL: define {{.*}}void @foo() // CHECK: fadd fast f0 = f1 + f2; diff --git a/test/CodeGen/finite-math.c b/test/CodeGen/finite-math.c index 8365b56..90a83fa 100644 --- a/test/CodeGen/finite-math.c +++ b/test/CodeGen/finite-math.c @@ -5,7 +5,7 @@ float f0, f1, f2; void foo(void) { - // CHECK-LABEL: define void @foo() + // CHECK-LABEL: define {{.*}}void @foo() // FINITE: fadd nnan ninf // NSZ: fadd nsz diff --git a/test/CodeGen/linkage-redecl.c b/test/CodeGen/linkage-redecl.c index 58993f3..4767a94 100644 --- a/test/CodeGen/linkage-redecl.c +++ b/test/CodeGen/linkage-redecl.c @@ -16,4 +16,4 @@ void g0() { } extern void f(int x) { } // still has internal linkage -// CHECK-LABEL: define internal void @f +// CHECK-LABEL: define internal {{.*}}void @f diff --git a/test/CodeGen/nomathbuiltin.c b/test/CodeGen/nomathbuiltin.c index f80cd91..35e7c56 100644 --- a/test/CodeGen/nomathbuiltin.c +++ b/test/CodeGen/nomathbuiltin.c @@ -7,6 +7,6 @@ double pow(double, double); double foo(double a, double b) { return pow(a, b); -// CHECK: call double @pow +// CHECK: call {{.*}}double @pow } diff --git a/test/CodeGen/openmp_default_simd_align.c b/test/CodeGen/openmp_default_simd_align.c new file mode 100644 index 0000000..dcab5ab --- /dev/null +++ b/test/CodeGen/openmp_default_simd_align.c @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -O1 -emit-llvm -o - %s | FileCheck %s + +enum e0 { E0 }; +struct s0 { + enum e0 a:31; +}; + +int f0() { + return __builtin_omp_required_simd_align(struct s0); + // CHECK: ret i32 16 +} diff --git a/test/CodeGen/pr9614.c b/test/CodeGen/pr9614.c index 53abef1..63cb5af 100644 --- a/test/CodeGen/pr9614.c +++ b/test/CodeGen/pr9614.c @@ -4,26 +4,42 @@ extern void foo_alias (void) __asm ("foo"); inline void foo (void) { return foo_alias (); } -extern void bar_alias (void) __asm ("bar"); -inline __attribute__ ((__always_inline__)) void bar (void) { - return bar_alias (); +extern int abs_alias (int) __asm ("abs"); +inline __attribute__ ((__always_inline__)) int abs (int x) { + return abs_alias(x); } extern char *strrchr_foo (const char *__s, int __c) __asm ("strrchr"); extern inline __attribute__ ((__always_inline__)) __attribute__ ((__gnu_inline__)) char * strrchr_foo (const char *__s, int __c) { return __builtin_strrchr (__s, __c); } + +extern inline void __attribute__((always_inline, __gnu_inline__)) +prefetch(void) { + __builtin_prefetch(0, 0, 1); +} + +extern inline __attribute__((__always_inline__, __gnu_inline__)) void *memchr(void *__s, int __c, __SIZE_TYPE__ __n) { + return __builtin_memchr(__s, __c, __n); +} + void f(void) { foo(); - bar(); + abs(0); strrchr_foo("", '.'); + prefetch(); + memchr("", '.', 0); } // CHECK-LABEL: define void @f() // CHECK: call void @foo() -// CHECK-NEXT: call void @bar() -// CHECK-NEXT: call i8* @strrchr( -// CHECK-NEXT: ret void +// CHECK: call i32 @abs(i32 0) +// CHECK: call i8* @strrchr( +// CHECK: call void @llvm.prefetch( +// CHECK: call i8* @memchr( +// CHECK: ret void // CHECK: declare void @foo() -// CHECK: declare void @bar() +// CHECK: declare i32 @abs(i32 // CHECK: declare i8* @strrchr(i8*, i32) +// CHECK: declare i8* @memchr( +// CHECK: declare void @llvm.prefetch( diff --git a/test/CodeGen/redefine_extname.c b/test/CodeGen/redefine_extname.c index a91e5b8..ad4106d 100644 --- a/test/CodeGen/redefine_extname.c +++ b/test/CodeGen/redefine_extname.c @@ -13,3 +13,14 @@ int fish() { return fake() + __PRAGMA_REDEFINE_EXTNAME + name; } // CHECK: call i32 @real() // Check that this also works with variables names // CHECK: load i32, i32* @alias + +// This is a case when redefenition is deferred *and* we have a local of the +// same name. PR23923. +#pragma redefine_extname foo bar +int f() { + int foo = 0; + return foo; +} +extern int foo() { return 1; } +// CHECK: define i32 @bar() + diff --git a/test/CodeGen/stack-protector.c b/test/CodeGen/stack-protector.c index 8039b60..ecfbc90 100644 --- a/test/CodeGen/stack-protector.c +++ b/test/CodeGen/stack-protector.c @@ -1,13 +1,13 @@ // RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 0 | FileCheck -check-prefix=NOSSP %s -// NOSSP: define void @test1(i8* %msg) #0 { +// NOSSP: define {{.*}}void @test1(i8* %msg) #0 { // RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 1 | FileCheck -check-prefix=WITHSSP %s -// WITHSSP: define void @test1(i8* %msg) #0 { +// WITHSSP: define {{.*}}void @test1(i8* %msg) #0 { // RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 2 | FileCheck -check-prefix=SSPSTRONG %s -// SSPSTRONG: define void @test1(i8* %msg) #0 { +// SSPSTRONG: define {{.*}}void @test1(i8* %msg) #0 { // RUN: %clang_cc1 -emit-llvm -o - %s -stack-protector 3 | FileCheck -check-prefix=SSPREQ %s -// SSPREQ: define void @test1(i8* %msg) #0 { +// SSPREQ: define {{.*}}void @test1(i8* %msg) #0 { // RUN: %clang_cc1 -emit-llvm -o - %s -fsanitize=safe-stack | FileCheck -check-prefix=SAFESTACK %s -// SAFESTACK: define void @test1(i8* %msg) #0 { +// SAFESTACK: define {{.*}}void @test1(i8* %msg) #0 { typedef __SIZE_TYPE__ size_t; diff --git a/test/CodeGen/static-order.c b/test/CodeGen/static-order.c index 58aabbe..20277d7 100644 --- a/test/CodeGen/static-order.c +++ b/test/CodeGen/static-order.c @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s // CHECK: ModuleID // CHECK-NOT: zeroinitializer -// CHECK-LABEL: define i8* @f +// CHECK-LABEL: define {{.*}}i8* @f struct s { int a; diff --git a/test/CodeGen/ubsan-blacklist.c b/test/CodeGen/ubsan-blacklist.c index 6c67f02..f6e3882 100644 --- a/test/CodeGen/ubsan-blacklist.c +++ b/test/CodeGen/ubsan-blacklist.c @@ -14,9 +14,9 @@ unsigned i; // FUNC: @hash // FILE: @hash unsigned hash() { -// DEFAULT: call void @__ubsan -// FUNC-NOT: call void @__ubsan -// FILE-NOT: call void @__ubsan +// DEFAULT: call {{.*}}void @__ubsan +// FUNC-NOT: call {{.*}}void @__ubsan +// FILE-NOT: call {{.*}}void @__ubsan return i * 37; } @@ -24,8 +24,8 @@ unsigned hash() { // FUNC: @add // FILE: @add unsigned add() { -// DEFAULT: call void @__ubsan -// FUNC: call void @__ubsan -// FILE-NOT: call void @__ubsan +// DEFAULT: call {{.*}}void @__ubsan +// FUNC: call {{.*}}void @__ubsan +// FILE-NOT: call {{.*}}void @__ubsan return i + 1; } diff --git a/test/CodeGen/volatile-1.c b/test/CodeGen/volatile-1.c index 71cd5f8..f63274b 100644 --- a/test/CodeGen/volatile-1.c +++ b/test/CodeGen/volatile-1.c @@ -22,7 +22,7 @@ int printf(const char *, ...); // that do implicit lvalue-to-rvalue conversion are substantially // reduced. -// CHECK-LABEL: define void @test() +// CHECK-LABEL: define {{.*}}void @test() void test() { // CHECK: load volatile [[INT]], [[INT]]* @i i; @@ -303,11 +303,11 @@ void test() { } extern volatile enum X x; -// CHECK-LABEL: define void @test1() +// CHECK-LABEL: define {{.*}}void @test1() void test1() { extern void test1_helper(void); test1_helper(); - // CHECK: call void @test1_helper() + // CHECK: call {{.*}}void @test1_helper() // CHECK-NEXT: ret void x; (void) x; diff --git a/test/CodeGen/x86_64-arguments.c b/test/CodeGen/x86_64-arguments.c index c412e3c..bb9fba1 100644 --- a/test/CodeGen/x86_64-arguments.c +++ b/test/CodeGen/x86_64-arguments.c @@ -1,7 +1,9 @@ // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | \ -// RUN: FileCheck %s -check-prefix=CHECK -check-prefix=SSE +// RUN: FileCheck %s -check-prefix=CHECK -check-prefix=SSE -check-prefix=NO-AVX512 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-feature +avx | \ -// RUN: FileCheck %s -check-prefix=CHECK -check-prefix=AVX +// RUN: FileCheck %s -check-prefix=CHECK -check-prefix=AVX -check-prefix=NO-AVX512 +// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s -target-feature +avx512f | \ +// RUN: FileCheck %s -check-prefix=CHECK -check-prefix=AVX -check-prefix=AVX512 #include <stdarg.h> // CHECK-LABEL: define signext i8 @f0() @@ -458,3 +460,77 @@ void test54() { } // AVX: @test54_helper(<8 x float> {{%[a-zA-Z0-9]+}}, <8 x float> {{%[a-zA-Z0-9]+}}, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double {{%[a-zA-Z0-9]+}}, double {{%[a-zA-Z0-9]+}}) // AVX: @test54_helper(<8 x float> {{%[a-zA-Z0-9]+}}, <8 x float> {{%[a-zA-Z0-9]+}}, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, { double, double }* byval align 8 {{%[a-zA-Z0-9]+}}) + +typedef float __m512 __attribute__ ((__vector_size__ (64))); +typedef struct { + __m512 m; +} s512; + +s512 x55; +__m512 x56; + +// Even on AVX512, aggregates of size larger than four eightbytes have class +// MEMORY (AVX512 draft 0.3 3.2.3p2 Rule 1). +// +// CHECK: declare void @f55(%struct.s512* byval align 64) +void f55(s512 x); + +// However, __m512 has type SSE/SSEUP on AVX512. +// +// AVX512: declare void @f56(<16 x float>) +// NO-AVX512: declare void @f56(<16 x float>* byval align 64) +void f56(__m512 x); +void f57() { f55(x55); f56(x56); } + +// Like for __m128 on AVX, check that the struct below is passed +// in the same way regardless of AVX512 being used. +// +// CHECK: declare void @f58(%struct.t256* byval align 32) +typedef struct t256 { + __m256 m; + __m256 n; +} two256; + +extern void f58(two256 s); +void f59(two256 s) { + f58(s); +} + +// CHECK: declare void @f60(%struct.sat256* byval align 32) +typedef struct at256 { + __m256 array[2]; +} Atwo256; +typedef struct sat256 { + Atwo256 x; +} SAtwo256; + +extern void f60(SAtwo256 s); +void f61(SAtwo256 s) { + f60(s); +} + +// AVX512: @f62_helper(i32 0, <16 x float> {{%[a-zA-Z0-9]+}}, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double {{%[a-zA-Z0-9]+}}, double {{%[a-zA-Z0-9]+}}) +void f62_helper(int, ...); +__m512 x62; +void f62() { + f62_helper(0, x62, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0i); +} + +// Like for __m256 on AVX, we always pass __m512 in memory, and don't +// need to use the register save area. +// +// AVX512-LABEL: define void @f63 +// AVX512-NOT: br i1 +// AVX512: ret void +void f63(__m512 *m, __builtin_va_list argList) { + *m = __builtin_va_arg(argList, __m512); +} + +// AVX512: @f64_helper(<16 x float> {{%[a-zA-Z0-9]+}}, <16 x float> {{%[a-zA-Z0-9]+}}, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double {{%[a-zA-Z0-9]+}}, double {{%[a-zA-Z0-9]+}}) +// AVX512: @f64_helper(<16 x float> {{%[a-zA-Z0-9]+}}, <16 x float> {{%[a-zA-Z0-9]+}}, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, double 1.000000e+00, { double, double }* byval align 8 {{%[a-zA-Z0-9]+}}) +void f64_helper(__m512, ...); +__m512 x64; +void f64() { + f64_helper(x64, x64, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0i); + f64_helper(x64, x64, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0i); +} diff --git a/test/CodeGenCXX/PR5093-static-member-function.cpp b/test/CodeGenCXX/PR5093-static-member-function.cpp index d61a87a..6811351 100644 --- a/test/CodeGenCXX/PR5093-static-member-function.cpp +++ b/test/CodeGenCXX/PR5093-static-member-function.cpp @@ -4,6 +4,6 @@ struct a { }; void g(a *a) { - // CHECK: call void @_ZN1a1fEv() + // CHECK: call {{.*}}void @_ZN1a1fEv() a->f(); } diff --git a/test/CodeGenCXX/address-of-fntemplate.cpp b/test/CodeGenCXX/address-of-fntemplate.cpp index 4ff597a..4840fe8 100644 --- a/test/CodeGenCXX/address-of-fntemplate.cpp +++ b/test/CodeGenCXX/address-of-fntemplate.cpp @@ -9,8 +9,8 @@ void test() { // CHECK: @_Z1fIiEvv void (*p2)() = f<int>; } -// CHECK-LABEL: define linkonce_odr void @_Z1fIiEvT_ -// CHECK-LABEL: define linkonce_odr void @_Z1fIiEvv +// CHECK-LABEL: define linkonce_odr {{.*}}void @_Z1fIiEvT_ +// CHECK-LABEL: define linkonce_odr {{.*}}void @_Z1fIiEvv namespace PR6973 { template<typename T> diff --git a/test/CodeGenCXX/attr-cleanup.cpp b/test/CodeGenCXX/attr-cleanup.cpp index 18a7798..5ece41a 100644 --- a/test/CodeGenCXX/attr-cleanup.cpp +++ b/test/CodeGenCXX/attr-cleanup.cpp @@ -5,7 +5,7 @@ namespace N { } int main(void) { - // CHECK: call void @_ZN1N4freeEPv + // CHECK: call {{.*}}void @_ZN1N4freeEPv void *fp __attribute__((cleanup(N::free))); return 0; } diff --git a/test/CodeGenCXX/block-byref-cxx-objc.cpp b/test/CodeGenCXX/block-byref-cxx-objc.cpp index 5c35ad7..ce1ebd6 100644 --- a/test/CodeGenCXX/block-byref-cxx-objc.cpp +++ b/test/CodeGenCXX/block-byref-cxx-objc.cpp @@ -20,9 +20,9 @@ int main() // CHECK-LABEL: define internal void @__Block_byref_object_dispose_ // CHECK: call {{.*}} @_ZN1AD1Ev // CHECK-LABEL: define internal void @__copy_helper_block_ -// CHECK: call void @_Block_object_assign +// CHECK: call {{.*}}void @_Block_object_assign // CHECK-LABEL: define internal void @__destroy_helper_block_ -// CHECK: call void @_Block_object_dispose +// CHECK: call {{.*}}void @_Block_object_dispose // rdar://problem/11135650 namespace test1 { diff --git a/test/CodeGenCXX/c-linkage.cpp b/test/CodeGenCXX/c-linkage.cpp index 2f8729e..a70a22e 100644 --- a/test/CodeGenCXX/c-linkage.cpp +++ b/test/CodeGenCXX/c-linkage.cpp @@ -15,10 +15,10 @@ extern "C" { extern "C" { static void test2_f() { } - // CHECK-LABEL: define internal void @_Z7test2_fv + // CHECK-LABEL: define internal {{.*}}void @_Z7test2_fv static void test2_f(int x) { } - // CHECK-LABEL: define internal void @_Z7test2_fi + // CHECK-LABEL: define internal {{.*}}void @_Z7test2_fi void test2_use() { test2_f(); test2_f(42); diff --git a/test/CodeGenCXX/captured-statements.cpp b/test/CodeGenCXX/captured-statements.cpp index ebb3833..fdda24f 100644 --- a/test/CodeGenCXX/captured-statements.cpp +++ b/test/CodeGenCXX/captured-statements.cpp @@ -44,11 +44,11 @@ void test1() { // CHECK-1: ret } -// CHECK-1: define internal void @[[HelperName]] +// CHECK-1: define internal {{.*}}void @[[HelperName]] // CHECK-1: getelementptr inbounds %[[Capture]], %[[Capture]]* {{[^,]*}}, i32 0, i32 0 -// CHECK-1: call i32 @__cxa_guard_acquire( +// CHECK-1: call {{.*}}i32 @__cxa_guard_acquire( // CHECK-1: store double %{{.+}}, double* [[INNER]], -// CHECK-1: call void @__cxa_guard_release( +// CHECK-1: call {{.*}}void @__cxa_guard_release( // CHECK-1: getelementptr inbounds %struct.TestClass, %struct.TestClass* {{[^,]*}}, i32 0, i32 0 // CHECK-1: getelementptr inbounds %[[Capture]], %[[Capture]]* {{[^,]*}}, i32 0, i32 1 @@ -61,13 +61,13 @@ void test2(int x) { return x; }(); - // CHECK-2-LABEL: define void @_Z5test2i + // CHECK-2-LABEL: define {{.*}}void @_Z5test2i // CHECK-2: call {{.*}} @[[Lambda:["$\w]+]] // // CHECK-2: define internal {{.*}} @[[Lambda]] // CHECK-2: call void @[[HelperName:["$_A-Za-z0-9]+]](%[[Capture:.*]]* // - // CHECK-2: define internal void @[[HelperName]] + // CHECK-2: define internal {{.*}}void @[[HelperName]] // CHECK-2: getelementptr inbounds %[[Capture]], %[[Capture]]* // CHECK-2: load i32*, i32** // CHECK-2: load i32, i32* @@ -81,7 +81,7 @@ void test3(int x) { // CHECK-3: %[[Capture:struct\.anon[\.0-9]*]] = type { i32* } - // CHECK-3-LABEL: define void @_Z5test3i + // CHECK-3-LABEL: define {{.*}}void @_Z5test3i // CHECK-3: store i32* // CHECK-3: call void @{{.*}}__captured_stmt // CHECK-3: ret void @@ -93,11 +93,11 @@ void test4() { Foo f; f.x = 5; } - // CHECK-4-LABEL: define void @_Z5test4v + // CHECK-4-LABEL: define {{.*}}void @_Z5test4v // CHECK-4: call void @[[HelperName:[\."$_A-Za-z0-9]+]](%[[Capture:.*]]* // CHECK-4: ret void // - // CHECK-4: define internal void @[[HelperName]] + // CHECK-4: define internal {{.*}}void @[[HelperName]] // CHECK-4: store i32 5, i32* // CHECK-4: call {{.*}}FooD1Ev } diff --git a/test/CodeGenCXX/constructor-attr.cpp b/test/CodeGenCXX/constructor-attr.cpp index 468ce36..ec27ed2 100644 --- a/test/CodeGenCXX/constructor-attr.cpp +++ b/test/CodeGenCXX/constructor-attr.cpp @@ -5,7 +5,7 @@ // PR6521 void bar(); struct Foo { - // CHECK-LABEL: define linkonce_odr void @_ZN3Foo3fooEv + // CHECK-LABEL: define linkonce_odr {{.*}}void @_ZN3Foo3fooEv static void foo() __attribute__((constructor)) { bar(); } diff --git a/test/CodeGenCXX/ctor-globalopt.cpp b/test/CodeGenCXX/ctor-globalopt.cpp index 26ec523..bcab609 100644 --- a/test/CodeGenCXX/ctor-globalopt.cpp +++ b/test/CodeGenCXX/ctor-globalopt.cpp @@ -11,8 +11,8 @@ // CHECK: @llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] // CHECK: [{ i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__sub_I_ctor_globalopt.cpp, i8* null }] -// CHECK-LABEL: define internal void @_GLOBAL__sub_I_ctor_globalopt.cpp() -// CHECK: call void @ +// CHECK-LABEL: define internal {{.*}}void @_GLOBAL__sub_I_ctor_globalopt.cpp() +// CHECK: call {{.*}}void @ // CHECK-NOT: call{{ }} // O1: @llvm.global_ctors = appending global [0 x { i32, void ()*, i8* }] zeroinitializer diff --git a/test/CodeGenCXX/debug-info-line.cpp b/test/CodeGenCXX/debug-info-line.cpp index 0b1b43b..7f8e117 100644 --- a/test/CodeGenCXX/debug-info-line.cpp +++ b/test/CodeGenCXX/debug-info-line.cpp @@ -158,7 +158,7 @@ __complex double f11() { void f12() { int f12_1(); void f12_2(int = f12_1()); -// CHECK: call {{(signext )?}}i32 {{.*}} !dbg [[DBG_F12:!.*]] +// CHECK: call {{.*}}{{(signext )?}}i32 {{.*}} !dbg [[DBG_F12:!.*]] #line 1400 f12_2(); } diff --git a/test/CodeGenCXX/debug-info-method-nodebug.cpp b/test/CodeGenCXX/debug-info-method-nodebug.cpp new file mode 100644 index 0000000..474053a --- /dev/null +++ b/test/CodeGenCXX/debug-info-method-nodebug.cpp @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -emit-llvm -g %s -o - | FileCheck %s + +class C { + void present(); + void absent() __attribute__((nodebug)); +}; + +C c; + +// CHECK-NOT: name: "absent" +// CHECK: name: "present" +// CHECK-NOT: name: "absent" diff --git a/test/CodeGenCXX/debug-info-namespace.cpp b/test/CodeGenCXX/debug-info-namespace.cpp index d59b778..35b371e 100644 --- a/test/CodeGenCXX/debug-info-namespace.cpp +++ b/test/CodeGenCXX/debug-info-namespace.cpp @@ -55,7 +55,7 @@ void B::func_fwd() {} // This should work even if 'i' and 'func' were declarations & not definitions, // but it doesn't yet. -// CHECK: [[CU:![0-9]+]] = !DICompileUnit( +// CHECK: [[CU:![0-9]+]] = distinct !DICompileUnit( // CHECK-SAME: imports: [[MODULES:![0-9]*]] // CHECK: [[FOO:![0-9]+]] = !DICompositeType(tag: DW_TAG_structure_type, name: "foo", // CHECK-SAME: line: 5 @@ -102,7 +102,7 @@ void B::func_fwd() {} // CHECK: [[M16]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[FUNC]], entity: [[FUNC_FWD:![0-9]+]] // CHECK: [[M17]] = !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: [[CTXT]], entity: [[I]] -// CHECK-GMLT: [[CU:![0-9]+]] = !DICompileUnit( +// CHECK-GMLT: [[CU:![0-9]+]] = distinct !DICompileUnit( // CHECK-GMLT-SAME: emissionKind: 2, // CHECK-GMLT-SAME: imports: [[MODULES:![0-9]+]] // CHECK-GMLT: [[MODULES]] = !{} diff --git a/test/CodeGenCXX/deferred-global-init.cpp b/test/CodeGenCXX/deferred-global-init.cpp index 920037c..e4c0d07 100644 --- a/test/CodeGenCXX/deferred-global-init.cpp +++ b/test/CodeGenCXX/deferred-global-init.cpp @@ -7,10 +7,10 @@ void* bar() { return a; } // CHECK: @_ZL1a = internal global i8* null -// CHECK-LABEL: define internal void @__cxx_global_var_init +// CHECK-LABEL: define internal {{.*}}void @__cxx_global_var_init // CHECK: load i8*, i8** @foo // CHECK: ret void -// CHECK-LABEL: define internal void @_GLOBAL__sub_I_deferred_global_init.cpp -// CHECK: call void @__cxx_global_var_init() +// CHECK-LABEL: define internal {{.*}}void @_GLOBAL__sub_I_deferred_global_init.cpp +// CHECK: call {{.*}}void @__cxx_global_var_init() // CHECK: ret void diff --git a/test/CodeGenCXX/derived-to-virtual-base-class-calls-final.cpp b/test/CodeGenCXX/derived-to-virtual-base-class-calls-final.cpp index dd64e81..3a4766d 100644 --- a/test/CodeGenCXX/derived-to-virtual-base-class-calls-final.cpp +++ b/test/CodeGenCXX/derived-to-virtual-base-class-calls-final.cpp @@ -9,7 +9,7 @@ struct D final : virtual C { virtual void f(); }; -// CHECK-LABEL: define dereferenceable({{[0-9]+}}) %struct.B* @_Z1fR1D +// CHECK-LABEL: define {{.*}}dereferenceable({{[0-9]+}}) %struct.B* @_Z1fR1D B &f(D &d) { // CHECK-NOT: load i8*, i8** return d; diff --git a/test/CodeGenCXX/destructor-crash.cpp b/test/CodeGenCXX/destructor-crash.cpp new file mode 100644 index 0000000..4329198 --- /dev/null +++ b/test/CodeGenCXX/destructor-crash.cpp @@ -0,0 +1,19 @@ +// RUN: %clang_cc1 %s -emit-llvm -std=c++11 -o %t + +struct A { + ~A(); +}; + +struct B { + A a; +}; + +struct C { + union { + B b; + }; + + ~C() noexcept; +}; + +C::~C() noexcept {} diff --git a/test/CodeGenCXX/dllexport.cpp b/test/CodeGenCXX/dllexport.cpp index 0eb6476..c598880 100644 --- a/test/CodeGenCXX/dllexport.cpp +++ b/test/CodeGenCXX/dllexport.cpp @@ -486,7 +486,7 @@ struct S { struct CtorWithClosure { __declspec(dllexport) CtorWithClosure(...) {} -// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_FCtorWithClosure@@QAEXXZ" +// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_FCtorWithClosure@@QAEXXZ"({{.*}}) comdat // M32-DAG: %[[this_addr:.*]] = alloca %struct.CtorWithClosure*, align 4 // M32-DAG: store %struct.CtorWithClosure* %this, %struct.CtorWithClosure** %[[this_addr]], align 4 // M32-DAG: %[[this:.*]] = load %struct.CtorWithClosure*, %struct.CtorWithClosure** %[[this_addr]] @@ -503,7 +503,7 @@ struct CtorWithClosure { struct __declspec(dllexport) ClassWithClosure { DELETE_IMPLICIT_MEMBERS(ClassWithClosure); ClassWithClosure(...) {} -// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_FClassWithClosure@@QAEXXZ" +// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_FClassWithClosure@@QAEXXZ"({{.*}}) comdat // M32-DAG: %[[this_addr:.*]] = alloca %struct.ClassWithClosure*, align 4 // M32-DAG: store %struct.ClassWithClosure* %this, %struct.ClassWithClosure** %[[this_addr]], align 4 // M32-DAG: %[[this:.*]] = load %struct.ClassWithClosure*, %struct.ClassWithClosure** %[[this_addr]] @@ -520,8 +520,8 @@ struct __declspec(dllexport) NestedOuter { }; }; -// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_FNestedOuter@@QAEXXZ" -// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_FNestedInner@NestedOuter@@QAEXXZ" +// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_FNestedOuter@@QAEXXZ"({{.*}}) comdat +// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_FNestedInner@NestedOuter@@QAEXXZ"({{.*}}) comdat template <typename T> struct SomeTemplate { @@ -530,7 +530,7 @@ struct SomeTemplate { }; struct __declspec(dllexport) InheritFromTemplate : SomeTemplate<int> {}; -// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_F?$SomeTemplate@H@@QAEXXZ" +// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_F?$SomeTemplate@H@@QAEXXZ"({{.*}}) comdat namespace PR23801 { template <typename> @@ -546,7 +546,7 @@ struct __declspec(dllexport) B { }; } // -// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_FB@PR23801@@QAEXXZ" +// M32-DAG: define weak_odr dllexport x86_thiscallcc void @"\01??_FB@PR23801@@QAEXXZ"({{.*}}) comdat struct __declspec(dllexport) T { // Copy assignment operator: diff --git a/test/CodeGenCXX/dynamic_cast-no-rtti.cpp b/test/CodeGenCXX/dynamic_cast-no-rtti.cpp index cde03a3..58834a5 100644 --- a/test/CodeGenCXX/dynamic_cast-no-rtti.cpp +++ b/test/CodeGenCXX/dynamic_cast-no-rtti.cpp @@ -13,14 +13,14 @@ struct B : public A { // does not use runtime support. A *upcast(B *b) { return dynamic_cast<A *>(b); -// CHECK-LABEL: define %struct.A* @_Z6upcastP1B -// CHECK-NOT: call i8* @__dynamic_cast +// CHECK-LABEL: define {{.*}}%struct.A* @_Z6upcastP1B +// CHECK-NOT: call {{.*}}i8* @__dynamic_cast } // A NoOp dynamic_cast can be used with -fno-rtti iff it does not use // runtime support. B *samecast(B *b) { return dynamic_cast<B *>(b); -// CHECK-LABEL: define %struct.B* @_Z8samecastP1B -// CHECK-NOT: call i8* @__dynamic_cast +// CHECK-LABEL: define {{.*}}%struct.B* @_Z8samecastP1B +// CHECK-NOT: call {{.*}}i8* @__dynamic_cast } diff --git a/test/CodeGenCXX/extern-c.cpp b/test/CodeGenCXX/extern-c.cpp index 7852644..e68738b 100644 --- a/test/CodeGenCXX/extern-c.cpp +++ b/test/CodeGenCXX/extern-c.cpp @@ -71,5 +71,5 @@ namespace PR19411 { struct A { void f(); }; extern "C" void A::f() { void g(); g(); } // CHECK-LABEL: @_ZN7PR194111A1fEv( - // CHECK: call void @g() + // CHECK: call {{.*}}void @g() } diff --git a/test/CodeGenCXX/function-template-explicit-specialization.cpp b/test/CodeGenCXX/function-template-explicit-specialization.cpp index 8ff0655..ed6cf84c 100644 --- a/test/CodeGenCXX/function-template-explicit-specialization.cpp +++ b/test/CodeGenCXX/function-template-explicit-specialization.cpp @@ -3,11 +3,11 @@ template<typename T> void a(T); template<> void a(int) {} -// CHECK-LABEL: define void @_Z1aIiEvT_ +// CHECK-LABEL: define {{.*}}void @_Z1aIiEvT_ namespace X { template<typename T> void b(T); template<> void b(int) {} } -// CHECK-LABEL: define void @_ZN1X1bIiEEvT_ +// CHECK-LABEL: define {{.*}}void @_ZN1X1bIiEEvT_ diff --git a/test/CodeGenCXX/globalinit-loc.cpp b/test/CodeGenCXX/globalinit-loc.cpp index 813a890..2712052 100644 --- a/test/CodeGenCXX/globalinit-loc.cpp +++ b/test/CodeGenCXX/globalinit-loc.cpp @@ -4,7 +4,7 @@ // Verify that the global init helper function does not get associated // with any source location. // -// CHECK: define internal void @_GLOBAL__sub_I_globalinit_loc.cpp +// CHECK: define internal {{.*}}void @_GLOBAL__sub_I_globalinit_loc.cpp // CHECK: !dbg ![[DBG:.*]] // CHECK: !DISubprogram(linkageName: "_GLOBAL__sub_I_globalinit_loc.cpp" // CHECK-NOT: line: diff --git a/test/CodeGenCXX/inline-dllexport-member.cpp b/test/CodeGenCXX/inline-dllexport-member.cpp index af9a536..4bc1d4c 100644 --- a/test/CodeGenCXX/inline-dllexport-member.cpp +++ b/test/CodeGenCXX/inline-dllexport-member.cpp @@ -5,7 +5,7 @@ struct __declspec(dllexport) s { static const unsigned int ui = 0; }; -// CHECK: ![[SCOPE:[0-9]+]] = !DICompileUnit( +// CHECK: ![[SCOPE:[0-9]+]] = distinct !DICompileUnit( // CHECK: !DIGlobalVariable(name: "ui", linkageName: "_ZN1s2uiE", scope: ![[SCOPE]], // CHECK-SAME: variable: i32* @_ZN1s2uiE diff --git a/test/CodeGenCXX/linetable-virtual-variadic.cpp b/test/CodeGenCXX/linetable-virtual-variadic.cpp index c16c5e3..115f1ae 100644 --- a/test/CodeGenCXX/linetable-virtual-variadic.cpp +++ b/test/CodeGenCXX/linetable-virtual-variadic.cpp @@ -17,7 +17,7 @@ void Derived::VariadicFunction(...) { } // // CHECK: !llvm.dbg.cu = !{![[CU:[0-9]+]]} // -// CHECK: ![[CU]] = !DICompileUnit({{.*}} subprograms: ![[SPs:[0-9]+]] +// CHECK: ![[CU]] = distinct !DICompileUnit({{.*}} subprograms: ![[SPs:[0-9]+]] // CHECK: ![[SPs]] = !{![[SP:[0-9]+]]} // CHECK: ![[SP]] = !DISubprogram(name: "VariadicFunction",{{.*}} function: {{[^:]+}} @_ZN7Derived16VariadicFunctionEz // CHECK: ![[LOC]] = !DILocation({{.*}}scope: ![[SP]]) diff --git a/test/CodeGenCXX/mangle-address-space.cpp b/test/CodeGenCXX/mangle-address-space.cpp index a0b3c1a..f18480d 100644 --- a/test/CodeGenCXX/mangle-address-space.cpp +++ b/test/CodeGenCXX/mangle-address-space.cpp @@ -1,12 +1,12 @@ // RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -o - %s | FileCheck %s -// CHECK-LABEL: define void @_Z2f0Pc +// CHECK-LABEL: define {{.*}}void @_Z2f0Pc void f0(char *p) { } -// CHECK-LABEL: define void @_Z2f0PU3AS1c +// CHECK-LABEL: define {{.*}}void @_Z2f0PU3AS1c void f0(char __attribute__((address_space(1))) *p) { } struct OpaqueType; typedef OpaqueType __attribute__((address_space(100))) * OpaqueTypePtr; -// CHECK-LABEL: define void @_Z2f0PU5AS10010OpaqueType +// CHECK-LABEL: define {{.*}}void @_Z2f0PU5AS10010OpaqueType void f0(OpaqueTypePtr) { } diff --git a/test/CodeGenCXX/mangle-ms-templates-memptrs-2.cpp b/test/CodeGenCXX/mangle-ms-templates-memptrs-2.cpp index e2cbe15..b01d609 100644 --- a/test/CodeGenCXX/mangle-ms-templates-memptrs-2.cpp +++ b/test/CodeGenCXX/mangle-ms-templates-memptrs-2.cpp @@ -3,22 +3,37 @@ template <typename T, int (T::*)() = nullptr> struct J {}; +template <typename T, int T::* = nullptr> +struct K {}; + struct __single_inheritance M; J<M> m; // CHECK-DAG: @"\01?m@@3U?$J@UM@@$0A@@@A" +K<M> m2; +// CHECK-DAG: @"\01?m2@@3U?$K@UM@@$0?0@@A" + struct __multiple_inheritance N; J<N> n; // CHECK-DAG: @"\01?n@@3U?$J@UN@@$HA@@@A" +K<N> n2; +// CHECK-DAG: @"\01?n2@@3U?$K@UN@@$0?0@@A" + struct __virtual_inheritance O; J<O> o; // CHECK-DAG: @"\01?o@@3U?$J@UO@@$IA@A@@@A" +K<O> o2; +// CHECK-DAG: @"\01?o2@@3U?$K@UO@@$FA@?0@@A" + struct P; J<P> p; // CHECK-DAG: @"\01?p@@3U?$J@UP@@$JA@A@?0@@A" +K<P> p2; +// CHECK-DAG: @"\01?p2@@3U?$K@UP@@$GA@A@?0@@A" + #pragma pointers_to_members(full_generality, virtual_inheritance) struct S { diff --git a/test/CodeGenCXX/mangle-ms-templates-memptrs.cpp b/test/CodeGenCXX/mangle-ms-templates-memptrs.cpp index 803cac3..e710abe 100644 --- a/test/CodeGenCXX/mangle-ms-templates-memptrs.cpp +++ b/test/CodeGenCXX/mangle-ms-templates-memptrs.cpp @@ -69,8 +69,8 @@ void ReadFields() { // them right in class templates. // CHECK: call {{.*}} @"\01??$ReadField@US@@$0A@@@YAHAAUS@@@Z" // CHECK: call {{.*}} @"\01??$ReadField@UM@@$0A@@@YAHAAUM@@@Z" -// CHECK: call {{.*}} @"\01??$ReadField@UV@@$FA@?0@@YAHAAUV@@@Z" -// CHECK: call {{.*}} @"\01??$ReadField@UU@@$GA@A@?0@@YAHAAUU@@@Z" +// CHECK: call {{.*}} @"\01??$ReadField@UV@@$0A@@@YAHAAUV@@@Z" +// CHECK: call {{.*}} @"\01??$ReadField@UU@@$0A@@@YAHAAUU@@@Z" // Non-polymorphic null data memptr vs first field memptr. MSVC mangles these // the same. @@ -141,3 +141,15 @@ void CallMethods() { // CHECK: call {{.*}} @"\01??$CallMethod@UM@@$0A@@@YAXAAUM@@@Z" // CHECK: call {{.*}} @"\01??$CallMethod@UV@@$0A@@@YAXAAUV@@@Z" // CHECK: call {{.*}} @"\01??$CallMethod@UU@@$0A@@@YAXAAUU@@@Z" + +namespace NegativeNVOffset { +struct A {}; +struct B : virtual A {}; +struct C : B { + virtual void f(); +}; +} + +template void CallMethod<NegativeNVOffset::C, &NegativeNVOffset::C::f>(NegativeNVOffset::C &); + +// CHECK-LABEL: define {{.*}} @"\01??$CallMethod@UC@NegativeNVOffset@@$I??_912@$BA@AEPPPPPPPM@A@@@YAXAAUC@NegativeNVOffset@@@Z" diff --git a/test/CodeGenCXX/mangle-nullptr-arg.cpp b/test/CodeGenCXX/mangle-nullptr-arg.cpp index 66ed7e5..e4ae353 100644 --- a/test/CodeGenCXX/mangle-nullptr-arg.cpp +++ b/test/CodeGenCXX/mangle-nullptr-arg.cpp @@ -2,15 +2,15 @@ template<int *ip> struct IP {}; -// CHECK-LABEL: define void @_Z5test12IPILPi0EE +// CHECK-LABEL: define {{.*}}void @_Z5test12IPILPi0EE void test1(IP<nullptr>) {} struct X{ }; template<int X::*pm> struct PM {}; -// CHECK-LABEL: define void @_Z5test22PMILM1Xi0EE +// CHECK-LABEL: define {{.*}}void @_Z5test22PMILM1Xi0EE void test2(PM<nullptr>) { } -// CHECK-LABEL: define void @_Z5test316DependentTypePtrIPiLS0_0EE +// CHECK-LABEL: define {{.*}}void @_Z5test316DependentTypePtrIPiLS0_0EE template<typename T, T x> struct DependentTypePtr {}; void test3(DependentTypePtr<int*,nullptr>) { } diff --git a/test/CodeGenCXX/mangle-template.cpp b/test/CodeGenCXX/mangle-template.cpp index aaae4b2..7fa300a 100644 --- a/test/CodeGenCXX/mangle-template.cpp +++ b/test/CodeGenCXX/mangle-template.cpp @@ -98,7 +98,7 @@ namespace test8 { template<typename T> void f(int_c<meta<T>::type::value>) { } - // CHECK-LABEL: define weak_odr void @_ZN5test81fIiEEvNS_5int_cIXsr4metaIT_E4typeE5valueEEE( + // CHECK-LABEL: define weak_odr {{.*}}void @_ZN5test81fIiEEvNS_5int_cIXsr4metaIT_E4typeE5valueEEE( template void f<int>(int_c<sizeof(int)>); } @@ -157,13 +157,13 @@ namespace test12 { const int n = 10; template<typename T, T v> void test() {} void use() { - // CHECK-LABEL: define internal void @_ZN6test124testIFivEXadL_ZNS_L1fEvEEEEvv( + // CHECK-LABEL: define internal {{.*}}void @_ZN6test124testIFivEXadL_ZNS_L1fEvEEEEvv( test<int(), &f>(); - // CHECK-LABEL: define internal void @_ZN6test124testIRFivEL_ZNS_L1fEvEEEvv( + // CHECK-LABEL: define internal {{.*}}void @_ZN6test124testIRFivEL_ZNS_L1fEvEEEvv( test<int(&)(), f>(); - // CHECK-LABEL: define internal void @_ZN6test124testIPKiXadL_ZNS_L1nEEEEEvv( + // CHECK-LABEL: define internal {{.*}}void @_ZN6test124testIPKiXadL_ZNS_L1nEEEEEvv( test<const int*, &n>(); - // CHECK-LABEL: define internal void @_ZN6test124testIRKiL_ZNS_L1nEEEEvv( + // CHECK-LABEL: define internal {{.*}}void @_ZN6test124testIRKiL_ZNS_L1nEEEEvv( test<const int&, n>(); } } diff --git a/test/CodeGenCXX/microsoft-abi-array-cookies.cpp b/test/CodeGenCXX/microsoft-abi-array-cookies.cpp index 619b1b8..62ead4f 100644 --- a/test/CodeGenCXX/microsoft-abi-array-cookies.cpp +++ b/test/CodeGenCXX/microsoft-abi-array-cookies.cpp @@ -58,4 +58,14 @@ void check_array_cookies_aligned() { // CHECK: getelementptr inbounds i8, i8* [[ARRAY_AS_CHAR]], i64 -8 } +namespace PR23990 { +struct S { + char x[42]; + void operator delete[](void *p, __SIZE_TYPE__); + // CHECK-LABEL: define void @"\01?delete_s@PR23990@@YAXPAUS@1@@Z"( + // CHECK: call void @"\01??_VS@PR23990@@SAXPAXI@Z"(i8* {{.*}}, i32 42) +}; +void delete_s(S *s) { delete[] s; } +} + // CHECK: attributes [[NUW]] = { nounwind{{.*}} } diff --git a/test/CodeGenCXX/microsoft-abi-member-pointers.cpp b/test/CodeGenCXX/microsoft-abi-member-pointers.cpp index 8cb4a1f..a509d57 100755 --- a/test/CodeGenCXX/microsoft-abi-member-pointers.cpp +++ b/test/CodeGenCXX/microsoft-abi-member-pointers.cpp @@ -541,9 +541,13 @@ void (D::*convertCToD(void (C::*mp)()))() { // // memptr.convert: ; preds = %entry // CHECK: extractvalue { i8*, i32, i32 } %{{.*}}, 0 -// CHECK: extractvalue { i8*, i32, i32 } %{{.*}}, 1 -// CHECK: extractvalue { i8*, i32, i32 } %{{.*}}, 2 -// CHECK: %[[adj:.*]] = add nsw i32 %{{.*}}, 4 +// CHECK: %[[nvoff:.*]] = extractvalue { i8*, i32, i32 } %{{.*}}, 1 +// CHECK: %[[vbidx:.*]] = extractvalue { i8*, i32, i32 } %{{.*}}, 2 +// CHECK: %[[is_nvbase:.*]] = icmp eq i32 %[[vbidx]], 0 +// CHECK: %[[nv_disp:.*]] = add nsw i32 %[[nvoff]], 4 +// CHECK: %[[nv_adj:.*]] = select i1 %[[is_nvbase]], i32 %[[nv_disp]], i32 0 +// CHECK: %[[dst_adj:.*]] = select i1 %[[is_nvbase]], i32 4, i32 0 +// CHECK: %[[adj:.*]] = sub nsw i32 %[[nv_adj]], %[[dst_adj]] // CHECK: insertvalue { i8*, i32, i32 } undef, i8* {{.*}}, 0 // CHECK: insertvalue { i8*, i32, i32 } {{.*}}, i32 %[[adj]], 1 // CHECK: insertvalue { i8*, i32, i32 } {{.*}}, i32 {{.*}}, 2 @@ -712,3 +716,16 @@ int foo(A *a, int A::*mp) { } #endif #endif + +namespace pr23878 { +struct A { virtual void g(); }; +struct B { virtual void f(); }; +struct C : virtual B { void f(); }; +struct D : A, C {}; + +typedef void (D::*DMemPtrTy)(); + +// CHECK-LABEL: define void @"\01?get_memptr@pr23878@@YAP8D@1@AEXXZXZ" +// CHECK: @"\01??_9C@pr23878@@$BA@AE" to i8*), i32 0, i32 4 +DMemPtrTy get_memptr() { return &D::f; } +} diff --git a/test/CodeGenCXX/microsoft-abi-thunks.cpp b/test/CodeGenCXX/microsoft-abi-thunks.cpp index 8cbea5c..8230334 100644 --- a/test/CodeGenCXX/microsoft-abi-thunks.cpp +++ b/test/CodeGenCXX/microsoft-abi-thunks.cpp @@ -91,7 +91,7 @@ struct E : D { E::E() {} // Emits vftable and forces thunk generation. -// CODEGEN-LABEL: define weak_odr x86_thiscallcc %struct.C* @"\01?goo@E@@QAEPAUB@@XZ" +// CODEGEN-LABEL: define weak_odr x86_thiscallcc %struct.C* @"\01?goo@E@@QAEPAUB@@XZ"{{.*}} comdat // CODEGEN: call x86_thiscallcc %struct.C* @"\01?goo@E@@UAEPAUC@@XZ" // CODEGEN: getelementptr inbounds i8, i8* {{.*}}, i32 4 // CODEGEN: ret @@ -124,7 +124,7 @@ struct I : D { I::I() {} // Emits vftable and forces thunk generation. -// CODEGEN-LABEL: define weak_odr x86_thiscallcc %struct.{{[BF]}}* @"\01?goo@I@@QAEPAUB@@XZ" +// CODEGEN-LABEL: define weak_odr x86_thiscallcc %struct.{{[BF]}}* @"\01?goo@I@@QAEPAUB@@XZ"{{.*}} comdat // CODEGEN: %[[ORIG_RET:.*]] = call x86_thiscallcc %struct.F* @"\01?goo@I@@UAEPAUF@@XZ" // CODEGEN: %[[ORIG_RET_i8:.*]] = bitcast %struct.F* %[[ORIG_RET]] to i8* // CODEGEN: %[[VBPTR_i8:.*]] = getelementptr inbounds i8, i8* %[[ORIG_RET_i8]], i32 4 diff --git a/test/CodeGenCXX/pr11797.cpp b/test/CodeGenCXX/pr11797.cpp index 2a31090..3767b1d 100644 --- a/test/CodeGenCXX/pr11797.cpp +++ b/test/CodeGenCXX/pr11797.cpp @@ -5,4 +5,4 @@ namespace std __attribute__ ((__visibility__ ("default"))) {} void foo() { } #pragma GCC visibility pop -// CHECK-LABEL: define void @_Z3foov() +// CHECK-LABEL: define {{.*}}void @_Z3foov() diff --git a/test/CodeGenCXX/pr18661.cpp b/test/CodeGenCXX/pr18661.cpp index 2358678..65ffd6f 100644 --- a/test/CodeGenCXX/pr18661.cpp +++ b/test/CodeGenCXX/pr18661.cpp @@ -11,4 +11,4 @@ extern "C" { // PR18661: Clang would fail to emit function definition with mismatching // exception specification, even though it was just treated as a warning. -// CHECK: define void @f() +// CHECK: define {{.*}}void @f() diff --git a/test/CodeGenCXX/pr9965.cpp b/test/CodeGenCXX/pr9965.cpp index 46fd609..95ba2be 100644 --- a/test/CodeGenCXX/pr9965.cpp +++ b/test/CodeGenCXX/pr9965.cpp @@ -8,7 +8,7 @@ struct X : A // default constructor is not trivial }; X<int> x; -// CHECK-LABEL: define internal void @__cxx_global_var_init() +// CHECK-LABEL: define internal {{.*}}void @__cxx_global_var_init() // CHECK: call {{.*}} @_ZN1XIiEC1Ev // CHECK: define linkonce_odr {{.*}} @_ZN1XIiEC1Ev // CHECK: define linkonce_odr {{.*}} @_ZN1XIiEC2Ev diff --git a/test/CodeGenCXX/pragma-weak.cpp b/test/CodeGenCXX/pragma-weak.cpp index e2d4648..caab266 100644 --- a/test/CodeGenCXX/pragma-weak.cpp +++ b/test/CodeGenCXX/pragma-weak.cpp @@ -14,18 +14,18 @@ void S::foo() {} #pragma weak zed namespace bar { void zed() {} } -// CHECK-LABEL: define void @_ZN3bar3zedEv( +// CHECK-LABEL: define {{.*}}void @_ZN3bar3zedEv( #pragma weak bah void bah() {} -// CHECK-LABEL: define void @_Z3bahv( +// CHECK-LABEL: define {{.*}}void @_Z3bahv( #pragma weak baz extern "C" void baz() {} -// CHECK-LABEL: define weak void @baz( +// CHECK-LABEL: define weak {{.*}}void @baz( #pragma weak _Z3baxv void bax() {} // GCC produces a weak symbol for this one, but it doesn't look like a good // idea to expose the mangling to the pragma unless we really have to. -// CHECK-LABEL: define void @_Z3baxv( +// CHECK-LABEL: define {{.*}}void @_Z3baxv( diff --git a/test/CodeGenCXX/predefined-expr.cpp b/test/CodeGenCXX/predefined-expr.cpp index 4c0a886..21ccedd 100644 --- a/test/CodeGenCXX/predefined-expr.cpp +++ b/test/CodeGenCXX/predefined-expr.cpp @@ -559,11 +559,11 @@ XXX::XXX() _dispatch_once(^{ notify_register_dispatch( ^(int token) { XXLog(__FUNCTION__); }); }); } -// CHECK: define internal void @___ZN3XXXC2Ev_block_invoke_ +// CHECK: define internal {{.*}}void @___ZN3XXXC2Ev_block_invoke_ XXX::~XXX() { _dispatch_once(^{ notify_register_dispatch( ^(int token) { XXLog(__FUNCTION__); }); }); } -// CHECK: define internal void @___ZN3XXXD2Ev_block_invoke_ +// CHECK: define internal {{.*}}void @___ZN3XXXD2Ev_block_invoke_ diff --git a/test/CodeGenCXX/redefine_extname.cpp b/test/CodeGenCXX/redefine_extname.cpp index 2b6b703..f76fe62 100644 --- a/test/CodeGenCXX/redefine_extname.cpp +++ b/test/CodeGenCXX/redefine_extname.cpp @@ -8,7 +8,7 @@ extern "C" { int statvfs64(struct statvfs64 *); } -void foo() { +void some_func() { struct statvfs64 st; statvfs64(&st); // Check that even if there is a structure with redefined name before the @@ -16,3 +16,15 @@ void foo() { // CHECK: call i32 @statvfs(%struct.statvfs64* %st) } +// This is a case when redefenition is deferred *and* we have a local of the +// same name. PR23923. +#pragma redefine_extname foo bar +int f() { + int foo = 0; + return foo; +} +extern "C" { + int foo() { return 1; } +// CHECK: define i32 @bar() +} + diff --git a/test/CodeGenCXX/template-dependent-bind-temporary.cpp b/test/CodeGenCXX/template-dependent-bind-temporary.cpp index 47d8279..4c4b3ea 100644 --- a/test/CodeGenCXX/template-dependent-bind-temporary.cpp +++ b/test/CodeGenCXX/template-dependent-bind-temporary.cpp @@ -18,7 +18,7 @@ void IntToString(T a) } int main() { -// CHECK-LABEL: define linkonce_odr void @_Z11IntToStringIcEvT_( +// CHECK-LABEL: define linkonce_odr {{.*}}void @_Z11IntToStringIcEvT_( IntToString('a'); } diff --git a/test/CodeGenCXX/thunks.cpp b/test/CodeGenCXX/thunks.cpp index 2287d65..0e97255 100644 --- a/test/CodeGenCXX/thunks.cpp +++ b/test/CodeGenCXX/thunks.cpp @@ -365,6 +365,7 @@ namespace Test15 { // This is from Test5: // CHECK-LABEL: define internal void @_ZThn8_N6Test4B12_GLOBAL__N_11C1fEv( +// CHECK-NOT: comdat // CHECK-LABEL: define linkonce_odr void @_ZTv0_n24_N5Test51B1fEv // This is from Test10: diff --git a/test/CodeGenCXX/trap-fnattr.cpp b/test/CodeGenCXX/trap-fnattr.cpp new file mode 100644 index 0000000..b73ea43 --- /dev/null +++ b/test/CodeGenCXX/trap-fnattr.cpp @@ -0,0 +1,36 @@ +// RUN: %clang_cc1 -O0 -emit-llvm -ftrapv -ftrap-function=mytrap %s -o - | FileCheck %s -check-prefix=TRAPFUNC +// RUN: %clang_cc1 -O0 -emit-llvm -ftrapv %s -o - | FileCheck %s -check-prefix=NOOPTION + +// TRAPFUNC-LABEL: define void @{{_Z12test_builtinv|\"\\01\?test_builtin@@YAXXZ\"}} +// TRAPFUNC: call void @llvm.trap() [[ATTR0:#[0-9]+]] + +// NOOPTION-LABEL: define void @{{_Z12test_builtinv|\"\\01\?test_builtin@@YAXXZ\"}} +// NOOPTION: call void @llvm.trap(){{$}} + +void test_builtin(void) { + __builtin_trap(); +} + +// TRAPFUNC-LABEL: define {{.*}}i32 @{{_Z13test_noreturnv|\"\\01\?test_noreturn@@YAHXZ\"}} +// TRAPFUNC: call void @llvm.trap() [[ATTR0]] + +// NOOPTION-LABEL: define {{.*}}i32 @{{_Z13test_noreturnv|\"\\01\?test_noreturn@@YAHXZ\"}} +// NOOPTION: call void @llvm.trap(){{$}} + +int test_noreturn(void) { +} + +// TRAPFUNC-LABEL: define {{.*}}i32 @{{_Z17test_add_overflowii|\"\\01\?test_add_overflow@@YAHHH@Z\"}} +// TRAPFUNC: call void @llvm.trap() [[ATTR1:#[0-9]+]] + +// NOOPTION-LABEL: define {{.*}}i32 @{{_Z17test_add_overflowii|\"\\01\?test_add_overflow@@YAHHH@Z\"}} +// NOOPTION: call void @llvm.trap() [[ATTR2:#[0-9]+]] + +int test_add_overflow(int a, int b) { + return a + b; +} + +// TRAPFUNC: attributes [[ATTR0]] = { {{.*}}"trap-func-name"="mytrap" } +// TRAPFUNC: attributes [[ATTR1]] = { {{.*}}"trap-func-name"="mytrap" } + +// NOOPTION-NOT: attributes [[ATTR2]] = { {{.*}}"trap-func-name"="mytrap" } diff --git a/test/CodeGenCXX/typeid-should-throw.cpp b/test/CodeGenCXX/typeid-should-throw.cpp index 1d8fc85..428c737 100644 --- a/test/CodeGenCXX/typeid-should-throw.cpp +++ b/test/CodeGenCXX/typeid-should-throw.cpp @@ -10,73 +10,73 @@ struct A { struct B : A {}; void f1(A *x) { typeid(false, *x); } -// CHECK-LABEL: define void @_Z2f1P1A +// CHECK-LABEL: define {{.*}}void @_Z2f1P1A // CHECK: icmp eq {{.*}}, null // CHECK-NEXT: br i1 void f2(bool b, A *x, A *y) { typeid(b ? *x : *y); } -// CHECK-LABEL: define void @_Z2f2bP1AS0_ +// CHECK-LABEL: define {{.*}}void @_Z2f2bP1AS0_ // CHECK: icmp eq {{.*}}, null // CHECK-NEXT: br i1 void f3(bool b, A *x, A &y) { typeid(b ? *x : y); } -// CHECK-LABEL: define void @_Z2f3bP1ARS_ +// CHECK-LABEL: define {{.*}}void @_Z2f3bP1ARS_ // CHECK: icmp eq {{.*}}, null // CHECK-NEXT: br i1 void f4(bool b, A &x, A *y) { typeid(b ? x : *y); } -// CHECK-LABEL: define void @_Z2f4bR1APS_ +// CHECK-LABEL: define {{.*}}void @_Z2f4bR1APS_ // CHECK: icmp eq {{.*}}, null // CHECK-NEXT: br i1 void f5(volatile A *x) { typeid(*x); } -// CHECK-LABEL: define void @_Z2f5PV1A +// CHECK-LABEL: define {{.*}}void @_Z2f5PV1A // CHECK: icmp eq {{.*}}, null // CHECK-NEXT: br i1 void f6(A *x) { typeid((B &)*(B *)x); } -// CHECK-LABEL: define void @_Z2f6P1A +// CHECK-LABEL: define {{.*}}void @_Z2f6P1A // CHECK: icmp eq {{.*}}, null // CHECK-NEXT: br i1 void f7(A *x) { typeid((*x)); } -// CHECK-LABEL: define void @_Z2f7P1A +// CHECK-LABEL: define {{.*}}void @_Z2f7P1A // CHECK: icmp eq {{.*}}, null // CHECK-NEXT: br i1 void f8(A *x) { typeid(x[0]); } -// CHECK-LABEL: define void @_Z2f8P1A +// CHECK-LABEL: define {{.*}}void @_Z2f8P1A // CHECK: icmp eq {{.*}}, null // CHECK-NEXT: br i1 void f9(A *x) { typeid(0[x]); } -// CHECK-LABEL: define void @_Z2f9P1A +// CHECK-LABEL: define {{.*}}void @_Z2f9P1A // CHECK: icmp eq {{.*}}, null // CHECK-NEXT: br i1 void f10(A *x, A *y) { typeid(*y ?: *x); } -// CHECK-LABEL: define void @_Z3f10P1AS0_ +// CHECK-LABEL: define {{.*}}void @_Z3f10P1AS0_ // CHECK: icmp eq {{.*}}, null // CHECK-NEXT: br i1 void f11(A *x, A &y) { typeid(*x ?: y); } -// CHECK-LABEL: define void @_Z3f11P1ARS_ +// CHECK-LABEL: define {{.*}}void @_Z3f11P1ARS_ // CHECK: icmp eq {{.*}}, null // CHECK-NEXT: br i1 void f12(A &x, A *y) { typeid(x ?: *y); } -// CHECK-LABEL: define void @_Z3f12R1APS_ +// CHECK-LABEL: define {{.*}}void @_Z3f12R1APS_ // CHECK: icmp eq {{.*}}, null // CHECK-NEXT: br i1 void f13(A &x, A &y) { typeid(x ?: y); } -// CHECK-LABEL: define void @_Z3f13R1AS0_ +// CHECK-LABEL: define {{.*}}void @_Z3f13R1AS0_ // CHECK-NOT: icmp eq {{.*}}, null void f14(A *x) { typeid((const A &)(A)*x); } -// CHECK-LABEL: define void @_Z3f14P1A +// CHECK-LABEL: define {{.*}}void @_Z3f14P1A // CHECK-NOT: icmp eq {{.*}}, null void f15(A *x) { typeid((A &&)*(A *)nullptr); } -// CHECK-LABEL: define void @_Z3f15P1A +// CHECK-LABEL: define {{.*}}void @_Z3f15P1A // CHECK-NOT: icmp eq {{.*}}, null diff --git a/test/CodeGenCXX/vararg-non-pod.cpp b/test/CodeGenCXX/vararg-non-pod.cpp index 613b28c..36891a4 100644 --- a/test/CodeGenCXX/vararg-non-pod.cpp +++ b/test/CodeGenCXX/vararg-non-pod.cpp @@ -8,7 +8,7 @@ struct X { void vararg(...); -// CHECK-LABEL: define void @_Z4test1X +// CHECK-LABEL: define {{.*}}void @_Z4test1X void test(X x) { // CHECK: call void @llvm.trap() vararg(x); diff --git a/test/CodeGenCXX/virtual-destructor-synthesis.cpp b/test/CodeGenCXX/virtual-destructor-synthesis.cpp index 80d1b1e..5927235 100644 --- a/test/CodeGenCXX/virtual-destructor-synthesis.cpp +++ b/test/CodeGenCXX/virtual-destructor-synthesis.cpp @@ -12,5 +12,5 @@ pile_box::pile_box(box *pp) { } -// CHECK: call void @_ZdlPv +// CHECK: call {{.*}}void @_ZdlPv diff --git a/test/CodeGenCXX/vla-lambda-capturing.cpp b/test/CodeGenCXX/vla-lambda-capturing.cpp index f2332bf..44b6a25 100644 --- a/test/CodeGenCXX/vla-lambda-capturing.cpp +++ b/test/CodeGenCXX/vla-lambda-capturing.cpp @@ -12,7 +12,7 @@ typedef __INTPTR_TYPE__ intptr_t; // CHECK-DAG: [[CAP_TYPE3:%.+]] = type { [[INTPTR_T]]*, [[INTPTR_T]], [[INTPTR_T]], [[INTPTR_T]]*, [[INTPTR_T]]* } // CHECK-DAG: [[CAP_TYPE4:%.+]] = type { [[INTPTR_T]]*, [[INTPTR_T]], [[INTPTR_T]]*, [[INTPTR_T]], [[INTPTR_T]]* } -// CHECK: define void [[G:@.+]]( +// CHECK: define {{.*}}void [[G:@.+]]( // CHECK: [[N_ADDR:%.+]] = alloca [[INTPTR_T]] // CHECK: store [[INTPTR_T]] %{{.+}}, [[INTPTR_T]]* [[N_ADDR]] // CHECK: [[N_VAL:%.+]] = load [[INTPTR_T]], [[INTPTR_T]]* [[N_ADDR]] @@ -22,7 +22,7 @@ typedef __INTPTR_TYPE__ intptr_t; // CHECK: store [[INTPTR_T]]* %{{.+}}, [[INTPTR_T]]** [[CAP_BUFFER_ADDR]] // CHECK: [[CAP_N_REF:%.+]] = getelementptr inbounds [[CAP_TYPE1]], [[CAP_TYPE1]]* [[CAP_ARG:%.+]], i{{.+}} 0, i{{.+}} 2 // CHECK: store [[INTPTR_T]]* [[N_ADDR]], [[INTPTR_T]]** [[CAP_N_REF]] -// CHECK: call{{( x86_thiscallcc)?}} void [[G_LAMBDA:@.+]]([[CAP_TYPE1]]* [[CAP_ARG]]) +// CHECK: call{{.*}} void [[G_LAMBDA:@.+]]([[CAP_TYPE1]]* [[CAP_ARG]]) // CHECK: ret void void g(intptr_t n) { intptr_t buffer[n]; @@ -70,17 +70,17 @@ void b(intptr_t n, T arg) { // CHECK-LABEL: @main int main() { - // CHECK: call void [[G]]([[INTPTR_T]] [[INTPTR_T_ATTR:(signext )?]]1) + // CHECK: call {{.*}}void [[G]]([[INTPTR_T]] [[INTPTR_T_ATTR:(signext )?]]1) g((intptr_t)1); - // CHECK: call void [[F_INT:@.+]]([[INTPTR_T]] [[INTPTR_T_ATTR]]1, [[INTPTR_T]] [[INTPTR_T_ATTR]]2) + // CHECK: call {{.*}}void [[F_INT:@.+]]([[INTPTR_T]] [[INTPTR_T_ATTR]]1, [[INTPTR_T]] [[INTPTR_T_ATTR]]2) f((intptr_t)1, (intptr_t)2); - // CHECK: call void [[B_INT:@.+]]([[INTPTR_T]] [[INTPTR_T_ATTR]]12, [[INTPTR_T]] [[INTPTR_T_ATTR]]13) + // CHECK: call {{.*}}void [[B_INT:@.+]]([[INTPTR_T]] [[INTPTR_T_ATTR]]12, [[INTPTR_T]] [[INTPTR_T_ATTR]]13) b((intptr_t)12, (intptr_t)13); // CHECK: ret i32 0 return 0; } -// CHECK: define linkonce_odr void [[F_INT]]([[INTPTR_T]] +// CHECK: define linkonce_odr {{.*}}void [[F_INT]]([[INTPTR_T]] // CHECK: [[SIZE:%.+]] = add // CHECK: call i{{.+}}* @llvm.stacksave() // CHECK: [[BUFFER_ADDR:%.+]] = alloca [[INTPTR_T]], [[INTPTR_T]] [[SIZE]] @@ -88,11 +88,11 @@ int main() { // CHECK: store [[INTPTR_T]] [[SIZE]], [[INTPTR_T]]* [[CAP_SIZE_REF]] // CHECK: [[CAP_BUFFER_ADDR_REF:%.+]] = getelementptr inbounds [[CAP_TYPE2]], [[CAP_TYPE2]]* [[CAP_ARG]], i{{.+}} 0, i{{.+}} 1 // CHECK: store [[INTPTR_T]]* [[BUFFER_ADDR]], [[INTPTR_T]]** [[CAP_BUFFER_ADDR_REF]] -// CHECK: call{{( x86_thiscallcc)?}} void [[F_INT_LAMBDA:@.+]]([[CAP_TYPE2]]* [[CAP_ARG]]) +// CHECK: call{{.*}} void [[F_INT_LAMBDA:@.+]]([[CAP_TYPE2]]* [[CAP_ARG]]) // CHECK: call void @llvm.stackrestore( // CHECK: ret void // CHECK: void [[B_INT]]([[INTPTR_T]] -// CHECK: [[SIZE1:%.+]] = call [[INTPTR_T]] +// CHECK: [[SIZE1:%.+]] = call {{.*}}[[INTPTR_T]] // CHECK: call i{{.+}}* @llvm.stacksave() // CHECK: [[BUFFER2_ADDR:%.+]] = alloca [[INTPTR_T]], [[INTPTR_T]] [[SIZE1]] // CHECK: [[SIZE2:%.+]] = add @@ -107,11 +107,11 @@ int main() { // CHECK: store [[INTPTR_T]]* [[BUFFER1_ADDR]], [[INTPTR_T]]** [[CAP_BUFFER1_ADDR_REF]] // CHECK: [[CAP_BUFFER2_ADDR_REF:%.+]] = getelementptr inbounds [[CAP_TYPE3]], [[CAP_TYPE3]]* [[CAP_ARG]], i{{.+}} 0, i{{.+}} 4 // CHECK: store [[INTPTR_T]]* [[BUFFER2_ADDR]], [[INTPTR_T]]** [[CAP_BUFFER2_ADDR_REF]] -// CHECK: call{{( x86_thiscallcc)?}} void [[B_INT_LAMBDA:@.+]]([[CAP_TYPE3]]* [[CAP_ARG]]) +// CHECK: call{{.*}} void [[B_INT_LAMBDA:@.+]]([[CAP_TYPE3]]* [[CAP_ARG]]) // CHECK: call void @llvm.stackrestore( // CHECK: ret void -// CHECK: define linkonce_odr{{( x86_thiscallcc)?}} void [[F_INT_LAMBDA]]([[CAP_TYPE2]]* +// CHECK: define linkonce_odr{{.*}} void [[F_INT_LAMBDA]]([[CAP_TYPE2]]* // CHECK: [[THIS:%.+]] = load [[CAP_TYPE2]]*, [[CAP_TYPE2]]** // CHECK: [[SIZE_REF:%.+]] = getelementptr inbounds [[CAP_TYPE2]], [[CAP_TYPE2]]* [[THIS]], i{{.+}} 0, i{{.+}} 0 // CHECK: [[SIZE:%.+]] = load [[INTPTR_T]], [[INTPTR_T]]* [[SIZE_REF]] @@ -120,7 +120,7 @@ int main() { // CHECK: call void @llvm.stackrestore( // CHECK: ret void -// CHECK: define linkonce_odr{{( x86_thiscallcc)?}} void [[B_INT_LAMBDA]]([[CAP_TYPE3]]* +// CHECK: define linkonce_odr{{.*}} void [[B_INT_LAMBDA]]([[CAP_TYPE3]]* // CHECK: [[SIZE2_REF:%.+]] = getelementptr inbounds [[CAP_TYPE3]], [[CAP_TYPE3]]* [[THIS:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 1 // CHECK: [[SIZE2:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[SIZE2_REF]] // CHECK: [[SIZE1_REF:%.+]] = getelementptr inbounds [[CAP_TYPE3]], [[CAP_TYPE3]]* [[THIS]], i{{[0-9]+}} 0, i{{[0-9]+}} 2 @@ -152,10 +152,10 @@ int main() { // CHECK: [[BUFFER1_ADDR_REF_ORIG:%.+]] = getelementptr inbounds [[CAP_TYPE3]], [[CAP_TYPE3]]* [[THIS]], i{{[0-9]+}} 0, i{{[0-9]+}} 3 // CHECK: [[BUFFER1_ADDR_ORIG:%.+]] = load [[INTPTR_T]]*, [[INTPTR_T]]** [[BUFFER1_ADDR_REF_ORIG]] // CHECK: store [[INTPTR_T]]* [[BUFFER1_ADDR_ORIG]], [[INTPTR_T]]** [[BUFFER1_ADDR_REF]] -// CHECK: call{{( x86_thiscallcc)?}} void [[B_INT_LAMBDA_LAMBDA:@.+]]([[CAP_TYPE4]]* [[CAP]]) +// CHECK: call{{.*}} void [[B_INT_LAMBDA_LAMBDA:@.+]]([[CAP_TYPE4]]* [[CAP]]) // CHECK: ret void -// CHECK: define linkonce_odr{{( x86_thiscallcc)?}} void [[B_INT_LAMBDA_LAMBDA]]([[CAP_TYPE4]]* +// CHECK: define linkonce_odr{{.*}} void [[B_INT_LAMBDA_LAMBDA]]([[CAP_TYPE4]]* // CHECK: [[SIZE1_REF:%.+]] = getelementptr inbounds [[CAP_TYPE4]], [[CAP_TYPE4]]* [[THIS:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 1 // CHECK: [[SIZE1:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[SIZE1_REF]] // CHECK: [[SIZE2_REF:%.+]] = getelementptr inbounds [[CAP_TYPE4]], [[CAP_TYPE4]]* [[THIS]], i{{[0-9]+}} 0, i{{[0-9]+}} 3 diff --git a/test/CodeGenCXX/volatile-1.cpp b/test/CodeGenCXX/volatile-1.cpp index 65eb9f6..f32e428 100644 --- a/test/CodeGenCXX/volatile-1.cpp +++ b/test/CodeGenCXX/volatile-1.cpp @@ -17,7 +17,7 @@ volatile struct S { int printf(const char *, ...); -// CHECK: define void @{{.*}}test +// CHECK: define {{.*}}void @{{.*}}test void test() { asm("nop"); // CHECK: call void asm diff --git a/test/CodeGenCXX/x86_64-arguments-nacl-x32.cpp b/test/CodeGenCXX/x86_64-arguments-nacl-x32.cpp index bb9bd88..3392b32 100644 --- a/test/CodeGenCXX/x86_64-arguments-nacl-x32.cpp +++ b/test/CodeGenCXX/x86_64-arguments-nacl-x32.cpp @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-unknown-nacl -emit-llvm -o - %s | FileCheck %s -// RUN: %clang_cc1 -triple=x86_64-unknown-linux-gnux32 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-nacl -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -std=c++11 -triple=x86_64-unknown-linux-gnux32 -emit-llvm -o - %s | FileCheck %s struct test_struct {}; typedef int test_struct::* test_struct_mdp; @@ -42,3 +42,16 @@ struct struct_with_mfp_too_much { void f_struct_with_mfp_too_much(struct_with_mfp_too_much a, int x) { (void)a; } + +/* Struct containing an empty struct */ +typedef struct { int* a; test_struct x; double *b; } struct_with_empty; + +// CHECK-LABEL: define void @{{.*}}f_pass_struct_with_empty{{.*}}(i64 %x{{.*}}, double* %x +void f_pass_struct_with_empty(struct_with_empty x) { + (void) x; +} + +// CHECK-LABEL: define { i64, double* } @{{.*}}f_return_struct_with_empty +struct_with_empty f_return_struct_with_empty() { + return {0, {}, 0}; +} diff --git a/test/CodeGenObjC/arc-block-copy-escape.m b/test/CodeGenObjC/arc-block-copy-escape.m index afe7c0b..16a75a0 100644 --- a/test/CodeGenObjC/arc-block-copy-escape.m +++ b/test/CodeGenObjC/arc-block-copy-escape.m @@ -8,15 +8,15 @@ void use_int(int); void test0(int i) { block_t block = ^{ use_int(i); }; - // CHECK-LABEL: define void @test0( - // CHECK: call i8* @objc_retainBlock(i8* {{%.*}}) [[NUW:#[0-9]+]], !clang.arc.copy_on_escape + // CHECK-LABEL: define {{.*}}void @test0( + // CHECK: call {{.*}}i8* @objc_retainBlock(i8* {{%.*}}) [[NUW:#[0-9]+]], !clang.arc.copy_on_escape // CHECK: ret void } void test1(int i) { id block = ^{ use_int(i); }; - // CHECK-LABEL: define void @test1( - // CHECK: call i8* @objc_retainBlock(i8* {{%.*}}) [[NUW]] + // CHECK-LABEL: define {{.*}}void @test1( + // CHECK: call {{.*}}i8* @objc_retainBlock(i8* {{%.*}}) [[NUW]] // CHECK-NOT: !clang.arc.copy_on_escape // CHECK: ret void } diff --git a/test/CodeGenObjC/objc2-legacy-dispatch.m b/test/CodeGenObjC/objc2-legacy-dispatch.m index aa944f8..5584f49 100644 --- a/test/CodeGenObjC/objc2-legacy-dispatch.m +++ b/test/CodeGenObjC/objc2-legacy-dispatch.m @@ -7,9 +7,9 @@ // // RUN: %clang_cc1 -fobjc-dispatch-method=legacy -emit-llvm -o - %s | FileCheck -check-prefix=CHECK_OLD_DISPATCH %s // -// CHECK_OLD_DISPATCH-LABEL: define void @f0 +// CHECK_OLD_DISPATCH-LABEL: define {{.*}}void @f0 // CHECK_OLD_DISPATCH: load {{.*}}OBJC_SELECTOR_REFERENCES -// CHECK_OLD_DISPATCH-LABEL: define void @f1 +// CHECK_OLD_DISPATCH-LABEL: define {{.*}}void @f1 // CHECK_OLD_DISPATCH: load {{.*}}OBJC_SELECTOR_REFERENCES @interface A diff --git a/test/CodeGenObjC/related-result-type.m b/test/CodeGenObjC/related-result-type.m index cd78474..cacf2c0 100644 --- a/test/CodeGenObjC/related-result-type.m +++ b/test/CodeGenObjC/related-result-type.m @@ -9,7 +9,7 @@ @interface NSString : NSObject @end -// CHECK-LABEL: define void @test1() +// CHECK-LABEL: define {{.*}}void @test1() void test1() { // CHECK: {{call.*@objc_msgSend}} // CHECK: {{call.*@objc_msgSend}} @@ -18,7 +18,7 @@ void test1() { NSString *str1 = [[[NSString alloc] init] retain]; } -// CHECK-LABEL: define void @test2() +// CHECK-LABEL: define {{.*}}void @test2() void test2() { // CHECK: {{call.*@objc_msgSend}} // CHECK: {{call.*@objc_msgSend}} @@ -32,7 +32,7 @@ void test2() { @end @implementation Test2 -// CHECK: define internal i8* @"\01-[Test2 init]" +// CHECK: define internal {{.*}}i8* @"\01-[Test2 init]" - (id)init { // CHECK: {{call.*@objc_msgSendSuper}} // CHECK-NEXT: bitcast i8* @@ -45,7 +45,7 @@ void test2() { @end @implementation Test3 -// CHECK: define internal i8* @"\01-[Test3 init]" +// CHECK: define internal {{.*}}i8* @"\01-[Test3 init]" - (id)init { // CHECK: {{call.*@objc_msgSendSuper}} // CHECK-NEXT: bitcast i8* diff --git a/test/CodeGenObjCXX/arc-mangle.mm b/test/CodeGenObjCXX/arc-mangle.mm index b921a7f..a168d41 100644 --- a/test/CodeGenObjCXX/arc-mangle.mm +++ b/test/CodeGenObjCXX/arc-mangle.mm @@ -1,25 +1,25 @@ // RUN: %clang_cc1 -fobjc-arc -fobjc-runtime-has-weak -triple %itanium_abi_triple -emit-llvm -o - %s | FileCheck %s -// CHECK-LABEL: define void @_Z1fPU8__strongP11objc_object(i8**) +// CHECK-LABEL: define {{.*}}void @_Z1fPU8__strongP11objc_object(i8**) void f(__strong id *) {} -// CHECK-LABEL: define void @_Z1fPU6__weakP11objc_object(i8**) +// CHECK-LABEL: define {{.*}}void @_Z1fPU6__weakP11objc_object(i8**) void f(__weak id *) {} -// CHECK-LABEL: define void @_Z1fPU15__autoreleasingP11objc_object(i8**) +// CHECK-LABEL: define {{.*}}void @_Z1fPU15__autoreleasingP11objc_object(i8**) void f(__autoreleasing id *) {} -// CHECK-LABEL: define void @_Z1fPP11objc_object(i8**) +// CHECK-LABEL: define {{.*}}void @_Z1fPP11objc_object(i8**) void f(__unsafe_unretained id *) {} -// CHECK-LABEL: define void @_Z1fPKU8__strongP11objc_object(i8**) +// CHECK-LABEL: define {{.*}}void @_Z1fPKU8__strongP11objc_object(i8**) void f(const __strong id *) {} -// CHECK-LABEL: define void @_Z1fPKU6__weakP11objc_object(i8**) +// CHECK-LABEL: define {{.*}}void @_Z1fPKU6__weakP11objc_object(i8**) void f(const __weak id *) {} -// CHECK-LABEL: define void @_Z1fPKU15__autoreleasingP11objc_object(i8**) +// CHECK-LABEL: define {{.*}}void @_Z1fPKU15__autoreleasingP11objc_object(i8**) void f(const __autoreleasing id *) {} -// CHECK-LABEL: define void @_Z1fPKP11objc_object(i8**) +// CHECK-LABEL: define {{.*}}void @_Z1fPKP11objc_object(i8**) void f(const __unsafe_unretained id *) {} template<unsigned N> struct unsigned_c { }; -// CHECK-LABEL: define weak_odr void @_Z1gIKvEvP10unsigned_cIXplszv1U8__bridgecvPT_v1U8__bridgecvP11objc_objectcvS3_Li0ELi1EEE +// CHECK-LABEL: define weak_odr {{.*}}void @_Z1gIKvEvP10unsigned_cIXplszv1U8__bridgecvPT_v1U8__bridgecvP11objc_objectcvS3_Li0ELi1EEE template<typename T>void g(unsigned_c<sizeof((__bridge T*)(__bridge id)(T*)0) + 1>*) {} template void g<const void>(unsigned_c<sizeof(id) + 1> *); diff --git a/test/CodeGenObjCXX/debug-info-line.mm b/test/CodeGenObjCXX/debug-info-line.mm index a7d6a15..6d7321c 100644 --- a/test/CodeGenObjCXX/debug-info-line.mm +++ b/test/CodeGenObjCXX/debug-info-line.mm @@ -15,7 +15,7 @@ void f1() { }(); } -// CHECK-LABEL: define internal i8* @"\01-[TNSObject init]" +// CHECK-LABEL: define internal {{.*}}i8* @"\01-[TNSObject init]" @implementation TNSObject - (id)init { diff --git a/test/CodeGenOpenCL/event_t.cl b/test/CodeGenOpenCL/event_t.cl index ddf12a9..a84d8bb 100644 --- a/test/CodeGenOpenCL/event_t.cl +++ b/test/CodeGenOpenCL/event_t.cl @@ -6,7 +6,7 @@ void kernel ker() { event_t e; // CHECK: alloca %opencl.event_t*, foo(e); -// CHECK: call void @foo(%opencl.event_t* % +// CHECK: call {{.*}}void @foo(%opencl.event_t* % foo(0); -// CHECK: call void @foo(%opencl.event_t* null) +// CHECK: call {{.*}}void @foo(%opencl.event_t* null) } diff --git a/test/CodeGenOpenCL/local.cl b/test/CodeGenOpenCL/local.cl index f1031cd..da371f8 100644 --- a/test/CodeGenOpenCL/local.cl +++ b/test/CodeGenOpenCL/local.cl @@ -8,7 +8,7 @@ __kernel void foo(void) { func(&i); } -// CHECK-LABEL: define void @_Z3barPU7CLlocali +// CHECK-LABEL: define {{.*}}void @_Z3barPU7CLlocali __kernel void __attribute__((__overloadable__)) bar(local int *x) { *x = 5; } diff --git a/test/CodeGenOpenCL/opencl_types.cl b/test/CodeGenOpenCL/opencl_types.cl index ac4ed1c..5f4ebb8 100644 --- a/test/CodeGenOpenCL/opencl_types.cl +++ b/test/CodeGenOpenCL/opencl_types.cl @@ -22,7 +22,7 @@ void fnc3(image3d_t img) {} // CHECK: @fnc3(%opencl.image3d_t* void fnc4smp(sampler_t s) {} -// CHECK-LABEL: define void @fnc4smp(i32 +// CHECK-LABEL: define {{.*}}void @fnc4smp(i32 kernel void foo(image1d_t img) { sampler_t smp = 5; @@ -31,9 +31,9 @@ kernel void foo(image1d_t img) { // CHECK: alloca %opencl.event_t* // CHECK: store i32 5, fnc4smp(smp); -// CHECK: call void @fnc4smp(i32 +// CHECK: call {{.*}}void @fnc4smp(i32 fnc4smp(glb_smp); -// CHECK: call void @fnc4smp(i32 +// CHECK: call {{.*}}void @fnc4smp(i32 } void __attribute__((overloadable)) bad1(image1d_t *b, image2d_t *c, image2d_t *d) {} diff --git a/test/CoverageMapping/implicit-def-in-macro.m b/test/CoverageMapping/implicit-def-in-macro.m new file mode 100644 index 0000000..7e563ac --- /dev/null +++ b/test/CoverageMapping/implicit-def-in-macro.m @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -fprofile-instr-generate -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -triple x86_64-apple-darwin -fobjc-runtime=macosx-10.10.0 -fblocks -fobjc-arc %s | FileCheck %s + +@interface Foo +@end +#define Bar Foo + +@implementation Blah +// CHECK-LABEL: +[Blah load]: ++ load { // CHECK: File 0, [[@LINE]]:8 -> [[END:[0-9:]+]] = #0 + return 0; + // CHECK: Expansion,File 0, [[@LINE+1]]:3 -> [[@LINE+1]]:6 = 0 + Bar *attribute; // CHECK: File 0, [[@LINE]]:6 -> [[END]] = 0 +} +@end + +int main() {} diff --git a/test/CoverageMapping/ir.c b/test/CoverageMapping/ir.c index 4b1238c..5ac3495 100644 --- a/test/CoverageMapping/ir.c +++ b/test/CoverageMapping/ir.c @@ -9,4 +9,4 @@ int main(void) { return 0; } -// CHECK: @__llvm_coverage_mapping = internal constant { i32, i32, i32, i32, [2 x { i8*, i32, i32, i64 }], [{{[0-9]+}} x i8] } { i32 2, i32 {{[0-9]+}}, i32 {{[0-9]+}}, i32 0, [2 x { i8*, i32, i32, i64 }] [{ i8*, i32, i32, i64 } { i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__llvm_profile_name_foo, i32 0, i32 0), i32 3, i32 9, i64 {{[0-9]+}} }, { i8*, i32, i32, i64 } { i8* getelementptr inbounds ([4 x i8], [4 x i8]* @__llvm_profile_name_main, i32 0, i32 0), i32 4, i32 9, i64 {{[0-9]+}} }] +// CHECK: @__llvm_coverage_mapping = internal constant { i32, i32, i32, i32, [2 x <{ i8*, i32, i32, i64 }>], [{{[0-9]+}} x i8] } { i32 2, i32 {{[0-9]+}}, i32 {{[0-9]+}}, i32 0, [2 x <{ i8*, i32, i32, i64 }>] [<{ i8*, i32, i32, i64 }> <{ i8* getelementptr inbounds ([3 x i8], [3 x i8]* @__llvm_profile_name_foo, i32 0, i32 0), i32 3, i32 9, i64 {{[0-9]+}} }>, <{ i8*, i32, i32, i64 }> <{ i8* getelementptr inbounds ([4 x i8], [4 x i8]* @__llvm_profile_name_main, i32 0, i32 0), i32 4, i32 9, i64 {{[0-9]+}} }>] diff --git a/test/Driver/Inputs/debian_multiarch_tree/lib/powerpc64le-linux-gnu/.keep b/test/Driver/Inputs/debian_multiarch_tree/lib/powerpc64le-linux-gnu/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/debian_multiarch_tree/lib/powerpc64le-linux-gnu/.keep diff --git a/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/powerpc64le-linux-gnu/4.5/crtbegin.o b/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/powerpc64le-linux-gnu/4.5/crtbegin.o new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/debian_multiarch_tree/usr/lib/gcc/powerpc64le-linux-gnu/4.5/crtbegin.o diff --git a/test/Driver/Inputs/debian_multiarch_tree/usr/lib/powerpc64le-linux-gnu/.keep b/test/Driver/Inputs/debian_multiarch_tree/usr/lib/powerpc64le-linux-gnu/.keep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Driver/Inputs/debian_multiarch_tree/usr/lib/powerpc64le-linux-gnu/.keep diff --git a/test/Driver/arm-mfpu.c b/test/Driver/arm-mfpu.c index 8439cdd..93fb0a8 100644 --- a/test/Driver/arm-mfpu.c +++ b/test/Driver/arm-mfpu.c @@ -34,6 +34,17 @@ // CHECK-VFP3: "-target-feature" "-fp-armv8" // CHECK-VFP3: "-target-feature" "-neon" +// RUN: %clang -target arm-linux-eabi -mfpu=vfpv3-fp16 %s -### -o %t.o 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-VFP3-FP16 %s +// CHECK-VFP3-FP16: "-target-feature" "-fp-only-sp" +// CHECK-VFP3-FP16: "-target-feature" "-d16" +// CHECK-VFP3-FP16: "-target-feature" "+vfp3" +// CHECK-VFP3-FP16: "-target-feature" "+fp16" +// CHECK-VFP3-FP16: "-target-feature" "-vfp4" +// CHECK-VFP3-FP16: "-target-feature" "-fp-armv8" +// CHECK-VFP3-FP16: "-target-feature" "-neon" +// CHECK-VFP3-FP16: "-target-feature" "-crypto" + // RUN: %clang -target arm-linux-eabi -mfpu=vfp3-d16 %s -### -o %t.o 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-VFP3-D16 %s // RUN: %clang -target arm-linux-eabi -mfpu=vfpv3-d16 %s -### -o %t.o 2>&1 \ @@ -45,6 +56,39 @@ // CHECK-VFP3-D16: "-target-feature" "-fp-armv8" // CHECK-VFP3-D16: "-target-feature" "-neon" +// RUN: %clang -target arm-linux-eabi -mfpu=vfpv3-d16-fp16 %s -### -o %t.o 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-VFP3-D16-FP16 %s +// CHECK-VFP3-D16-FP16: "-target-feature" "-fp-only-sp" +// CHECK-VFP3-D16-FP16: "-target-feature" "+d16" +// CHECK-VFP3-D16-FP16: "-target-feature" "+vfp3" +// CHECK-VFP3-D16-FP16: "-target-feature" "+fp16" +// CHECK-VFP3-D16-FP16: "-target-feature" "-vfp4" +// CHECK-VFP3-D16-FP16: "-target-feature" "-fp-armv8" +// CHECK-VFP3-D16-FP16: "-target-feature" "-neon" +// CHECK-VFP3-D16-FP16: "-target-feature" "-crypto" + +// RUN: %clang -target arm-linux-eabi -mfpu=vfpv3xd %s -### -o %t.o 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-VFP3XD %s +// CHECK-VFP3XD: "-target-feature" "+fp-only-sp" +// CHECK-VFP3XD: "-target-feature" "+d16" +// CHECK-VFP3XD: "-target-feature" "+vfp3" +// CHECK-VFP3XD: "-target-feature" "-fp16" +// CHECK-VFP3XD: "-target-feature" "-vfp4" +// CHECK-VFP3XD: "-target-feature" "-fp-armv8" +// CHECK-VFP3XD: "-target-feature" "-neon" +// CHECK-VFP3XD: "-target-feature" "-crypto" + +// RUN: %clang -target arm-linux-eabi -mfpu=vfpv3xd-fp16 %s -### -o %t.o 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-VFP3XD-FP16 %s +// CHECK-VFP3XD-FP16: "-target-feature" "+fp-only-sp" +// CHECK-VFP3XD-FP16: "-target-feature" "+d16" +// CHECK-VFP3XD-FP16: "-target-feature" "+vfp3" +// CHECK-VFP3XD-FP16: "-target-feature" "+fp16" +// CHECK-VFP3XD-FP16: "-target-feature" "-vfp4" +// CHECK-VFP3XD-FP16: "-target-feature" "-fp-armv8" +// CHECK-VFP3XD-FP16: "-target-feature" "-neon" +// CHECK-VFP3XD-FP16: "-target-feature" "-crypto" + // RUN: %clang -target arm-linux-eabi -mfpu=vfp4 %s -### -o %t.o 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-VFP4 %s // RUN: %clang -target arm-linux-eabi -mfpu=vfpv4 %s -### -o %t.o 2>&1 \ @@ -97,6 +141,17 @@ // RUN: | FileCheck --check-prefix=CHECK-NEON %s // CHECK-NEON: "-target-feature" "+neon" +// RUN: %clang -target arm-linux-eabi -mfpu=neon-fp16 %s -### -o %t.o 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-NEON-FP16 %s +// CHECK-NEON-FP16: "-target-feature" "-fp-only-sp" +// CHECK-NEON-FP16: "-target-feature" "-d16" +// CHECK-NEON-FP16: "-target-feature" "+vfp3" +// CHECK-NEON-FP16: "-target-feature" "+fp16" +// CHECK-NEON-FP16: "-target-feature" "-vfp4" +// CHECK-NEON-FP16: "-target-feature" "-fp-armv8" +// CHECK-NEON-FP16: "-target-feature" "+neon" +// CHECK-NEON-FP16: "-target-feature" "-crypto" + // RUN: %clang -target arm-linux-eabi -mfpu=neon-vfpv3 %s -### -o %t.o 2>&1 \ // RUN: | FileCheck --check-prefix=CHECK-NEON-VFPV3 %s // CHECK-NEON-VFPV3: "-target-feature" "+neon" diff --git a/test/Driver/bindings.c b/test/Driver/bindings.c index dd8ad14..880667b 100644 --- a/test/Driver/bindings.c +++ b/test/Driver/bindings.c @@ -1,8 +1,8 @@ // Basic binding. // RUN: %clang -target i386-unknown-unknown -ccc-print-bindings -no-integrated-as %s 2>&1 | FileCheck %s --check-prefix=CHECK01 // CHECK01: "clang", inputs: ["{{.*}}bindings.c"], output: "{{.*}}.s" -// CHECK01: "GNU::Assemble", inputs: ["{{.*}}.s"], output: "{{.*}}.o" -// CHECK01: "gcc::Link", inputs: ["{{.*}}.o"], output: "a.out" +// CHECK01: "GNU::Assembler", inputs: ["{{.*}}.s"], output: "{{.*}}.o" +// CHECK01: "gcc::Linker", inputs: ["{{.*}}.o"], output: "a.out" // Clang control options @@ -21,5 +21,5 @@ // Darwin bindings // RUN: %clang -target i386-apple-darwin9 -no-integrated-as -ccc-print-bindings %s 2>&1 | FileCheck %s --check-prefix=CHECK14 // CHECK14: "clang", inputs: ["{{.*}}bindings.c"], output: "{{.*}}.s" -// CHECK14: "darwin::Assemble", inputs: ["{{.*}}.s"], output: "{{.*}}.o" -// CHECK14: "darwin::Link", inputs: ["{{.*}}.o"], output: "a.out" +// CHECK14: "darwin::Assembler", inputs: ["{{.*}}.s"], output: "{{.*}}.o" +// CHECK14: "darwin::Linker", inputs: ["{{.*}}.o"], output: "a.out" diff --git a/test/Driver/cl-link.c b/test/Driver/cl-link.c index 5bd2001..8572b77 100644 --- a/test/Driver/cl-link.c +++ b/test/Driver/cl-link.c @@ -11,7 +11,7 @@ // LINK: "bar" // LINK: "baz" -// RUN: %clang_cl /Tc%s -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN %s +// RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /Tc%s -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN %s // ASAN: link.exe // ASAN: "-debug" // ASAN: "-incremental:no" @@ -19,7 +19,7 @@ // ASAN: "{{.*}}clang_rt.asan_cxx-i386.lib" // ASAN: "{{.*}}cl-link{{.*}}.obj" -// RUN: %clang_cl /MD /Tc%s -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-MD %s +// RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /MD /Tc%s -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-MD %s // ASAN-MD: link.exe // ASAN-MD: "-debug" // ASAN-MD: "-incremental:no" @@ -33,8 +33,8 @@ // DLL: link.exe // "-dll" -// RUN: %clang_cl /LD /Tc%s -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-DLL %s -// RUN: %clang_cl /LDd /Tc%s -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-DLL %s +// RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /LD /Tc%s -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-DLL %s +// RUN: %clang_cl -m32 -arch:IA32 --target=i386-pc-win32 /LDd /Tc%s -### -fsanitize=address 2>&1 | FileCheck --check-prefix=ASAN-DLL %s // ASAN-DLL: link.exe // ASAN-DLL: "-dll" // ASAN-DLL: "-debug" diff --git a/test/Driver/cl-x86-flags.c b/test/Driver/cl-x86-flags.c index 5aae4c4..d4f7fb5 100644 --- a/test/Driver/cl-x86-flags.c +++ b/test/Driver/cl-x86-flags.c @@ -8,10 +8,10 @@ // RUN: --target=i386-pc-win32 -### -- 2>&1 %s | FileCheck -check-prefix=MFLAGS %s // MFLAGS-NOT: argument unused during compilation -// -arch:IA32 is no-op. // RUN: %clang_cl -m32 -arch:IA32 --target=i386 -### -- 2>&1 %s | FileCheck -check-prefix=IA32 %s -// IA32-NOT: argument unused during compilation +// IA32: "-target-cpu" "i386" // IA32-NOT: -target-feature +// IA32-NOT: argument unused during compilation // RUN: %clang_cl -m32 -arch:ia32 --target=i386 -### -- 2>&1 %s | FileCheck -check-prefix=ia32 %s // ia32: argument unused during compilation @@ -22,6 +22,7 @@ // IA3264-NOT: -target-feature // RUN: %clang_cl -m32 -arch:SSE --target=i386 -### -- 2>&1 %s | FileCheck -check-prefix=SSE %s +// SSE: "-target-cpu" "pentium3" // SSE: -target-feature // SSE: +sse // SSE-NOT: argument unused during compilation @@ -31,6 +32,7 @@ // sse-NOT: -target-feature // RUN: %clang_cl -m32 -arch:SSE2 --target=i386 -### -- 2>&1 %s | FileCheck -check-prefix=SSE2 %s +// SSE2: "-target-cpu" "pentium4" // SSE2: -target-feature // SSE2: +sse2 // SSE2-NOT: argument unused during compilation @@ -42,12 +44,14 @@ // RUN: %clang_cl -m64 -arch:SSE --target=x86_64 -### -- 2>&1 %s | FileCheck -check-prefix=SSE64 %s // SSE64: argument unused during compilation // SSE64-NOT: -target-feature +// SSE64-NOT: pentium3 // RUN: %clang_cl -m64 -arch:SSE2 --target=x86_64 -### -- 2>&1 %s | FileCheck -check-prefix=SSE264 %s // SSE264: argument unused during compilation // SSE264-NOT: -target-feature // RUN: %clang_cl -m32 -arch:AVX --target=i386 -### -- 2>&1 %s | FileCheck -check-prefix=AVX %s +// AVX: "-target-cpu" "sandybridge" // AVX: -target-feature // AVX: +avx @@ -56,6 +60,7 @@ // avx-NOT: -target-feature // RUN: %clang_cl -m32 -arch:AVX2 --target=i386 -### -- 2>&1 %s | FileCheck -check-prefix=AVX2 %s +// AVX2: "-target-cpu" "haswell" // AVX2: -target-feature // AVX2: +avx2 @@ -64,6 +69,7 @@ // avx2-NOT: -target-feature // RUN: %clang_cl -m64 -arch:AVX --target=x86_64 -### -- 2>&1 %s | FileCheck -check-prefix=AVX64 %s +// AVX64: "-target-cpu" "sandybridge" // AVX64: -target-feature // AVX64: +avx @@ -72,6 +78,7 @@ // avx64-NOT: -target-feature // RUN: %clang_cl -m64 -arch:AVX2 --target=x86_64 -### -- 2>&1 %s | FileCheck -check-prefix=AVX264 %s +// AVX264: "-target-cpu" "haswell" // AVX264: -target-feature // AVX264: +avx2 diff --git a/test/Driver/darwin-debug-flags.c b/test/Driver/darwin-debug-flags.c index 17b0bba..5080a59e 100644 --- a/test/Driver/darwin-debug-flags.c +++ b/test/Driver/darwin-debug-flags.c @@ -5,7 +5,7 @@ // <rdar://problem/12955296> // RUN: %clang -### -target i386-apple-darwin9 -c -g %t.s 2>&1 | FileCheck -check-prefix=P %s -// CHECK: !0 = !DICompileUnit( +// CHECK: !0 = distinct !DICompileUnit( // CHECK-SAME: flags: // CHECK-SAME: -I path\5C with\5C \5C\5Cspaces // CHECK-SAME: -g -Os diff --git a/test/Driver/darwin-dsymutil.c b/test/Driver/darwin-dsymutil.c index 0e2c490..09451a8 100644 --- a/test/Driver/darwin-dsymutil.c +++ b/test/Driver/darwin-dsymutil.c @@ -28,7 +28,7 @@ // RUN: -o foo %s -g 2> %t // RUN: FileCheck -check-prefix=CHECK-OUTPUT-NAME < %t %s // -// CHECK-OUTPUT-NAME: "x86_64-apple-darwin10" - "darwin::Link", inputs: [{{.*}}], output: "foo" +// CHECK-OUTPUT-NAME: "x86_64-apple-darwin10" - "darwin::Linker", inputs: [{{.*}}], output: "foo" // CHECK-OUTPUT-NAME: "x86_64-apple-darwin10" - "darwin::Dsymutil", inputs: ["foo"], output: "foo.dSYM" // Check that we only use dsymutil when needed. diff --git a/test/Driver/darwin-sdkroot.c b/test/Driver/darwin-sdkroot.c index 58bc683..3d2a413 100644 --- a/test/Driver/darwin-sdkroot.c +++ b/test/Driver/darwin-sdkroot.c @@ -40,3 +40,39 @@ // env SDKROOT=/ cmd //c echo %SDKROOT% // // This test passes using env.exe from GnuWin32. + +// Check if clang set the correct deployment target from -sysroot +// +// RUN: rm -rf %t/SDKs/iPhoneOS8.0.0.sdk +// RUN: mkdir -p %t/SDKs/iPhoneOS8.0.0.sdk +// RUN: env SDKROOT=%t/SDKs/iPhoneOS8.0.0.sdk %clang -target arm64-apple-darwin %s -### 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-IPHONE %s +// +// CHECK-IPHONE: clang +// CHECK-IPHONE: "-cc1" +// CHECK-IPHONE: "-triple" "arm64-apple-ios8.0.0" +// CHECK-IPHONE: ld +// CHECK-IPHONE: "-iphoneos_version_min" "8.0.0" +// +// +// RUN: rm -rf %t/SDKs/iPhoneSimulator8.0.sdk +// RUN: mkdir -p %t/SDKs/iPhoneSimulator8.0.sdk +// RUN: env SDKROOT=%t/SDKs/iPhoneSimulator8.0.sdk %clang -target x86_64-apple-darwin %s -### 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-SIMULATOR %s +// +// CHECK-SIMULATOR: clang +// CHECK-SIMULATOR: "-cc1" +// CHECK-SIMULATOR: "-triple" "x86_64-apple-ios8.0.0" +// CHECK-SIMULATOR: ld +// CHECK-SIMULATOR: "-ios_simulator_version_min" "8.0.0" +// +// RUN: rm -rf %t/SDKs/MacOSX10.10.0.sdk +// RUN: mkdir -p %t/SDKs/MacOSX10.10.0.sdk +// RUN: env SDKROOT=%t/SDKs/MacOSX10.10.0.sdk %clang -target x86_64-apple-darwin %s -### 2>&1 \ +// RUN: | FileCheck --check-prefix=CHECK-MACOSX %s +// +// CHECK-MACOSX: clang +// CHECK-MACOSX: "-cc1" +// CHECK-MACOSX: "-triple" "x86_64-apple-macosx10.10.0" +// CHECK-MACOSX: ld +// CHECK-MACOSX: "-macosx_version_min" "10.10.0" diff --git a/test/Driver/darwin-verify-debug.c b/test/Driver/darwin-verify-debug.c index ebbf89a..6b91290 100644 --- a/test/Driver/darwin-verify-debug.c +++ b/test/Driver/darwin-verify-debug.c @@ -21,7 +21,7 @@ // RUN: --verify-debug-info -o foo %s -g 2> %t // RUN: FileCheck -check-prefix=CHECK-OUTPUT-NAME < %t %s // -// CHECK-OUTPUT-NAME: "x86_64-apple-darwin10" - "darwin::Link", inputs: [{{.*}}], output: "foo" +// CHECK-OUTPUT-NAME: "x86_64-apple-darwin10" - "darwin::Linker", inputs: [{{.*}}], output: "foo" // CHECK-OUTPUT-NAME: "x86_64-apple-darwin10" - "darwin::Dsymutil", inputs: ["foo"], output: "foo.dSYM" // CHECK-OUTPUT-NAME: "x86_64-apple-darwin10" - "darwin::VerifyDebug", inputs: ["foo.dSYM"], output: (nothing) diff --git a/test/Driver/fsanitize.c b/test/Driver/fsanitize.c index bac12dc..96d0781 100644 --- a/test/Driver/fsanitize.c +++ b/test/Driver/fsanitize.c @@ -11,11 +11,20 @@ // CHECK-UNDEFINED: "-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|function|shift-base|shift-exponent|unreachable|return|vla-bound|alignment|null|vptr|object-size|float-cast-overflow|array-bounds|enum|bool|returns-nonnull-attribute|nonnull-attribute),?){19}"}} // RUN: %clang -target x86_64-apple-darwin10 -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-DARWIN -// CHECK-UNDEFINED-DARWIN: "-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|shift-base|shift-exponent|unreachable|return|vla-bound|alignment|null|vptr|object-size|float-cast-overflow|array-bounds|enum|bool|returns-nonnull-attribute|nonnull-attribute),?){18}"}} +// CHECK-UNDEFINED-DARWIN: "-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|shift-base|shift-exponent|unreachable|return|vla-bound|alignment|null|object-size|float-cast-overflow|array-bounds|enum|bool|returns-nonnull-attribute|nonnull-attribute),?){17}"}} // RUN: %clang -target i386-unknown-openbsd -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-OPENBSD // CHECK-UNDEFINED-OPENBSD: "-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|shift-base|shift-exponent|unreachable|return|vla-bound|alignment|null|object-size|float-cast-overflow|array-bounds|enum|bool|returns-nonnull-attribute|nonnull-attribute),?){17}"}} +// RUN: %clang -target i386-pc-win32 -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN --check-prefix=CHECK-UNDEFINED-WIN32 +// RUN: %clang -target i386-pc-win32 -fsanitize=undefined -x c++ %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN --check-prefix=CHECK-UNDEFINED-WIN32 --check-prefix=CHECK-UNDEFINED-WIN-CXX +// RUN: %clang -target x86_64-pc-win32 -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN --check-prefix=CHECK-UNDEFINED-WIN64 +// RUN: %clang -target x86_64-pc-win32 -fsanitize=undefined -x c++ %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN --check-prefix=CHECK-UNDEFINED-WIN64 --check-prefix=CHECK-UNDEFINED-WIN-CXX +// CHECK-UNDEFINED-WIN: "-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|shift-base|shift-exponent|unreachable|return|vla-bound|alignment|null|object-size|float-cast-overflow|array-bounds|enum|bool|returns-nonnull-attribute|nonnull-attribute),?){17}"}} +// CHECK-UNDEFINED-WIN32-SAME: "--dependent-lib={{[^"]*}}ubsan_standalone-i386.lib" +// CHECK-UNDEFINED-WIN64-SAME: "--dependent-lib={{[^"]*}}ubsan_standalone-x86_64.lib" +// CHECK-UNDEFINED-WIN-CXX-SAME: "--dependent-lib={{[^"]*}}ubsan_standalone_cxx{{[^"]*}}.lib" + // RUN: %clang -target x86_64-linux-gnu -fsanitize=integer %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-INTEGER // CHECK-INTEGER: "-fsanitize={{((signed-integer-overflow|unsigned-integer-overflow|integer-divide-by-zero|shift-base|shift-exponent),?){5}"}} @@ -205,6 +214,12 @@ // RUN: %clang -target x86_64-apple-darwin10 -fsanitize=function -fsanitize=undefined %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-FSAN-UBSAN-DARWIN // CHECK-FSAN-UBSAN-DARWIN: unsupported option '-fsanitize=function' for target 'x86_64-apple-darwin10' +// RUN: %clang -target x86_64-apple-darwin10 -mmacosx-version-min=10.8 -fsanitize=vptr %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-VPTR-DARWIN-OLD +// CHECK-VPTR-DARWIN-OLD: unsupported option '-fsanitize=vptr' for target 'x86_64-apple-darwin10' + +// RUN: %clang -target x86_64-apple-darwin10 -mmacosx-version-min=10.9 -fsanitize=alignment,vptr %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-VPTR-DARWIN-NEW +// CHECK-VPTR-DARWIN-NEW: -fsanitize=alignment,vptr + // RUN: %clang -target armv7-apple-ios7 -miphoneos-version-min=7.0 -fsanitize=address %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-IOS // CHECK-ASAN-IOS: unsupported option '-fsanitize=address' for target 'arm-apple-ios7' @@ -228,6 +243,9 @@ // RUN: %clang -target x86_64-linux-gnu -fsanitize-trap=address -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-TRAP // CHECK-ASAN-TRAP: error: unsupported argument 'address' to option '-fsanitize-trap' +// RUN: %clang -target x86_64-apple-darwin10 -mmacosx-version-min=10.7 -flto -fsanitize=cfi-vcall -fno-sanitize-trap=cfi -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI-NOTRAP-OLD-MACOS +// CHECK-CFI-NOTRAP-OLD-MACOS: error: unsupported option '-fno-sanitize-trap=cfi-vcall' for target 'x86_64-apple-darwin10' + // RUN: %clang_cl -fsanitize=address -c -MDd -### -- %s 2>&1 | FileCheck %s -check-prefix=CHECK-ASAN-DEBUGRTL // RUN: %clang_cl -fsanitize=address -c -MTd -### -- %s 2>&1 | FileCheck %s -check-prefix=CHECK-ASAN-DEBUGRTL // RUN: %clang_cl -fsanitize=address -c -LDd -### -- %s 2>&1 | FileCheck %s -check-prefix=CHECK-ASAN-DEBUGRTL @@ -257,3 +275,7 @@ // SP: "-fsanitize=safe-stack" // SP-ASAN-NOT: stack-protector // SP-ASAN: "-fsanitize=address,safe-stack" + +// RUN: %clang -target powerpc64-unknown-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s -check-prefix=CHECK-SANM +// RUN: %clang -target powerpc64le-unknown-linux-gnu -fsanitize=memory %s -### 2>&1 | FileCheck %s -check-prefix=CHECK-SANM +// CHECK-SANM: "-fsanitize=memory" diff --git a/test/Driver/integrated-as.s b/test/Driver/integrated-as.s index 9a7d2c5..181f790 100644 --- a/test/Driver/integrated-as.s +++ b/test/Driver/integrated-as.s @@ -43,3 +43,6 @@ // RUN: %clang -### -c -integrated-as %s -Wa,-gdwarf-2 2>&1 | FileCheck --check-prefix=DWARF2WA %s // DWARF2WA: "-gdwarf-2" + +// RUN: %clang -### -x assembler -c -integrated-as %s -I myincludedir 2>&1 | FileCheck --check-prefix=INCLUDEPATH %s +// INCLUDEPATH: "-I" "myincludedir" diff --git a/test/Driver/ios-version-min.c b/test/Driver/ios-version-min.c new file mode 100644 index 0000000..aa536cf7 --- /dev/null +++ b/test/Driver/ios-version-min.c @@ -0,0 +1,7 @@ +// REQUIRES: x86-registered-target +// REQUIRES: arm-registered-target +// RUN: %clang -target i386-apple-darwin10 -miphonesimulator-version-min=7.0 -arch i386 -S -o - %s | FileCheck %s +// RUN: %clang -target armv7s-apple-darwin10 -miphoneos-version-min=7.0 -arch armv7s -S -o - %s | FileCheck %s + +int main() { return 0; } +// CHECK: .ios_version_min 7, 0 diff --git a/test/Driver/linux-ld.c b/test/Driver/linux-ld.c index 5c4778b..5e865a9 100644 --- a/test/Driver/linux-ld.c +++ b/test/Driver/linux-ld.c @@ -817,6 +817,19 @@ // CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/lib" // CHECK-DEBIAN-PPC: "-L[[SYSROOT]]/usr/lib" // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ +// RUN: --target=powerpc64le-linux-gnu \ +// RUN: --gcc-toolchain="" \ +// RUN: --sysroot=%S/Inputs/debian_multiarch_tree \ +// RUN: | FileCheck --check-prefix=CHECK-DEBIAN-PPC64LE %s +// CHECK-DEBIAN-PPC64LE: "{{.*}}ld{{(.exe)?}}" "--sysroot=[[SYSROOT:[^"]+]]" +// CHECK-DEBIAN-PPC64LE: "{{.*}}/usr/lib/gcc/powerpc64le-linux-gnu/4.5{{/|\\\\}}crtbegin.o" +// CHECK-DEBIAN-PPC64LE: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64le-linux-gnu/4.5" +// CHECK-DEBIAN-PPC64LE: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64le-linux-gnu/4.5/../../../powerpc64le-linux-gnu" +// CHECK-DEBIAN-PPC64LE: "-L[[SYSROOT]]/usr/lib/powerpc64le-linux-gnu" +// CHECK-DEBIAN-PPC64LE: "-L[[SYSROOT]]/usr/lib/gcc/powerpc64le-linux-gnu/4.5/../../.." +// CHECK-DEBIAN-PPC64LE: "-L[[SYSROOT]]/lib" +// CHECK-DEBIAN-PPC64LE: "-L[[SYSROOT]]/usr/lib" +// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \ // RUN: --target=powerpc64-linux-gnu \ // RUN: --gcc-toolchain="" \ // RUN: --sysroot=%S/Inputs/debian_multiarch_tree \ diff --git a/test/Driver/lit.local.cfg b/test/Driver/lit.local.cfg index af6d021..6c2373b 100644 --- a/test/Driver/lit.local.cfg +++ b/test/Driver/lit.local.cfg @@ -4,3 +4,15 @@ config.substitutions = list(config.substitutions) config.substitutions.insert(0, ('%clang_cc1', """*** Do not use 'clang -cc1' in Driver tests. ***""") ) + +# Remove harmful environmental variables for clang Driver tests. +# Some might be useful for other tests so they are only removed here. +driver_overwrite_env_vars = ['MACOSX_DEPLOYMENT_TARGET', + 'IPHONEOS_DEPLOYMENT_TARGET', + 'SDKROOT', 'CCC_OVERRIDE_OPTIONS', + 'CC_PRINT_OPTIONS', 'CC_PRINT_HEADERS', + 'CC_LOG_DIAGNOSTICS'] + +for name in driver_overwrite_env_vars: + if name in config.environment: + del config.environment[name] diff --git a/test/Driver/msan.c b/test/Driver/msan.c new file mode 100644 index 0000000..22f7471 --- /dev/null +++ b/test/Driver/msan.c @@ -0,0 +1,12 @@ +// RUN: %clang -target x86_64-unknown-linux -fsanitize=memory %s -S -emit-llvm -o - | FileCheck %s +// RUN: %clang -O1 -target x86_64-unknown-linux -fsanitize=memory %s -S -emit-llvm -o - | FileCheck %s +// RUN: %clang -O2 -target x86_64-unknown-linux -fsanitize=memory %s -S -emit-llvm -o - | FileCheck %s +// RUN: %clang -O3 -target x86_64-unknown-linux -fsanitize=memory %s -S -emit-llvm -o - | FileCheck %s +// RUN: %clang -target mips64-linux-gnu -fsanitize=memory %s -S -emit-llvm -o - | FileCheck %s +// RUN: %clang -target mips64el-unknown-linux-gnu -fsanitize=memory %s -S -emit-llvm -o - | FileCheck %s +// RUN: %clang -target powerpc64-unknown-linux-gnu -fsanitize=memory %s -S -emit-llvm -o - | FileCheck %s +// RUN: %clang -target powerpc64le-unknown-linux-gnu -fsanitize=memory %s -S -emit-llvm -o - | FileCheck %s +// Verify that -fsanitize=memory invokes msan instrumentation. + +int foo(int *a) { return *a; } +// CHECK: __msan_init diff --git a/test/Driver/pic.c b/test/Driver/pic.c index a515f81..120e66a 100644 --- a/test/Driver/pic.c +++ b/test/Driver/pic.c @@ -242,3 +242,9 @@ // RUN: | FileCheck %s --check-prefix=CHECK-PIC1 // RUN: %clang -c %s -target arm64-linux-android -### 2>&1 \ // RUN: | FileCheck %s --check-prefix=CHECK-PIC1 +// +// On Windows-X64 PIC is enabled by default +// RUN: %clang -c %s -target x86_64-pc-windows-msvc18.0.0 -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-PIC2 +// RUN: %clang -c %s -target x86_64-pc-windows-gnu -### 2>&1 \ +// RUN: | FileCheck %s --check-prefix=CHECK-PIC2 diff --git a/test/FixIt/fixit-nullability-declspec.cpp b/test/FixIt/fixit-nullability-declspec.cpp index 2ac20b9..17989c3 100644 --- a/test/FixIt/fixit-nullability-declspec.cpp +++ b/test/FixIt/fixit-nullability-declspec.cpp @@ -4,6 +4,6 @@ // RUN: not %clang_cc1 -fixit -fblocks -Werror=nullability-declspec -x c++ %t // RUN: %clang_cc1 -fblocks -Werror=nullability-declspec -x c++ %t -__nullable int *ip1; // expected-error{{nullability specifier '__nullable' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the pointer?}} -__nullable int (*fp1)(int); // expected-error{{nullability specifier '__nullable' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the function pointer?}} -__nonnull int (^bp1)(int); // expected-error{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the block pointer?}} +_Nullable int *ip1; // expected-error{{nullability specifier '_Nullable' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the pointer?}} +_Nullable int (*fp1)(int); // expected-error{{nullability specifier '_Nullable' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the function pointer?}} +_Nonnull int (^bp1)(int); // expected-error{{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the block pointer?}} diff --git a/test/Index/annotate-literals.m b/test/Index/annotate-literals.m index 20bfd2c..a1e4fb2 100644 --- a/test/Index/annotate-literals.m +++ b/test/Index/annotate-literals.m @@ -29,44 +29,61 @@ typedef unsigned char BOOL; + (id)dictionaryWithObjects:(const id [])objects forKeys:(const id [])keys count:(unsigned long)cnt; @end -void test_literals(id k1, id o1, id k2, id o2, id k3) { +@interface NSValue ++ (NSValue *)valueWithBytes:(const void *)value objCType:(const char *)type; +@end + +typedef struct __attribute__((objc_boxable)) _c_struct { + int dummy; +} c_struct; + +void test_literals(id k1, id o1, id k2, id o2, id k3, c_struct s) { id objects = @[ o1, o2 ]; id dict = @{ k1 : o1, k2 : o2, k3 : @17 }; + id val = @(s); } -// RUN: c-index-test -test-annotate-tokens=%s:33:1:37:1 %s | FileCheck -check-prefix=CHECK-LITERALS %s +// RUN: c-index-test -test-annotate-tokens=%s:41:1:46:1 %s | FileCheck -check-prefix=CHECK-LITERALS %s -// CHECK-LITERALS: Identifier: "id" [33:3 - 33:5] TypeRef=id:0:0 -// CHECK-LITERALS: Identifier: "objects" [33:6 - 33:13] VarDecl=objects:33:6 (Definition) -// CHECK-LITERALS: Punctuation: "=" [33:14 - 33:15] VarDecl=objects:33:6 (Definition) -// CHECK-LITERALS: Punctuation: "@" [33:16 - 33:17] UnexposedExpr= -// CHECK-LITERALS: Punctuation: "[" [33:17 - 33:18] UnexposedExpr= -// CHECK-LITERALS: Identifier: "o1" [33:19 - 33:21] DeclRefExpr=o1:32:30 -// CHECK-LITERALS: Punctuation: "," [33:21 - 33:22] UnexposedExpr= -// CHECK-LITERALS: Identifier: "o2" [33:23 - 33:25] DeclRefExpr=o2:32:44 -// CHECK-LITERALS: Punctuation: "]" [33:26 - 33:27] UnexposedExpr= -// CHECK-LITERALS: Punctuation: ";" [33:27 - 33:28] DeclStmt= -// CHECK-LITERALS: Identifier: "id" [34:3 - 34:5] TypeRef=id:0:0 -// CHECK-LITERALS: Identifier: "dict" [34:6 - 34:10] VarDecl=dict:34:6 (Definition) -// CHECK-LITERALS: Punctuation: "=" [34:11 - 34:12] VarDecl=dict:34:6 (Definition) -// CHECK-LITERALS: Punctuation: "@" [34:13 - 34:14] UnexposedExpr= -// CHECK-LITERALS: Punctuation: "{" [34:14 - 34:15] UnexposedExpr= -// CHECK-LITERALS: Identifier: "k1" [34:16 - 34:18] DeclRefExpr=k1:32:23 -// CHECK-LITERALS: Punctuation: ":" [34:19 - 34:20] UnexposedExpr= -// CHECK-LITERALS: Identifier: "o1" [34:21 - 34:23] DeclRefExpr=o1:32:30 -// CHECK-LITERALS: Punctuation: "," [34:23 - 34:24] UnexposedExpr= -// CHECK-LITERALS: Identifier: "k2" [35:16 - 35:18] DeclRefExpr=k2:32:37 -// CHECK-LITERALS: Punctuation: ":" [35:19 - 35:20] UnexposedExpr= -// CHECK-LITERALS: Identifier: "o2" [35:21 - 35:23] DeclRefExpr=o2:32:44 -// CHECK-LITERALS: Punctuation: "," [35:23 - 35:24] UnexposedExpr= -// CHECK-LITERALS: Identifier: "k3" [36:16 - 36:18] DeclRefExpr=k3:32:51 -// CHECK-LITERALS: Punctuation: ":" [36:19 - 36:20] UnexposedExpr= -// CHECK-LITERALS: Punctuation: "@" [36:21 - 36:22] UnexposedExpr= -// CHECK-LITERALS: Literal: "17" [36:22 - 36:24] IntegerLiteral= -// CHECK-LITERALS: Punctuation: "}" [36:25 - 36:26] UnexposedExpr= -// CHECK-LITERALS: Punctuation: ";" [36:26 - 36:27] DeclStmt= -// CHECK-LITERALS: Punctuation: "}" [37:1 - 37:2] CompoundStmt= +// CHECK-LITERALS: Identifier: "id" [41:3 - 41:5] TypeRef=id:0:0 +// CHECK-LITERALS: Identifier: "objects" [41:6 - 41:13] VarDecl=objects:41:6 (Definition) +// CHECK-LITERALS: Punctuation: "=" [41:14 - 41:15] VarDecl=objects:41:6 (Definition) +// CHECK-LITERALS: Punctuation: "@" [41:16 - 41:17] UnexposedExpr= +// CHECK-LITERALS: Punctuation: "[" [41:17 - 41:18] UnexposedExpr= +// CHECK-LITERALS: Identifier: "o1" [41:19 - 41:21] DeclRefExpr=o1:40:30 +// CHECK-LITERALS: Punctuation: "," [41:21 - 41:22] UnexposedExpr= +// CHECK-LITERALS: Identifier: "o2" [41:23 - 41:25] DeclRefExpr=o2:40:44 +// CHECK-LITERALS: Punctuation: "]" [41:26 - 41:27] UnexposedExpr= +// CHECK-LITERALS: Punctuation: ";" [41:27 - 41:28] DeclStmt= +// CHECK-LITERALS: Identifier: "id" [42:3 - 42:5] TypeRef=id:0:0 +// CHECK-LITERALS: Identifier: "dict" [42:6 - 42:10] VarDecl=dict:42:6 (Definition) +// CHECK-LITERALS: Punctuation: "=" [42:11 - 42:12] VarDecl=dict:42:6 (Definition) +// CHECK-LITERALS: Punctuation: "@" [42:13 - 42:14] UnexposedExpr= +// CHECK-LITERALS: Punctuation: "{" [42:14 - 42:15] UnexposedExpr= +// CHECK-LITERALS: Identifier: "k1" [42:16 - 42:18] DeclRefExpr=k1:40:23 +// CHECK-LITERALS: Punctuation: ":" [42:19 - 42:20] UnexposedExpr= +// CHECK-LITERALS: Identifier: "o1" [42:21 - 42:23] DeclRefExpr=o1:40:30 +// CHECK-LITERALS: Punctuation: "," [42:23 - 42:24] UnexposedExpr= +// CHECK-LITERALS: Identifier: "k2" [43:16 - 43:18] DeclRefExpr=k2:40:37 +// CHECK-LITERALS: Punctuation: ":" [43:19 - 43:20] UnexposedExpr= +// CHECK-LITERALS: Identifier: "o2" [43:21 - 43:23] DeclRefExpr=o2:40:44 +// CHECK-LITERALS: Punctuation: "," [43:23 - 43:24] UnexposedExpr= +// CHECK-LITERALS: Identifier: "k3" [44:16 - 44:18] DeclRefExpr=k3:40:51 +// CHECK-LITERALS: Punctuation: ":" [44:19 - 44:20] UnexposedExpr= +// CHECK-LITERALS: Punctuation: "@" [44:21 - 44:22] UnexposedExpr= +// CHECK-LITERALS: Literal: "17" [44:22 - 44:24] IntegerLiteral= +// CHECK-LITERALS: Punctuation: "}" [44:25 - 44:26] UnexposedExpr= +// CHECK-LITERALS: Punctuation: ";" [44:26 - 44:27] DeclStmt= +// CHECK-LITERALS: Identifier: "id" [45:3 - 45:5] TypeRef=id:0:0 +// CHECK-LITERALS: Identifier: "val" [45:6 - 45:9] VarDecl=val:45:6 (Definition) +// CHECK-LITERALS: Punctuation: "=" [45:10 - 45:11] VarDecl=val:45:6 (Definition) +// CHECK-LITERALS: Punctuation: "@" [45:12 - 45:13] UnexposedExpr= +// CHECK-LITERALS: Punctuation: "(" [45:13 - 45:14] ParenExpr= +// CHECK-LITERALS: Identifier: "s" [45:14 - 45:15] DeclRefExpr=s:40:64 +// CHECK-LITERALS: Punctuation: ")" [45:15 - 45:16] ParenExpr= +// CHECK-LITERALS: Punctuation: ";" [45:16 - 45:17] DeclStmt= +// CHECK-LITERALS: Punctuation: "}" [46:1 - 46:2] CompoundStmt= diff --git a/test/Index/complete-objc-message.m b/test/Index/complete-objc-message.m index a62b491..193f1f8 100644 --- a/test/Index/complete-objc-message.m +++ b/test/Index/complete-objc-message.m @@ -345,4 +345,4 @@ void test_Nullability(Nullability *n, A* a) { // CHECK-DISTRIB-OBJECTS: ObjCInstanceMethodDecl:{ResultType void}{TypedText method:}{Placeholder (in bycopy A *)}{HorizontalSpace }{TypedText result:}{Placeholder (out byref A **)} (35) // RUN: c-index-test -code-completion-at=%s:197:6 %s | FileCheck -check-prefix=CHECK-NULLABLE %s -// CHECK-NULLABLE: ObjCInstanceMethodDecl:{ResultType A * __nonnull}{TypedText method:}{Placeholder (nullable A *)} +// CHECK-NULLABLE: ObjCInstanceMethodDecl:{ResultType A * _Nonnull}{TypedText method:}{Placeholder (nullable A *)} diff --git a/test/Index/complete-stmt.c b/test/Index/complete-stmt.c index 8bbfe2d..0deb4d3 100644 --- a/test/Index/complete-stmt.c +++ b/test/Index/complete-stmt.c @@ -16,8 +16,8 @@ void f(int x) { // CHECK-IF-ELSE-SIMPLE: NotImplemented:{TypedText else}{HorizontalSpace }{Text if}{HorizontalSpace }{LeftParen (}{Placeholder expression}{RightParen )} (40) // RUN: c-index-test -code-completion-at=%s:6:1 %s | FileCheck -check-prefix=CHECK-STMT %s -// CHECK-STMT: NotImplemented:{TypedText __nonnull} (50) -// CHECK-STMT: NotImplemented:{TypedText __nullable} (50) +// CHECK-STMT: NotImplemented:{TypedText _Nonnull} (50) +// CHECK-STMT: NotImplemented:{TypedText _Nullable} (50) // CHECK-STMT: NotImplemented:{TypedText char} (50) // CHECK-STMT: NotImplemented:{TypedText const} (50) // CHECK-STMT: NotImplemented:{TypedText double} (50) diff --git a/test/Modules/Inputs/DebugModule.h b/test/Modules/Inputs/DebugModule.h new file mode 100644 index 0000000..5612b73 --- /dev/null +++ b/test/Modules/Inputs/DebugModule.h @@ -0,0 +1 @@ +@class F; diff --git a/test/Modules/Inputs/ImportNameInDir.h b/test/Modules/Inputs/ImportNameInDir.h new file mode 100644 index 0000000..ae7b1a0 --- /dev/null +++ b/test/Modules/Inputs/ImportNameInDir.h @@ -0,0 +1,4 @@ +#import <NameInDir/NameInDir.h> + +// Don't crash. +#undef NAME_IN_DIR diff --git a/test/Modules/Inputs/NameInDir.framework/Headers/NameInDir.h b/test/Modules/Inputs/NameInDir.framework/Headers/NameInDir.h new file mode 100644 index 0000000..bea2391 --- /dev/null +++ b/test/Modules/Inputs/NameInDir.framework/Headers/NameInDir.h @@ -0,0 +1,2 @@ +// NameInDir.h +#define NAME_IN_DIR 1 diff --git a/test/Modules/Inputs/NameInDir.framework/Modules/module.modulemap b/test/Modules/Inputs/NameInDir.framework/Modules/module.modulemap new file mode 100644 index 0000000..48e1c56 --- /dev/null +++ b/test/Modules/Inputs/NameInDir.framework/Modules/module.modulemap @@ -0,0 +1,5 @@ +framework module NameInModMap { + umbrella header "NameInDir.h" + export * + module * { export * } +} diff --git a/test/Modules/Inputs/NameInDir2.framework/Headers/NameInDir2.h b/test/Modules/Inputs/NameInDir2.framework/Headers/NameInDir2.h new file mode 100644 index 0000000..6dc3eea --- /dev/null +++ b/test/Modules/Inputs/NameInDir2.framework/Headers/NameInDir2.h @@ -0,0 +1 @@ +// NameInDir2.h diff --git a/test/Modules/Inputs/NameInDir2.framework/Modules/module.modulemap b/test/Modules/Inputs/NameInDir2.framework/Modules/module.modulemap new file mode 100644 index 0000000..24f15f8 --- /dev/null +++ b/test/Modules/Inputs/NameInDir2.framework/Modules/module.modulemap @@ -0,0 +1,5 @@ +framework module NameInDir2 { + umbrella header "NameInDir2.h" + export * + module * { export * } +} diff --git a/test/Modules/Inputs/NameInDirInferred.framework/Headers/NameInDirInferred.h b/test/Modules/Inputs/NameInDirInferred.framework/Headers/NameInDirInferred.h new file mode 100644 index 0000000..c0b12e6 --- /dev/null +++ b/test/Modules/Inputs/NameInDirInferred.framework/Headers/NameInDirInferred.h @@ -0,0 +1 @@ +// NameInDirInferred.h diff --git a/test/Modules/Inputs/crash.h b/test/Modules/Inputs/crash.h new file mode 100644 index 0000000..bc878fb --- /dev/null +++ b/test/Modules/Inputs/crash.h @@ -0,0 +1 @@ +#pragma clang __debug crash diff --git a/test/Modules/Inputs/explicit-build-prefer-self/a.h b/test/Modules/Inputs/explicit-build-prefer-self/a.h new file mode 100644 index 0000000..d457612 --- /dev/null +++ b/test/Modules/Inputs/explicit-build-prefer-self/a.h @@ -0,0 +1,2 @@ +// a +#include "x.h" diff --git a/test/Modules/Inputs/explicit-build-prefer-self/b.h b/test/Modules/Inputs/explicit-build-prefer-self/b.h new file mode 100644 index 0000000..76e2042 --- /dev/null +++ b/test/Modules/Inputs/explicit-build-prefer-self/b.h @@ -0,0 +1,2 @@ +// b +#include "x.h" diff --git a/test/Modules/Inputs/explicit-build-prefer-self/map b/test/Modules/Inputs/explicit-build-prefer-self/map new file mode 100644 index 0000000..26be8e6 --- /dev/null +++ b/test/Modules/Inputs/explicit-build-prefer-self/map @@ -0,0 +1,2 @@ +module a { header "a.h" header "x.h" } +module b { header "b.h" header "x.h" } diff --git a/test/Modules/Inputs/explicit-build-prefer-self/x.h b/test/Modules/Inputs/explicit-build-prefer-self/x.h new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test/Modules/Inputs/explicit-build-prefer-self/x.h diff --git a/test/Modules/Inputs/merge-class-definition-visibility/b.h b/test/Modules/Inputs/merge-class-definition-visibility/b.h index 2b8f5f8..03c0ad9 100644 --- a/test/Modules/Inputs/merge-class-definition-visibility/b.h +++ b/test/Modules/Inputs/merge-class-definition-visibility/b.h @@ -1,2 +1,4 @@ // Include definition of A into the same module as c.h #include "a.h" + +struct B {}; diff --git a/test/Modules/Inputs/merge-class-definition-visibility/d.h b/test/Modules/Inputs/merge-class-definition-visibility/d.h index 2243de1..c51edab 100644 --- a/test/Modules/Inputs/merge-class-definition-visibility/d.h +++ b/test/Modules/Inputs/merge-class-definition-visibility/d.h @@ -1 +1 @@ -#include "a.h" +struct B {}; diff --git a/test/Modules/Inputs/merge-class-definition-visibility/e.h b/test/Modules/Inputs/merge-class-definition-visibility/e.h new file mode 100644 index 0000000..f126b50 --- /dev/null +++ b/test/Modules/Inputs/merge-class-definition-visibility/e.h @@ -0,0 +1,3 @@ +#include "a.h" + +struct B {}; diff --git a/test/Modules/Inputs/merge-class-definition-visibility/modmap b/test/Modules/Inputs/merge-class-definition-visibility/modmap index 7d988fb..dcb6587 100644 --- a/test/Modules/Inputs/merge-class-definition-visibility/modmap +++ b/test/Modules/Inputs/merge-class-definition-visibility/modmap @@ -3,5 +3,6 @@ module Def1 { module C { header "c.h" } } module Def2 { - header "d.h" + module D { header "d.h" } + module E { header "e.h" } } diff --git a/test/Modules/Inputs/module.map b/test/Modules/Inputs/module.map index 8ec3e21..ffaa53e 100644 --- a/test/Modules/Inputs/module.map +++ b/test/Modules/Inputs/module.map @@ -324,3 +324,15 @@ module recursive1 { module recursive2 { header "recursive2.h" } +module crash { + header "crash.h" +} + +module DebugModule { + header "DebugModule.h" +} + +module ImportNameInDir { + header "ImportNameInDir.h" + export * +} diff --git a/test/Modules/Inputs/submodule-visibility/a.h b/test/Modules/Inputs/submodule-visibility/a.h index d8805c9..e4965d7 100644 --- a/test/Modules/Inputs/submodule-visibility/a.h +++ b/test/Modules/Inputs/submodule-visibility/a.h @@ -1 +1,9 @@ int n; + +#ifdef B +#error B is defined +#endif + +#define A + +#include "c.h" diff --git a/test/Modules/Inputs/submodule-visibility/b.h b/test/Modules/Inputs/submodule-visibility/b.h index fa419c0..67ef652 100644 --- a/test/Modules/Inputs/submodule-visibility/b.h +++ b/test/Modules/Inputs/submodule-visibility/b.h @@ -1 +1,10 @@ int m = n; + +#include "other.h" +#include "c.h" + +#if defined(A) && !defined(ALLOW_NAME_LEAKAGE) +#error A is defined +#endif + +#define B diff --git a/test/Modules/Inputs/submodule-visibility/c.h b/test/Modules/Inputs/submodule-visibility/c.h new file mode 100644 index 0000000..259b8c7 --- /dev/null +++ b/test/Modules/Inputs/submodule-visibility/c.h @@ -0,0 +1,6 @@ +#ifndef C_H_INCLUDED +#define C_H_INCLUDED + +struct C {}; + +#endif diff --git a/test/Modules/Inputs/submodule-visibility/module.modulemap b/test/Modules/Inputs/submodule-visibility/module.modulemap index 2e13344..d2f0c77 100644 --- a/test/Modules/Inputs/submodule-visibility/module.modulemap +++ b/test/Modules/Inputs/submodule-visibility/module.modulemap @@ -1,4 +1,5 @@ module x { module a { header "a.h" } module b { header "b.h" } } +module other { header "other.h" } module cycles { module cycle1 { header "cycle1.h" } diff --git a/test/Modules/Inputs/submodule-visibility/other.h b/test/Modules/Inputs/submodule-visibility/other.h new file mode 100644 index 0000000..f40c757 --- /dev/null +++ b/test/Modules/Inputs/submodule-visibility/other.h @@ -0,0 +1 @@ +#include "c.h" diff --git a/test/Modules/Inputs/submodules-merge-defs/defs.h b/test/Modules/Inputs/submodules-merge-defs/defs.h index 247b05c..bda0567 100644 --- a/test/Modules/Inputs/submodules-merge-defs/defs.h +++ b/test/Modules/Inputs/submodules-merge-defs/defs.h @@ -10,6 +10,7 @@ public: // Check that lookup and access checks are performed in the right context. struct B::Inner2 : Inner1 {}; template<typename T> void B::f() {} +template<> inline void B::f<int>() {} // Check that base-specifiers are correctly disambiguated. template<int N> struct C_Base { struct D { constexpr operator int() const { return 0; } }; }; @@ -31,7 +32,8 @@ template<typename T> struct F { template<typename T> int F<T>::f() { return 0; } template<typename T> template<typename U> int F<T>::g() { return 0; } template<typename T> int F<T>::n = 0; -//template<> template<typename U> int F<char>::g() { return 0; } // FIXME: Re-enable this once we support merging member specializations. +template<> inline int F<char>::f() { return 0; } +template<> template<typename U> int F<char>::g() { return 0; } template<> struct F<void> { int h(); }; inline int F<void>::h() { return 0; } template<typename T> struct F<T *> { int i(); }; @@ -74,3 +76,21 @@ namespace FriendDefArg { template<typename, int, template<typename> class> friend struct D; }; } + +namespace SeparateInline { + inline void f(); + void f() {} + constexpr int g() { return 0; } +} + +namespace TrailingAttributes { + template<typename T> struct X {} __attribute__((aligned(8))); +} + +namespace MergeFunctionTemplateSpecializations { + template<typename T> T f(); + template<typename T> struct X { + template<typename U> using Q = decltype(f<T>() + U()); + }; + using xiq = X<int>::Q<int>; +} diff --git a/test/Modules/cxx-irgen.cpp b/test/Modules/cxx-irgen.cpp index 37de23f..7cdb0d6 100644 --- a/test/Modules/cxx-irgen.cpp +++ b/test/Modules/cxx-irgen.cpp @@ -12,7 +12,7 @@ CtorInit<int> x; // Keep these two namespace definitions separate; merging them hides the bug. namespace EmitInlineMethods { - // CHECK-DAG: define linkonce_odr [[CC:(x86_thiscallcc[ ]+)?]]void @_ZN17EmitInlineMethods1C1fEPNS_1AE( + // CHECK-DAG: define linkonce_odr [[CC:([0-9_a-z]*cc[ ]+)?]]void @_ZN17EmitInlineMethods1C1fEPNS_1AE( // CHECK-DAG: declare [[CC]]void @_ZN17EmitInlineMethods1A1gEv( struct C { __attribute__((used)) void f(A *p) { p->g(); } @@ -26,14 +26,14 @@ namespace EmitInlineMethods { }; } -// CHECK-DAG: define available_externally hidden {{signext i32|i32}} @_ZN1SIiE1gEv({{.*}} #[[ALWAYS_INLINE:.*]] align +// CHECK-DAG: define available_externally hidden {{.*}}{{signext i32|i32}} @_ZN1SIiE1gEv({{.*}} #[[ALWAYS_INLINE:.*]] align int a = S<int>::g(); int b = h(); -// CHECK-DAG: define linkonce_odr {{signext i32|i32}} @_Z3minIiET_S0_S0_(i32 +// CHECK-DAG: define linkonce_odr {{.*}}{{signext i32|i32}} @_Z3minIiET_S0_S0_(i32 int c = min(1, 2); -// CHECK: define available_externally {{signext i32|i32}} @_ZN1SIiE1fEv({{.*}} #[[ALWAYS_INLINE]] align +// CHECK: define available_externally {{.*}}{{signext i32|i32}} @_ZN1SIiE1fEv({{.*}} #[[ALWAYS_INLINE]] align namespace ImplicitSpecialMembers { // CHECK-LABEL: define {{.*}} @_ZN22ImplicitSpecialMembers1BC2ERKS0_( @@ -49,9 +49,9 @@ namespace ImplicitSpecialMembers { // CHECK-LABEL: define {{.*}} @_ZN22ImplicitSpecialMembers1DC2EOS0_( // CHECK: call {{.*}} @_ZN22ImplicitSpecialMembers1AC1ERKS0_( // CHECK-LABEL: define {{.*}} @_ZN20OperatorDeleteLookup1AD0Ev( - // CHECK: call void @_ZN20OperatorDeleteLookup1AdlEPv( + // CHECK: call {{.*}}void @_ZN20OperatorDeleteLookup1AdlEPv( - // CHECK-DAG: call {{[a-z]*[ ]?i32}} @_ZN8CtorInitIiE1fEv( + // CHECK-DAG: call {{[a-z\_\d]*[ ]?i32}} @_ZN8CtorInitIiE1fEv( extern B b1; B b2(b1); diff --git a/test/Modules/debug-info-moduleimport.m b/test/Modules/debug-info-moduleimport.m new file mode 100644 index 0000000..1f12b02 --- /dev/null +++ b/test/Modules/debug-info-moduleimport.m @@ -0,0 +1,7 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -g -fmodules -DGREETING="Hello World" -UNDEBUG -fimplicit-module-maps -fmodules-cache-path=%t %s -I %S/Inputs -isysroot /tmp/.. -I %t -emit-llvm -o - | FileCheck %s + +// CHECK: ![[CU:.*]] = distinct !DICompileUnit +@import DebugModule; +// CHECK: !DIImportedEntity(tag: DW_TAG_imported_declaration, scope: ![[CU]], entity: ![[MODULE:.*]], line: 5) +// CHECK: ![[MODULE]] = !DIModule(scope: null, name: "DebugModule", configMacros: "\22-DGREETING=Hello World\22 \22-UNDEBUG\22", includePath: "{{.*}}test{{.*}}Modules{{.*}}Inputs", isysroot: "/tmp/..") diff --git a/test/Modules/direct-module-import.m b/test/Modules/direct-module-import.m index 3216eb9..bf9248e 100644 --- a/test/Modules/direct-module-import.m +++ b/test/Modules/direct-module-import.m @@ -1,7 +1,7 @@ // RUN: rm -rf %t // RUN: %clang_cc1 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -F %S/Inputs -include Module/Module.h %s -emit-llvm -o - | FileCheck %s -// CHECK: call i8* @getModuleVersion +// CHECK: call {{.*}}i8* @getModuleVersion const char* getVer(void) { return getModuleVersion(); } diff --git a/test/Modules/explicit-build-prefer-self.cpp b/test/Modules/explicit-build-prefer-self.cpp new file mode 100644 index 0000000..13fbdbd --- /dev/null +++ b/test/Modules/explicit-build-prefer-self.cpp @@ -0,0 +1,3 @@ +// RUN: rm -rf %t +// RUN: %clang_cc1 -fmodules -fno-implicit-modules -emit-module -fmodule-name=a %S/Inputs/explicit-build-prefer-self/map -o %t/a.pcm +// RUN: %clang_cc1 -fmodules -fno-implicit-modules -emit-module -fmodule-name=b %S/Inputs/explicit-build-prefer-self/map -o %t/b.pcm diff --git a/test/Modules/framework-name.m b/test/Modules/framework-name.m new file mode 100644 index 0000000..a63e206 --- /dev/null +++ b/test/Modules/framework-name.m @@ -0,0 +1,33 @@ +// REQUIRES: shell +// RUN: rm -rf %t.mcp %t +// RUN: mkdir -p %t +// RUN: ln -s %S/Inputs/NameInDir2.framework %t/NameInImport.framework +// RUN: ln -s %S/Inputs/NameInDirInferred.framework %t/NameInImportInferred.framework +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t.mcp -fimplicit-module-maps -I %S/Inputs -F %S/Inputs -F %t -Wauto-import -verify %s + +// Sanity check that we won't somehow find non-canonical module names or +// modules where we shouldn't search the framework. +// RUN: echo '@import NameInModMap' | not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -F %S/Inputs -F %t -Wauto-import -x objective-c - 2>&1 | FileCheck %s +// RUN: echo '@import NameInDir' | not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -F %S/Inputs -F %t -Wauto-import -x objective-c - 2>&1 | FileCheck %s +// RUN: echo '@import NameInImport' | not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -F %S/Inputs -F %t -Wauto-import -x objective-c - 2>&1 | FileCheck %s +// RUN: echo '@import NameInImportInferred' | not %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t.mcp -F %S/Inputs -F %t -Wauto-import -x objective-c - 2>&1 | FileCheck %s +// CHECK: module '{{.*}}' not found + +// FIXME: We might want to someday lock down framework modules so that these +// name mismatches are disallowed. However, as long as we *don't* prevent them +// it's important that they map correctly to module imports. + +// The module map name doesn't match the directory name. +#import <NameInDir/NameInDir.h> // expected-warning {{import of module 'NameInModMap'}} + +// The name in the import doesn't match the module name. +#import <NameInImport/NameInDir2.h> // expected-warning {{import of module 'NameInDir2'}} +@import NameInDir2; // OK + +// The name in the import doesn't match the module name (inferred framework module). +#import <NameInImportInferred/NameInDirInferred.h> // expected-warning {{import of module 'NameInDirInferred'}} + +@import ImportNameInDir; +#ifdef NAME_IN_DIR +#error NAME_IN_DIR should be undef'd +#endif diff --git a/test/Modules/merge-class-definition-visibility.cpp b/test/Modules/merge-class-definition-visibility.cpp index e8602c0..ac4c951 100644 --- a/test/Modules/merge-class-definition-visibility.cpp +++ b/test/Modules/merge-class-definition-visibility.cpp @@ -1,15 +1,23 @@ // RUN: rm -rf %t // RUN: %clang_cc1 -fmodules -fmodule-map-file=%S/Inputs/merge-class-definition-visibility/modmap \ // RUN: -I%S/Inputs/merge-class-definition-visibility \ -// RUN: -fmodules-cache-path=%t %s -verify +// RUN: -fmodules-cache-path=%t %s -verify \ +// RUN: -fmodules-local-submodule-visibility // expected-no-diagnostics #include "c.h" template<typename T> struct X { T t; }; typedef X<A> XA; +struct B; -#include "d.h" -// Ensure that this triggers the import of the second definition from d.h, +#include "e.h" +// Ensure that this triggers the import of the second definition from e.h, // which is necessary to make the definition of A visible in the template // instantiation. XA xa; + +// Ensure that we make the definition of B visible. We made the parse-merged +// definition from e.h visible, which makes the definition from d.h visible, +// and that definition was merged into the canonical definition from b.h, +// so that becomes visible, and we have a visible definition. +B b; diff --git a/test/Modules/module-feature.m b/test/Modules/module-feature.m new file mode 100644 index 0000000..4926d26 --- /dev/null +++ b/test/Modules/module-feature.m @@ -0,0 +1,14 @@ +// RUN: rm -rf %t %t.nohash + +// Each set of features gets its own cache. +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -fmodule-feature f1 -fmodule-feature f2 -F %S/Inputs %s -verify -Rmodule-build +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -fmodule-feature f2 -F %S/Inputs %s -verify -Rmodule-build +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -fmodule-feature f2 -fmodule-feature f1 -F %S/Inputs %s -Rmodule-build 2>&1 | FileCheck %s -allow-empty -check-prefix=ALREADY_BUILT +// ALREADY_BUILT-NOT: building module + +// Errors if we try to force the load. +// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t.nohash -fimplicit-module-maps -fdisable-module-hash -fmodule-feature f1 -fmodule-feature f2 -F %S/Inputs %s -verify -Rmodule-build +// RUN: not %clang_cc1 -fmodules -fmodules-cache-path=%t.nohash -fimplicit-module-maps -fdisable-module-hash -fmodule-feature f2 -F %S/Inputs %s 2>&1 | FileCheck %s -check-prefix=DIFFERS +// DIFFERS: error: module features differs + +@import Module; // expected-remark {{building module 'Module'}} expected-remark {{finished}} diff --git a/test/Modules/module_file_info.m b/test/Modules/module_file_info.m index 01d5073..8693d2b 100644 --- a/test/Modules/module_file_info.m +++ b/test/Modules/module_file_info.m @@ -2,7 +2,7 @@ @import DependsOnModule; // RUN: rm -rf %t -// RUN: %clang_cc1 -w -Wunused -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t -F %S/Inputs -DBLARG -DWIBBLE=WOBBLE %s +// RUN: %clang_cc1 -w -Wunused -fmodules -fimplicit-module-maps -fdisable-module-hash -fmodules-cache-path=%t -F %S/Inputs -DBLARG -DWIBBLE=WOBBLE -fmodule-feature myfeature %s // RUN: %clang_cc1 -module-file-info %t/DependsOnModule.pcm | FileCheck %s // CHECK: Generated by this Clang: @@ -14,6 +14,8 @@ // CHECK: C99: Yes // CHECK: Objective-C 1: Yes // CHECK: modules extension to C: Yes +// CHECK: Module features: +// CHECK: myfeature // CHECK: Target options: // CHECK: Triple: diff --git a/test/Modules/modules-with-same-name.m b/test/Modules/modules-with-same-name.m index b5cb6fa..b6925df 100644 --- a/test/Modules/modules-with-same-name.m +++ b/test/Modules/modules-with-same-name.m @@ -7,19 +7,19 @@ // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fmodules-ignore-macro=EXPECTED_PATH -fmodules-ignore-macro=DIRECT -fsyntax-only %s -verify -I %S/Inputs/modules-with-same-name/path2/A -DDIRECT -DEXPECTED_PATH=2 // Confirm that we have two pcm files (one for each 'A'). -// RUN: find %t -name "A-*.pcm" | count 2 +// RUN: find %t -name "A-*.pc[m]" | count 2 // DependsOnA, using A from path 1 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fmodules-ignore-macro=EXPECTED_PATH -fmodules-ignore-macro=DIRECT -fsyntax-only %s -verify -I %S/Inputs/modules-with-same-name/DependsOnA -I %S/Inputs/modules-with-same-name/path1/A -DEXPECTED_PATH=1 // Confirm that we have three pcm files (one for each 'A', and one for 'DependsOnA') -// RUN: find %t -name "*.pcm" | count 3 +// RUN: find %t -name "*.pc[m]" | count 3 // DependsOnA, using A from path 2 // RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -fmodules-ignore-macro=EXPECTED_PATH -fmodules-ignore-macro=DIRECT -fsyntax-only %s -verify -I %S/Inputs/modules-with-same-name/DependsOnA -I %S/Inputs/modules-with-same-name/path2/A -DEXPECTED_PATH=2 // Confirm that we still have three pcm files, since DependsOnA will be rebuilt -// RUN: find %t -name "*.pcm" | count 3 +// RUN: find %t -name "*.pc[m]" | count 3 #ifdef DIRECT @import A; diff --git a/test/Modules/pch-used.m b/test/Modules/pch-used.m index cdfadb2..0711d13 100644 --- a/test/Modules/pch-used.m +++ b/test/Modules/pch-used.m @@ -6,4 +6,4 @@ void f() { SPXTrace(); } void g() { double x = DBL_MAX; } -// CHECK: define internal void @SPXTrace +// CHECK: define internal {{.*}}void @SPXTrace diff --git a/test/Modules/signal.m b/test/Modules/signal.m new file mode 100644 index 0000000..30059e9 --- /dev/null +++ b/test/Modules/signal.m @@ -0,0 +1,11 @@ +// REQUIRES: shell +// RUN: rm -rf %t + +// Crash building module. +// RUN: not --crash %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -I%S/Inputs %s + +// The dead symlink is still around, but the underlying lock file is gone. +// RUN: find %t -name "crash-*.pcm.lock" | count 1 +// RUN: find %t -name "crash-*.pcm.lock-*" | count 0 + +@import crash; diff --git a/test/Modules/submodule-visibility.cpp b/test/Modules/submodule-visibility.cpp index 084f811..b2c5fc7 100644 --- a/test/Modules/submodule-visibility.cpp +++ b/test/Modules/submodule-visibility.cpp @@ -20,3 +20,11 @@ #endif int k = n + m; // OK, a and b are visible here. + +#ifndef A +#error A is not defined +#endif + +#ifndef B +#error B is not defined +#endif diff --git a/test/Modules/submodules-merge-defs.cpp b/test/Modules/submodules-merge-defs.cpp index 94c0fd3..92c7844 100644 --- a/test/Modules/submodules-merge-defs.cpp +++ b/test/Modules/submodules-merge-defs.cpp @@ -3,7 +3,7 @@ // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -I %S/Inputs/submodules-merge-defs %s -verify -fno-modules-error-recovery // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -I %S/Inputs/submodules-merge-defs %s -verify -fno-modules-error-recovery -fmodules-local-submodule-visibility -DTEXTUAL // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -I %S/Inputs/submodules-merge-defs %s -verify -fno-modules-error-recovery -fmodules-local-submodule-visibility -// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules-cache-path=%t -fimplicit-module-maps -I %S/Inputs/submodules-merge-defs %s -verify -fno-modules-error-recovery -fmodules-local-submodule-visibility -DTEXTUAL -DEARLY_INDIRECT_INCLUDE +// RUN: %clang_cc1 -x c++ -std=c++11 -fmodules-cache-path=%t -fimplicit-module-maps -I %S/Inputs/submodules-merge-defs %s -verify -fno-modules-error-recovery -fmodules-local-submodule-visibility -DTEXTUAL -DEARLY_INDIRECT_INCLUDE -fno-modules-hide-internal-linkage // RUN: %clang_cc1 -x c++ -std=c++11 -fmodules-cache-path=%t -fmodules -fimplicit-module-maps -I %S/Inputs/submodules-merge-defs %s -verify -fno-modules-error-recovery -fmodules-local-submodule-visibility -fmodule-feature use_defs_twice -DIMPORT_USE_2 // Trigger import of definitions, but don't make them visible. @@ -27,33 +27,37 @@ int pre_use_a = use_a(pre_a); // expected-error {{'A' must be imported}} expecte B::Inner2 pre_bi; // expected-error +{{must be imported}} // expected-note@defs.h:4 +{{here}} // expected-note@defs.h:11 +{{here}} +void pre_bfi(B b) { // expected-error {{must use 'class'}} expected-error +{{must be imported}} + b.f<int>(); // expected-error +{{must be imported}} expected-error +{{}} + // expected-note@defs.h:12 +{{here}} +} C_Base<1> pre_cb1; // expected-error +{{must be imported}} -// expected-note@defs.h:15 +{{here}} +// expected-note@defs.h:16 +{{here}} C1 pre_c1; // expected-error +{{must be imported}} expected-error {{must use 'struct'}} -// expected-note@defs.h:17 +{{here}} -C2 pre_c2; // expected-error +{{must be imported}} expected-error {{must use 'struct'}} // expected-note@defs.h:18 +{{here}} +C2 pre_c2; // expected-error +{{must be imported}} expected-error {{must use 'struct'}} +// expected-note@defs.h:19 +{{here}} D::X pre_dx; // expected-error +{{must be imported}} -// expected-note@defs.h:20 +{{here}} // expected-note@defs.h:21 +{{here}} +// expected-note@defs.h:22 +{{here}} // FIXME: We should warn that use_dx is being used without being imported. int pre_use_dx = use_dx(pre_dx); int pre_e = E(0); // expected-error {{must be imported}} -// expected-note@defs.h:24 +{{here}} +// expected-note@defs.h:25 +{{here}} int pre_ff = F<int>().f(); // expected-error +{{must be imported}} int pre_fg = F<int>().g<int>(); // expected-error +{{must be imported}} -// expected-note@defs.h:26 +{{here}} +// expected-note@defs.h:27 +{{here}} G::A pre_ga // expected-error +{{must be imported}} = G::a; // expected-error +{{must be imported}} -// expected-note@defs.h:40 +{{here}} -// expected-note@defs.h:41 +{{here}} -decltype(G::h) pre_gh = G::h; // expected-error +{{must be imported}} // expected-note@defs.h:42 +{{here}} +// expected-note@defs.h:43 +{{here}} +decltype(G::h) pre_gh = G::h; // expected-error +{{must be imported}} +// expected-note@defs.h:44 +{{here}} J<> pre_j; // expected-error {{declaration of 'J' must be imported}} #ifdef IMPORT_USE_2 @@ -63,7 +67,7 @@ J<> pre_j; // expected-error {{declaration of 'J' must be imported}} #else // expected-error@-6 {{default argument of 'J' must be imported from module 'stuff.use'}} #endif -// expected-note@defs.h:49 +{{here}} +// expected-note@defs.h:51 +{{here}} // Make definitions from second module visible. #ifdef TEXTUAL @@ -77,6 +81,9 @@ J<> pre_j; // expected-error {{declaration of 'J' must be imported}} A post_a; int post_use_a = use_a(post_a); B::Inner2 post_bi; +void post_bfi(B b) { + b.f<int>(); +} C_Base<1> post_cb1; C1 c1; C2 c2; @@ -92,3 +99,10 @@ template<typename T, int N, template<typename> class K> struct J; J<> post_j2; FriendDefArg::Y<int> friend_def_arg; FriendDefArg::D<> friend_def_arg_d; + +MergeFunctionTemplateSpecializations::X<int>::Q<char> xiqc; + +#ifdef TEXTUAL +#include "use-defs.h" +void use_static_inline() { StaticInline::g({}); } +#endif diff --git a/test/OpenMP/barrier_codegen.cpp b/test/OpenMP/barrier_codegen.cpp index 12d4c44..9e393ac 100644 --- a/test/OpenMP/barrier_codegen.cpp +++ b/test/OpenMP/barrier_codegen.cpp @@ -24,7 +24,7 @@ int main(int argc, char **argv) { static int a; #pragma omp barrier // CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num([[IDENT_T]]* [[LOC]]) - // CHECK: call i32 @__kmpc_cancel_barrier([[IDENT_T]]* [[EXPLICIT_BARRIER_LOC]], i32 [[GTID]]) + // CHECK: call void @__kmpc_barrier([[IDENT_T]]* [[EXPLICIT_BARRIER_LOC]], i32 [[GTID]]) // CHECK: call {{.+}} [[TMAIN_INT:@.+]](i{{[0-9][0-9]}} // CHECK: call {{.+}} [[TMAIN_CHAR:@.+]](i{{[0-9]}} return tmain(argc) + tmain(argv[0][0]) + a; @@ -32,10 +32,10 @@ int main(int argc, char **argv) { // CHECK: define {{.+}} [[TMAIN_INT]]( // CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num([[IDENT_T]]* [[LOC]]) -// CHECK: call i32 @__kmpc_cancel_barrier([[IDENT_T]]* [[EXPLICIT_BARRIER_LOC]], i32 [[GTID]]) +// CHECK: call void @__kmpc_barrier([[IDENT_T]]* [[EXPLICIT_BARRIER_LOC]], i32 [[GTID]]) // CHECK: define {{.+}} [[TMAIN_CHAR]]( // CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num([[IDENT_T]]* [[LOC]]) -// CHECK: call i32 @__kmpc_cancel_barrier([[IDENT_T]]* [[EXPLICIT_BARRIER_LOC]], i32 [[GTID]]) +// CHECK: call void @__kmpc_barrier([[IDENT_T]]* [[EXPLICIT_BARRIER_LOC]], i32 [[GTID]]) #endif diff --git a/test/OpenMP/cancel_ast_print.cpp b/test/OpenMP/cancel_ast_print.cpp new file mode 100644 index 0000000..f244c78 --- /dev/null +++ b/test/OpenMP/cancel_ast_print.cpp @@ -0,0 +1,47 @@ +// RUN: %clang_cc1 -verify -fopenmp -ast-print %s | FileCheck %s +// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s +// expected-no-diagnostics + +#ifndef HEADER +#define HEADER + +int main (int argc, char **argv) { +// CHECK: int main(int argc, char **argv) { +#pragma omp parallel +{ +#pragma omp cancel parallel +} +// CHECK: #pragma omp parallel +// CHECK-NEXT: { +// CHECK-NEXT: #pragma omp cancel parallel +// CHECK-NEXT: } +#pragma omp sections +{ +#pragma omp cancel sections +} +// CHECK-NEXT: #pragma omp sections +// CHECK: { +// CHECK: #pragma omp cancel sections +// CHECK: } +#pragma omp for +for (int i = 0; i < argc; ++i) { +#pragma omp cancel for +} +// CHECK: #pragma omp for +// CHECK-NEXT: for (int i = 0; i < argc; ++i) { +// CHECK-NEXT: #pragma omp cancel for +// CHECK-NEXT: } +#pragma omp task +{ +#pragma omp cancel taskgroup +} +// CHECK: #pragma omp task +// CHECK: { +// CHECK: #pragma omp cancel taskgroup +// CHECK: } +// CHECK: return argc; + return argc; +} + +#endif diff --git a/test/OpenMP/cancel_messages.cpp b/test/OpenMP/cancel_messages.cpp new file mode 100644 index 0000000..0708838 --- /dev/null +++ b/test/OpenMP/cancel_messages.cpp @@ -0,0 +1,83 @@ +// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s + +int main(int argc, char **argv) { +#pragma omp cancellation // expected-error {{expected an OpenMP directive}} +#pragma omp cancel // expected-error {{one of 'for', 'parallel', 'sections' or 'taskgroup' is expected}} + ; +#pragma omp cancel parallel untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp cancel'}} +#pragma omp cancel unknown // expected-error {{one of 'for', 'parallel', 'sections' or 'taskgroup' is expected}} +#pragma omp cancel sections( // expected-warning {{extra tokens at the end of '#pragma omp cancel' are ignored}} +#pragma omp cancel for, ) // expected-warning {{extra tokens at the end of '#pragma omp cancel' are ignored}} +#pragma omp cancel taskgroup() // expected-warning {{extra tokens at the end of '#pragma omp cancel' are ignored}} +#pragma omp cancel parallel, if // expected-warning {{extra tokens at the end of '#pragma omp cancel' are ignored}} + if (argc) +#pragma omp cancel for // expected-error {{'#pragma omp cancel' cannot be an immediate substatement}} + if (argc) { +#pragma omp taskgroup +#pragma omp task +#pragma omp parallel + { +#pragma omp cancel taskgroup // expected-error {{region cannot be closely nested inside 'parallel' region}} + } + } +#pragma omp parallel +#pragma omp taskgroup + { +#pragma omp cancel taskgroup // expected-error {{region cannot be closely nested inside 'taskgroup' region}} + } +#pragma omp parallel + { +#pragma omp cancel for // expected-error {{region cannot be closely nested inside 'parallel' region}} + } +#pragma omp task + { +#pragma omp cancel sections // expected-error {{region cannot be closely nested inside 'task' region}} + } +#pragma omp sections + { +#pragma omp cancel parallel // expected-error {{region cannot be closely nested inside 'sections' region}} + } + while (argc) +#pragma omp cancel for // expected-error {{'#pragma omp cancel' cannot be an immediate substatement}} + while (argc) { +#pragma omp cancel sections + } + do +#pragma omp cancel parallel // expected-error {{'#pragma omp cancel' cannot be an immediate substatement}} + while (argc) + ; + do { +#pragma omp cancel taskgroup + } while (argc); + switch (argc) +#pragma omp cancel parallel // expected-error {{'#pragma omp cancel' cannot be an immediate substatement}} + switch (argc) + case 1: +#pragma omp cancel sections // expected-error {{'#pragma omp cancel' cannot be an immediate substatement}} + switch (argc) + case 1: { +#pragma omp cancel for + } + switch (argc) { +#pragma omp cancel taskgroup + case 1: +#pragma omp cancel parallel // expected-error {{'#pragma omp cancel' cannot be an immediate substatement}} + break; + default: { +#pragma omp cancel sections + } break; + } + for (;;) +#pragma omp cancel for // expected-error {{'#pragma omp cancel' cannot be an immediate substatement}} + for (;;) { +#pragma omp cancel taskgroup + } +label: +#pragma omp cancel parallel // expected-error {{'#pragma omp cancel' cannot be an immediate substatement}} +label1 : { +#pragma omp cancel sections +} + + return 0; +} + diff --git a/test/OpenMP/cancellation_point_ast_print.cpp b/test/OpenMP/cancellation_point_ast_print.cpp new file mode 100644 index 0000000..c8b133c --- /dev/null +++ b/test/OpenMP/cancellation_point_ast_print.cpp @@ -0,0 +1,47 @@ +// RUN: %clang_cc1 -verify -fopenmp -ast-print %s | FileCheck %s +// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s +// expected-no-diagnostics + +#ifndef HEADER +#define HEADER + +int main (int argc, char **argv) { +// CHECK: int main(int argc, char **argv) { +#pragma omp parallel +{ +#pragma omp cancellation point parallel +} +// CHECK: #pragma omp parallel +// CHECK-NEXT: { +// CHECK-NEXT: #pragma omp cancellation point parallel +// CHECK-NEXT: } +#pragma omp sections +{ +#pragma omp cancellation point sections +} +// CHECK-NEXT: #pragma omp sections +// CHECK: { +// CHECK: #pragma omp cancellation point sections +// CHECK: } +#pragma omp for +for (int i = 0; i < argc; ++i) { +#pragma omp cancellation point for +} +// CHECK: #pragma omp for +// CHECK-NEXT: for (int i = 0; i < argc; ++i) { +// CHECK-NEXT: #pragma omp cancellation point for +// CHECK-NEXT: } +#pragma omp task +{ +#pragma omp cancellation point taskgroup +} +// CHECK: #pragma omp task +// CHECK: { +// CHECK: #pragma omp cancellation point taskgroup +// CHECK: } +// CHECK: return argc; + return argc; +} + +#endif diff --git a/test/OpenMP/cancellation_point_codegen.cpp b/test/OpenMP/cancellation_point_codegen.cpp new file mode 100644 index 0000000..47903c1 --- /dev/null +++ b/test/OpenMP/cancellation_point_codegen.cpp @@ -0,0 +1,95 @@ +// RUN: %clang_cc1 -verify -fopenmp -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-apple-darwin13.4.0 -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -fsyntax-only -verify %s -triple x86_64-apple-darwin13.4.0 -emit-llvm -o - | FileCheck %s +// expected-no-diagnostics + +#ifndef HEADER +#define HEADER + +int main (int argc, char **argv) { +// CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num( +#pragma omp parallel +{ +#pragma omp cancellation point parallel + argv[0][0] = argc; +} +// CHECK: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call( +#pragma omp sections +{ +#pragma omp cancellation point sections +} +// CHECK: call i32 @__kmpc_single( +// CHECK-NOT: @__kmpc_cancellationpoint +// CHECK: call void @__kmpc_end_single( +// CHECK: call void @__kmpc_barrier(%ident_t* +#pragma omp sections +{ +#pragma omp cancellation point sections +#pragma omp section + { +#pragma omp cancellation point sections + } +} +// CHECK: call void @__kmpc_for_static_init_4( +// CHECK: [[RES:%.+]] = call i32 @__kmpc_cancellationpoint(%ident_t* {{[^,]+}}, i32 [[GTID]], i32 3) +// CHECK: [[CMP:%.+]] = icmp ne i32 [[RES]], 0 +// CHECK: br i1 [[CMP]], label %[[EXIT:[^,].+]], label %[[CONTINUE:.+]] +// CHECK: [[EXIT]] +// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* +// CHECK: br label +// CHECK: [[CONTINUE]] +// CHECK: br label +// CHECK: [[RES:%.+]] = call i32 @__kmpc_cancellationpoint(%ident_t* {{[^,]+}}, i32 [[GTID]], i32 3) +// CHECK: [[CMP:%.+]] = icmp ne i32 [[RES]], 0 +// CHECK: br i1 [[CMP]], label %[[EXIT:[^,].+]], label %[[CONTINUE:.+]] +// CHECK: [[EXIT]] +// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* +// CHECK: br label +// CHECK: [[CONTINUE]] +// CHECK: br label +// CHECK: call void @__kmpc_for_static_fini( +#pragma omp for +for (int i = 0; i < argc; ++i) { +#pragma omp cancellation point for +} +// CHECK: call void @__kmpc_for_static_init_4( +// CHECK: [[RES:%.+]] = call i32 @__kmpc_cancellationpoint(%ident_t* {{[^,]+}}, i32 [[GTID]], i32 2) +// CHECK: [[CMP:%.+]] = icmp ne i32 [[RES]], 0 +// CHECK: br i1 [[CMP]], label %[[EXIT:[^,].+]], label %[[CONTINUE:.+]] +// CHECK: [[EXIT]] +// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* +// CHECK: br label +// CHECK: [[CONTINUE]] +// CHECK: br label +// CHECK: call void @__kmpc_for_static_fini( +// CHECK: call void @__kmpc_barrier(%ident_t* +#pragma omp task +{ +#pragma omp cancellation point taskgroup +} +// CHECK: call i8* @__kmpc_omp_task_alloc( +// CHECK: call i32 @__kmpc_omp_task( + return argc; +} + +// CHECK: define internal void @{{[^(]+}}(i32* {{[^,]+}}, i32* {{[^,]+}}, +// CHECK: [[RES:%.+]] = call i32 @__kmpc_cancellationpoint(%ident_t* {{[^,]+}}, i32 {{[^,]+}}, i32 1) +// CHECK: [[CMP:%.+]] = icmp ne i32 [[RES]], 0 +// CHECK: br i1 [[CMP]], label %[[EXIT:[^,]+]], +// CHECK: [[EXIT]] +// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* +// CHECK: br label %[[RETURN:.+]] +// CHECK: [[RETURN]] +// CHECK: ret void + +// CHECK: define internal i32 @{{[^(]+}}(i32 +// CHECK: [[RES:%.+]] = call i32 @__kmpc_cancellationpoint(%ident_t* {{[^,]+}}, i32 {{[^,]+}}, i32 4) +// CHECK: [[CMP:%.+]] = icmp ne i32 [[RES]], 0 +// CHECK: br i1 [[CMP]], label %[[EXIT:[^,]+]], +// CHECK: [[EXIT]] +// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* +// CHECK: br label %[[RETURN:.+]] +// CHECK: [[RETURN]] +// CHECK: ret i32 0 + +#endif diff --git a/test/OpenMP/cancellation_point_messages.cpp b/test/OpenMP/cancellation_point_messages.cpp new file mode 100644 index 0000000..d25cb61 --- /dev/null +++ b/test/OpenMP/cancellation_point_messages.cpp @@ -0,0 +1,83 @@ +// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s + +int main(int argc, char **argv) { +#pragma omp cancellation // expected-error {{expected an OpenMP directive}} +#pragma omp cancellation point // expected-error {{one of 'for', 'parallel', 'sections' or 'taskgroup' is expected}} + ; +#pragma omp cancellation point parallel untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp cancellation point'}} +#pragma omp cancellation point unknown // expected-error {{one of 'for', 'parallel', 'sections' or 'taskgroup' is expected}} +#pragma omp cancellation point sections( // expected-warning {{extra tokens at the end of '#pragma omp cancellation point' are ignored}} +#pragma omp cancellation point for, ) // expected-warning {{extra tokens at the end of '#pragma omp cancellation point' are ignored}} +#pragma omp cancellation point taskgroup() // expected-warning {{extra tokens at the end of '#pragma omp cancellation point' are ignored}} +#pragma omp cancellation point parallel, if // expected-warning {{extra tokens at the end of '#pragma omp cancellation point' are ignored}} + if (argc) +#pragma omp cancellation point for // expected-error {{'#pragma omp cancellation point' cannot be an immediate substatement}} + if (argc) { +#pragma omp taskgroup +#pragma omp task +#pragma omp parallel + { +#pragma omp cancellation point taskgroup // expected-error {{region cannot be closely nested inside 'parallel' region}} + } + } +#pragma omp parallel +#pragma omp taskgroup + { +#pragma omp cancellation point taskgroup // expected-error {{region cannot be closely nested inside 'taskgroup' region}} + } +#pragma omp parallel + { +#pragma omp cancellation point for // expected-error {{region cannot be closely nested inside 'parallel' region}} + } +#pragma omp task + { +#pragma omp cancellation point sections // expected-error {{region cannot be closely nested inside 'task' region}} + } +#pragma omp sections + { +#pragma omp cancellation point parallel // expected-error {{region cannot be closely nested inside 'sections' region}} + } + while (argc) +#pragma omp cancellation point for // expected-error {{'#pragma omp cancellation point' cannot be an immediate substatement}} + while (argc) { +#pragma omp cancellation point sections + } + do +#pragma omp cancellation point parallel // expected-error {{'#pragma omp cancellation point' cannot be an immediate substatement}} + while (argc) + ; + do { +#pragma omp cancellation point taskgroup + } while (argc); + switch (argc) +#pragma omp cancellation point parallel // expected-error {{'#pragma omp cancellation point' cannot be an immediate substatement}} + switch (argc) + case 1: +#pragma omp cancellation point sections // expected-error {{'#pragma omp cancellation point' cannot be an immediate substatement}} + switch (argc) + case 1: { +#pragma omp cancellation point for + } + switch (argc) { +#pragma omp cancellation point taskgroup + case 1: +#pragma omp cancellation point parallel // expected-error {{'#pragma omp cancellation point' cannot be an immediate substatement}} + break; + default: { +#pragma omp cancellation point sections + } break; + } + for (;;) +#pragma omp cancellation point for // expected-error {{'#pragma omp cancellation point' cannot be an immediate substatement}} + for (;;) { +#pragma omp cancellation point taskgroup + } +label: +#pragma omp cancellation point parallel // expected-error {{'#pragma omp cancellation point' cannot be an immediate substatement}} +label1 : { +#pragma omp cancellation point sections +} + + return 0; +} + diff --git a/test/OpenMP/critical_codegen.cpp b/test/OpenMP/critical_codegen.cpp index d350d6e..26f5edb 100644 --- a/test/OpenMP/critical_codegen.cpp +++ b/test/OpenMP/critical_codegen.cpp @@ -11,7 +11,7 @@ // CHECK: [[UNNAMED_LOCK:@.+]] = common global [8 x i32] zeroinitializer // CHECK: [[THE_NAME_LOCK:@.+]] = common global [8 x i32] zeroinitializer -// CHECK: define void [[FOO:@.+]]() +// CHECK: define {{.*}}void [[FOO:@.+]]() void foo() {} @@ -21,15 +21,15 @@ int main() { // CHECK: [[A_ADDR:%.+]] = alloca i8 char a; -// CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEFAULT_LOC:@.+]]) -// CHECK: call void @__kmpc_critical([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]], [8 x i32]* [[UNNAMED_LOCK]]) +// CHECK: [[GTID:%.+]] = call {{.*}}i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEFAULT_LOC:@.+]]) +// CHECK: call {{.*}}void @__kmpc_critical([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]], [8 x i32]* [[UNNAMED_LOCK]]) // CHECK-NEXT: store i8 2, i8* [[A_ADDR]] -// CHECK-NEXT: call void @__kmpc_end_critical([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]], [8 x i32]* [[UNNAMED_LOCK]]) +// CHECK-NEXT: call {{.*}}void @__kmpc_end_critical([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]], [8 x i32]* [[UNNAMED_LOCK]]) #pragma omp critical a = 2; -// CHECK: call void @__kmpc_critical([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]], [8 x i32]* [[THE_NAME_LOCK]]) -// CHECK-NEXT: invoke void [[FOO]]() -// CHECK: call void @__kmpc_end_critical([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]], [8 x i32]* [[THE_NAME_LOCK]]) +// CHECK: call {{.*}}void @__kmpc_critical([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]], [8 x i32]* [[THE_NAME_LOCK]]) +// CHECK-NEXT: invoke {{.*}}void [[FOO]]() +// CHECK: call {{.*}}void @__kmpc_end_critical([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]], [8 x i32]* [[THE_NAME_LOCK]]) #pragma omp critical(the_name) foo(); // CHECK-NOT: call void @__kmpc_critical diff --git a/test/OpenMP/flush_codegen.cpp b/test/OpenMP/flush_codegen.cpp index 2c41b3a..4ebdf52 100644 --- a/test/OpenMP/flush_codegen.cpp +++ b/test/OpenMP/flush_codegen.cpp @@ -19,16 +19,16 @@ int main() { static int a; #pragma omp flush #pragma omp flush(a) - // CHECK: call void @__kmpc_flush(%{{.+}}* {{(@|%).+}}) - // CHECK: call void @__kmpc_flush(%{{.+}}* {{(@|%).+}}) + // CHECK: call {{.*}}void @__kmpc_flush(%{{.+}}* {{(@|%).+}}) + // CHECK: call {{.*}}void @__kmpc_flush(%{{.+}}* {{(@|%).+}}) return tmain(a); // CHECK: call {{.*}} [[TMAIN:@.+]]( // CHECK: ret } // CHECK: [[TMAIN]] -// CHECK: call void @__kmpc_flush(%{{.+}}* {{(@|%).+}}) -// CHECK: call void @__kmpc_flush(%{{.+}}* {{(@|%).+}}) +// CHECK: call {{.*}}void @__kmpc_flush(%{{.+}}* {{(@|%).+}}) +// CHECK: call {{.*}}void @__kmpc_flush(%{{.+}}* {{(@|%).+}}) // CHECK: ret #endif diff --git a/test/OpenMP/for_codegen.cpp b/test/OpenMP/for_codegen.cpp index 5dcacb2..30cf484 100644 --- a/test/OpenMP/for_codegen.cpp +++ b/test/OpenMP/for_codegen.cpp @@ -50,7 +50,7 @@ void without_schedule_clause(float *a, float *b, float *c, float *d) { } // CHECK: [[LOOP1_END]] // CHECK: call void @__kmpc_for_static_fini([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) -// CHECK-NOT: __kmpc_cancel_barrier +// CHECK-NOT: __kmpc_barrier // CHECK: ret void } @@ -91,7 +91,7 @@ void static_not_chunked(float *a, float *b, float *c, float *d) { } // CHECK: [[LOOP1_END]] // CHECK: call void @__kmpc_for_static_fini([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) -// CHECK: call {{.+}} @__kmpc_cancel_barrier([[IDENT_T_TY]]* [[IMPLICIT_BARRIER_LOC]], i32 [[GTID]]) +// CHECK: call {{.+}} @__kmpc_barrier([[IDENT_T_TY]]* [[IMPLICIT_BARRIER_LOC]], i32 [[GTID]]) // CHECK: ret void } @@ -151,7 +151,7 @@ void static_chunked(float *a, float *b, float *c, float *d) { // CHECK: [[O_LOOP1_END]] // CHECK: call void @__kmpc_for_static_fini([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) -// CHECK: call {{.+}} @__kmpc_cancel_barrier([[IDENT_T_TY]]* [[IMPLICIT_BARRIER_LOC]], i32 [[GTID]]) +// CHECK: call {{.+}} @__kmpc_barrier([[IDENT_T_TY]]* [[IMPLICIT_BARRIER_LOC]], i32 [[GTID]]) // CHECK: ret void } @@ -192,7 +192,7 @@ void dynamic1(float *a, float *b, float *c, float *d) { } // CHECK: [[LOOP1_END]] // CHECK: [[O_LOOP1_END]] -// CHECK: call {{.+}} @__kmpc_cancel_barrier([[IDENT_T_TY]]* [[IMPLICIT_BARRIER_LOC]], i32 [[GTID]]) +// CHECK: call {{.+}} @__kmpc_barrier([[IDENT_T_TY]]* [[IMPLICIT_BARRIER_LOC]], i32 [[GTID]]) // CHECK: ret void } @@ -233,7 +233,7 @@ void guided7(float *a, float *b, float *c, float *d) { } // CHECK: [[LOOP1_END]] // CHECK: [[O_LOOP1_END]] -// CHECK: call {{.+}} @__kmpc_cancel_barrier([[IDENT_T_TY]]* [[IMPLICIT_BARRIER_LOC]], i32 [[GTID]]) +// CHECK: call {{.+}} @__kmpc_barrier([[IDENT_T_TY]]* [[IMPLICIT_BARRIER_LOC]], i32 [[GTID]]) // CHECK: ret void } @@ -278,7 +278,7 @@ void test_auto(float *a, float *b, float *c, float *d) { } // CHECK: [[LOOP1_END]] // CHECK: [[O_LOOP1_END]] -// CHECK: call {{.+}} @__kmpc_cancel_barrier([[IDENT_T_TY]]* [[IMPLICIT_BARRIER_LOC]], i32 [[GTID]]) +// CHECK: call {{.+}} @__kmpc_barrier([[IDENT_T_TY]]* [[IMPLICIT_BARRIER_LOC]], i32 [[GTID]]) // CHECK: ret void } @@ -320,7 +320,7 @@ void runtime(float *a, float *b, float *c, float *d) { } // CHECK: [[LOOP1_END]] // CHECK: [[O_LOOP1_END]] -// CHECK: call {{.+}} @__kmpc_cancel_barrier([[IDENT_T_TY]]* [[IMPLICIT_BARRIER_LOC]], i32 [[GTID]]) +// CHECK: call {{.+}} @__kmpc_barrier([[IDENT_T_TY]]* [[IMPLICIT_BARRIER_LOC]], i32 [[GTID]]) // CHECK: ret void } diff --git a/test/OpenMP/for_firstprivate_codegen.cpp b/test/OpenMP/for_firstprivate_codegen.cpp index 2402b50..1ef3866 100644 --- a/test/OpenMP/for_firstprivate_codegen.cpp +++ b/test/OpenMP/for_firstprivate_codegen.cpp @@ -82,7 +82,7 @@ int main() { // LAMBDA: [[G_PRIVATE_ADDR:%.+]] = alloca i{{[0-9]+}}, // LAMBDA: [[G_VAL:%.+]] = load volatile i{{[0-9]+}}, i{{[0-9]+}}* [[G]] // LAMBDA: store i{{[0-9]+}} [[G_VAL]], i{{[0-9]+}}* [[G_PRIVATE_ADDR]] - // LAMBDA: call i32 @__kmpc_cancel_barrier( + // LAMBDA: call void @__kmpc_barrier( g = 1; // LAMBDA: call void @__kmpc_for_static_init_4( // LAMBDA: store volatile i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], @@ -123,7 +123,7 @@ int main() { // BLOCKS: [[G_PRIVATE_ADDR:%.+]] = alloca i{{[0-9]+}}, // BLOCKS: [[G_VAL:%.+]] = load volatile i{{[0-9]+}}, i{{[0-9]+}}* [[G]] // BLOCKS: store i{{[0-9]+}} [[G_VAL]], i{{[0-9]+}}* [[G_PRIVATE_ADDR]] - // BLOCKS: call i32 @__kmpc_cancel_barrier( + // BLOCKS: call void @__kmpc_barrier( g = 1; // BLOCKS: call void @__kmpc_for_static_init_4( // BLOCKS: store volatile i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], @@ -194,7 +194,7 @@ int main() { // CHECK: call {{.*}} [[ST_TY_DESTR]]([[ST_TY]]* [[ST_TY_TEMP]]) // Synchronization for initialization. -// CHECK: call i32 @__kmpc_cancel_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], i{{[0-9]+}} [[GTID]]) +// CHECK: call void @__kmpc_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], i{{[0-9]+}} [[GTID]]) // CHECK: call void @__kmpc_for_static_init_4( // CHECK: call void @__kmpc_for_static_fini( @@ -202,7 +202,7 @@ int main() { // ~(firstprivate var), ~(firstprivate s_arr) // CHECK-DAG: call {{.*}} [[S_FLOAT_TY_DESTR]]([[S_FLOAT_TY]]* [[VAR_PRIV]]) // CHECK-DAG: call {{.*}} [[S_FLOAT_TY_DESTR]]([[S_FLOAT_TY]]* -// CHECK: call i32 @__kmpc_cancel_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], i{{[0-9]+}} [[GTID]]) +// CHECK: call void @__kmpc_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], i{{[0-9]+}} [[GTID]]) // CHECK: = call {{.*}}i{{.+}} [[TMAIN_INT:@.+]]() @@ -264,7 +264,7 @@ int main() { // Synchronization for initialization. // CHECK: [[GTID_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[GTID_ADDR_ADDR]] // CHECK: [[GTID:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[GTID_REF]] -// CHECK: call i32 @__kmpc_cancel_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], i{{[0-9]+}} [[GTID]]) +// CHECK: call void @__kmpc_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], i{{[0-9]+}} [[GTID]]) // CHECK: call void @__kmpc_for_static_init_4( // CHECK: call void @__kmpc_for_static_fini( diff --git a/test/OpenMP/for_private_codegen.cpp b/test/OpenMP/for_private_codegen.cpp index 8fc5fe7..8172912 100644 --- a/test/OpenMP/for_private_codegen.cpp +++ b/test/OpenMP/for_private_codegen.cpp @@ -19,9 +19,10 @@ struct S { volatile double g; // CHECK: [[S_FLOAT_TY:%.+]] = type { float } -// CHECK: [[CAP_MAIN_TY:%.+]] = type { i{{[0-9]+}}*, [2 x i{{[0-9]+}}]*, [2 x [[S_FLOAT_TY]]]*, [[S_FLOAT_TY]]* } +// CHECK: [[CAP_MAIN_TY:%.+]] = type { i8 } +// CHECK: type { i8 } // CHECK: [[S_INT_TY:%.+]] = type { i{{[0-9]+}} } -// CHECK: [[CAP_TMAIN_TY:%.+]] = type { i{{[0-9]+}}*, [2 x i{{[0-9]+}}]*, [2 x [[S_INT_TY]]]*, [[S_INT_TY]]* } +// CHECK: [[CAP_TMAIN_TY:%.+]] = type { i8 } template <typename T> T tmain() { S<T> test; @@ -42,10 +43,10 @@ int main() { #ifdef LAMBDA // LAMBDA: [[G:@.+]] = global double // LAMBDA-LABEL: @main - // LAMBDA: call{{( x86_thiscallcc)?}} void [[OUTER_LAMBDA:@.+]]( + // LAMBDA: call{{.*}} void [[OUTER_LAMBDA:@.+]]( [&]() { // LAMBDA: define{{.*}} internal{{.*}} void [[OUTER_LAMBDA]]( - // LAMBDA: call void {{.+}} @__kmpc_fork_call({{.+}}, i32 1, {{.+}}* [[OMP_REGION:@.+]] to {{.+}}, i8* %{{.+}}) + // LAMBDA: call {{.*}}void {{.+}} @__kmpc_fork_call({{.+}}, i32 1, {{.+}}* [[OMP_REGION:@.+]] to {{.+}}, i8* %{{.+}}) #pragma omp parallel #pragma omp for private(g) for (int i = 0; i < 2; ++i) { @@ -53,12 +54,12 @@ int main() { // LAMBDA: [[G_PRIVATE_ADDR:%.+]] = alloca double, // LAMBDA: store %{{.+}}* [[ARG]], %{{.+}}** [[ARG_REF:%.+]], g = 1; - // LAMBDA: call void @__kmpc_for_static_init_4( + // LAMBDA: call {{.*}}void @__kmpc_for_static_init_4( // LAMBDA: store volatile double 1.0{{.+}}, double* [[G_PRIVATE_ADDR]], // LAMBDA: [[G_PRIVATE_ADDR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // LAMBDA: store double* [[G_PRIVATE_ADDR]], double** [[G_PRIVATE_ADDR_REF]] - // LAMBDA: call{{( x86_thiscallcc)?}} void [[INNER_LAMBDA:@.+]](%{{.+}}* [[ARG]]) - // LAMBDA: call void @__kmpc_for_static_fini( + // LAMBDA: call{{.*}} void [[INNER_LAMBDA:@.+]](%{{.+}}* [[ARG]]) + // LAMBDA: call {{.*}}void @__kmpc_for_static_fini( [&]() { // LAMBDA: define {{.+}} void [[INNER_LAMBDA]](%{{.+}}* [[ARG_PTR:%.+]]) // LAMBDA: store %{{.+}}* [[ARG_PTR]], %{{.+}}** [[ARG_PTR_REF:%.+]], @@ -74,10 +75,10 @@ int main() { #elif defined(BLOCKS) // BLOCKS: [[G:@.+]] = global double // BLOCKS-LABEL: @main - // BLOCKS: call void {{%.+}}(i8 + // BLOCKS: call {{.*}}void {{%.+}}(i8 ^{ // BLOCKS: define{{.*}} internal{{.*}} void {{.+}}(i8* - // BLOCKS: call void {{.+}} @__kmpc_fork_call({{.+}}, i32 1, {{.+}}* [[OMP_REGION:@.+]] to {{.+}}, i8* {{.+}}) + // BLOCKS: call {{.*}}void {{.+}} @__kmpc_fork_call({{.+}}, i32 1, {{.+}}* [[OMP_REGION:@.+]] to {{.+}}, i8* {{.+}}) #pragma omp parallel #pragma omp for private(g) for (int i = 0; i < 2; ++i) { @@ -85,13 +86,13 @@ int main() { // BLOCKS: [[G_PRIVATE_ADDR:%.+]] = alloca double, // BLOCKS: store %{{.+}}* [[ARG]], %{{.+}}** [[ARG_REF:%.+]], g = 1; - // BLOCKS: call void @__kmpc_for_static_init_4( + // BLOCKS: call {{.*}}void @__kmpc_for_static_init_4( // BLOCKS: store volatile double 1.0{{.+}}, double* [[G_PRIVATE_ADDR]], // BLOCKS-NOT: [[G]]{{[[^:word:]]}} // BLOCKS: double* [[G_PRIVATE_ADDR]] // BLOCKS-NOT: [[G]]{{[[^:word:]]}} - // BLOCKS: call void {{%.+}}(i8 - // BLOCKS: call void @__kmpc_for_static_fini( + // BLOCKS: call {{.*}}void {{%.+}}(i8 + // BLOCKS: call {{.*}}void @__kmpc_for_static_fini( ^{ // BLOCKS: define {{.+}} void {{@.+}}(i8* g = 2; diff --git a/test/OpenMP/for_simd_codegen.cpp b/test/OpenMP/for_simd_codegen.cpp index 00ec6cb..9361192 100644 --- a/test/OpenMP/for_simd_codegen.cpp +++ b/test/OpenMP/for_simd_codegen.cpp @@ -50,7 +50,7 @@ void simple(float *a, float *b, float *c, float *d) { } // CHECK: [[SIMPLE_LOOP1_END]] // CHECK: call void @__kmpc_for_static_fini(%ident_t* {{.+}}, i32 %{{.+}}) -// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: call void @__kmpc_barrier(%ident_t* {{.+}}, i32 %{{.+}}) long long k = get_val(); @@ -101,7 +101,7 @@ void simple(float *a, float *b, float *c, float *d) { // CHECK: [[LIN0_2:%.+]] = load i64, i64* [[LIN0]] // CHECK-NEXT: [[LIN_ADD2:%.+]] = add nsw i64 [[LIN0_2]], 27 // CHECK-NEXT: store i64 [[LIN_ADD2]], i64* [[K_VAR]] -// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: call void @__kmpc_barrier(%ident_t* {{.+}}, i32 %{{.+}}) int lin = 12; #pragma omp for simd linear(lin : get_val()), linear(g_ptr) @@ -172,7 +172,7 @@ void simple(float *a, float *b, float *c, float *d) { // CHECK: store i32 {{.+}}, i32* [[LIN_VAR]], // CHECK: [[GLINSTART:.+]] = load double*, double** [[GLIN_START]] // CHECK: store double* {{.*}}[[GLIN_VAR]] -// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: call void @__kmpc_barrier(%ident_t* {{.+}}, i32 %{{.+}}) #pragma omp for simd // CHECK: call void @__kmpc_for_static_init_4(%ident_t* {{[^,]+}}, i32 %{{[^,]+}}, i32 34, i32* %{{[^,]+}}, i32* [[LB:%[^,]+]], i32* [[UB:%[^,]+]], i32* [[STRIDE:%[^,]+]], i32 1, i32 1) @@ -209,7 +209,7 @@ void simple(float *a, float *b, float *c, float *d) { } // CHECK: [[SIMPLE_LOOP4_END]] // CHECK: call void @__kmpc_for_static_fini(%ident_t* {{.+}}, i32 %{{.+}}) -// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: call void @__kmpc_barrier(%ident_t* {{.+}}, i32 %{{.+}}) #pragma omp for simd // CHECK: call void @__kmpc_for_static_init_4(%ident_t* {{[^,]+}}, i32 %{{[^,]+}}, i32 34, i32* %{{[^,]+}}, i32* [[LB:%[^,]+]], i32* [[UB:%[^,]+]], i32* [[STRIDE:%[^,]+]], i32 1, i32 1) @@ -246,7 +246,7 @@ void simple(float *a, float *b, float *c, float *d) { } // CHECK: [[SIMPLE_LOOP5_END]] // CHECK: call void @__kmpc_for_static_fini(%ident_t* {{.+}}, i32 %{{.+}}) -// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: call void @__kmpc_barrier(%ident_t* {{.+}}, i32 %{{.+}}) // CHECK-NOT: mul i32 %{{.+}}, 10 #pragma omp for simd @@ -413,7 +413,7 @@ int templ1(T a, T *z) { // CHECK-NEXT: br label {{%.+}} // CHECK: [[T1_END]] // CHECK: call void @__kmpc_for_static_fini(%ident_t* {{.+}}, i32 %{{.+}}) -// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: call void @__kmpc_barrier(%ident_t* {{.+}}, i32 %{{.+}}) // CHECK: ret i32 0 // void inst_templ1() { @@ -505,7 +505,7 @@ void iter_simple(IterDouble ia, IterDouble ib, IterDouble ic) { } // CHECK: [[IT_END]] // CHECK: call void @__kmpc_for_static_fini(%ident_t* {{.+}}, i32 %{{.+}}) -// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: call void @__kmpc_barrier(%ident_t* {{.+}}, i32 %{{.+}}) // CHECK: ret void } @@ -584,7 +584,7 @@ void collapsed(float *a, float *b, float *c, float *d) { // CHECK-NEXT: store i32 3, i32* [[I:%[^,]+]] // CHECK-NEXT: store i32 5, i32* [[I:%[^,]+]] // CHECK-NEXT: store i16 9, i16* [[I:%[^,]+]] -// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: call void @__kmpc_barrier(%ident_t* {{.+}}, i32 %{{.+}}) // CHECK: ret void } diff --git a/test/OpenMP/master_codegen.cpp b/test/OpenMP/master_codegen.cpp index 1eb47e4..e6ea21a 100644 --- a/test/OpenMP/master_codegen.cpp +++ b/test/OpenMP/master_codegen.cpp @@ -9,7 +9,7 @@ // CHECK: [[IDENT_T_TY:%.+]] = type { i32, i32, i32, i32, i8* } -// CHECK: define void [[FOO:@.+]]() +// CHECK: define {{.*}}void [[FOO:@.+]]() void foo() {} @@ -19,23 +19,23 @@ int main() { // CHECK: [[A_ADDR:%.+]] = alloca i8 char a; -// CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEFAULT_LOC:@.+]]) -// CHECK: [[RES:%.+]] = call i32 @__kmpc_master([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) +// CHECK: [[GTID:%.+]] = call {{.*}}i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEFAULT_LOC:@.+]]) +// CHECK: [[RES:%.+]] = call {{.*}}i32 @__kmpc_master([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) // CHECK-NEXT: [[IS_MASTER:%.+]] = icmp ne i32 [[RES]], 0 // CHECK-NEXT: br i1 [[IS_MASTER]], label {{%?}}[[THEN:.+]], label {{%?}}[[EXIT:.+]] // CHECK: [[THEN]] // CHECK-NEXT: store i8 2, i8* [[A_ADDR]] -// CHECK-NEXT: call void @__kmpc_end_master([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) +// CHECK-NEXT: call {{.*}}void @__kmpc_end_master([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) // CHECK-NEXT: br label {{%?}}[[EXIT]] // CHECK: [[EXIT]] #pragma omp master a = 2; -// CHECK: [[RES:%.+]] = call i32 @__kmpc_master([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) +// CHECK: [[RES:%.+]] = call {{.*}}i32 @__kmpc_master([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) // CHECK-NEXT: [[IS_MASTER:%.+]] = icmp ne i32 [[RES]], 0 // CHECK-NEXT: br i1 [[IS_MASTER]], label {{%?}}[[THEN:.+]], label {{%?}}[[EXIT:.+]] // CHECK: [[THEN]] -// CHECK-NEXT: invoke void [[FOO]]() -// CHECK: call void @__kmpc_end_master([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) +// CHECK-NEXT: invoke {{.*}}void [[FOO]]() +// CHECK: call {{.*}}void @__kmpc_end_master([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) // CHECK-NEXT: br label {{%?}}[[EXIT]] // CHECK: [[EXIT]] #pragma omp master diff --git a/test/OpenMP/ordered_codegen.cpp b/test/OpenMP/ordered_codegen.cpp index adc6ff6..7684623 100644 --- a/test/OpenMP/ordered_codegen.cpp +++ b/test/OpenMP/ordered_codegen.cpp @@ -53,7 +53,7 @@ void static_not_chunked(float *a, float *b, float *c, float *d) { } // CHECK: [[LOOP1_END]] // CHECK: [[O_LOOP1_END]] -// CHECK: call {{.+}} @__kmpc_cancel_barrier([[IDENT_T_TY]]* [[IMPLICIT_BARRIER_LOC]], i32 [[GTID]]) +// CHECK: call {{.+}} @__kmpc_barrier([[IDENT_T_TY]]* [[IMPLICIT_BARRIER_LOC]], i32 [[GTID]]) // CHECK: ret void } @@ -104,7 +104,7 @@ void dynamic1(float *a, float *b, float *c, float *d) { } // CHECK: [[LOOP1_END]] // CHECK: [[O_LOOP1_END]] -// CHECK: call {{.+}} @__kmpc_cancel_barrier([[IDENT_T_TY]]* [[IMPLICIT_BARRIER_LOC]], i32 [[GTID]]) +// CHECK: call {{.+}} @__kmpc_barrier([[IDENT_T_TY]]* [[IMPLICIT_BARRIER_LOC]], i32 [[GTID]]) // CHECK: ret void } @@ -158,7 +158,7 @@ void test_auto(float *a, float *b, float *c, float *d) { } // CHECK: [[LOOP1_END]] // CHECK: [[O_LOOP1_END]] -// CHECK: call {{.+}} @__kmpc_cancel_barrier([[IDENT_T_TY]]* [[IMPLICIT_BARRIER_LOC]], i32 [[GTID]]) +// CHECK: call {{.+}} @__kmpc_barrier([[IDENT_T_TY]]* [[IMPLICIT_BARRIER_LOC]], i32 [[GTID]]) // CHECK: ret void } @@ -209,7 +209,7 @@ void runtime(float *a, float *b, float *c, float *d) { } // CHECK: [[LOOP1_END]] // CHECK: [[O_LOOP1_END]] -// CHECK: call {{.+}} @__kmpc_cancel_barrier([[IDENT_T_TY]]* [[IMPLICIT_BARRIER_LOC]], i32 [[GTID]]) +// CHECK: call {{.+}} @__kmpc_barrier([[IDENT_T_TY]]* [[IMPLICIT_BARRIER_LOC]], i32 [[GTID]]) // CHECK: ret void } diff --git a/test/OpenMP/parallel_codegen.cpp b/test/OpenMP/parallel_codegen.cpp index 16c9c59..907d135 100644 --- a/test/OpenMP/parallel_codegen.cpp +++ b/test/OpenMP/parallel_codegen.cpp @@ -34,14 +34,14 @@ int main (int argc, char **argv) { return tmain(argv); } -// CHECK-LABEL: define {{[a-z]*[ ]?i32}} @main({{i32[ ]?[a-z]*}} %argc, i8** %argv) +// CHECK-LABEL: define {{[a-z\_\b]*[ ]?i32}} @main({{i32[ ]?[a-z]*}} %argc, i8** %argv) // CHECK: [[AGG_CAPTURED:%.+]] = alloca %struct.anon // CHECK: [[ARGC_REF:%.+]] = getelementptr inbounds %struct.anon, %struct.anon* [[AGG_CAPTURED]], i32 0, i32 0 // CHECK-NEXT: store i32* {{%[a-z0-9.]+}}, i32** [[ARGC_REF]] // CHECK-NEXT: [[BITCAST:%.+]] = bitcast %struct.anon* [[AGG_CAPTURED]] to i8* -// CHECK-NEXT: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(%ident_t* [[DEF_LOC_2]], i32 1, void (i32*, i32*, ...)* bitcast (void (i32*, i32*, %struct.anon*)* [[OMP_OUTLINED:@.+]] to void (i32*, i32*, ...)*), i8* [[BITCAST]]) +// CHECK-NEXT: call {{.*}}void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(%ident_t* [[DEF_LOC_2]], i32 1, void (i32*, i32*, ...)* bitcast (void (i32*, i32*, %struct.anon*)* [[OMP_OUTLINED:@.+]] to void (i32*, i32*, ...)*), i8* [[BITCAST]]) // CHECK-NEXT: [[ARGV:%.+]] = load i8**, i8*** {{%[a-z0-9.]+}} -// CHECK-NEXT: [[RET:%.+]] = call {{[a-z]*[ ]?i32}} [[TMAIN:@.+tmain.+]](i8** [[ARGV]]) +// CHECK-NEXT: [[RET:%.+]] = call {{[a-z\_\b]*[ ]?i32}} [[TMAIN:@.+tmain.+]](i8** [[ARGV]]) // CHECK-NEXT: ret i32 [[RET]] // CHECK-NEXT: } // CHECK-DEBUG-LABEL: define i32 @main(i32 %argc, i8** %argv) @@ -61,7 +61,7 @@ int main (int argc, char **argv) { // CHECK-DEBUG-NEXT: ret i32 [[RET]] // CHECK-DEBUG-NEXT: } -// CHECK: define internal void [[OMP_OUTLINED]](i32* %.global_tid., i32* %.bound_tid., %struct.anon* %__context) +// CHECK: define internal {{.*}}void [[OMP_OUTLINED]](i32* %.global_tid., i32* %.bound_tid., %struct.anon* %__context) // CHECK: #[[FN_ATTRS:[0-9]+]] // CHECK: [[CONTEXT_ADDR:%.+]] = alloca %struct.anon* // CHECK: store %struct.anon* %__context, %struct.anon** [[CONTEXT_ADDR]] @@ -69,10 +69,10 @@ int main (int argc, char **argv) { // CHECK-NEXT: [[ARGC_PTR_REF:%.+]] = getelementptr inbounds %struct.anon, %struct.anon* [[CONTEXT_PTR]], i32 0, i32 0 // CHECK-NEXT: [[ARGC_REF:%.+]] = load i32*, i32** [[ARGC_PTR_REF]] // CHECK-NEXT: [[ARGC:%.+]] = load i32, i32* [[ARGC_REF]] -// CHECK-NEXT: invoke void [[FOO:@.+foo.+]](i32{{[ ]?[a-z]*}} [[ARGC]]) +// CHECK-NEXT: invoke {{.*}}void [[FOO:@.+foo.+]](i32{{[ ]?[a-z]*}} [[ARGC]]) // CHECK: call {{.+}} @__kmpc_cancel_barrier( // CHECK: ret void -// CHECK: call void @{{.+terminate.*|abort}}( +// CHECK: call {{.*}}void @{{.+terminate.*|abort}}( // CHECK-NEXT: unreachable // CHECK-NEXT: } // CHECK-DEBUG: define internal void [[OMP_OUTLINED]](i32* %.global_tid., i32* %.bound_tid., %struct.anon* %__context) @@ -90,17 +90,17 @@ int main (int argc, char **argv) { // CHECK-DEBUG-NEXT: unreachable // CHECK-DEBUG-NEXT: } -// CHECK-DAG: define linkonce_odr void [[FOO]]({{i32[ ]?[a-z]*}} %argc) -// CHECK-DAG: declare void @__kmpc_fork_call(%ident_t*, i32, void (i32*, i32*, ...)*, ...) +// CHECK-DAG: define linkonce_odr {{.*}}void [[FOO]]({{i32[ ]?[a-z]*}} %argc) +// CHECK-DAG: declare {{.*}}void @__kmpc_fork_call(%ident_t*, i32, void (i32*, i32*, ...)*, ...) // CHECK-DEBUG-DAG: define linkonce_odr void [[FOO]](i32 %argc) // CHECK-DEBUG-DAG: declare void @__kmpc_fork_call(%ident_t*, i32, void (i32*, i32*, ...)*, ...) -// CHECK: define linkonce_odr {{[a-z]*[ ]?i32}} [[TMAIN]](i8** %argc) +// CHECK: define linkonce_odr {{[a-z\_\b]*[ ]?i32}} [[TMAIN]](i8** %argc) // CHECK: [[AGG_CAPTURED:%.+]] = alloca %struct.anon.0 // CHECK: [[ARGC_REF:%.+]] = getelementptr inbounds %struct.anon.0, %struct.anon.0* [[AGG_CAPTURED]], i32 0, i32 0 // CHECK-NEXT: store i8*** {{%[a-z0-9.]+}}, i8**** [[ARGC_REF]] // CHECK-NEXT: [[BITCAST:%.+]] = bitcast %struct.anon.0* [[AGG_CAPTURED]] to i8* -// CHECK-NEXT: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(%ident_t* [[DEF_LOC_2]], i32 1, void (i32*, i32*, ...)* bitcast (void (i32*, i32*, %struct.anon.0*)* [[OMP_OUTLINED:@.+]] to void (i32*, i32*, ...)*), i8* [[BITCAST]]) +// CHECK-NEXT: call {{.*}}void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call(%ident_t* [[DEF_LOC_2]], i32 1, void (i32*, i32*, ...)* bitcast (void (i32*, i32*, %struct.anon.0*)* [[OMP_OUTLINED:@.+]] to void (i32*, i32*, ...)*), i8* [[BITCAST]]) // CHECK-NEXT: ret i32 0 // CHECK-NEXT: } // CHECK-DEBUG: define linkonce_odr i32 [[TMAIN]](i8** %argc) @@ -118,17 +118,17 @@ int main (int argc, char **argv) { // CHECK-DEBUG-NEXT: ret i32 0 // CHECK-DEBUG-NEXT: } -// CHECK: define internal void [[OMP_OUTLINED]](i32* %.global_tid., i32* %.bound_tid., %struct.anon.0* %__context) +// CHECK: define internal {{.*}}void [[OMP_OUTLINED]](i32* %.global_tid., i32* %.bound_tid., %struct.anon.0* %__context) // CHECK: [[CONTEXT_ADDR:%.+]] = alloca %struct.anon.0* // CHECK: store %struct.anon.0* %__context, %struct.anon.0** [[CONTEXT_ADDR]] // CHECK: [[CONTEXT_PTR:%.+]] = load %struct.anon.0*, %struct.anon.0** [[CONTEXT_ADDR]] // CHECK-NEXT: [[ARGC_PTR_REF:%.+]] = getelementptr inbounds %struct.anon.0, %struct.anon.0* [[CONTEXT_PTR]], i32 0, i32 0 // CHECK-NEXT: [[ARGC_REF:%.+]] = load i8***, i8**** [[ARGC_PTR_REF]] // CHECK-NEXT: [[ARGC:%.+]] = load i8**, i8*** [[ARGC_REF]] -// CHECK-NEXT: invoke void [[FOO1:@.+foo.+]](i8** [[ARGC]]) +// CHECK-NEXT: invoke {{.*}}void [[FOO1:@.+foo.+]](i8** [[ARGC]]) // CHECK: call {{.+}} @__kmpc_cancel_barrier( // CHECK: ret void -// CHECK: call void @{{.+terminate.*|abort}}( +// CHECK: call {{.*}}void @{{.+terminate.*|abort}}( // CHECK-NEXT: unreachable // CHECK-NEXT: } // CHECK-DEBUG: define internal void [[OMP_OUTLINED]](i32* %.global_tid., i32* %.bound_tid., %struct.anon.0* %__context) @@ -145,7 +145,7 @@ int main (int argc, char **argv) { // CHECK-DEBUG-NEXT: unreachable // CHECK-DEBUG-NEXT: } -// CHECK: define linkonce_odr void [[FOO1]](i8** %argc) +// CHECK: define linkonce_odr {{.*}}void [[FOO1]](i8** %argc) // CHECK-DEBUG: define linkonce_odr void [[FOO1]](i8** %argc) // CHECK: attributes #[[FN_ATTRS]] = {{.+}} nounwind diff --git a/test/OpenMP/parallel_copyin_codegen.cpp b/test/OpenMP/parallel_copyin_codegen.cpp index e69ace7..dd0a9b6 100644 --- a/test/OpenMP/parallel_copyin_codegen.cpp +++ b/test/OpenMP/parallel_copyin_codegen.cpp @@ -58,16 +58,16 @@ int main() { #ifdef LAMBDA // LAMBDA: [[G:@.+]] = global i{{[0-9]+}} 1212, // LAMBDA-LABEL: @main - // LAMBDA: call{{( x86_thiscallcc)?}} void [[OUTER_LAMBDA:@.+]]( + // LAMBDA: call{{.*}} void [[OUTER_LAMBDA:@.+]]( [&]() { // LAMBDA: define{{.*}} internal{{.*}} void [[OUTER_LAMBDA]]( - // LAMBDA: call void {{.+}} @__kmpc_fork_call({{.+}}, i32 1, {{.+}}* [[OMP_REGION:@.+]] to {{.+}}, i8* + // LAMBDA: call {{.*}}void {{.+}} @__kmpc_fork_call({{.+}}, i32 1, {{.+}}* [[OMP_REGION:@.+]] to {{.+}}, i8* #pragma omp parallel copyin(g) { // LAMBDA: define{{.*}} internal{{.*}} void [[OMP_REGION]](i32* %{{.+}}, i32* %{{.+}}, %{{.+}}* [[ARG:%.+]]) // threadprivate_g = g; - // LAMBDA: call i8* @__kmpc_threadprivate_cached({{.+}} [[G]] + // LAMBDA: call {{.*}}i8* @__kmpc_threadprivate_cached({{.+}} [[G]] // LAMBDA: ptrtoint i{{[0-9]+}}* %{{.+}} to i{{[0-9]+}} // LAMBDA: icmp ne i{{[0-9]+}} ptrtoint (i{{[0-9]+}}* [[G]] to i{{[0-9]+}}), %{{.+}} // LAMBDA: br i1 %{{.+}}, label %[[NOT_MASTER:.+]], label %[[DONE:.+]] @@ -76,9 +76,9 @@ int main() { // LAMBDA: store volatile i{{[0-9]+}} %{{.+}}, i{{[0-9]+}}* %{{.+}}, // LAMBDA: [[DONE]] - // LAMBDA: call i32 @__kmpc_cancel_barrier( + // LAMBDA: call {{.*}}i32 @__kmpc_cancel_barrier( g = 1; - // LAMBDA: call{{( x86_thiscallcc)?}} void [[INNER_LAMBDA:@.+]](%{{.+}}* + // LAMBDA: call{{.*}} void [[INNER_LAMBDA:@.+]](%{{.+}}* [&]() { // LAMBDA: define {{.+}} void [[INNER_LAMBDA]](%{{.+}}* [[ARG_PTR:%.+]]) // LAMBDA: store %{{.+}}* [[ARG_PTR]], %{{.+}}** [[ARG_PTR_REF:%.+]], @@ -91,16 +91,16 @@ int main() { #elif defined(BLOCKS) // BLOCKS: [[G:@.+]] = global i{{[0-9]+}} 1212, // BLOCKS-LABEL: @main - // BLOCKS: call void {{%.+}}(i8 + // BLOCKS: call {{.*}}void {{%.+}}(i8 ^{ // BLOCKS: define{{.*}} internal{{.*}} void {{.+}}(i8* - // BLOCKS: call void {{.+}} @__kmpc_fork_call({{.+}}, i32 1, {{.+}}* [[OMP_REGION:@.+]] to {{.+}}, i8* + // BLOCKS: call {{.*}}void {{.+}} @__kmpc_fork_call({{.+}}, i32 1, {{.+}}* [[OMP_REGION:@.+]] to {{.+}}, i8* #pragma omp parallel copyin(g) { // BLOCKS: define{{.*}} internal{{.*}} void [[OMP_REGION]](i32* %{{.+}}, i32* %{{.+}}, %{{.+}}* [[ARG:%.+]]) // threadprivate_g = g; - // BLOCKS: call i8* @__kmpc_threadprivate_cached({{.+}} [[G]] + // BLOCKS: call {{.*}}i8* @__kmpc_threadprivate_cached({{.+}} [[G]] // BLOCKS: ptrtoint i{{[0-9]+}}* %{{.+}} to i{{[0-9]+}} // BLOCKS: icmp ne i{{[0-9]+}} ptrtoint (i{{[0-9]+}}* [[G]] to i{{[0-9]+}}), %{{.+}} // BLOCKS: br i1 %{{.+}}, label %[[NOT_MASTER:.+]], label %[[DONE:.+]] @@ -109,16 +109,16 @@ int main() { // BLOCKS: store volatile i{{[0-9]+}} %{{.+}}, i{{[0-9]+}}* %{{.+}}, // BLOCKS: [[DONE]] - // BLOCKS: call i32 @__kmpc_cancel_barrier( + // BLOCKS: call {{.*}}i32 @__kmpc_cancel_barrier( g = 1; // BLOCKS: store volatile i{{[0-9]+}} 1, i{{[0-9]+}}* // BLOCKS-NOT: [[G]]{{[[^:word:]]}} - // BLOCKS: call void {{%.+}}(i8 + // BLOCKS: call {{.*}}void {{%.+}}(i8 ^{ // BLOCKS: define {{.+}} void {{@.+}}(i8* g = 2; // BLOCKS-NOT: [[G]]{{[[^:word:]]}} - // BLOCKS: call i8* @__kmpc_threadprivate_cached({{.+}} [[G]] + // BLOCKS: call {{.*}}i8* @__kmpc_threadprivate_cached({{.+}} [[G]] // BLOCKS: store volatile i{{[0-9]+}} 2, i{{[0-9]+}}* // BLOCKS-NOT: [[G]]{{[[^:word:]]}} // BLOCKS: ret @@ -148,19 +148,19 @@ int main() { // CHECK-LABEL: @main // CHECK: [[TEST:%.+]] = alloca [[S_FLOAT_TY]], // CHECK: call {{.*}} [[S_FLOAT_TY_COPY_ASSIGN:@.+]]([[S_FLOAT_TY]]* [[TEST]], [[S_FLOAT_TY]]* -// CHECK: call void (%{{.+}}*, i{{[0-9]+}}, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)*, ...) @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{[0-9]+}} 1, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)* bitcast (void (i{{[0-9]+}}*, i{{[0-9]+}}*, {{%.+}}*)* [[MAIN_MICROTASK:@.+]] to void (i32*, i32*, ...)*), i8* %{{.+}}) -// CHECK: call void (%{{.+}}*, i{{[0-9]+}}, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)*, ...) @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{[0-9]+}} 1, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)* bitcast (void (i{{[0-9]+}}*, i{{[0-9]+}}*, {{%.+}}*)* [[MAIN_MICROTASK1:@.+]] to void (i32*, i32*, ...)*), i8* %{{.+}}) +// CHECK: call {{.*}}void (%{{.+}}*, i{{[0-9]+}}, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)*, ...) @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{[0-9]+}} 1, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)* bitcast (void (i{{[0-9]+}}*, i{{[0-9]+}}*, {{%.+}}*)* [[MAIN_MICROTASK:@.+]] to void (i32*, i32*, ...)*), i8* %{{.+}}) +// CHECK: call {{.*}}void (%{{.+}}*, i{{[0-9]+}}, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)*, ...) @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{[0-9]+}} 1, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)* bitcast (void (i{{[0-9]+}}*, i{{[0-9]+}}*, {{%.+}}*)* [[MAIN_MICROTASK1:@.+]] to void (i32*, i32*, ...)*), i8* %{{.+}}) // CHECK: = call {{.*}}i{{.+}} [[TMAIN_INT:@.+]]() // CHECK: call {{.*}} [[S_FLOAT_TY_DESTR:@.+]]([[S_FLOAT_TY]]* // CHECK: ret // -// CHECK: define internal void [[MAIN_MICROTASK]](i{{[0-9]+}}* [[GTID_ADDR:%.+]], i{{[0-9]+}}* %{{.+}}, {{%.+}}* %{{.+}}) +// CHECK: define internal {{.*}}void [[MAIN_MICROTASK]](i{{[0-9]+}}* [[GTID_ADDR:%.+]], i{{[0-9]+}}* %{{.+}}, {{%.+}}* %{{.+}}) // CHECK: store i{{[0-9]+}}* [[GTID_ADDR]], i{{[0-9]+}}** [[GTID_ADDR_ADDR:%.+]], // CHECK: [[GTID_ADDR:%.+]] = load i32*, i32** [[GTID_ADDR_ADDR]], // CHECK: [[GTID:%.+]] = load i32, i32* [[GTID_ADDR]], // threadprivate_t_var = t_var; -// CHECK: call i8* @__kmpc_threadprivate_cached({{.+}} [[T_VAR]] +// CHECK: call {{.*}}i8* @__kmpc_threadprivate_cached({{.+}} [[T_VAR]] // CHECK: ptrtoint i{{[0-9]+}}* %{{.+}} to i{{[0-9]+}} // CHECK: icmp ne i{{[0-9]+}} ptrtoint (i{{[0-9]+}}* [[T_VAR]] to i{{[0-9]+}}), %{{.+}} // CHECK: br i1 %{{.+}}, label %[[NOT_MASTER:.+]], label %[[DONE:.+]] @@ -169,11 +169,11 @@ int main() { // CHECK: store i{{[0-9]+}} %{{.+}}, i{{[0-9]+}}* %{{.+}}, // threadprivate_vec = vec; -// CHECK: call i8* @__kmpc_threadprivate_cached({{.+}} [[VEC]] +// CHECK: call {{.*}}i8* @__kmpc_threadprivate_cached({{.+}} [[VEC]] // CHECK: call void @llvm.memcpy{{.*}}(i8* %{{.+}}, i8* bitcast ([2 x i{{[0-9]+}}]* [[VEC]] to i8*), // threadprivate_s_arr = s_arr; -// CHECK: call i8* @__kmpc_threadprivate_cached({{.+}} [[S_ARR]] +// CHECK: call {{.*}}i8* @__kmpc_threadprivate_cached({{.+}} [[S_ARR]] // CHECK: [[S_ARR_PRIV_BEGIN:%.+]] = getelementptr inbounds [2 x [[S_FLOAT_TY]]], [2 x [[S_FLOAT_TY]]]* {{%.+}}, i{{[0-9]+}} 0, i{{[0-9]+}} 0 // CHECK: [[S_ARR_PRIV_END:%.+]] = getelementptr [[S_FLOAT_TY]], [[S_FLOAT_TY]]* [[S_ARR_PRIV_BEGIN]], i{{[0-9]+}} 2 // CHECK: [[IS_EMPTY:%.+]] = icmp eq [[S_FLOAT_TY]]* [[S_ARR_PRIV_BEGIN]], [[S_ARR_PRIV_END]] @@ -183,20 +183,20 @@ int main() { // CHECK: br i1 {{.+}}, label %{{.+}}, label %[[S_ARR_BODY]] // threadprivate_var = var; -// CHECK: call i8* @__kmpc_threadprivate_cached({{.+}} [[VAR]] +// CHECK: call {{.*}}i8* @__kmpc_threadprivate_cached({{.+}} [[VAR]] // CHECK: call {{.*}} [[S_FLOAT_TY_COPY_ASSIGN]]([[S_FLOAT_TY]]* {{%.+}}, [[S_FLOAT_TY]]* {{.*}}[[VAR]]) // CHECK: [[DONE]] -// CHECK: call i32 @__kmpc_cancel_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], i32 [[GTID]]) +// CHECK: call {{.*}}i32 @__kmpc_cancel_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], i32 [[GTID]]) // CHECK: ret void -// CHECK: define internal void [[MAIN_MICROTASK1]](i{{[0-9]+}}* [[GTID_ADDR:%.+]], i{{[0-9]+}}* %{{.+}}, {{%.+}}* %{{.+}}) +// CHECK: define internal {{.*}}void [[MAIN_MICROTASK1]](i{{[0-9]+}}* [[GTID_ADDR:%.+]], i{{[0-9]+}}* %{{.+}}, {{%.+}}* %{{.+}}) // CHECK: store i{{[0-9]+}}* [[GTID_ADDR]], i{{[0-9]+}}** [[GTID_ADDR_ADDR:%.+]], // CHECK: [[GTID_ADDR:%.+]] = load i32*, i32** [[GTID_ADDR_ADDR]], // CHECK: [[GTID:%.+]] = load i32, i32* [[GTID_ADDR]], // threadprivate_t_var = t_var; -// CHECK: call i8* @__kmpc_threadprivate_cached({{.+}} [[T_VAR]] +// CHECK: call {{.*}}i8* @__kmpc_threadprivate_cached({{.+}} [[T_VAR]] // CHECK: ptrtoint i{{[0-9]+}}* %{{.+}} to i{{[0-9]+}} // CHECK: icmp ne i{{[0-9]+}} ptrtoint (i{{[0-9]+}}* [[T_VAR]] to i{{[0-9]+}}), %{{.+}} // CHECK: br i1 %{{.+}}, label %[[NOT_MASTER:.+]], label %[[DONE:.+]] @@ -205,24 +205,24 @@ int main() { // CHECK: store i{{[0-9]+}} %{{.+}}, i{{[0-9]+}}* %{{.+}}, // CHECK: [[DONE]] -// CHECK: call i32 @__kmpc_cancel_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], i32 [[GTID]]) +// CHECK: call {{.*}}i32 @__kmpc_cancel_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], i32 [[GTID]]) // CHECK: ret void // CHECK: define {{.*}} i{{[0-9]+}} [[TMAIN_INT]]() // CHECK: [[TEST:%.+]] = alloca [[S_INT_TY]], // CHECK: call {{.*}} [[S_INT_TY_COPY_ASSIGN:@.+]]([[S_INT_TY]]* [[TEST]], [[S_INT_TY]]* -// CHECK: call void (%{{.+}}*, i{{[0-9]+}}, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)*, ...) @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{[0-9]+}} 1, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)* bitcast (void (i{{[0-9]+}}*, i{{[0-9]+}}*, {{%.+}}*)* [[TMAIN_MICROTASK:@.+]] to void (i32*, i32*, ...)*), i8* %{{.+}}) -// CHECK: call void (%{{.+}}*, i{{[0-9]+}}, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)*, ...) @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{[0-9]+}} 1, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)* bitcast (void (i{{[0-9]+}}*, i{{[0-9]+}}*, {{%.+}}*)* [[TMAIN_MICROTASK1:@.+]] to void (i32*, i32*, ...)*), i8* %{{.+}}) +// CHECK: call {{.*}}void (%{{.+}}*, i{{[0-9]+}}, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)*, ...) @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{[0-9]+}} 1, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)* bitcast (void (i{{[0-9]+}}*, i{{[0-9]+}}*, {{%.+}}*)* [[TMAIN_MICROTASK:@.+]] to void (i32*, i32*, ...)*), i8* %{{.+}}) +// CHECK: call {{.*}}void (%{{.+}}*, i{{[0-9]+}}, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)*, ...) @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{[0-9]+}} 1, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)* bitcast (void (i{{[0-9]+}}*, i{{[0-9]+}}*, {{%.+}}*)* [[TMAIN_MICROTASK1:@.+]] to void (i32*, i32*, ...)*), i8* %{{.+}}) // CHECK: call {{.*}} [[S_INT_TY_DESTR:@.+]]([[S_INT_TY]]* // CHECK: ret // -// CHECK: define internal void [[TMAIN_MICROTASK]](i{{[0-9]+}}* [[GTID_ADDR:%.+]], i{{[0-9]+}}* %{{.+}}, {{%.+}}* %{{.+}}) +// CHECK: define internal {{.*}}void [[TMAIN_MICROTASK]](i{{[0-9]+}}* [[GTID_ADDR:%.+]], i{{[0-9]+}}* %{{.+}}, {{%.+}}* %{{.+}}) // CHECK: store i{{[0-9]+}}* [[GTID_ADDR]], i{{[0-9]+}}** [[GTID_ADDR_ADDR:%.+]], // CHECK: [[GTID_ADDR:%.+]] = load i32*, i32** [[GTID_ADDR_ADDR]], // CHECK: [[GTID:%.+]] = load i32, i32* [[GTID_ADDR]], // threadprivate_t_var = t_var; -// CHECK: call i8* @__kmpc_threadprivate_cached({{.+}} [[TMAIN_T_VAR]] +// CHECK: call {{.*}}i8* @__kmpc_threadprivate_cached({{.+}} [[TMAIN_T_VAR]] // CHECK: ptrtoint i{{[0-9]+}}* %{{.+}} to i{{[0-9]+}} // CHECK: icmp ne i{{[0-9]+}} ptrtoint (i{{[0-9]+}}* [[TMAIN_T_VAR]] to i{{[0-9]+}}), %{{.+}} // CHECK: br i1 %{{.+}}, label %[[NOT_MASTER:.+]], label %[[DONE:.+]] @@ -231,11 +231,11 @@ int main() { // CHECK: store i{{[0-9]+}} %{{.+}}, i{{[0-9]+}}* %{{.+}}, // threadprivate_vec = vec; -// CHECK: call i8* @__kmpc_threadprivate_cached({{.+}} [[TMAIN_VEC]] -// CHECK: call void @llvm.memcpy{{.*}}(i8* %{{.+}}, i8* bitcast ([2 x i{{[0-9]+}}]* [[TMAIN_VEC]] to i8*), +// CHECK: call {{.*}}i8* @__kmpc_threadprivate_cached({{.+}} [[TMAIN_VEC]] +// CHECK: call {{.*}}void @llvm.memcpy{{.*}}(i8* %{{.+}}, i8* bitcast ([2 x i{{[0-9]+}}]* [[TMAIN_VEC]] to i8*), // threadprivate_s_arr = s_arr; -// CHECK: call i8* @__kmpc_threadprivate_cached({{.+}} [[TMAIN_S_ARR]] +// CHECK: call {{.*}}i8* @__kmpc_threadprivate_cached({{.+}} [[TMAIN_S_ARR]] // CHECK: [[S_ARR_PRIV_BEGIN:%.+]] = getelementptr inbounds [2 x [[S_INT_TY]]], [2 x [[S_INT_TY]]]* {{%.+}}, i{{[0-9]+}} 0, i{{[0-9]+}} 0 // CHECK: [[S_ARR_PRIV_END:%.+]] = getelementptr [[S_INT_TY]], [[S_INT_TY]]* [[S_ARR_PRIV_BEGIN]], i{{[0-9]+}} 2 // CHECK: [[IS_EMPTY:%.+]] = icmp eq [[S_INT_TY]]* [[S_ARR_PRIV_BEGIN]], [[S_ARR_PRIV_END]] @@ -245,20 +245,20 @@ int main() { // CHECK: br i1 {{.+}}, label %{{.+}}, label %[[S_ARR_BODY]] // threadprivate_var = var; -// CHECK: call i8* @__kmpc_threadprivate_cached({{.+}} [[TMAIN_VAR]] +// CHECK: call {{.*}}i8* @__kmpc_threadprivate_cached({{.+}} [[TMAIN_VAR]] // CHECK: call {{.*}} [[S_INT_TY_COPY_ASSIGN]]([[S_INT_TY]]* {{%.+}}, [[S_INT_TY]]* {{.*}}[[TMAIN_VAR]]) // CHECK: [[DONE]] -// CHECK: call i32 @__kmpc_cancel_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], i32 [[GTID]]) +// CHECK: call {{.*}}i32 @__kmpc_cancel_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], i32 [[GTID]]) // CHECK: ret void -// CHECK: define internal void [[TMAIN_MICROTASK1]](i{{[0-9]+}}* [[GTID_ADDR:%.+]], i{{[0-9]+}}* %{{.+}}, {{%.+}}* %{{.+}}) +// CHECK: define internal {{.*}}void [[TMAIN_MICROTASK1]](i{{[0-9]+}}* [[GTID_ADDR:%.+]], i{{[0-9]+}}* %{{.+}}, {{%.+}}* %{{.+}}) // CHECK: store i{{[0-9]+}}* [[GTID_ADDR]], i{{[0-9]+}}** [[GTID_ADDR_ADDR:%.+]], // CHECK: [[GTID_ADDR:%.+]] = load i32*, i32** [[GTID_ADDR_ADDR]], // CHECK: [[GTID:%.+]] = load i32, i32* [[GTID_ADDR]], // threadprivate_t_var = t_var; -// CHECK: call i8* @__kmpc_threadprivate_cached({{.+}} [[TMAIN_T_VAR]] +// CHECK: call {{.*}}i8* @__kmpc_threadprivate_cached({{.+}} [[TMAIN_T_VAR]] // CHECK: ptrtoint i{{[0-9]+}}* %{{.+}} to i{{[0-9]+}} // CHECK: icmp ne i{{[0-9]+}} ptrtoint (i{{[0-9]+}}* [[TMAIN_T_VAR]] to i{{[0-9]+}}), %{{.+}} // CHECK: br i1 %{{.+}}, label %[[NOT_MASTER:.+]], label %[[DONE:.+]] @@ -267,7 +267,7 @@ int main() { // CHECK: store i{{[0-9]+}} %{{.+}}, i{{[0-9]+}}* %{{.+}}, // CHECK: [[DONE]] -// CHECK: call i32 @__kmpc_cancel_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], i32 [[GTID]]) +// CHECK: call {{.*}}i32 @__kmpc_cancel_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], i32 [[GTID]]) // CHECK: ret void #endif diff --git a/test/OpenMP/parallel_firstprivate_codegen.cpp b/test/OpenMP/parallel_firstprivate_codegen.cpp index 3f61362a..760b961 100644 --- a/test/OpenMP/parallel_firstprivate_codegen.cpp +++ b/test/OpenMP/parallel_firstprivate_codegen.cpp @@ -56,13 +56,13 @@ int main() { #ifdef LAMBDA // LAMBDA: [[G:@.+]] = global i{{[0-9]+}} 1212, // LAMBDA-LABEL: @main - // LAMBDA: call{{( x86_thiscallcc)?}} void [[OUTER_LAMBDA:@.+]]( + // LAMBDA: call{{.*}} void [[OUTER_LAMBDA:@.+]]( [&]() { // LAMBDA: define{{.*}} internal{{.*}} void [[OUTER_LAMBDA]]( // LAMBDA: [[G_LOCAL_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[AGG_CAPTURED:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // LAMBDA: store i{{[0-9]+}}* [[G]], i{{[0-9]+}}** [[G_LOCAL_REF]] // LAMBDA: [[ARG:%.+]] = bitcast %{{.+}}* [[AGG_CAPTURED]] to i8* - // LAMBDA: call void {{.+}} @__kmpc_fork_call({{.+}}, i32 1, {{.+}}* [[OMP_REGION:@.+]] to {{.+}}, i8* [[ARG]]) + // LAMBDA: call {{.*}}void {{.+}} @__kmpc_fork_call({{.+}}, i32 1, {{.+}}* [[OMP_REGION:@.+]] to {{.+}}, i8* [[ARG]]) #pragma omp parallel firstprivate(g) { // LAMBDA: define{{.*}} internal{{.*}} void [[OMP_REGION]](i32* %{{.+}}, i32* %{{.+}}, %{{.+}}* [[ARG:%.+]]) @@ -73,12 +73,12 @@ int main() { // LAMBDA: [[G_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[G_REF_ADDR]] // LAMBDA: [[G_VAL:%.+]] = load volatile i{{[0-9]+}}, i{{[0-9]+}}* [[G_REF]] // LAMBDA: store i{{[0-9]+}} [[G_VAL]], i{{[0-9]+}}* [[G_PRIVATE_ADDR]] - // LAMBDA: call i32 @__kmpc_cancel_barrier( + // LAMBDA: call {{.*}}i32 @__kmpc_cancel_barrier( g = 1; // LAMBDA: store volatile i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], // LAMBDA: [[G_PRIVATE_ADDR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // LAMBDA: store i{{[0-9]+}}* [[G_PRIVATE_ADDR]], i{{[0-9]+}}** [[G_PRIVATE_ADDR_REF]] - // LAMBDA: call{{( x86_thiscallcc)?}} void [[INNER_LAMBDA:@.+]](%{{.+}}* [[ARG]]) + // LAMBDA: call{{.*}} void [[INNER_LAMBDA:@.+]](%{{.+}}* [[ARG]]) [&]() { // LAMBDA: define {{.+}} void [[INNER_LAMBDA]](%{{.+}}* [[ARG_PTR:%.+]]) // LAMBDA: store %{{.+}}* [[ARG_PTR]], %{{.+}}** [[ARG_PTR_REF:%.+]], @@ -94,13 +94,13 @@ int main() { #elif defined(BLOCKS) // BLOCKS: [[G:@.+]] = global i{{[0-9]+}} 1212, // BLOCKS-LABEL: @main - // BLOCKS: call void {{%.+}}(i8 + // BLOCKS: call {{.*}}void {{%.+}}(i8 ^{ // BLOCKS: define{{.*}} internal{{.*}} void {{.+}}(i8* // BLOCKS: [[G_LOCAL_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[AGG_CAPTURED:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // BLOCKS: store i{{[0-9]+}}* [[G]], i{{[0-9]+}}** [[G_LOCAL_REF]] // BLOCKS: [[ARG:%.+]] = bitcast %{{.+}}* [[AGG_CAPTURED]] to i8* - // BLOCKS: call void {{.+}} @__kmpc_fork_call({{.+}}, i32 1, {{.+}}* [[OMP_REGION:@.+]] to {{.+}}, i8* [[ARG]]) + // BLOCKS: call {{.*}}void {{.+}} @__kmpc_fork_call({{.+}}, i32 1, {{.+}}* [[OMP_REGION:@.+]] to {{.+}}, i8* [[ARG]]) #pragma omp parallel firstprivate(g) { // BLOCKS: define{{.*}} internal{{.*}} void [[OMP_REGION]](i32* %{{.+}}, i32* %{{.+}}, %{{.+}}* [[ARG:%.+]]) @@ -111,13 +111,13 @@ int main() { // BLOCKS: [[G_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[G_REF_ADDR]] // BLOCKS: [[G_VAL:%.+]] = load volatile i{{[0-9]+}}, i{{[0-9]+}}* [[G_REF]] // BLOCKS: store i{{[0-9]+}} [[G_VAL]], i{{[0-9]+}}* [[G_PRIVATE_ADDR]] - // BLOCKS: call i32 @__kmpc_cancel_barrier( + // BLOCKS: call {{.*}}i32 @__kmpc_cancel_barrier( g = 1; // BLOCKS: store volatile i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], // BLOCKS-NOT: [[G]]{{[[^:word:]]}} // BLOCKS: i{{[0-9]+}}* [[G_PRIVATE_ADDR]] // BLOCKS-NOT: [[G]]{{[[^:word:]]}} - // BLOCKS: call void {{%.+}}(i8 + // BLOCKS: call {{.*}}void {{%.+}}(i8 ^{ // BLOCKS: define {{.+}} void {{@.+}}(i8* g = 2; @@ -150,12 +150,12 @@ int main() { // CHECK: [[TEST:%.+]] = alloca [[S_FLOAT_TY]], // CHECK: call {{.*}} [[S_FLOAT_TY_DEF_CONSTR:@.+]]([[S_FLOAT_TY]]* [[TEST]]) // CHECK: %{{.+}} = bitcast [[CAP_MAIN_TY]]* -// CHECK: call void (%{{.+}}*, i{{[0-9]+}}, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)*, ...) @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{[0-9]+}} 1, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)* bitcast (void (i{{[0-9]+}}*, i{{[0-9]+}}*, [[CAP_MAIN_TY]]*)* [[MAIN_MICROTASK:@.+]] to void +// CHECK: call {{.*}}void (%{{.+}}*, i{{[0-9]+}}, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)*, ...) @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{[0-9]+}} 1, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)* bitcast (void (i{{[0-9]+}}*, i{{[0-9]+}}*, [[CAP_MAIN_TY]]*)* [[MAIN_MICROTASK:@.+]] to void // CHECK: = call {{.*}}i{{.+}} [[TMAIN_INT:@.+]]() // CHECK: call {{.*}} [[S_FLOAT_TY_DESTR:@.+]]([[S_FLOAT_TY]]* // CHECK: ret // -// CHECK: define internal void [[MAIN_MICROTASK]](i{{[0-9]+}}* [[GTID_ADDR:%.+]], i{{[0-9]+}}* %{{.+}}, [[CAP_MAIN_TY]]* %{{.+}}) +// CHECK: define internal {{.*}}void [[MAIN_MICROTASK]](i{{[0-9]+}}* [[GTID_ADDR:%.+]], i{{[0-9]+}}* %{{.+}}, [[CAP_MAIN_TY]]* %{{.+}}) // CHECK: [[T_VAR_PRIV:%.+]] = alloca i{{[0-9]+}}, // CHECK: [[VEC_PRIV:%.+]] = alloca [2 x i{{[0-9]+}}], // CHECK: [[S_ARR_PRIV:%.+]] = alloca [2 x [[S_FLOAT_TY]]], @@ -189,7 +189,7 @@ int main() { // CHECK: call {{.*}} [[ST_TY_DESTR]]([[ST_TY]]* [[ST_TY_TEMP]]) // CHECK: [[GTID_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[GTID_ADDR_ADDR]] // CHECK: [[GTID:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[GTID_REF]] -// CHECK: call i32 @__kmpc_cancel_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], i{{[0-9]+}} [[GTID]]) +// CHECK: call {{.*}}i32 @__kmpc_cancel_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], i{{[0-9]+}} [[GTID]]) // CHECK-DAG: call {{.*}} [[S_FLOAT_TY_DESTR]]([[S_FLOAT_TY]]* [[VAR_PRIV]]) // CHECK-DAG: call {{.*}} [[S_FLOAT_TY_DESTR]]([[S_FLOAT_TY]]* // CHECK: ret void @@ -197,11 +197,11 @@ int main() { // CHECK: define {{.*}} i{{[0-9]+}} [[TMAIN_INT]]() // CHECK: [[TEST:%.+]] = alloca [[S_INT_TY]], // CHECK: call {{.*}} [[S_INT_TY_DEF_CONSTR:@.+]]([[S_INT_TY]]* [[TEST]]) -// CHECK: call void (%{{.+}}*, i{{[0-9]+}}, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)*, ...) @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{[0-9]+}} 1, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)* bitcast (void (i{{[0-9]+}}*, i{{[0-9]+}}*, [[CAP_TMAIN_TY]]*)* [[TMAIN_MICROTASK:@.+]] to void +// CHECK: call {{.*}}void (%{{.+}}*, i{{[0-9]+}}, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)*, ...) @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{[0-9]+}} 1, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)* bitcast (void (i{{[0-9]+}}*, i{{[0-9]+}}*, [[CAP_TMAIN_TY]]*)* [[TMAIN_MICROTASK:@.+]] to void // CHECK: call {{.*}} [[S_INT_TY_DESTR:@.+]]([[S_INT_TY]]* // CHECK: ret // -// CHECK: define internal void [[TMAIN_MICROTASK]](i{{[0-9]+}}* [[GTID_ADDR:%.+]], i{{[0-9]+}}* %{{.+}}, [[CAP_TMAIN_TY]]* %{{.+}}) +// CHECK: define internal {{.*}}void [[TMAIN_MICROTASK]](i{{[0-9]+}}* [[GTID_ADDR:%.+]], i{{[0-9]+}}* %{{.+}}, [[CAP_TMAIN_TY]]* %{{.+}}) // CHECK: [[T_VAR_PRIV:%.+]] = alloca i{{[0-9]+}}, // CHECK: [[VEC_PRIV:%.+]] = alloca [2 x i{{[0-9]+}}], // CHECK: [[S_ARR_PRIV:%.+]] = alloca [2 x [[S_INT_TY]]], @@ -235,7 +235,7 @@ int main() { // CHECK: call {{.*}} [[ST_TY_DESTR]]([[ST_TY]]* [[ST_TY_TEMP]]) // CHECK: [[GTID_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[GTID_ADDR_ADDR]] // CHECK: [[GTID:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[GTID_REF]] -// CHECK: call i32 @__kmpc_cancel_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], i{{[0-9]+}} [[GTID]]) +// CHECK: call {{.*}}i32 @__kmpc_cancel_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], i{{[0-9]+}} [[GTID]]) // CHECK-DAG: call {{.*}} [[S_INT_TY_DESTR]]([[S_INT_TY]]* [[VAR_PRIV]]) // CHECK-DAG: call {{.*}} [[S_INT_TY_DESTR]]([[S_INT_TY]]* // CHECK: ret void diff --git a/test/OpenMP/parallel_for_codegen.cpp b/test/OpenMP/parallel_for_codegen.cpp index 6262e76..2a387d9 100644 --- a/test/OpenMP/parallel_for_codegen.cpp +++ b/test/OpenMP/parallel_for_codegen.cpp @@ -27,7 +27,7 @@ void with_var_schedule() { // CHECK: [[CHUNK_SIZE:%.+]] = sext i8 [[CHUNK_VAL]] to i64 // CHECK: call void @__kmpc_for_static_init_8u([[IDENT_T_TY]]* [[DEFAULT_LOC:@[^,]+]], i32 [[GTID:%[^,]+]], i32 33, i32* [[IS_LAST:%[^,]+]], i64* [[OMP_LB:%[^,]+]], i64* [[OMP_UB:%[^,]+]], i64* [[OMP_ST:%[^,]+]], i64 1, i64 [[CHUNK_SIZE]]) // CHECK: call void @__kmpc_for_static_fini([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) -// CHECK: __kmpc_cancel_barrier +// CHECK: __kmpc_barrier #pragma omp parallel for schedule(static, char(a)) for (unsigned long long i = 1; i < 2; ++i) { } @@ -73,7 +73,7 @@ void without_schedule_clause(float *a, float *b, float *c, float *d) { } // CHECK: [[LOOP1_END]] // CHECK: call void @__kmpc_for_static_fini([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) -// CHECK: call {{.+}} @__kmpc_cancel_barrier([[IDENT_T_TY]]* [[DEFAULT_LOC_BARRIER:[@%].+]], i32 [[GTID]]) +// CHECK: call {{.+}} @__kmpc_barrier([[IDENT_T_TY]]* [[DEFAULT_LOC_BARRIER:[@%].+]], i32 [[GTID]]) // CHECK: ret void } @@ -117,7 +117,7 @@ void static_not_chunked(float *a, float *b, float *c, float *d) { } // CHECK: [[LOOP1_END]] // CHECK: call void @__kmpc_for_static_fini([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) -// CHECK: call {{.+}} @__kmpc_cancel_barrier([[IDENT_T_TY]]* [[DEFAULT_LOC_BARRIER:[@%].+]], i32 [[GTID]]) +// CHECK: call {{.+}} @__kmpc_barrier([[IDENT_T_TY]]* [[DEFAULT_LOC_BARRIER:[@%].+]], i32 [[GTID]]) // CHECK: ret void } @@ -180,7 +180,7 @@ void static_chunked(float *a, float *b, float *c, float *d) { // CHECK: [[O_LOOP1_END]] // CHECK: call void @__kmpc_for_static_fini([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) -// CHECK: call {{.+}} @__kmpc_cancel_barrier([[IDENT_T_TY]]* [[DEFAULT_LOC_BARRIER:[@%].+]], i32 [[GTID]]) +// CHECK: call {{.+}} @__kmpc_barrier([[IDENT_T_TY]]* [[DEFAULT_LOC_BARRIER:[@%].+]], i32 [[GTID]]) // CHECK: ret void } @@ -225,7 +225,7 @@ void dynamic1(float *a, float *b, float *c, float *d) { } // CHECK: [[LOOP1_END]] // CHECK: [[O_LOOP1_END]] -// CHECK: call {{.+}} @__kmpc_cancel_barrier([[IDENT_T_TY]]* [[DEFAULT_LOC_BARRIER:[@%].+]], i32 [[GTID]]) +// CHECK: call {{.+}} @__kmpc_barrier([[IDENT_T_TY]]* [[DEFAULT_LOC_BARRIER:[@%].+]], i32 [[GTID]]) // CHECK: ret void } @@ -270,7 +270,7 @@ void guided7(float *a, float *b, float *c, float *d) { } // CHECK: [[LOOP1_END]] // CHECK: [[O_LOOP1_END]] -// CHECK: call {{.+}} @__kmpc_cancel_barrier([[IDENT_T_TY]]* [[DEFAULT_LOC_BARRIER:[@%].+]], i32 [[GTID]]) +// CHECK: call {{.+}} @__kmpc_barrier([[IDENT_T_TY]]* [[DEFAULT_LOC_BARRIER:[@%].+]], i32 [[GTID]]) // CHECK: ret void } @@ -322,7 +322,7 @@ void test_auto(float *a, float *b, float *c, float *d) { // CHECK: [[O_LOOP1_END]] // CHECK: [[GTID_REF:%.+]] = load i32*, i32** [[GTID_REF_ADDR]], // CHECK: [[GTID:%.+]] = load i32, i32* [[GTID_REF]], -// CHECK: call {{.+}} @__kmpc_cancel_barrier([[IDENT_T_TY]]* [[DEFAULT_LOC_BARRIER:[@%].+]], i32 [[GTID]]) +// CHECK: call {{.+}} @__kmpc_barrier([[IDENT_T_TY]]* [[DEFAULT_LOC_BARRIER:[@%].+]], i32 [[GTID]]) // CHECK: ret void } @@ -369,7 +369,7 @@ void runtime(float *a, float *b, float *c, float *d) { // CHECK: [[O_LOOP1_END]] // CHECK: [[GTID_REF:%.+]] = load i32*, i32** [[GTID_REF_ADDR]], // CHECK: [[GTID:%.+]] = load i32, i32* [[GTID_REF]], -// CHECK: call {{.+}} @__kmpc_cancel_barrier([[IDENT_T_TY]]* [[DEFAULT_LOC_BARRIER:[@%].+]], i32 [[GTID]]) +// CHECK: call {{.+}} @__kmpc_barrier([[IDENT_T_TY]]* [[DEFAULT_LOC_BARRIER:[@%].+]], i32 [[GTID]]) // CHECK: ret void } @@ -386,14 +386,14 @@ void parallel_for(float *a) { // TERM_DEBUG: unwind label %[[TERM_LPAD:.+]], // TERM_DEBUG-NOT: __kmpc_global_thread_num // TERM_DEBUG: call void @__kmpc_for_static_fini({{.+}}), !dbg [[DBG_LOC_END:![0-9]+]] - // TERM_DEBUG: call {{.+}} @__kmpc_cancel_barrier({{.+}}), !dbg [[DBG_LOC_CANCEL:![0-9]+]] + // TERM_DEBUG: call {{.+}} @__kmpc_barrier({{.+}}), !dbg [[DBG_LOC_CANCEL:![0-9]+]] // TERM_DEBUG: [[TERM_LPAD]] // TERM_DEBUG: call void @__clang_call_terminate // TERM_DEBUG: unreachable // CLEANUP-NOT: __kmpc_global_thread_num // CLEANUP: call void @__kmpc_for_static_init_4u({{.+}}) // CLEANUP: call void @__kmpc_for_static_fini({{.+}}) - // CLEANUP: call {{.+}} @__kmpc_cancel_barrier({{.+}}) + // CLEANUP: call {{.+}} @__kmpc_barrier({{.+}}) for (unsigned i = 131071; i <= 2147483647; i += 127) a[i] += foo(); } diff --git a/test/OpenMP/parallel_for_simd_codegen.cpp b/test/OpenMP/parallel_for_simd_codegen.cpp index 3490b8f..adde424 100644 --- a/test/OpenMP/parallel_for_simd_codegen.cpp +++ b/test/OpenMP/parallel_for_simd_codegen.cpp @@ -63,7 +63,7 @@ void simple(float *a, float *b, float *c, float *d) { } // CHECK: [[SIMPLE_LOOP1_END]] // CHECK: call void @__kmpc_for_static_fini(%ident_t* {{.+}}, i32 %{{.+}}) -// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: call void @__kmpc_barrier(%ident_t* {{.+}}, i32 %{{.+}}) long long k = get_val(); @@ -112,7 +112,7 @@ void simple(float *a, float *b, float *c, float *d) { // CHECK: [[LIN0_2:%.+]] = load i64, i64* [[LIN0]] // CHECK-NEXT: [[LIN_ADD2:%.+]] = add nsw i64 [[LIN0_2]], 27 // CHECK-NEXT: store i64 [[LIN_ADD2]], i64* %{{.+}} -// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: call void @__kmpc_barrier(%ident_t* {{.+}}, i32 %{{.+}}) int lin = 12; #pragma omp parallel for simd linear(lin : get_val()), linear(g_ptr) @@ -186,7 +186,7 @@ void simple(float *a, float *b, float *c, float *d) { // CHECK: [[GLIN_VAR:%.+]] = load double**, double*** % // CHECK: [[GLINSTART:.+]] = load double*, double** [[GLIN_START]] // CHECK: store double* {{.*}}[[GLIN_VAR]] -// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: call void @__kmpc_barrier(%ident_t* {{.+}}, i32 %{{.+}}) #pragma omp parallel for simd // CHECK: call void @__kmpc_for_static_init_4(%ident_t* {{[^,]+}}, i32 %{{[^,]+}}, i32 34, i32* %{{[^,]+}}, i32* [[LB:%[^,]+]], i32* [[UB:%[^,]+]], i32* [[STRIDE:%[^,]+]], i32 1, i32 1) @@ -223,7 +223,7 @@ void simple(float *a, float *b, float *c, float *d) { } // CHECK: [[SIMPLE_LOOP4_END]] // CHECK: call void @__kmpc_for_static_fini(%ident_t* {{.+}}, i32 %{{.+}}) -// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: call void @__kmpc_barrier(%ident_t* {{.+}}, i32 %{{.+}}) #pragma omp parallel for simd // CHECK: call void @__kmpc_for_static_init_4(%ident_t* {{[^,]+}}, i32 %{{[^,]+}}, i32 34, i32* %{{[^,]+}}, i32* [[LB:%[^,]+]], i32* [[UB:%[^,]+]], i32* [[STRIDE:%[^,]+]], i32 1, i32 1) @@ -260,7 +260,7 @@ void simple(float *a, float *b, float *c, float *d) { } // CHECK: [[SIMPLE_LOOP5_END]] // CHECK: call void @__kmpc_for_static_fini(%ident_t* {{.+}}, i32 %{{.+}}) -// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: call void @__kmpc_barrier(%ident_t* {{.+}}, i32 %{{.+}}) // CHECK-NOT: mul i32 %{{.+}}, 10 #pragma omp parallel for simd @@ -315,7 +315,7 @@ void simple(float *a, float *b, float *c, float *d) { // CHECK: [[A_PRIV_VAL:%.+]] = load i32, i32* [[A_PRIV]], // CHECK-NEXT: store i32 [[A_PRIV_VAL]], i32* %{{.+}}, // CHECK-NEXT: br label -// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: call void @__kmpc_barrier(%ident_t* {{.+}}, i32 %{{.+}}) } int R; { @@ -364,7 +364,7 @@ void simple(float *a, float *b, float *c, float *d) { // CHECK: [[RED:%.+]] = mul nsw i32 %{{.+}}, [[R_PRIV_VAL]] // CHECK-NEXT: store i32 [[RED]], i32* %{{.+}}, // CHECK-NEXT: call void @__kmpc_end_reduce_nowait( -// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: call void @__kmpc_barrier(%ident_t* {{.+}}, i32 %{{.+}}) } } @@ -473,7 +473,7 @@ void iter_simple(IterDouble ia, IterDouble ib, IterDouble ic) { } // CHECK: [[IT_END]] // CHECK: call void @__kmpc_for_static_fini(%ident_t* {{.+}}, i32 %{{.+}}) -// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: call void @__kmpc_barrier(%ident_t* {{.+}}, i32 %{{.+}}) // CHECK: ret void } @@ -552,7 +552,7 @@ void collapsed(float *a, float *b, float *c, float *d) { // CHECK: store i32 3, i32* [[I:%[^,]+]] // CHECK: store i32 5, i32* [[I:%[^,]+]] // CHECK: store i16 9, i16* [[I:%[^,]+]] -// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: call void @__kmpc_barrier(%ident_t* {{.+}}, i32 %{{.+}}) // CHECK: ret void } @@ -672,7 +672,7 @@ void widened(float *a, float *b, float *c, float *d) { // CHECK-NEXT: br label {{%.+}} // CHECK: [[T1_END]] // CHECK: call void @__kmpc_for_static_fini(%ident_t* {{.+}}, i32 %{{.+}}) -// CHECK: call i32 @__kmpc_cancel_barrier(%ident_t* {{.+}}, i32 %{{.+}}) +// CHECK: call void @__kmpc_barrier(%ident_t* {{.+}}, i32 %{{.+}}) // CHECK: ret void // // TERM_DEBUG-LABEL: bar diff --git a/test/OpenMP/parallel_if_codegen.cpp b/test/OpenMP/parallel_if_codegen.cpp index 3461743..ace20ec 100644 --- a/test/OpenMP/parallel_if_codegen.cpp +++ b/test/OpenMP/parallel_if_codegen.cpp @@ -14,27 +14,27 @@ void fn6(); int Arg; -// CHECK-LABEL: define void @{{.+}}gtid_test +// CHECK-LABEL: define {{.*}}void @{{.+}}gtid_test void gtid_test() { -// CHECK: call void {{.+}} @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{.+}} 1, {{.+}}* [[GTID_TEST_REGION1:@.+]] to void +// CHECK: call {{.*}}void {{.+}} @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{.+}} 1, {{.+}}* [[GTID_TEST_REGION1:@.+]] to void #pragma omp parallel #pragma omp parallel if (false) gtid_test(); // CHECK: ret void } -// CHECK: define internal void [[GTID_TEST_REGION1]](i{{.+}}* [[GTID_PARAM:%.+]], i +// CHECK: define internal {{.*}}void [[GTID_TEST_REGION1]](i{{.+}}* [[GTID_PARAM:%.+]], i // CHECK: store i{{[0-9]+}}* [[GTID_PARAM]], i{{[0-9]+}}** [[GTID_ADDR_REF:%.+]], // CHECK: [[GTID_ADDR:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[GTID_ADDR_REF]] // CHECK: [[GTID:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[GTID_ADDR]] -// CHECK: call void @__kmpc_serialized_parallel(%{{.+}}* @{{.+}}, i{{.+}} [[GTID]]) +// CHECK: call {{.*}}void @__kmpc_serialized_parallel(%{{.+}}* @{{.+}}, i{{.+}} [[GTID]]) // CHECK: [[GTID_ADDR:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[GTID_ADDR_REF]] // CHECK: call void [[GTID_TEST_REGION2:@.+]](i{{[0-9]+}}* [[GTID_ADDR]] -// CHECK: call void @__kmpc_end_serialized_parallel(%{{.+}}* @{{.+}}, i{{.+}} [[GTID]]) +// CHECK: call {{.*}}void @__kmpc_end_serialized_parallel(%{{.+}}* @{{.+}}, i{{.+}} [[GTID]]) // CHECK: ret void -// CHECK: define internal void [[GTID_TEST_REGION2]]( -// CHECK: call void @{{.+}}gtid_test +// CHECK: define internal {{.*}}void [[GTID_TEST_REGION2]]( +// CHECK: call {{.*}}void @{{.+}}gtid_test // CHECK: ret void template <typename T> @@ -50,26 +50,26 @@ int tmain(T Arg) { // CHECK-LABEL: define {{.*}}i{{[0-9]+}} @main() int main() { -// CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num( -// CHECK: call void {{.+}} @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{.+}} 1, void {{.+}}* [[CAP_FN4:@.+]] to void +// CHECK: [[GTID:%.+]] = call {{.*}}i32 @__kmpc_global_thread_num( +// CHECK: call {{.*}}void {{.+}} @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{.+}} 1, void {{.+}}* [[CAP_FN4:@.+]] to void #pragma omp parallel if (true) fn4(); -// CHECK: call void @__kmpc_serialized_parallel(%{{.+}}* @{{.+}}, i32 [[GTID]]) +// CHECK: call {{.*}}void @__kmpc_serialized_parallel(%{{.+}}* @{{.+}}, i32 [[GTID]]) // CHECK: store i32 [[GTID]], i32* [[GTID_ADDR:%.+]], // CHECK: call void [[CAP_FN5:@.+]](i32* [[GTID_ADDR]], -// CHECK: call void @__kmpc_end_serialized_parallel(%{{.+}}* @{{.+}}, i32 [[GTID]]) +// CHECK: call {{.*}}void @__kmpc_end_serialized_parallel(%{{.+}}* @{{.+}}, i32 [[GTID]]) #pragma omp parallel if (false) fn5(); // CHECK: br i1 %{{.+}}, label %[[OMP_THEN:.+]], label %[[OMP_ELSE:.+]] // CHECK: [[OMP_THEN]] -// CHECK: call void {{.+}} @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{.+}} 1, void {{.+}}* [[CAP_FN6:@.+]] to void +// CHECK: call {{.*}}void {{.+}} @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{.+}} 1, void {{.+}}* [[CAP_FN6:@.+]] to void // CHECK: br label %[[OMP_END:.+]] // CHECK: [[OMP_ELSE]] -// CHECK: call void @__kmpc_serialized_parallel(%{{.+}}* @{{.+}}, i32 [[GTID]]) +// CHECK: call {{.*}}void @__kmpc_serialized_parallel(%{{.+}}* @{{.+}}, i32 [[GTID]]) // CHECK: store i32 [[GTID]], i32* [[GTID_ADDR:%.+]], // CHECK: call void [[CAP_FN6]](i32* [[GTID_ADDR]], -// CHECK: call void @__kmpc_end_serialized_parallel(%{{.+}}* @{{.+}}, i32 [[GTID]]) +// CHECK: call {{.*}}void @__kmpc_end_serialized_parallel(%{{.+}}* @{{.+}}, i32 [[GTID]]) // CHECK: br label %[[OMP_END]] // CHECK: [[OMP_END]] #pragma omp parallel if (Arg) @@ -78,47 +78,47 @@ int main() { return tmain(Arg); } -// CHECK: define internal void [[CAP_FN4]] -// CHECK: call void @{{.+}}fn4 +// CHECK: define internal {{.*}}void [[CAP_FN4]] +// CHECK: call {{.*}}void @{{.+}}fn4 // CHECK: ret void -// CHECK: define internal void [[CAP_FN5]] -// CHECK: call void @{{.+}}fn5 +// CHECK: define internal {{.*}}void [[CAP_FN5]] +// CHECK: call {{.*}}void @{{.+}}fn5 // CHECK: ret void -// CHECK: define internal void [[CAP_FN6]] -// CHECK: call void @{{.+}}fn6 +// CHECK: define internal {{.*}}void [[CAP_FN6]] +// CHECK: call {{.*}}void @{{.+}}fn6 // CHECK: ret void // CHECK-LABEL: define {{.+}} @{{.+}}tmain -// CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num( -// CHECK: call void {{.+}} @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{.+}} 1, void {{.+}}* [[CAP_FN1:@.+]] to void -// CHECK: call void @__kmpc_serialized_parallel(%{{.+}}* @{{.+}}, i32 [[GTID]]) +// CHECK: [[GTID:%.+]] = call {{.*}}i32 @__kmpc_global_thread_num( +// CHECK: call {{.*}}void {{.+}} @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{.+}} 1, void {{.+}}* [[CAP_FN1:@.+]] to void +// CHECK: call {{.*}}void @__kmpc_serialized_parallel(%{{.+}}* @{{.+}}, i32 [[GTID]]) // CHECK: store i32 [[GTID]], i32* [[GTID_ADDR:%.+]], // CHECK: call void [[CAP_FN2:@.+]](i32* [[GTID_ADDR]], -// CHECK: call void @__kmpc_end_serialized_parallel(%{{.+}}* @{{.+}}, i32 [[GTID]]) +// CHECK: call {{.*}}void @__kmpc_end_serialized_parallel(%{{.+}}* @{{.+}}, i32 [[GTID]]) // CHECK: br i1 %{{.+}}, label %[[OMP_THEN:.+]], label %[[OMP_ELSE:.+]] // CHECK: [[OMP_THEN]] -// CHECK: call void {{.+}} @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{.+}} 1, void {{.+}}* [[CAP_FN3:@.+]] to void +// CHECK: call {{.*}}void {{.+}} @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{.+}} 1, void {{.+}}* [[CAP_FN3:@.+]] to void // CHECK: br label %[[OMP_END:.+]] // CHECK: [[OMP_ELSE]] -// CHECK: call void @__kmpc_serialized_parallel(%{{.+}}* @{{.+}}, i32 [[GTID]]) +// CHECK: call {{.*}}void @__kmpc_serialized_parallel(%{{.+}}* @{{.+}}, i32 [[GTID]]) // CHECK: store i32 [[GTID]], i32* [[GTID_ADDR:%.+]], // CHECK: call void [[CAP_FN3]](i32* [[GTID_ADDR]], -// CHECK: call void @__kmpc_end_serialized_parallel(%{{.+}}* @{{.+}}, i32 [[GTID]]) +// CHECK: call {{.*}}void @__kmpc_end_serialized_parallel(%{{.+}}* @{{.+}}, i32 [[GTID]]) // CHECK: br label %[[OMP_END]] // CHECK: [[OMP_END]] -// CHECK: define internal void [[CAP_FN1]] -// CHECK: call void @{{.+}}fn1 +// CHECK: define internal {{.*}}void [[CAP_FN1]] +// CHECK: call {{.*}}void @{{.+}}fn1 // CHECK: ret void -// CHECK: define internal void [[CAP_FN2]] -// CHECK: call void @{{.+}}fn2 +// CHECK: define internal {{.*}}void [[CAP_FN2]] +// CHECK: call {{.*}}void @{{.+}}fn2 // CHECK: ret void -// CHECK: define internal void [[CAP_FN3]] -// CHECK: call void @{{.+}}fn3 +// CHECK: define internal {{.*}}void [[CAP_FN3]] +// CHECK: call {{.*}}void @{{.+}}fn3 // CHECK: ret void #endif diff --git a/test/OpenMP/parallel_num_threads_codegen.cpp b/test/OpenMP/parallel_num_threads_codegen.cpp index 2342c47..d744e5e 100644 --- a/test/OpenMP/parallel_num_threads_codegen.cpp +++ b/test/OpenMP/parallel_num_threads_codegen.cpp @@ -43,16 +43,16 @@ int main() { // CHECK-LABEL: define {{.*}}i{{[0-9]+}} @main() // CHECK-DAG: [[S_ADDR:%.+]] = alloca [[S_TY]] // CHECK-DAG: [[A_ADDR:%.+]] = alloca i8 -// CHECK-DAG: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEF_LOC_2]]) +// CHECK-DAG: [[GTID:%.+]] = call {{.*}}i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEF_LOC_2]]) // CHECK-DAG: call {{.*}} [[S_TY_CONSTR:@.+]]([[S_TY]]* [[S_ADDR]], [[INTPTR_T_TY]] [[INTPTR_T_TY_ATTR:(signext )?]]0) // CHECK: [[S_CHAR_OP:%.+]] = invoke{{.*}} i8 [[S_TY_CHAR_OP:@.+]]([[S_TY]]* [[S_ADDR]]) // CHECK: store i8 [[S_CHAR_OP]], i8* [[A_ADDR]] -// CHECK: call void @__kmpc_push_num_threads([[IDENT_T_TY]]* [[DEF_LOC_2]], i32 [[GTID]], i32 2) -// CHECK: call void {{.*}} @__kmpc_fork_call( +// CHECK: call {{.*}}void @__kmpc_push_num_threads([[IDENT_T_TY]]* [[DEF_LOC_2]], i32 [[GTID]], i32 2) +// CHECK: call {{.*}}void {{.*}} @__kmpc_fork_call( // CHECK: [[A_VAL:%.+]] = load i8, i8* [[A_ADDR]] // CHECK: [[RES:%.+]] = sext i8 [[A_VAL]] to i32 -// CHECK: call void @__kmpc_push_num_threads([[IDENT_T_TY]]* [[DEF_LOC_2]], i32 [[GTID]], i32 [[RES]]) -// CHECK: call void {{.*}} @__kmpc_fork_call( +// CHECK: call {{.*}}void @__kmpc_push_num_threads([[IDENT_T_TY]]* [[DEF_LOC_2]], i32 [[GTID]], i32 [[RES]]) +// CHECK: call {{.*}}void {{.*}} @__kmpc_fork_call( // CHECK: invoke{{.*}} [[INT_TY:i[0-9]+]] [[TMAIN_CHAR_5:@.+]]() // CHECK: invoke{{.*}} [[INT_TY]] [[TMAIN_S_1:@.+]]() // CHECK: call {{.*}} [[S_TY_DESTR:@.+]]([[S_TY]]* [[S_ADDR]]) @@ -60,24 +60,24 @@ int main() { // CHECK: } // CHECK: define{{.*}} [[INT_TY]] [[TMAIN_CHAR_5]]() -// CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEF_LOC_2]]) -// CHECK: call void @__kmpc_push_num_threads([[IDENT_T_TY]]* [[DEF_LOC_2]], i32 [[GTID]], i32 5) -// CHECK: call void {{.*}} @__kmpc_fork_call( -// CHECK: call void @__kmpc_push_num_threads([[IDENT_T_TY]]* [[DEF_LOC_2]], i32 [[GTID]], i32 23) -// CHECK: call void {{.*}} @__kmpc_fork_call( +// CHECK: [[GTID:%.+]] = call {{.*}}i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEF_LOC_2]]) +// CHECK: call {{.*}}void @__kmpc_push_num_threads([[IDENT_T_TY]]* [[DEF_LOC_2]], i32 [[GTID]], i32 5) +// CHECK: call {{.*}}void {{.*}} @__kmpc_fork_call( +// CHECK: call {{.*}}void @__kmpc_push_num_threads([[IDENT_T_TY]]* [[DEF_LOC_2]], i32 [[GTID]], i32 23) +// CHECK: call {{.*}}void {{.*}} @__kmpc_fork_call( // CHECK: ret [[INT_TY]] 0 // CHECK-NEXT: } // CHECK: define{{.*}} [[INT_TY]] [[TMAIN_S_1]]() -// CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEF_LOC_2]]) -// CHECK: call void @__kmpc_push_num_threads([[IDENT_T_TY]]* [[DEF_LOC_2]], i32 [[GTID]], i32 1) -// CHECK: call void {{.*}} @__kmpc_fork_call( +// CHECK: [[GTID:%.+]] = call {{.*}}i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEF_LOC_2]]) +// CHECK: call {{.*}}void @__kmpc_push_num_threads([[IDENT_T_TY]]* [[DEF_LOC_2]], i32 [[GTID]], i32 1) +// CHECK: call {{.*}}void {{.*}} @__kmpc_fork_call( // CHECK: call {{.*}} [[S_TY_CONSTR]]([[S_TY]]* [[S_TEMP:%.+]], [[INTPTR_T_TY]] [[INTPTR_T_TY_ATTR]]23) // CHECK: [[S_CHAR_OP:%.+]] = invoke{{.*}} i8 [[S_TY_CHAR_OP]]([[S_TY]]* [[S_TEMP]]) // CHECK: [[RES:%.+]] = sext {{.*}}i8 [[S_CHAR_OP]] to i32 -// CHECK: call void @__kmpc_push_num_threads([[IDENT_T_TY]]* [[DEF_LOC_2]], i32 [[GTID]], i32 [[RES]]) +// CHECK: call {{.*}}void @__kmpc_push_num_threads([[IDENT_T_TY]]* [[DEF_LOC_2]], i32 [[GTID]], i32 [[RES]]) // CHECK: call {{.*}} [[S_TY_DESTR]]([[S_TY]]* [[S_TEMP]]) -// CHECK: call void {{.*}} @__kmpc_fork_call( +// CHECK: call {{.*}}void {{.*}} @__kmpc_fork_call( // CHECK: ret [[INT_TY]] 0 // CHECK: } diff --git a/test/OpenMP/parallel_private_codegen.cpp b/test/OpenMP/parallel_private_codegen.cpp index 99e2d4d..55f25c6 100644 --- a/test/OpenMP/parallel_private_codegen.cpp +++ b/test/OpenMP/parallel_private_codegen.cpp @@ -19,9 +19,9 @@ struct S { volatile int g = 1212; // CHECK: [[S_FLOAT_TY:%.+]] = type { float } -// CHECK: [[CAP_MAIN_TY:%.+]] = type { [2 x i{{[0-9]+}}]*, i{{[0-9]+}}*, [2 x [[S_FLOAT_TY]]]*, [[S_FLOAT_TY]]* } +// CHECK: [[CAP_MAIN_TY:%.+]] = type { i8 } // CHECK: [[S_INT_TY:%.+]] = type { i{{[0-9]+}} } -// CHECK: [[CAP_TMAIN_TY:%.+]] = type { [2 x i{{[0-9]+}}]*, i{{[0-9]+}}*, [2 x [[S_INT_TY]]]*, [[S_INT_TY]]* } +// CHECK: [[CAP_TMAIN_TY:%.+]] = type { i8 } template <typename T> T tmain() { S<T> test; @@ -41,13 +41,12 @@ int main() { #ifdef LAMBDA // LAMBDA: [[G:@.+]] = global i{{[0-9]+}} 1212, // LAMBDA-LABEL: @main - // LAMBDA: call{{( x86_thiscallcc)?}} void [[OUTER_LAMBDA:@.+]]( + // LAMBDA: call{{.*}} void [[OUTER_LAMBDA:@.+]]( [&]() { // LAMBDA: define{{.*}} internal{{.*}} void [[OUTER_LAMBDA]]( - // LAMBDA: [[G_LOCAL_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[AGG_CAPTURED:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 - // LAMBDA: store i{{[0-9]+}}* [[G]], i{{[0-9]+}}** [[G_LOCAL_REF]] - // LAMBDA: [[ARG:%.+]] = bitcast %{{.+}}* [[AGG_CAPTURED]] to i8* - // LAMBDA: call void {{.+}} @__kmpc_fork_call({{.+}}, i32 1, {{.+}}* [[OMP_REGION:@.+]] to {{.+}}, i8* [[ARG]]) + // LAMBDA-NOT: = getelementptr inbounds %{{.+}}, + // LAMBDA: [[ARG:%.+]] = bitcast %{{.+}}* %{{.+}} to i8* + // LAMBDA: call{{.*}} void {{.+}} @__kmpc_fork_call({{.+}}, i32 1, {{.+}}* [[OMP_REGION:@.+]] to {{.+}}, i8* [[ARG]]) #pragma omp parallel private(g) { // LAMBDA: define{{.*}} internal{{.*}} void [[OMP_REGION]](i32* %{{.+}}, i32* %{{.+}}, %{{.+}}* [[ARG:%.+]]) @@ -57,7 +56,7 @@ int main() { // LAMBDA: store volatile i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], // LAMBDA: [[G_PRIVATE_ADDR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // LAMBDA: store i{{[0-9]+}}* [[G_PRIVATE_ADDR]], i{{[0-9]+}}** [[G_PRIVATE_ADDR_REF]] - // LAMBDA: call{{( x86_thiscallcc)?}} void [[INNER_LAMBDA:@.+]](%{{.+}}* [[ARG]]) + // LAMBDA: call{{.*}} void [[INNER_LAMBDA:@.+]](%{{.+}}* [[ARG]]) [&]() { // LAMBDA: define {{.+}} void [[INNER_LAMBDA]](%{{.+}}* [[ARG_PTR:%.+]]) // LAMBDA: store %{{.+}}* [[ARG_PTR]], %{{.+}}** [[ARG_PTR_REF:%.+]], @@ -73,13 +72,12 @@ int main() { #elif defined(BLOCKS) // BLOCKS: [[G:@.+]] = global i{{[0-9]+}} 1212, // BLOCKS-LABEL: @main - // BLOCKS: call void {{%.+}}(i8 + // BLOCKS: call{{.*}} void {{%.+}}(i8 ^{ // BLOCKS: define{{.*}} internal{{.*}} void {{.+}}(i8* - // BLOCKS: [[G_LOCAL_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[AGG_CAPTURED:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 - // BLOCKS: store i{{[0-9]+}}* [[G]], i{{[0-9]+}}** [[G_LOCAL_REF]] - // BLOCKS: [[ARG:%.+]] = bitcast %{{.+}}* [[AGG_CAPTURED]] to i8* - // BLOCKS: call void {{.+}} @__kmpc_fork_call({{.+}}, i32 1, {{.+}}* [[OMP_REGION:@.+]] to {{.+}}, i8* [[ARG]]) + // BLOCKS-NOT: = getelementptr inbounds %{{.+}}, + // BLOCKS: [[ARG:%.+]] = bitcast %{{.+}}* %{{.+}} to i8* + // BLOCKS: call{{.*}} void {{.+}} @__kmpc_fork_call({{.+}}, i32 1, {{.+}}* [[OMP_REGION:@.+]] to {{.+}}, i8* [[ARG]]) #pragma omp parallel private(g) { // BLOCKS: define{{.*}} internal{{.*}} void [[OMP_REGION]](i32* %{{.+}}, i32* %{{.+}}, %{{.+}}* [[ARG:%.+]]) @@ -90,7 +88,7 @@ int main() { // BLOCKS-NOT: [[G]]{{[[^:word:]]}} // BLOCKS: i{{[0-9]+}}* [[G_PRIVATE_ADDR]] // BLOCKS-NOT: [[G]]{{[[^:word:]]}} - // BLOCKS: call void {{%.+}}(i8 + // BLOCKS: call{{.*}} void {{%.+}}(i8 ^{ // BLOCKS: define {{.+}} void {{@.+}}(i8* g = 2; diff --git a/test/OpenMP/parallel_proc_bind_codegen.cpp b/test/OpenMP/parallel_proc_bind_codegen.cpp index 2a8eaee..34a64de 100644 --- a/test/OpenMP/parallel_proc_bind_codegen.cpp +++ b/test/OpenMP/parallel_proc_bind_codegen.cpp @@ -36,16 +36,16 @@ int main() { } // CHECK-LABEL: @main -// CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEF_LOC_2]]) -// CHECK: call void @__kmpc_push_proc_bind([[IDENT_T_TY]]* [[DEF_LOC_2]], i32 [[GTID]], i32 4) -// CHECK: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call( -// CHECK: call void @__kmpc_push_proc_bind([[IDENT_T_TY]]* [[DEF_LOC_2]], i32 [[GTID]], i32 3) -// CHECK: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call( +// CHECK: [[GTID:%.+]] = call {{.*}}i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEF_LOC_2]]) +// CHECK: call {{.*}}void @__kmpc_push_proc_bind([[IDENT_T_TY]]* [[DEF_LOC_2]], i32 [[GTID]], i32 4) +// CHECK: call {{.*}}void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call( +// CHECK: call {{.*}}void @__kmpc_push_proc_bind([[IDENT_T_TY]]* [[DEF_LOC_2]], i32 [[GTID]], i32 3) +// CHECK: call {{.*}}void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call( // CHECK-LABEL: @{{.+}}tmain -// CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEF_LOC_2]]) -// CHECK: call void @__kmpc_push_proc_bind([[IDENT_T_TY]]* [[DEF_LOC_2]], i32 [[GTID]], i32 2) -// CHECK: call void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call( +// CHECK: [[GTID:%.+]] = call {{.*}}i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEF_LOC_2]]) +// CHECK: call {{.*}}void @__kmpc_push_proc_bind([[IDENT_T_TY]]* [[DEF_LOC_2]], i32 [[GTID]], i32 2) +// CHECK: call {{.*}}void (%ident_t*, i32, void (i32*, i32*, ...)*, ...) @__kmpc_fork_call( // CHECK: ret i32 0 // CHECK-NEXT: } diff --git a/test/OpenMP/parallel_sections_codegen.cpp b/test/OpenMP/parallel_sections_codegen.cpp index c16cc8d..ba1bf6c 100644 --- a/test/OpenMP/parallel_sections_codegen.cpp +++ b/test/OpenMP/parallel_sections_codegen.cpp @@ -73,7 +73,7 @@ int main() { // CHECK: [[INNER_LOOP_END]] } // CHECK: call void @__kmpc_for_static_fini(%{{.+}}* @{{.+}}, i32 [[GTID]]) -// CHECK: call i32 @__kmpc_cancel_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], +// CHECK: call void @__kmpc_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], return tmain<int>(); } @@ -89,7 +89,7 @@ int main() { // CHECK: call void @__kmpc_end_single( // CHECK-NEXT: br label %[[END]] // CHECK: [[END]] -// CHECK-NEXT: call i32 @__kmpc_cancel_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], +// CHECK-NEXT: call void @__kmpc_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], // CHECK-NEXT: ret // CHECK: [[TERM_LPAD]] // CHECK: call void @__clang_call_terminate(i8* diff --git a/test/OpenMP/sections_codegen.cpp b/test/OpenMP/sections_codegen.cpp index 11cc900..d25230a 100644 --- a/test/OpenMP/sections_codegen.cpp +++ b/test/OpenMP/sections_codegen.cpp @@ -72,7 +72,7 @@ int main() { // CHECK: [[INNER_LOOP_END]] } // CHECK: call void @__kmpc_for_static_fini(%{{.+}}* @{{.+}}, i32 [[GTID]]) -// CHECK: call i32 @__kmpc_cancel_barrier(%{{.+}}* [[IMPLICIT_BARRIER_SECTIONS_LOC]], +// CHECK: call void @__kmpc_barrier(%{{.+}}* [[IMPLICIT_BARRIER_SECTIONS_LOC]], #pragma omp sections nowait { foo(); @@ -96,8 +96,8 @@ int main() { // CHECK-NEXT: br label %[[END]] // CHECK: [[END]] // CHECK-NEXT: call i32 @__kmpc_cancel_barrier(%{{.+}}* [[IMPLICIT_BARRIER_SINGLE_LOC]], -// CHECK-NEXT: call i32 @__kmpc_cancel_barrier( -// CHECK-NEXT: ret +// CHECK: call i32 @__kmpc_cancel_barrier( +// CHECK: ret // CHECK: [[TERM_LPAD]] // CHECK: call void @__clang_call_terminate(i8* // CHECK-NEXT: unreachable diff --git a/test/OpenMP/sections_firstprivate_codegen.cpp b/test/OpenMP/sections_firstprivate_codegen.cpp index ba49864..4ec16ba 100644 --- a/test/OpenMP/sections_firstprivate_codegen.cpp +++ b/test/OpenMP/sections_firstprivate_codegen.cpp @@ -84,7 +84,7 @@ int main() { // LAMBDA: [[G_PRIVATE_ADDR:%.+]] = alloca i{{[0-9]+}}, // LAMBDA: [[G_VAL:%.+]] = load volatile i{{[0-9]+}}, i{{[0-9]+}}* [[G]] // LAMBDA: store i{{[0-9]+}} [[G_VAL]], i{{[0-9]+}}* [[G_PRIVATE_ADDR]] - // LAMBDA: call i32 @__kmpc_cancel_barrier( + // LAMBDA: call void @__kmpc_barrier( g = 1; // LAMBDA: call void @__kmpc_for_static_init_4( // LAMBDA: store volatile i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], @@ -126,7 +126,7 @@ int main() { // BLOCKS: [[G_PRIVATE_ADDR:%.+]] = alloca i{{[0-9]+}}, // BLOCKS: [[G_VAL:%.+]] = load volatile i{{[0-9]+}}, i{{[0-9]+}}* [[G]] // BLOCKS: store i{{[0-9]+}} [[G_VAL]], i{{[0-9]+}}* [[G_PRIVATE_ADDR]] - // BLOCKS: call i32 @__kmpc_cancel_barrier( + // BLOCKS: call void @__kmpc_barrier( g = 1; // BLOCKS: call void @__kmpc_for_static_init_4( // BLOCKS: store volatile i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]], @@ -199,7 +199,7 @@ int main() { // CHECK-DAG: call {{.*}} [[S_FLOAT_TY_DESTR]]([[S_FLOAT_TY]]* // CHECK: call void @__kmpc_end_single( -// CHECK: call i32 @__kmpc_cancel_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], i{{[0-9]+}} [[GTID]]) +// CHECK: call void @__kmpc_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], i{{[0-9]+}} [[GTID]]) // CHECK: = call {{.*}}i{{.+}} [[TMAIN_INT:@.+]]() @@ -261,7 +261,7 @@ int main() { // Synchronization for initialization. // CHECK: [[GTID_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[GTID_ADDR_ADDR]] // CHECK: [[GTID:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[GTID_REF]] -// CHECK: call i32 @__kmpc_cancel_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], i{{[0-9]+}} [[GTID]]) +// CHECK: call void @__kmpc_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], i{{[0-9]+}} [[GTID]]) // CHECK: call void @__kmpc_for_static_init_4( // CHECK: call void @__kmpc_for_static_fini( diff --git a/test/OpenMP/sections_private_codegen.cpp b/test/OpenMP/sections_private_codegen.cpp index 4bad714..90331cb 100644 --- a/test/OpenMP/sections_private_codegen.cpp +++ b/test/OpenMP/sections_private_codegen.cpp @@ -19,9 +19,9 @@ struct S { volatile double g; // CHECK: [[S_FLOAT_TY:%.+]] = type { float } -// CHECK: [[CAP_MAIN_TY:%.+]] = type { i{{[0-9]+}}*, [2 x i{{[0-9]+}}]*, [2 x [[S_FLOAT_TY]]]*, [[S_FLOAT_TY]]* } +// CHECK: [[CAP_MAIN_TY:%.+]] = type { i8 } // CHECK: [[S_INT_TY:%.+]] = type { i{{[0-9]+}} } -// CHECK: [[CAP_TMAIN_TY:%.+]] = type { i{{[0-9]+}}*, [2 x i{{[0-9]+}}]*, [2 x [[S_INT_TY]]]*, [[S_INT_TY]]* } +// CHECK: [[CAP_TMAIN_TY:%.+]] = type { i8 } template <typename T> T tmain() { S<T> test; @@ -43,10 +43,10 @@ int main() { #ifdef LAMBDA // LAMBDA: [[G:@.+]] = global double // LAMBDA-LABEL: @main - // LAMBDA: call{{( x86_thiscallcc)?}} void [[OUTER_LAMBDA:@.+]]( + // LAMBDA: call{{.*}} void [[OUTER_LAMBDA:@.+]]( [&]() { // LAMBDA: define{{.*}} internal{{.*}} void [[OUTER_LAMBDA]]( - // LAMBDA: call void {{.+}} @__kmpc_fork_call({{.+}}, i32 1, {{.+}}* [[OMP_REGION:@.+]] to {{.+}}, i8* %{{.+}}) + // LAMBDA: call {{.*}}void {{.+}} @__kmpc_fork_call({{.+}}, i32 1, {{.+}}* [[OMP_REGION:@.+]] to {{.+}}, i8* %{{.+}}) #pragma omp parallel #pragma omp sections private(g) { @@ -54,12 +54,12 @@ int main() { // LAMBDA: [[G_PRIVATE_ADDR:%.+]] = alloca double, // LAMBDA: store %{{.+}}* [[ARG]], %{{.+}}** [[ARG_REF:%.+]], g = 1; - // LAMBDA: call void @__kmpc_for_static_init_4( + // LAMBDA: call {{.*}}void @__kmpc_for_static_init_4( // LAMBDA: store volatile double 1.0{{.+}}, double* [[G_PRIVATE_ADDR]], // LAMBDA: [[G_PRIVATE_ADDR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // LAMBDA: store double* [[G_PRIVATE_ADDR]], double** [[G_PRIVATE_ADDR_REF]] - // LAMBDA: call{{( x86_thiscallcc)?}} void [[INNER_LAMBDA:@.+]](%{{.+}}* [[ARG]]) - // LAMBDA: call void @__kmpc_for_static_fini( + // LAMBDA: call{{.*}} void [[INNER_LAMBDA:@.+]](%{{.+}}* [[ARG]]) + // LAMBDA: call {{.*}}void @__kmpc_for_static_fini( #pragma omp section [&]() { // LAMBDA: define {{.+}} void [[INNER_LAMBDA]](%{{.+}}* [[ARG_PTR:%.+]]) @@ -76,10 +76,10 @@ int main() { #elif defined(BLOCKS) // BLOCKS: [[G:@.+]] = global double // BLOCKS-LABEL: @main - // BLOCKS: call void {{%.+}}(i8 + // BLOCKS: call {{.*}}void {{%.+}}(i8 ^{ // BLOCKS: define{{.*}} internal{{.*}} void {{.+}}(i8* - // BLOCKS: call void {{.+}} @__kmpc_fork_call({{.+}}, i32 1, {{.+}}* [[OMP_REGION:@.+]] to {{.+}}, i8* {{.+}}) + // BLOCKS: call {{.*}}void {{.+}} @__kmpc_fork_call({{.+}}, i32 1, {{.+}}* [[OMP_REGION:@.+]] to {{.+}}, i8* {{.+}}) #pragma omp parallel #pragma omp sections private(g) { @@ -87,13 +87,13 @@ int main() { // BLOCKS: [[G_PRIVATE_ADDR:%.+]] = alloca double, // BLOCKS: store %{{.+}}* [[ARG]], %{{.+}}** [[ARG_REF:%.+]], g = 1; - // BLOCKS: call void @__kmpc_for_static_init_4( + // BLOCKS: call {{.*}}void @__kmpc_for_static_init_4( // BLOCKS: store volatile double 1.0{{.+}}, double* [[G_PRIVATE_ADDR]], // BLOCKS-NOT: [[G]]{{[[^:word:]]}} // BLOCKS: double* [[G_PRIVATE_ADDR]] // BLOCKS-NOT: [[G]]{{[[^:word:]]}} - // BLOCKS: call void {{%.+}}(i8 - // BLOCKS: call void @__kmpc_for_static_fini( + // BLOCKS: call {{.*}}void {{%.+}}(i8 + // BLOCKS: call {{.*}}void @__kmpc_for_static_fini( #pragma omp section ^{ // BLOCKS: define {{.+}} void {{@.+}}(i8* diff --git a/test/OpenMP/simd_metadata.c b/test/OpenMP/simd_metadata.c index 2a95fef1..e7e35dd 100644 --- a/test/OpenMP/simd_metadata.c +++ b/test/OpenMP/simd_metadata.c @@ -1,5 +1,6 @@ // RUN: %clang_cc1 -fopenmp -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=X86 // RUN: %clang_cc1 -fopenmp -triple x86_64-unknown-unknown -target-feature +avx -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=X86-AVX +// RUN: %clang_cc1 -fopenmp -triple x86_64-unknown-unknown -target-feature +avx512f -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=X86-AVX512 // RUN: %clang_cc1 -fopenmp -triple powerpc64-unknown-unknown -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=PPC // RUN: %clang_cc1 -fopenmp -triple powerpc64-unknown-unknown -target-abi elfv1-qpx -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK -check-prefix=PPC-QPX @@ -16,6 +17,7 @@ void h1(float *c, float *a, double b[], int size) // X86-NEXT: [[A_MASKEDPTR:%.+]] = and i{{[0-9]+}} [[A_PTRINT]], 15 // X86-AVX-NEXT: [[A_MASKEDPTR:%.+]] = and i{{[0-9]+}} [[A_PTRINT]], 31 +// X86-AVX512-NEXT: [[A_MASKEDPTR:%.+]] = and i{{[0-9]+}} [[A_PTRINT]], 63 // PPC-NEXT: [[A_MASKEDPTR:%.+]] = and i{{[0-9]+}} [[A_PTRINT]], 15 // PPC-QPX-NEXT: [[A_MASKEDPTR:%.+]] = and i{{[0-9]+}} [[A_PTRINT]], 15 @@ -25,6 +27,7 @@ void h1(float *c, float *a, double b[], int size) // X86-NEXT: [[B_MASKEDPTR:%.+]] = and i{{[0-9]+}} [[B_PTRINT]], 15 // X86-AVX-NEXT: [[B_MASKEDPTR:%.+]] = and i{{[0-9]+}} [[B_PTRINT]], 31 +// X86-AVX512-NEXT: [[B_MASKEDPTR:%.+]] = and i{{[0-9]+}} [[B_PTRINT]], 63 // PPC-NEXT: [[B_MASKEDPTR:%.+]] = and i{{[0-9]+}} [[B_PTRINT]], 15 // PPC-QPX-NEXT: [[B_MASKEDPTR:%.+]] = and i{{[0-9]+}} [[B_PTRINT]], 31 diff --git a/test/OpenMP/single_codegen.cpp b/test/OpenMP/single_codegen.cpp index 0593b2a..d81739e 100644 --- a/test/OpenMP/single_codegen.cpp +++ b/test/OpenMP/single_codegen.cpp @@ -63,7 +63,7 @@ int main() { // CHECK-NEXT: call void @__kmpc_end_single([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) // CHECK-NEXT: br label {{%?}}[[EXIT]] // CHECK: [[EXIT]] -// CHECK: call{{.*}} @__kmpc_cancel_barrier([[IDENT_T_TY]]* [[IMPLICIT_BARRIER_SINGLE_LOC]], i32 [[GTID]]) +// CHECK: call{{.*}} @__kmpc_barrier([[IDENT_T_TY]]* [[IMPLICIT_BARRIER_SINGLE_LOC]], i32 [[GTID]]) #pragma omp single a = 2; // CHECK: store i32 0, i32* [[DID_IT]] diff --git a/test/OpenMP/single_firstprivate_codegen.cpp b/test/OpenMP/single_firstprivate_codegen.cpp index e30c00d..059108b 100644 --- a/test/OpenMP/single_firstprivate_codegen.cpp +++ b/test/OpenMP/single_firstprivate_codegen.cpp @@ -182,7 +182,7 @@ int main() { // CHECK-DAG: call {{.*}} [[S_FLOAT_TY_DESTR]]([[S_FLOAT_TY]]* // CHECK: call void @__kmpc_end_single( -// CHECK: call i32 @__kmpc_cancel_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], i{{[0-9]+}} [[GTID]]) +// CHECK: call void @__kmpc_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], i{{[0-9]+}} [[GTID]]) // CHECK: = call {{.*}}i{{.+}} [[TMAIN_INT:@.+]]() diff --git a/test/OpenMP/single_private_codegen.cpp b/test/OpenMP/single_private_codegen.cpp index 4f78d08..a7fb2ed 100644 --- a/test/OpenMP/single_private_codegen.cpp +++ b/test/OpenMP/single_private_codegen.cpp @@ -19,9 +19,9 @@ struct S { volatile double g; // CHECK: [[S_FLOAT_TY:%.+]] = type { float } -// CHECK: [[CAP_MAIN_TY:%.+]] = type { i{{[0-9]+}}*, [2 x i{{[0-9]+}}]*, [2 x [[S_FLOAT_TY]]]*, [[S_FLOAT_TY]]* } +// CHECK: [[CAP_MAIN_TY:%.+]] = type { i8 } // CHECK: [[S_INT_TY:%.+]] = type { i{{[0-9]+}} } -// CHECK: [[CAP_TMAIN_TY:%.+]] = type { i{{[0-9]+}}*, [2 x i{{[0-9]+}}]*, [2 x [[S_INT_TY]]]*, [[S_INT_TY]]* } +// CHECK: [[CAP_TMAIN_TY:%.+]] = type { i8 } template <typename T> T tmain() { S<T> test; @@ -42,10 +42,10 @@ int main() { #ifdef LAMBDA // LAMBDA: [[G:@.+]] = global double // LAMBDA-LABEL: @main - // LAMBDA: call{{( x86_thiscallcc)?}} void [[OUTER_LAMBDA:@.+]]( + // LAMBDA: call{{.*}} void [[OUTER_LAMBDA:@.+]]( [&]() { // LAMBDA: define{{.*}} internal{{.*}} void [[OUTER_LAMBDA]]( - // LAMBDA: call void {{.+}} @__kmpc_fork_call({{.+}}, i32 1, {{.+}}* [[OMP_REGION:@.+]] to {{.+}}, i8* %{{.+}}) + // LAMBDA: call {{.*}}void {{.+}} @__kmpc_fork_call({{.+}}, i32 1, {{.+}}* [[OMP_REGION:@.+]] to {{.+}}, i8* %{{.+}}) #pragma omp parallel #pragma omp single private(g) { @@ -53,12 +53,12 @@ int main() { // LAMBDA: [[G_PRIVATE_ADDR:%.+]] = alloca double, // LAMBDA: store %{{.+}}* [[ARG]], %{{.+}}** [[ARG_REF:%.+]], g = 1; - // LAMBDA: call i32 @__kmpc_single( + // LAMBDA: call {{.*}}i32 @__kmpc_single( // LAMBDA: store volatile double 1.0{{.+}}, double* [[G_PRIVATE_ADDR]], // LAMBDA: [[G_PRIVATE_ADDR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // LAMBDA: store double* [[G_PRIVATE_ADDR]], double** [[G_PRIVATE_ADDR_REF]] - // LAMBDA: call{{( x86_thiscallcc)?}} void [[INNER_LAMBDA:@.+]](%{{.+}}* [[ARG]]) - // LAMBDA: call void @__kmpc_end_single( + // LAMBDA: call{{.*}} void [[INNER_LAMBDA:@.+]](%{{.+}}* [[ARG]]) + // LAMBDA: call {{.*}}void @__kmpc_end_single( [&]() { // LAMBDA: define {{.+}} void [[INNER_LAMBDA]](%{{.+}}* [[ARG_PTR:%.+]]) // LAMBDA: store %{{.+}}* [[ARG_PTR]], %{{.+}}** [[ARG_PTR_REF:%.+]], @@ -74,10 +74,10 @@ int main() { #elif defined(BLOCKS) // BLOCKS: [[G:@.+]] = global double // BLOCKS-LABEL: @main - // BLOCKS: call void {{%.+}}(i8 + // BLOCKS: call {{.*}}void {{%.+}}(i8 ^{ // BLOCKS: define{{.*}} internal{{.*}} void {{.+}}(i8* - // BLOCKS: call void {{.+}} @__kmpc_fork_call({{.+}}, i32 1, {{.+}}* [[OMP_REGION:@.+]] to {{.+}}, i8* {{.+}}) + // BLOCKS: call {{.*}}void {{.+}} @__kmpc_fork_call({{.+}}, i32 1, {{.+}}* [[OMP_REGION:@.+]] to {{.+}}, i8* {{.+}}) #pragma omp parallel #pragma omp single private(g) { @@ -85,13 +85,13 @@ int main() { // BLOCKS: [[G_PRIVATE_ADDR:%.+]] = alloca double, // BLOCKS: store %{{.+}}* [[ARG]], %{{.+}}** [[ARG_REF:%.+]], g = 1; - // BLOCKS: call i32 @__kmpc_single( + // BLOCKS: call {{.*}}i32 @__kmpc_single( // BLOCKS: store volatile double 1.0{{.+}}, double* [[G_PRIVATE_ADDR]], // BLOCKS-NOT: [[G]]{{[[^:word:]]}} // BLOCKS: double* [[G_PRIVATE_ADDR]] // BLOCKS-NOT: [[G]]{{[[^:word:]]}} - // BLOCKS: call void {{%.+}}(i8 - // BLOCKS: call void @__kmpc_end_single( + // BLOCKS: call {{.*}}void {{%.+}}(i8 + // BLOCKS: call {{.*}}void @__kmpc_end_single( ^{ // BLOCKS: define {{.+}} void {{@.+}}(i8* g = 2; diff --git a/test/OpenMP/task_ast_print.cpp b/test/OpenMP/task_ast_print.cpp index 55407c1..5fd4103 100644 --- a/test/OpenMP/task_ast_print.cpp +++ b/test/OpenMP/task_ast_print.cpp @@ -33,7 +33,7 @@ T tmain(T argc, T *argv) { T b = argc, c, d, e, f, g; static T a; S<T> s; -#pragma omp task untied +#pragma omp task untied depend(in : argc) a = 2; #pragma omp task default(none), private(argc, b) firstprivate(argv) shared(d) if (argc > 0) final(S<T>::TS > 0) foo(); @@ -46,7 +46,7 @@ T tmain(T argc, T *argv) { // CHECK-NEXT: int b = argc, c, d, e, f, g; // CHECK-NEXT: static int a; // CHECK-NEXT: S<int> s; -// CHECK-NEXT: #pragma omp task untied +// CHECK-NEXT: #pragma omp task untied depend(in : argc) // CHECK-NEXT: a = 2; // CHECK-NEXT: #pragma omp task default(none) private(argc,b) firstprivate(argv) shared(d) if(argc > 0) final(S<int>::TS > 0) // CHECK-NEXT: foo() @@ -56,7 +56,7 @@ T tmain(T argc, T *argv) { // CHECK-NEXT: long b = argc, c, d, e, f, g; // CHECK-NEXT: static long a; // CHECK-NEXT: S<long> s; -// CHECK-NEXT: #pragma omp task untied +// CHECK-NEXT: #pragma omp task untied depend(in : argc) // CHECK-NEXT: a = 2; // CHECK-NEXT: #pragma omp task default(none) private(argc,b) firstprivate(argv) shared(d) if(argc > 0) final(S<long>::TS > 0) // CHECK-NEXT: foo() @@ -66,7 +66,7 @@ T tmain(T argc, T *argv) { // CHECK-NEXT: T b = argc, c, d, e, f, g; // CHECK-NEXT: static T a; // CHECK-NEXT: S<T> s; -// CHECK-NEXT: #pragma omp task untied +// CHECK-NEXT: #pragma omp task untied depend(in : argc) // CHECK-NEXT: a = 2; // CHECK-NEXT: #pragma omp task default(none) private(argc,b) firstprivate(argv) shared(d) if(argc > 0) final(S<T>::TS > 0) // CHECK-NEXT: foo() @@ -82,12 +82,12 @@ int main(int argc, char **argv) { #pragma omp threadprivate(a) Enum ee; // CHECK: Enum ee; -#pragma omp task untied mergeable - // CHECK-NEXT: #pragma omp task untied mergeable +#pragma omp task untied mergeable depend(out:argv[1]) + // CHECK-NEXT: #pragma omp task untied mergeable depend(out : argv[1]) a = 2; // CHECK-NEXT: a = 2; -#pragma omp task default(none), private(argc, b) firstprivate(argv) if (argc > 0) final(a > 0) - // CHECK-NEXT: #pragma omp task default(none) private(argc,b) firstprivate(argv) if(argc > 0) final(a > 0) +#pragma omp task default(none), private(argc, b) firstprivate(argv) if (argc > 0) final(a > 0) depend(inout : a) + // CHECK-NEXT: #pragma omp task default(none) private(argc,b) firstprivate(argv) if(argc > 0) final(a > 0) depend(inout : a) foo(); // CHECK-NEXT: foo(); return tmain<int, 5>(b, &b) + tmain<long, 1>(x, &x); diff --git a/test/OpenMP/task_codegen.cpp b/test/OpenMP/task_codegen.cpp index 1c28fbc..cce0a13 100644 --- a/test/OpenMP/task_codegen.cpp +++ b/test/OpenMP/task_codegen.cpp @@ -7,8 +7,10 @@ #define HEADER // CHECK-DAG: [[IDENT_T:%.+]] = type { i32, i32, i32, i32, i8* } -// CHECK-DAG: [[STRUCT_SHAREDS:%.+]] = type { i8*, [[STRUCT_S:%.+]]* } +// CHECK-DAG: [[STRUCT_SHAREDS:%.+]] = type { i8*, [2 x [[STRUCT_S:%.+]]]* } +// CHECK-DAG: [[STRUCT_SHAREDS1:%.+]] = type { [2 x [[STRUCT_S:%.+]]]* } // CHECK-DAG: [[KMP_TASK_T:%.+]] = type { i8*, i32 (i32, i8*)*, i32, i32 (i32, i8*)* } +// CHECK-DAG: [[KMP_DEPEND_INFO:%.+]] = type { i64, i64, i8 } struct S { int a; S() : a(0) {} @@ -19,14 +21,14 @@ int a; // CHECK-LABEL : @main int main() { // CHECK: [[B:%.+]] = alloca i8 -// CHECK: [[S:%.+]] = alloca [[STRUCT_S]] +// CHECK: [[S:%.+]] = alloca [2 x [[STRUCT_S]]] char b; - S s; + S s[2]; // CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num([[IDENT_T]]* @{{.+}}) // CHECK: [[B_REF:%.+]] = getelementptr inbounds [[STRUCT_SHAREDS]], [[STRUCT_SHAREDS]]* [[CAPTURES:%.+]], i32 0, i32 0 // CHECK: store i8* [[B]], i8** [[B_REF]] // CHECK: [[S_REF:%.+]] = getelementptr inbounds [[STRUCT_SHAREDS]], [[STRUCT_SHAREDS]]* [[CAPTURES]], i32 0, i32 1 -// CHECK: store [[STRUCT_S]]* [[S]], [[STRUCT_S]]** [[S_REF]] +// CHECK: store [2 x [[STRUCT_S]]]* [[S]], [2 x [[STRUCT_S]]]** [[S_REF]] // CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i32 1, i64 32, i64 16, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_T]]{{.*}}*)* [[TASK_ENTRY1:@.+]] to i32 (i32, i8*)*)) // CHECK: [[SHAREDS_REF_PTR:%.+]] = getelementptr inbounds [[KMP_TASK_T]], [[KMP_TASK_T]]* [[TASK_PTR:%.+]], i32 0, i32 0 // CHECK: [[SHAREDS_REF:%.+]] = load i8*, i8** [[SHAREDS_REF_PTR]] @@ -39,7 +41,47 @@ int main() { { a = 15; b = a; - s.a = 10; + s[0].a = 10; + } +// CHECK: [[S_REF:%.+]] = getelementptr inbounds [[STRUCT_SHAREDS1]], [[STRUCT_SHAREDS1]]* [[CAPTURES:%.+]], i32 0, i32 0 +// CHECK: store [2 x [[STRUCT_S]]]* [[S]], [2 x [[STRUCT_S]]]** [[S_REF]] +// CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc([[IDENT_T]]* @{{[^,]+}}, i32 [[GTID]], i32 1, i64 32, i64 8, +// CHECK: [[SHAREDS_REF_PTR:%.+]] = getelementptr inbounds [[KMP_TASK_T]], [[KMP_TASK_T]]* [[TASK_PTR:%.+]], i32 0, i32 0 +// CHECK: [[SHAREDS_REF:%.+]] = load i8*, i8** [[SHAREDS_REF_PTR]] +// CHECK: [[BITCAST:%.+]] = bitcast [[STRUCT_SHAREDS1]]* [[CAPTURES]] to i8* +// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[SHAREDS_REF]], i8* [[BITCAST]], i64 8, i32 8, i1 false) +// CHECK: [[DESTRUCTORS_REF_PTR:%.+]] = getelementptr inbounds [[KMP_TASK_T]], [[KMP_TASK_T]]* [[TASK_PTR]], i32 0, i32 3 +// CHECK: store i32 (i32, i8*)* null, i32 (i32, i8*)** [[DESTRUCTORS_REF_PTR]] +// CHECK: getelementptr inbounds [3 x [[KMP_DEPEND_INFO]]], [3 x [[KMP_DEPEND_INFO]]]* %{{[^,]+}}, i32 0, i32 0 +// CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 0 +// CHECK: store i64 ptrtoint (i32* @{{.+}} to i64), i64* +// CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 1 +// CHECK: store i64 4, i64* +// CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 2 +// CHECK: store i8 1, i8* +// CHECK: getelementptr inbounds [3 x [[KMP_DEPEND_INFO]]], [3 x [[KMP_DEPEND_INFO]]]* %{{[^,]+}}, i32 0, i32 1 +// CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 0 +// CHECK: ptrtoint i8* [[B]] to i64 +// CHECK: store i64 %{{[^,]+}}, i64* +// CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 1 +// CHECK: store i64 1, i64* +// CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 2 +// CHECK: store i8 1, i8* +// CHECK: getelementptr inbounds [3 x [[KMP_DEPEND_INFO]]], [3 x [[KMP_DEPEND_INFO]]]* %{{[^,]+}}, i32 0, i32 2 +// CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 0 +// CHECK: ptrtoint [2 x [[STRUCT_S]]]* [[S]] to i64 +// CHECK: store i64 %{{[^,]+}}, i64* +// CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 1 +// CHECK: store i64 8, i64* +// CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 2 +// CHECK: store i8 1, i8* +// CHECK: getelementptr inbounds [3 x [[KMP_DEPEND_INFO]]], [3 x [[KMP_DEPEND_INFO]]]* %{{[^,]+}}, i32 0, i32 0 +// CHECK: bitcast [[KMP_DEPEND_INFO]]* %{{.+}} to i8* +// CHECK: call i32 @__kmpc_omp_task_with_deps([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i8* [[ORIG_TASK_PTR]], i32 3, i8* %{{[^,]+}}, i32 0, i8* null) +#pragma omp task shared(a, s) depend(in : a, b, s) + { + a = 15; + s[1].a = 10; } // CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i32 0, i64 32, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_T]]{{.*}}*)* [[TASK_ENTRY2:@.+]] to i32 (i32, i8*)*)) // CHECK: [[DESTRUCTORS_REF_PTR:%.+]] = getelementptr inbounds [[KMP_TASK_T]]{{.*}}* {{%.+}}, i32 0, i32 3 @@ -49,6 +91,51 @@ int main() { { a = 1; } +// CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i32 0, i64 32, i64 1, +// CHECK: [[DESTRUCTORS_REF_PTR:%.+]] = getelementptr inbounds [[KMP_TASK_T]]{{.*}}* {{%.+}}, i32 0, i32 3 +// CHECK: store i32 (i32, i8*)* null, i32 (i32, i8*)** [[DESTRUCTORS_REF_PTR]] +// CHECK: getelementptr inbounds [2 x [[STRUCT_S]]], [2 x [[STRUCT_S]]]* [[S]], i32 0, i64 0 +// CHECK: getelementptr inbounds [1 x [[KMP_DEPEND_INFO]]], [1 x [[KMP_DEPEND_INFO]]]* %{{[^,]+}}, i32 0, i32 0 +// CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 0 +// CHECK: ptrtoint [[STRUCT_S]]* %{{.+}} to i64 +// CHECK: store i64 %{{[^,]+}}, i64* +// CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 1 +// CHECK: store i64 4, i64* +// CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 2 +// CHECK: store i8 2, i8* +// CHECK: getelementptr inbounds [1 x [[KMP_DEPEND_INFO]]], [1 x [[KMP_DEPEND_INFO]]]* %{{[^,]+}}, i32 0, i32 0 +// CHECK: bitcast [[KMP_DEPEND_INFO]]* %{{.+}} to i8* +// CHECK: call i32 @__kmpc_omp_task_with_deps([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i8* [[ORIG_TASK_PTR]], i32 1, i8* %{{[^,]+}}, i32 0, i8* null) +#pragma omp task untied depend(out : s[0]) + { + a = 1; + } +// CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i32 3, i64 32, i64 1, +// CHECK: [[DESTRUCTORS_REF_PTR:%.+]] = getelementptr inbounds [[KMP_TASK_T]]{{.*}}* {{%.+}}, i32 0, i32 3 +// CHECK: store i32 (i32, i8*)* null, i32 (i32, i8*)** [[DESTRUCTORS_REF_PTR]] +// CHECK: getelementptr inbounds [2 x [[KMP_DEPEND_INFO]]], [2 x [[KMP_DEPEND_INFO]]]* %{{[^,]+}}, i32 0, i32 0 +// CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 0 +// CHECK: store i64 ptrtoint (i32* @{{.+}} to i64), i64* +// CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 1 +// CHECK: store i64 4, i64* +// CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 2 +// CHECK: store i8 3, i8* +// CHECK: getelementptr inbounds [2 x [[STRUCT_S]]], [2 x [[STRUCT_S]]]* [[S]], i32 0, i64 1 +// CHECK: getelementptr inbounds [2 x [[KMP_DEPEND_INFO]]], [2 x [[KMP_DEPEND_INFO]]]* %{{[^,]+}}, i32 0, i32 1 +// CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 0 +// CHECK: ptrtoint [[STRUCT_S]]* %{{.+}} to i64 +// CHECK: store i64 %{{[^,]+}}, i64* +// CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 1 +// CHECK: store i64 4, i64* +// CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 2 +// CHECK: store i8 3, i8* +// CHECK: getelementptr inbounds [2 x [[KMP_DEPEND_INFO]]], [2 x [[KMP_DEPEND_INFO]]]* %{{[^,]+}}, i32 0, i32 0 +// CHECK: bitcast [[KMP_DEPEND_INFO]]* %{{.+}} to i8* +// CHECK: call i32 @__kmpc_omp_task_with_deps([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i8* [[ORIG_TASK_PTR]], i32 2, i8* %{{[^,]+}}, i32 0, i8* null) +#pragma omp task final(true) depend(inout: a, s[1]) + { + a = 2; + } // CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i32 3, i64 32, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_T]]{{.*}}*)* [[TASK_ENTRY3:@.+]] to i32 (i32, i8*)*)) // CHECK: [[DESTRUCTORS_REF_PTR:%.+]] = getelementptr inbounds [[KMP_TASK_T]]{{.*}}* {{%.+}}, i32 0, i32 3 // CHECK: store i32 (i32, i8*)* null, i32 (i32, i8*)** [[DESTRUCTORS_REF_PTR]] diff --git a/test/OpenMP/task_depend_messages.cpp b/test/OpenMP/task_depend_messages.cpp new file mode 100644 index 0000000..152350c --- /dev/null +++ b/test/OpenMP/task_depend_messages.cpp @@ -0,0 +1,39 @@ +// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - %s + +void foo() { +} + +bool foobool(int argc) { + return argc; +} + +struct S1; // expected-note {{declared here}} + +class vector { + public: + int operator[](int index) { return 0; } +}; + +int main(int argc, char **argv) { + vector vec; + typedef float V __attribute__((vector_size(16))); + V a; + + #pragma omp task depend // expected-error {{expected '(' after 'depend'}} + #pragma omp task depend ( // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after dependency type - ignoring}} + #pragma omp task depend () // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} + #pragma omp task depend (argc // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}} + #pragma omp task depend (in : argc)) // expected-warning {{extra tokens at the end of '#pragma omp task' are ignored}} + #pragma omp task depend (out: ) // expected-error {{expected expression}} + #pragma omp task depend (inout : foobool(argc)), depend (in, argc) // expected-error {{expected variable name, array element or array section}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected expression}} + #pragma omp task depend (out :S1) // expected-error {{'S1' does not refer to a value}} + #pragma omp task depend(in : argv[1][1] = '2') // expected-error {{expected variable name, array element or array section}} + #pragma omp task depend (in : vec[1]) // expected-error {{expected variable name, array element or array section}} + #pragma omp task depend (in : argv[0]) + #pragma omp task depend (in : ) // expected-error {{expected expression}} + #pragma omp task depend (in : main) // expected-error {{expected variable name, array element or array section}} + #pragma omp task depend(in : a[0]) // expected-error{{expected variable name, array element or array section}} + foo(); + + return 0; +} diff --git a/test/OpenMP/task_if_codegen.cpp b/test/OpenMP/task_if_codegen.cpp index d4fd6bb..be9b47b 100644 --- a/test/OpenMP/task_if_codegen.cpp +++ b/test/OpenMP/task_if_codegen.cpp @@ -11,6 +11,10 @@ void fn3(); void fn4(); void fn5(); void fn6(); +void fn7(); +void fn8(); +void fn9(); +void fn10(); int Arg; @@ -46,25 +50,31 @@ int tmain(T Arg) { fn2(); #pragma omp task if (Arg) fn3(); +#pragma omp task if (Arg) depend(in : Arg) + fn4(); +#pragma omp task if (Arg) depend(out : Arg) + fn5(); +#pragma omp task if (Arg) depend(inout : Arg) + fn6(); return 0; } // CHECK-LABEL: @main int main() { // CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num( -// CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc({{[^,]+}}, i32 [[GTID]], i32 1, i64 32, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[CAP_FN4:[^ ]+]] to i32 (i32, i8*)*)) +// CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc({{[^,]+}}, i32 [[GTID]], i32 1, i64 32, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[CAP_FN7:[^ ]+]] to i32 (i32, i8*)*)) // CHECK: call i32 @__kmpc_omp_task(%{{.+}}* @{{.+}}, i32 [[GTID]], i8* [[ORIG_TASK_PTR]]) #pragma omp task if (true) - fn4(); -// CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc( + fn7(); +// CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc({{[^,]+}}, i32 [[GTID]], i32 1, i64 32, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[CAP_FN8:[^ ]+]] to i32 (i32, i8*)*)) // CHECK: [[TASK_PTR:%.+]] = bitcast i8* [[ORIG_TASK_PTR]] to // CHECK: call void @__kmpc_omp_task_begin_if0(%{{.+}}* @{{.+}}, i{{.+}} [[GTID]], i8* [[ORIG_TASK_PTR]]) -// CHECK: call i32 [[CAP_FN5:@.+]](i32 [[GTID]], %{{.+}}* [[TASK_PTR]]) +// CHECK: call i32 [[CAP_FN8]](i32 [[GTID]], %{{.+}}* [[TASK_PTR]]) // CHECK: call void @__kmpc_omp_task_complete_if0(%{{.+}}* @{{.+}}, i{{.+}} [[GTID]], i8* [[ORIG_TASK_PTR]]) #pragma omp task if (false) - fn5(); + fn8(); -// CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc({{[^,]+}}, i32 [[GTID]], i32 1, i64 32, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[CAP_FN6:[^ ]+]] to i32 (i32, i8*)*)) +// CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc({{[^,]+}}, i32 [[GTID]], i32 1, i64 32, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[CAP_FN9:[^ ]+]] to i32 (i32, i8*)*)) // CHECK: [[TASK_PTR:%.+]] = bitcast i8* [[ORIG_TASK_PTR]] to // CHECK: br i1 %{{.+}}, label %[[OMP_THEN:.+]], label %[[OMP_ELSE:.+]] // CHECK: [[OMP_THEN]] @@ -72,26 +82,45 @@ int main() { // CHECK: br label %[[OMP_END:.+]] // CHECK: [[OMP_ELSE]] // CHECK: call void @__kmpc_omp_task_begin_if0(%{{.+}}* @{{.+}}, i{{.+}} [[GTID]], i8* [[ORIG_TASK_PTR]]) -// CHECK: call i32 [[CAP_FN6:@.+]](i32 [[GTID]], %{{.+}}* [[TASK_PTR]]) +// CHECK: call i32 [[CAP_FN9]](i32 [[GTID]], %{{.+}}* [[TASK_PTR]]) // CHECK: call void @__kmpc_omp_task_complete_if0(%{{.+}}* @{{.+}}, i{{.+}} [[GTID]], i8* [[ORIG_TASK_PTR]]) // CHECK: br label %[[OMP_END]] // CHECK: [[OMP_END]] #pragma omp task if (Arg) - fn6(); + fn9(); +// CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc({{[^,]+}}, i32 [[GTID]], i32 1, i64 32, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[CAP_FN10:[^ ]+]] to i32 (i32, i8*)*)) +// CHECK: [[TASK_PTR:%.+]] = bitcast i8* [[ORIG_TASK_PTR]] to +// CHECK: br i1 %{{.+}}, label %[[OMP_THEN:.+]], label %[[OMP_ELSE:.+]] +// CHECK: [[OMP_THEN]] +// CHECK: call i32 @__kmpc_omp_task_with_deps(%{{.+}}* @{{.+}}, i32 [[GTID]], i8* [[ORIG_TASK_PTR]], i32 1, i8* [[LIST:%[^,]+]], i32 0, i8* null) +// CHECK: br label %[[OMP_END:.+]] +// CHECK: [[OMP_ELSE]] +// CHECK: call void @__kmpc_omp_wait_deps(%{{.+}}* @{{.+}}, i32 [[GTID]], i32 1, i8* [[LIST]], i32 0, i8* null) +// CHECK: call void @__kmpc_omp_task_begin_if0(%{{.+}}* @{{.+}}, i{{.+}} [[GTID]], i8* [[ORIG_TASK_PTR]]) +// CHECK: call i32 [[CAP_FN10]](i32 [[GTID]], %{{.+}}* [[TASK_PTR]]) +// CHECK: call void @__kmpc_omp_task_complete_if0(%{{.+}}* @{{.+}}, i{{.+}} [[GTID]], i8* [[ORIG_TASK_PTR]]) +// CHECK: br label %[[OMP_END]] +// CHECK: [[OMP_END]] +#pragma omp task if (Arg) depend(inout : Arg) + fn10(); // CHECK: = call {{.*}}i{{.+}} @{{.+}}tmain return tmain(Arg); } -// CHECK: define internal i32 [[CAP_FN4]] -// CHECK: call void @{{.+}}fn4 +// CHECK: define internal i32 [[CAP_FN7]] +// CHECK: call void @{{.+}}fn7 // CHECK: ret i32 -// CHECK: define internal i32 [[CAP_FN5]] -// CHECK: call void @{{.+}}fn5 +// CHECK: define internal i32 [[CAP_FN8]] +// CHECK: call void @{{.+}}fn8 // CHECK: ret i32 -// CHECK: define internal i32 [[CAP_FN6]] -// CHECK: call void @{{.+}}fn6 +// CHECK: define internal i32 [[CAP_FN9]] +// CHECK: call void @{{.+}}fn9 +// CHECK: ret i32 + +// CHECK: define internal i32 [[CAP_FN10]] +// CHECK: call void @{{.+}}fn10 // CHECK: ret i32 // CHECK-LABEL: define {{.+}} @{{.+}}tmain @@ -113,7 +142,49 @@ int main() { // CHECK: br label %[[OMP_END:.+]] // CHECK: [[OMP_ELSE]] // CHECK: call void @__kmpc_omp_task_begin_if0(%{{.+}}* @{{.+}}, i{{.+}} [[GTID]], i8* [[ORIG_TASK_PTR]]) -// CHECK: call i32 [[CAP_FN3:@.+]](i32 [[GTID]], %{{.+}}* [[TASK_PTR]]) +// CHECK: call i32 [[CAP_FN3]](i32 [[GTID]], %{{.+}}* [[TASK_PTR]]) +// CHECK: call void @__kmpc_omp_task_complete_if0(%{{.+}}* @{{.+}}, i{{.+}} [[GTID]], i8* [[ORIG_TASK_PTR]]) +// CHECK: br label %[[OMP_END]] +// CHECK: [[OMP_END]] + +// CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc(%{{[^,]+}}, i32 [[GTID]], i32 1, i64 32, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[CAP_FN4:[^ ]+]] to i32 (i32, i8*)*)) +// CHECK: [[TASK_PTR:%.+]] = bitcast i8* [[ORIG_TASK_PTR]] to +// CHECK: br i1 %{{.+}}, label %[[OMP_THEN:.+]], label %[[OMP_ELSE:.+]] +// CHECK: [[OMP_THEN]] +// CHECK: call i32 @__kmpc_omp_task_with_deps(%{{.+}}* @{{.+}}, i32 [[GTID]], i8* [[ORIG_TASK_PTR]], i32 1, i8* [[LIST:%.+]], i32 0, i8* null) +// CHECK: br label %[[OMP_END:.+]] +// CHECK: [[OMP_ELSE]] +// CHECK: call void @__kmpc_omp_wait_deps(%{{.+}}* @{{.+}}, i32 [[GTID]], i32 1, i8* [[LIST]], i32 0, i8* null) +// CHECK: call void @__kmpc_omp_task_begin_if0(%{{.+}}* @{{.+}}, i{{.+}} [[GTID]], i8* [[ORIG_TASK_PTR]]) +// CHECK: call i32 [[CAP_FN4]](i32 [[GTID]], %{{.+}}* [[TASK_PTR]]) +// CHECK: call void @__kmpc_omp_task_complete_if0(%{{.+}}* @{{.+}}, i{{.+}} [[GTID]], i8* [[ORIG_TASK_PTR]]) +// CHECK: br label %[[OMP_END]] +// CHECK: [[OMP_END]] + +// CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc(%{{[^,]+}}, i32 [[GTID]], i32 1, i64 32, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[CAP_FN5:[^ ]+]] to i32 (i32, i8*)*)) +// CHECK: [[TASK_PTR:%.+]] = bitcast i8* [[ORIG_TASK_PTR]] to +// CHECK: br i1 %{{.+}}, label %[[OMP_THEN:.+]], label %[[OMP_ELSE:.+]] +// CHECK: [[OMP_THEN]] +// CHECK: call i32 @__kmpc_omp_task_with_deps(%{{.+}}* @{{.+}}, i32 [[GTID]], i8* [[ORIG_TASK_PTR]], i32 1, i8* [[LIST:%.+]], i32 0, i8* null) +// CHECK: br label %[[OMP_END:.+]] +// CHECK: [[OMP_ELSE]] +// CHECK: call void @__kmpc_omp_wait_deps(%{{.+}}* @{{.+}}, i32 [[GTID]], i32 1, i8* [[LIST]], i32 0, i8* null) +// CHECK: call void @__kmpc_omp_task_begin_if0(%{{.+}}* @{{.+}}, i{{.+}} [[GTID]], i8* [[ORIG_TASK_PTR]]) +// CHECK: call i32 [[CAP_FN5]](i32 [[GTID]], %{{.+}}* [[TASK_PTR]]) +// CHECK: call void @__kmpc_omp_task_complete_if0(%{{.+}}* @{{.+}}, i{{.+}} [[GTID]], i8* [[ORIG_TASK_PTR]]) +// CHECK: br label %[[OMP_END]] +// CHECK: [[OMP_END]] + +// CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc(%{{[^,]+}}, i32 [[GTID]], i32 1, i64 32, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[CAP_FN6:[^ ]+]] to i32 (i32, i8*)*)) +// CHECK: [[TASK_PTR:%.+]] = bitcast i8* [[ORIG_TASK_PTR]] to +// CHECK: br i1 %{{.+}}, label %[[OMP_THEN:.+]], label %[[OMP_ELSE:.+]] +// CHECK: [[OMP_THEN]] +// CHECK: call i32 @__kmpc_omp_task_with_deps(%{{.+}}* @{{.+}}, i32 [[GTID]], i8* [[ORIG_TASK_PTR]], i32 1, i8* [[LIST:%.+]], i32 0, i8* null) +// CHECK: br label %[[OMP_END:.+]] +// CHECK: [[OMP_ELSE]] +// CHECK: call void @__kmpc_omp_wait_deps(%{{.+}}* @{{.+}}, i32 [[GTID]], i32 1, i8* [[LIST]], i32 0, i8* null) +// CHECK: call void @__kmpc_omp_task_begin_if0(%{{.+}}* @{{.+}}, i{{.+}} [[GTID]], i8* [[ORIG_TASK_PTR]]) +// CHECK: call i32 [[CAP_FN6]](i32 [[GTID]], %{{.+}}* [[TASK_PTR]]) // CHECK: call void @__kmpc_omp_task_complete_if0(%{{.+}}* @{{.+}}, i{{.+}} [[GTID]], i8* [[ORIG_TASK_PTR]]) // CHECK: br label %[[OMP_END]] // CHECK: [[OMP_END]] @@ -130,4 +201,16 @@ int main() { // CHECK: call void @{{.+}}fn3 // CHECK: ret i32 +// CHECK: define internal i32 [[CAP_FN4]] +// CHECK: call void @{{.+}}fn4 +// CHECK: ret i32 + +// CHECK: define internal i32 [[CAP_FN5]] +// CHECK: call void @{{.+}}fn5 +// CHECK: ret i32 + +// CHECK: define internal i32 [[CAP_FN6]] +// CHECK: call void @{{.+}}fn6 +// CHECK: ret i32 + #endif diff --git a/test/OpenMP/task_private_codegen.cpp b/test/OpenMP/task_private_codegen.cpp index 3a9ed7c..463913f 100644 --- a/test/OpenMP/task_private_codegen.cpp +++ b/test/OpenMP/task_private_codegen.cpp @@ -26,11 +26,11 @@ volatile double g; // CHECK-DAG: [[KMP_TASK_T_TY:%.+]] = type { i8*, i32 (i32, i8*)*, i32, i32 (i32, i8*)* } // CHECK-DAG: [[S_DOUBLE_TY:%.+]] = type { double } -// CHECK-DAG: [[CAP_MAIN_TY:%.+]] = type { [2 x i32]*, i32*, [2 x [[S_DOUBLE_TY]]]*, [[S_DOUBLE_TY]]* } +// CHECK-DAG: [[CAP_MAIN_TY:%.+]] = type { i8 } // CHECK-DAG: [[PRIVATES_MAIN_TY:%.+]] = type {{.?}}{ [[S_DOUBLE_TY]], [2 x [[S_DOUBLE_TY]]], i32, [2 x i32] // CHECK-DAG: [[KMP_TASK_MAIN_TY:%.+]] = type { [[KMP_TASK_T_TY]], [[PRIVATES_MAIN_TY]] } // CHECK-DAG: [[S_INT_TY:%.+]] = type { i32 } -// CHECK-DAG: [[CAP_TMAIN_TY:%.+]] = type { [2 x i32]*, i32*, [2 x [[S_INT_TY]]]*, [[S_INT_TY]]* } +// CHECK-DAG: [[CAP_TMAIN_TY:%.+]] = type { i8 } // CHECK-DAG: [[PRIVATES_TMAIN_TY:%.+]] = type { i32, [2 x i32], [2 x [[S_INT_TY]]], [[S_INT_TY]] } // CHECK-DAG: [[KMP_TASK_TMAIN_TY:%.+]] = type { [[KMP_TASK_T_TY]], [[PRIVATES_TMAIN_TY]] } template <typename T> @@ -55,7 +55,7 @@ int main() { // LAMBDA: call{{( x86_thiscallcc)?}} void [[OUTER_LAMBDA:@.+]]( [&]() { // LAMBDA: define{{.*}} internal{{.*}} void [[OUTER_LAMBDA]]( - // LAMBDA: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%{{[^ ]+}} @{{[^,]+}}, i32 %{{[^,]+}}, i32 1, i64 40, i64 8, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) + // LAMBDA: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%{{[^ ]+}} @{{[^,]+}}, i32 %{{[^,]+}}, i32 1, i64 40, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) // LAMBDA: [[PRIVATES:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* %{{.+}}, i{{.+}} 0, i{{.+}} 1 // LAMBDA: [[G_PRIVATE_ADDR:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[PRIVATES]], i{{.+}} 0, i{{.+}} 0 // LAMBDA: call i32 @__kmpc_omp_task(%{{.+}}* @{{.+}}, i32 %{{.+}}, i8* [[RES]]) @@ -86,7 +86,7 @@ int main() { // BLOCKS: call void {{%.+}}(i8 ^{ // BLOCKS: define{{.*}} internal{{.*}} void {{.+}}(i8* - // BLOCKS: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%{{[^ ]+}} @{{[^,]+}}, i32 %{{[^,]+}}, i32 1, i64 40, i64 8, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) + // BLOCKS: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc(%{{[^ ]+}} @{{[^,]+}}, i32 %{{[^,]+}}, i32 1, i64 40, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, %{{[^*]+}}*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) // BLOCKS: [[PRIVATES:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* %{{.+}}, i{{.+}} 0, i{{.+}} 1 // BLOCKS: [[G_PRIVATE_ADDR:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[PRIVATES]], i{{.+}} 0, i{{.+}} 0 // BLOCKS: call i32 @__kmpc_omp_task(%{{.+}}* @{{.+}}, i32 %{{.+}}, i8* [[RES]]) @@ -135,31 +135,18 @@ int main() { // CHECK: call {{.*}} [[S_DOUBLE_TY_DEF_CONSTR:@.+]]([[S_DOUBLE_TY]]* [[TEST]]) -// Store original variables in capture struct. -// CHECK: [[VEC_REF:%.+]] = getelementptr inbounds [[CAP_MAIN_TY]], [[CAP_MAIN_TY]]* %{{.+}}, i{{[0-9]+}} 0, i{{[0-9]+}} 0 -// CHECK: store [2 x i32]* [[VEC_ADDR]], [2 x i32]** [[VEC_REF]], -// CHECK: [[T_VAR_REF:%.+]] = getelementptr inbounds [[CAP_MAIN_TY]], [[CAP_MAIN_TY]]* %{{.+}}, i{{[0-9]+}} 0, i{{[0-9]+}} 1 -// CHECK: store i32* [[T_VAR_ADDR]], i32** [[T_VAR_REF]], -// CHECK: [[S_ARR_REF:%.+]] = getelementptr inbounds [[CAP_MAIN_TY]], [[CAP_MAIN_TY]]* %{{.+}}, i{{[0-9]+}} 0, i{{[0-9]+}} 2 -// CHECK: store [2 x [[S_DOUBLE_TY]]]* [[S_ARR_ADDR]], [2 x [[S_DOUBLE_TY]]]** [[S_ARR_REF]], -// CHECK: [[VAR_REF:%.+]] = getelementptr inbounds [[CAP_MAIN_TY]], [[CAP_MAIN_TY]]* %{{.+}}, i{{[0-9]+}} 0, i{{[0-9]+}} 3 -// CHECK: store [[S_DOUBLE_TY]]* [[VAR_ADDR]], [[S_DOUBLE_TY]]** [[VAR_REF]], +// Do not store original variables in capture struct. +// CHECK-NOT: getelementptr inbounds [[CAP_MAIN_TY]], // Allocate task. // Returns struct kmp_task_t { // [[KMP_TASK_T_TY]] task_data; // [[KMP_TASK_MAIN_TY]] privates; // }; -// CHECK: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc([[LOC]], i32 [[GTID]], i32 1, i64 72, i64 32, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_MAIN_TY]]*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) +// CHECK: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc([[LOC]], i32 [[GTID]], i32 1, i64 72, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_MAIN_TY]]*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) // CHECK: [[RES_KMP_TASK:%.+]] = bitcast i8* [[RES]] to [[KMP_TASK_MAIN_TY]]* -// Fill kmp_task_t->shareds by copying from original capture argument. // CHECK: [[TASK:%.+]] = getelementptr inbounds [[KMP_TASK_MAIN_TY]], [[KMP_TASK_MAIN_TY]]* [[RES_KMP_TASK]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 -// CHECK: [[SHAREDS_REF_ADDR:%.+]] = getelementptr inbounds [[KMP_TASK_T_TY]], [[KMP_TASK_T_TY]]* [[TASK]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 -// CHECK: [[SHAREDS_REF:%.+]] = load i8*, i8** [[SHAREDS_REF_ADDR]], -// CHECK: [[CAPTURES_ADDR:%.+]] = bitcast [[CAP_MAIN_TY]]* %{{.+}} to i8* -// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[SHAREDS_REF]], i8* [[CAPTURES_ADDR]], i64 32, i32 8, i1 false) - // Initialize kmp_task_t->privates with default values (no init for simple types, default constructors for classes). // Also copy address of private copy to the corresponding shareds reference. // CHECK: [[PRIVATES:%.+]] = getelementptr inbounds [[KMP_TASK_MAIN_TY]], [[KMP_TASK_MAIN_TY]]* [[RES_KMP_TASK]], i{{[0-9]+}} 0, i{{[0-9]+}} 1 @@ -257,30 +244,18 @@ int main() { // CHECK: call {{.*}} [[S_INT_TY_DEF_CONSTR:@.+]]([[S_INT_TY]]* [[TEST]]) -// Store original variables in capture struct. -// CHECK: [[VEC_REF:%.+]] = getelementptr inbounds [[CAP_TMAIN_TY]], [[CAP_TMAIN_TY]]* %{{.+}}, i{{[0-9]+}} 0, i{{[0-9]+}} 0 -// CHECK: store [2 x i32]* [[VEC_ADDR]], [2 x i32]** [[VEC_REF]], -// CHECK: [[T_VAR_REF:%.+]] = getelementptr inbounds [[CAP_TMAIN_TY]], [[CAP_TMAIN_TY]]* %{{.+}}, i{{[0-9]+}} 0, i{{[0-9]+}} 1 -// CHECK: store i32* [[T_VAR_ADDR]], i32** [[T_VAR_REF]], -// CHECK: [[S_ARR_REF:%.+]] = getelementptr inbounds [[CAP_TMAIN_TY]], [[CAP_TMAIN_TY]]* %{{.+}}, i{{[0-9]+}} 0, i{{[0-9]+}} 2 -// CHECK: store [2 x [[S_INT_TY]]]* [[S_ARR_ADDR]], [2 x [[S_INT_TY]]]** [[S_ARR_REF]], -// CHECK: [[VAR_REF:%.+]] = getelementptr inbounds [[CAP_TMAIN_TY]], [[CAP_TMAIN_TY]]* %{{.+}}, i{{[0-9]+}} 0, i{{[0-9]+}} 3 -// CHECK: store [[S_INT_TY]]* [[VAR_ADDR]], [[S_INT_TY]]** [[VAR_REF]], +// Do not store original variables in capture struct. +// CHECK-NOT: getelementptr inbounds [[CAP_TMAIN_TY]], // Allocate task. // Returns struct kmp_task_t { // [[KMP_TASK_T_TY]] task_data; // [[KMP_TASK_TMAIN_TY]] privates; // }; -// CHECK: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc([[LOC]], i32 [[GTID]], i32 1, i64 56, i64 32, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_TMAIN_TY]]*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) +// CHECK: [[RES:%.+]] = call i8* @__kmpc_omp_task_alloc([[LOC]], i32 [[GTID]], i32 1, i64 56, i64 1, i32 (i32, i8*)* bitcast (i32 (i32, [[KMP_TASK_TMAIN_TY]]*)* [[TASK_ENTRY:@[^ ]+]] to i32 (i32, i8*)*)) // CHECK: [[RES_KMP_TASK:%.+]] = bitcast i8* [[RES]] to [[KMP_TASK_TMAIN_TY]]* -// Fill kmp_task_t->shareds by copying from original capture argument. // CHECK: [[TASK:%.+]] = getelementptr inbounds [[KMP_TASK_TMAIN_TY]], [[KMP_TASK_TMAIN_TY]]* [[RES_KMP_TASK]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 -// CHECK: [[SHAREDS_REF_ADDR:%.+]] = getelementptr inbounds [[KMP_TASK_T_TY]], [[KMP_TASK_T_TY]]* [[TASK]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 -// CHECK: [[SHAREDS_REF:%.+]] = load i8*, i8** [[SHAREDS_REF_ADDR]], -// CHECK: [[CAPTURES_ADDR:%.+]] = bitcast [[CAP_TMAIN_TY]]* %{{.+}} to i8* -// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64(i8* [[SHAREDS_REF]], i8* [[CAPTURES_ADDR]], i64 32, i32 8, i1 false) // Initialize kmp_task_t->privates with default values (no init for simple types, default constructors for classes). // CHECK: [[PRIVATES:%.+]] = getelementptr inbounds [[KMP_TASK_TMAIN_TY]], [[KMP_TASK_TMAIN_TY]]* [[RES_KMP_TASK]], i{{[0-9]+}} 0, i{{[0-9]+}} 1 diff --git a/test/OpenMP/taskgroup_codegen.cpp b/test/OpenMP/taskgroup_codegen.cpp index a6aec1f..eb45f31 100644 --- a/test/OpenMP/taskgroup_codegen.cpp +++ b/test/OpenMP/taskgroup_codegen.cpp @@ -9,7 +9,7 @@ // CHECK: [[IDENT_T_TY:%.+]] = type { i32, i32, i32, i32, i8* } -// CHECK: define void [[FOO:@.+]]() +// CHECK: define {{.*}}void [[FOO:@.+]]() void foo() {} @@ -19,19 +19,19 @@ int main() { // CHECK: [[A_ADDR:%.+]] = alloca i8 char a; -// CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEFAULT_LOC:@.+]]) -// CHECK: call void @__kmpc_taskgroup([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) +// CHECK: [[GTID:%.+]] = call {{.*}}i32 @__kmpc_global_thread_num([[IDENT_T_TY]]* [[DEFAULT_LOC:@.+]]) +// CHECK: call {{.*}}void @__kmpc_taskgroup([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) // CHECK-NEXT: store i8 2, i8* [[A_ADDR]] -// CHECK-NEXT: call void @__kmpc_end_taskgroup([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) +// CHECK-NEXT: call {{.*}}void @__kmpc_end_taskgroup([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) #pragma omp taskgroup a = 2; -// CHECK: call void @__kmpc_taskgroup([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) -// CHECK-NEXT: invoke void [[FOO]]() -// CHECK: call void @__kmpc_end_taskgroup([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) +// CHECK: call {{.*}}void @__kmpc_taskgroup([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) +// CHECK-NEXT: invoke {{.*}}void [[FOO]]() +// CHECK: call {{.*}}void @__kmpc_end_taskgroup([[IDENT_T_TY]]* [[DEFAULT_LOC]], i32 [[GTID]]) #pragma omp taskgroup foo(); -// CHECK-NOT: call void @__kmpc_taskgroup -// CHECK-NOT: call void @__kmpc_end_taskgroup +// CHECK-NOT: call {{.*}}void @__kmpc_taskgroup +// CHECK-NOT: call {{.*}}void @__kmpc_end_taskgroup return a; } diff --git a/test/PCH/cxx-mangling.cpp b/test/PCH/cxx-mangling.cpp index d086f26..2802687 100644 --- a/test/PCH/cxx-mangling.cpp +++ b/test/PCH/cxx-mangling.cpp @@ -17,11 +17,11 @@ struct A { template<typename T> void f(T) {} -// CHECK-LABEL: define void @_Z1g1A( +// CHECK-LABEL: define {{.*}}void @_Z1g1A( void g(A a) { - // CHECK: call void @_Z1fIN1AUt0_EEvT_( + // CHECK: call {{.*}}void @_Z1fIN1AUt0_EEvT_( f(a.b); - // CHECK: call void @_Z1fIN1AUt_EEvT_( + // CHECK: call {{.*}}void @_Z1fIN1AUt_EEvT_( f(a.a); } diff --git a/test/PCH/objc_container.m b/test/PCH/objc_container.m index 44aac70..2af51cb 100644 --- a/test/PCH/objc_container.m +++ b/test/PCH/objc_container.m @@ -14,7 +14,7 @@ // CHECK-PRINT: oldObject = dictionary[key]; // CHECK-PRINT: dictionary[key] = newObject; -// CHECK-IR: define void @all() #0 +// CHECK-IR: define {{.*}}void @all() #0 // CHECK-IR: {{call.*objc_msgSend}} // CHECK-IR: {{call.*objc_msgSend}} // CHECK-IR: {{call.*objc_msgSend}} diff --git a/test/PCH/objc_literals.m b/test/PCH/objc_literals.m index f96d4af..f65bbe7 100644 --- a/test/PCH/objc_literals.m +++ b/test/PCH/objc_literals.m @@ -39,7 +39,7 @@ typedef unsigned char BOOL; + (id)dictionaryWithObjects:(const id [])objects forKeys:(const id [])keys count:(unsigned long)cnt; @end -// CHECK-IR: define internal void @test_numeric_literals() +// CHECK-IR: define internal {{.*}}void @test_numeric_literals() static inline void test_numeric_literals() { // CHECK-PRINT: id intlit = @17 // CHECK-IR: {{call.*17}} diff --git a/test/PCH/objc_literals.mm b/test/PCH/objc_literals.mm index 777046e..7baf4a8 100644 --- a/test/PCH/objc_literals.mm +++ b/test/PCH/objc_literals.mm @@ -50,7 +50,7 @@ pair<T, U> make_pair(const T& first, const U& second) { return { first, second }; } -// CHECK-IR: define linkonce_odr void @_Z29variadic_dictionary_expansionIJP8NSStringS1_EJP8NSNumberS3_EEvDp4pairIT_T0_E +// CHECK-IR: define linkonce_odr {{.*}}void @_Z29variadic_dictionary_expansionIJP8NSStringS1_EJP8NSNumberS3_EEvDp4pairIT_T0_E template<typename ...Ts, typename ... Us> void variadic_dictionary_expansion(pair<Ts, Us>... key_values) { // CHECK-PRINT: id dict = @{ key_values.first : key_values.second... }; diff --git a/test/PCH/subscripting-literals.m b/test/PCH/subscripting-literals.m index 1675373..725e580 100644 --- a/test/PCH/subscripting-literals.m +++ b/test/PCH/subscripting-literals.m @@ -30,6 +30,14 @@ @class NSString; +@interface NSValue ++ (NSValue *)valueWithBytes:(const void *)bytes objCType:(const char *)type; +@end + +typedef struct __attribute__((objc_boxable)) _some_struct { + int dummy; +} some_struct; + id testArray(int idx, id p) { NSMutableArray *array; array[idx] = p; @@ -44,4 +52,9 @@ void testDict(NSString *key, id newObject, id oldObject) { NSDictionary *dict = @{ key: newObject, key: oldObject }; } +void testBoxableValue() { + some_struct ss; + id value = @(ss); +} + #endif diff --git a/test/Parser/cxx-class.cpp b/test/Parser/cxx-class.cpp index 38eef17..9e907f1 100644 --- a/test/Parser/cxx-class.cpp +++ b/test/Parser/cxx-class.cpp @@ -24,6 +24,16 @@ public: ; // expected-warning{{extra ';' inside a class}} virtual int vf() const volatile = 0; + + virtual int vf0() = 0l; // expected-error {{does not look like a pure-specifier}} + virtual int vf1() = 1; // expected-error {{does not look like a pure-specifier}} + virtual int vf2() = 00; // expected-error {{does not look like a pure-specifier}} + virtual int vf3() = 0x0; // expected-error {{does not look like a pure-specifier}} + virtual int vf4() = 0.0; // expected-error {{does not look like a pure-specifier}} + virtual int vf5(){0}; // expected-error +{{}} expected-warning {{unused}} + virtual int vf5a(){0;}; // function definition, expected-warning {{unused}} + virtual int vf6()(0); // expected-error +{{}} expected-note +{{}} + virtual int vf7() = { 0 }; // expected-error {{does not look like a pure-specifier}} private: int x,f(),y,g(); diff --git a/test/Parser/cxx-concept-declaration.cpp b/test/Parser/cxx-concept-declaration.cpp new file mode 100644 index 0000000..591629c --- /dev/null +++ b/test/Parser/cxx-concept-declaration.cpp @@ -0,0 +1,30 @@ + +// Support parsing of function concepts and variable concepts + +// RUN: %clang_cc1 -std=c++14 -fconcepts-ts -x c++ -verify %s + +template<typename T> concept bool C1 = true; + +template<typename T> concept bool C2() { return true; } + +template<typename T> +struct A { typedef bool Boolean; }; + +template<int N> +A<void>::Boolean concept C3(!0); + +template<typename T, int = 0> +concept auto C4(void) -> bool { return true; } + +constexpr int One = 1; + +template <typename> +static concept decltype(!0) C5 { bool(One) }; + +template<typename T> concept concept bool C6 = true; // expected-warning {{duplicate 'concept' declaration specifier}} + +template<typename T> concept concept bool C7() { return true; } // expected-warning {{duplicate 'concept' declaration specifier}} + +concept D1 = true; // expected-error {{C++ requires a type specifier for all declarations}} + +template<concept T> concept bool D2 = true; // expected-error {{unknown type name 'T'}} diff --git a/test/Parser/cxx-concepts-ambig-constraint-expr.cpp b/test/Parser/cxx-concepts-ambig-constraint-expr.cpp new file mode 100644 index 0000000..12ab338 --- /dev/null +++ b/test/Parser/cxx-concepts-ambig-constraint-expr.cpp @@ -0,0 +1,29 @@ +// RUN: %clang_cc1 -std=c++14 -fconcepts-ts -x c++ %s -verify + +// Test parsing of constraint-expressions in cases where the grammar is +// ambiguous with the expectation that the longest token sequence which matches +// the syntax is consumed without backtracking. + +// type-specifier-seq in conversion-type-id +template <typename T> requires (bool)&T::operator short +unsigned int foo(); // expected-error {{C++ requires a type specifier for all declarations}} + +// type-specifier-seq in new-type-id +template <typename T> requires (bool)sizeof new (T::f()) short +unsigned int bar(); // expected-error {{C++ requires a type specifier for all declarations}} + +template<typename T> requires (bool)sizeof new (T::f()) unsigned // expected-error {{'struct' cannot be signed or unsigned}} +struct X { }; // expected-error {{'X' cannot be defined in a type specifier}} + +// C-style cast +// of function call on function-style cast +template <typename T> requires (bool(T())) +T (*fp)(); // expected-error {{use of undeclared identifier 'fp'}} + +// function-style cast +// as the callee in a function call +struct A { + static int t; + template <typename T> requires bool(T()) + (A(T (&t))) { } // expected-error {{called object type 'bool' is not a function or function pointer}} +}; diff --git a/test/Parser/cxx-concepts-requires-clause.cpp b/test/Parser/cxx-concepts-requires-clause.cpp new file mode 100644 index 0000000..01893a9 --- /dev/null +++ b/test/Parser/cxx-concepts-requires-clause.cpp @@ -0,0 +1,82 @@ +// RUN: %clang_cc1 -std=c++14 -fconcepts-ts -x c++ %s -verify +// expected-no-diagnostics + +// Test parsing of the optional requires-clause in a template-declaration. + +template <typename T> requires true +void foo() { } + + +template <typename T> requires !0 +struct A { + void foo(); + struct AA; + enum E : int; + static int x; + + template <typename> requires true + void Mfoo(); + + template <typename> requires true + struct M; + + template <typename> requires true + static int Mx; + + template <typename TT> requires true + using MQ = M<TT>; +}; + +template <typename T> requires !0 +void A<T>::foo() { } + +template <typename T> requires !0 +struct A<T>::AA { }; + +template <typename T> requires !0 +enum A<T>::E : int { E0 }; + +template <typename T> requires !0 +int A<T>::x = 0; + +template <typename T> requires !0 +template <typename> requires true +void A<T>::Mfoo() { } + +template <typename T> requires !0 +template <typename> requires true +struct A<T>::M { }; + +template <typename T> requires !0 +template <typename> requires true +int A<T>::Mx = 0; + + +template <typename T> requires true +int x = 0; + +template <typename T> requires true +using Q = A<T>; + +struct C { + template <typename> requires true + void Mfoo(); + + template <typename> requires true + struct M; + + template <typename> requires true + static int Mx; + + template <typename T> requires true + using MQ = M<T>; +}; + +template <typename> requires true +void C::Mfoo() { } + +template <typename> requires true +struct C::M { }; + +template <typename> requires true +int C::Mx = 0; diff --git a/test/Parser/nullability.c b/test/Parser/nullability.c index f2b6abf..7117bce 100644 --- a/test/Parser/nullability.c +++ b/test/Parser/nullability.c @@ -1,14 +1,14 @@ // RUN: %clang_cc1 -fsyntax-only -std=c99 -Wno-nullability-declspec -pedantic %s -verify -__nonnull int *ptr; // expected-warning{{type nullability specifier '__nonnull' is a Clang extension}} +_Nonnull int *ptr; // expected-warning{{type nullability specifier '_Nonnull' is a Clang extension}} #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wnullability-extension" -__nonnull int *ptr2; // no-warning +_Nonnull int *ptr2; // no-warning #pragma clang diagnostic pop -#if __has_feature(nullability) -# error Nullability should not be supported in C under -pedantic -std=c99 +#if !__has_feature(nullability) +# error Nullability should always be supported #endif #if !__has_extension(nullability) diff --git a/test/Preprocessor/cxx_true.cpp b/test/Preprocessor/cxx_true.cpp index 39cb349..f6dc459 100644 --- a/test/Preprocessor/cxx_true.cpp +++ b/test/Preprocessor/cxx_true.cpp @@ -1,15 +1,18 @@ -/* RUN: %clang_cc1 -E %s -x c++ | grep block_1 - RUN: %clang_cc1 -E %s -x c++ | not grep block_2 - RUN: %clang_cc1 -E %s -x c | not grep block +/* RUN: %clang_cc1 -E %s -x c++ | FileCheck -check-prefix CPP %s + RUN: %clang_cc1 -E %s -x c | FileCheck -check-prefix C %s RUN: %clang_cc1 -E %s -x c++ -verify -Wundef */ // expected-no-diagnostics #if true -block_1 +// CPP: test block_1 +// C-NOT: test block_1 +test block_1 #endif #if false -block_2 +// CPP-NOT: test block_2 +// C-NOT: test block_2 +test block_2 #endif diff --git a/test/Preprocessor/predefined-nullability.c b/test/Preprocessor/predefined-nullability.c new file mode 100644 index 0000000..d736afa --- /dev/null +++ b/test/Preprocessor/predefined-nullability.c @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 %s -E -dM -triple i386-apple-darwin10 -o - | FileCheck %s --check-prefix=CHECK-DARWIN + +// RUN: %clang_cc1 %s -E -dM -triple x86_64-unknown-linux -o - | FileCheck %s --check-prefix=CHECK-NONDARWIN + + +// CHECK-DARWIN: #define __nonnull _Nonnull +// CHECK-DARWIN: #define __null_unspecified _Null_unspecified +// CHECK-DARWIN: #define __nullable _Nullable + +// CHECK-NONDARWIN-NOT: __nonnull +// CHECK-NONDARWIN: #define __clang__ +// CHECK-NONDARWIN-NOT: __nonnull diff --git a/test/Profile/cxx-lambda.cpp b/test/Profile/cxx-lambda.cpp index 34e1857..a111f06 100644 --- a/test/Profile/cxx-lambda.cpp +++ b/test/Profile/cxx-lambda.cpp @@ -13,14 +13,14 @@ // PGOGEN: @[[MAC:__llvm_profile_counters_main]] = private global [1 x i64] zeroinitializer // LMBGEN: @[[LFC:"__llvm_profile_counters_cxx-lambda.cpp:_ZZ7lambdasvENK3\$_0clEi"]] = private global [3 x i64] zeroinitializer -// PGOGEN-LABEL: define void @_Z7lambdasv() -// PGOUSE-LABEL: define void @_Z7lambdasv() +// PGOGEN-LABEL: define {{.*}}void @_Z7lambdasv() +// PGOUSE-LABEL: define {{.*}}void @_Z7lambdasv() // PGOGEN: store {{.*}} @[[LWC]], i64 0, i64 0 void lambdas() { int i = 1; - // LMBGEN-LABEL: define internal{{( x86_thiscallcc)?( zeroext)?}} i1 @"_ZZ7lambdasvENK3$_0clEi"( - // LMBUSE-LABEL: define internal{{( x86_thiscallcc)?( zeroext)?}} i1 @"_ZZ7lambdasvENK3$_0clEi"( + // LMBGEN-LABEL: define internal{{( [0-9_a-z]*cc)?( zeroext)?}} i1 @"_ZZ7lambdasvENK3$_0clEi"( + // LMBUSE-LABEL: define internal{{( [0-9_a-z]*cc)?( zeroext)?}} i1 @"_ZZ7lambdasvENK3$_0clEi"( // LMBGEN: store {{.*}} @[[LFC]], i64 0, i64 0 auto f = [&i](int k) { // LMBGEN: store {{.*}} @[[LFC]], i64 0, i64 1 diff --git a/test/Profile/cxx-rangefor.cpp b/test/Profile/cxx-rangefor.cpp index f30cdc7..23be0f5 100644 --- a/test/Profile/cxx-rangefor.cpp +++ b/test/Profile/cxx-rangefor.cpp @@ -9,7 +9,7 @@ // PGOGEN: @[[RFC:__llvm_profile_counters__Z9range_forv]] = private global [5 x i64] zeroinitializer -// CHECK-LABEL: define void @_Z9range_forv() +// CHECK-LABEL: define {{.*}}void @_Z9range_forv() // PGOGEN: store {{.*}} @[[RFC]], i64 0, i64 0 void range_for() { int arr[] = {1, 2, 3, 4, 5}; diff --git a/test/Profile/cxx-templates.cpp b/test/Profile/cxx-templates.cpp index ce5651a..ca0e861 100644 --- a/test/Profile/cxx-templates.cpp +++ b/test/Profile/cxx-templates.cpp @@ -13,10 +13,10 @@ // T0GEN: @[[T0C:__llvm_profile_counters__Z4loopILj0EEvv]] = linkonce_odr hidden global [2 x i64] zeroinitializer // T100GEN: @[[T100C:__llvm_profile_counters__Z4loopILj100EEvv]] = linkonce_odr hidden global [2 x i64] zeroinitializer -// T0GEN-LABEL: define linkonce_odr void @_Z4loopILj0EEvv() -// T0USE-LABEL: define linkonce_odr void @_Z4loopILj0EEvv() -// T100GEN-LABEL: define linkonce_odr void @_Z4loopILj100EEvv() -// T100USE-LABEL: define linkonce_odr void @_Z4loopILj100EEvv() +// T0GEN-LABEL: define linkonce_odr {{.*}}void @_Z4loopILj0EEvv() +// T0USE-LABEL: define linkonce_odr {{.*}}void @_Z4loopILj0EEvv() +// T100GEN-LABEL: define linkonce_odr {{.*}}void @_Z4loopILj100EEvv() +// T100USE-LABEL: define linkonce_odr {{.*}}void @_Z4loopILj100EEvv() template <unsigned N> void loop() { // ALL-NOT: ret // T0GEN: store {{.*}} @[[T0C]], i64 0, i64 0 diff --git a/test/Profile/profile-does-not-exist.c b/test/Profile/profile-does-not-exist.c index 89609bd..d45981f 100644 --- a/test/Profile/profile-does-not-exist.c +++ b/test/Profile/profile-does-not-exist.c @@ -1,4 +1,4 @@ // RUN: not %clang_cc1 -emit-llvm %s -o - -fprofile-instr-use=%t.nonexistent.profdata 2>&1 | FileCheck %s -// CHECK: error: Could not read profile: +// CHECK: error: Could not read profile {{.*}}.nonexistent.profdata: // CHECK-NOT: Assertion failed diff --git a/test/Sema/arm-microsoft-intrinsics.c b/test/Sema/arm-microsoft-intrinsics.c new file mode 100644 index 0000000..0637d98 --- /dev/null +++ b/test/Sema/arm-microsoft-intrinsics.c @@ -0,0 +1,9 @@ +// RUN: %clang_cc1 -triple armv7 -fms-extensions -fsyntax-only -ffreestanding -verify %s + +unsigned int test_MoveFromCoprocessor(const unsigned int value) { + return _MoveFromCoprocessor(value, 1, 2, 3, 4); // expected-error-re {{argument to {{.*}} must be a constant integer}} +} + +void test_MoveToCoprocessor(const unsigned int value) { + _MoveToCoprocessor(1, 2, value, 3, 4, 5); // expected-error-re {{argument to {{.*}} must be a constant integer}} +} diff --git a/test/Sema/attr-malloc.c b/test/Sema/attr-malloc.c index 5351d75..6af15d2 100644 --- a/test/Sema/attr-malloc.c +++ b/test/Sema/attr-malloc.c @@ -19,10 +19,10 @@ __attribute((malloc)) int (*g)(); // expected-warning{{attribute only applies to __attribute((malloc)) void * xalloc(unsigned n) { return malloc(n); } // no-warning -// RUN: grep 'define noalias .* @xalloc(' %t +// RUN: grep 'define .*noalias .* @xalloc(' %t %t #define malloc_like __attribute((__malloc__)) void * xalloc2(unsigned) malloc_like; void * xalloc2(unsigned n) { return malloc(n); } -// RUN: grep 'define noalias .* @xalloc2(' %t +// RUN: grep 'define .*noalias .* @xalloc2(' %t %t diff --git a/test/Sema/builtin-cpu-supports.c b/test/Sema/builtin-cpu-supports.c new file mode 100644 index 0000000..c537b41 --- /dev/null +++ b/test/Sema/builtin-cpu-supports.c @@ -0,0 +1,21 @@ +// RUN: %clang_cc1 -fsyntax-only -triple x86_64-pc-linux-gnu -verify %s +// RUN: %clang_cc1 -fsyntax-only -triple powerpc64le-linux-gnu -verify %s + +extern void a(const char *); + +extern const char *str; + +int main() { +#ifdef __x86_64__ + if (__builtin_cpu_supports("ss")) // expected-error {{invalid cpu feature string}} + a("sse4.2"); + + if (__builtin_cpu_supports(str)) // expected-error {{expression is not a string literal}} + a(str); +#else + if (__builtin_cpu_supports("vsx")) // expected-error {{use of unknown builtin}} + a("vsx"); +#endif + + return 0; +} diff --git a/test/Sema/enable_if.c b/test/Sema/enable_if.c index a3c4323..4644858 100644 --- a/test/Sema/enable_if.c +++ b/test/Sema/enable_if.c @@ -49,7 +49,7 @@ size_t strnlen(const char *s, size_t maxlen) // expected-note{{candidate functi __attribute__((unavailable("'maxlen' is larger than the buffer size"))); void test2(const char *s, int i) { -// CHECK: define void @test2 +// CHECK: define {{.*}}void @test2 const char c[123]; strnlen(s, i); // CHECK: call {{.*}}strnlen_real1 diff --git a/test/Sema/non-null-warning.c b/test/Sema/non-null-warning.c index 6cd98e2..024ef1e 100644 --- a/test/Sema/non-null-warning.c +++ b/test/Sema/non-null-warning.c @@ -7,29 +7,29 @@ #endif -int * __nullable foo(int * __nonnull x); +int * _Nullable foo(int * _Nonnull x); -int *__nonnull ret_nonnull(); +int *_Nonnull ret_nonnull(); int *foo(int *x) { return 0; } -int * __nullable foo1(int * __nonnull x); // expected-note {{previous declaration is here}} +int * _Nullable foo1(int * _Nonnull x); // expected-note {{previous declaration is here}} -int *foo1(int * __nullable x) { // expected-warning {{nullability specifier '__nullable' conflicts with existing specifier '__nonnull'}} +int *foo1(int * _Nullable x) { // expected-warning {{nullability specifier '_Nullable' conflicts with existing specifier '_Nonnull'}} return 0; } -int * __nullable foo2(int * __nonnull x); +int * _Nullable foo2(int * _Nonnull x); -int *foo2(int * __nonnull x) { +int *foo2(int * _Nonnull x) { return 0; } -int * __nullable foo3(int * __nullable x); // expected-note {{previous declaration is here}} +int * _Nullable foo3(int * _Nullable x); // expected-note {{previous declaration is here}} -int *foo3(int * __nonnull x) { // expected-warning {{nullability specifier '__nonnull' conflicts with existing specifier '__nullable'}} +int *foo3(int * _Nonnull x) { // expected-warning {{nullability specifier '_Nonnull' conflicts with existing specifier '_Nullable'}} return 0; } diff --git a/test/Sema/nullability.c b/test/Sema/nullability.c index 6144b7e..59644c4 100644 --- a/test/Sema/nullability.c +++ b/test/Sema/nullability.c @@ -8,88 +8,88 @@ typedef int * int_ptr; // Parse nullability type specifiers. -typedef int * __nonnull nonnull_int_ptr; // expected-note{{'__nonnull' specified here}} -typedef int * __nullable nullable_int_ptr; -typedef int * __null_unspecified null_unspecified_int_ptr; +typedef int * _Nonnull nonnull_int_ptr; // expected-note{{'_Nonnull' specified here}} +typedef int * _Nullable nullable_int_ptr; +typedef int * _Null_unspecified null_unspecified_int_ptr; // Redundant nullability type specifiers. -typedef int * __nonnull __nonnull redundant_1; // expected-warning{{duplicate nullability specifier '__nonnull'}} +typedef int * _Nonnull _Nonnull redundant_1; // expected-warning{{duplicate nullability specifier '_Nonnull'}} // Conflicting nullability type specifiers. -typedef int * __nonnull __nullable conflicting_1; // expected-error{{nullability specifier '__nonnull' conflicts with existing specifier '__nullable'}} -typedef int * __null_unspecified __nonnull conflicting_2; // expected-error{{nullability specifier '__null_unspecified' conflicts with existing specifier '__nonnull'}} +typedef int * _Nonnull _Nullable conflicting_1; // expected-error{{nullability specifier '_Nonnull' conflicts with existing specifier '_Nullable'}} +typedef int * _Null_unspecified _Nonnull conflicting_2; // expected-error{{nullability specifier '_Null_unspecified' conflicts with existing specifier '_Nonnull'}} // Redundant nullability specifiers via a typedef are okay. -typedef nonnull_int_ptr __nonnull redundant_okay_1; +typedef nonnull_int_ptr _Nonnull redundant_okay_1; // Conflicting nullability specifiers via a typedef are not. -typedef nonnull_int_ptr __nullable conflicting_2; // expected-error{{nullability specifier '__nullable' conflicts with existing specifier '__nonnull'}} +typedef nonnull_int_ptr _Nullable conflicting_2; // expected-error{{nullability specifier '_Nullable' conflicts with existing specifier '_Nonnull'}} typedef nonnull_int_ptr nonnull_int_ptr_typedef; -typedef nonnull_int_ptr_typedef __nullable conflicting_2; // expected-error{{nullability specifier '__nullable' conflicts with existing specifier '__nonnull'}} +typedef nonnull_int_ptr_typedef _Nullable conflicting_2; // expected-error{{nullability specifier '_Nullable' conflicts with existing specifier '_Nonnull'}} typedef nonnull_int_ptr_typedef nonnull_int_ptr_typedef_typedef; -typedef nonnull_int_ptr_typedef_typedef __null_unspecified conflicting_3; // expected-error{{nullability specifier '__null_unspecified' conflicts with existing specifier '__nonnull'}} +typedef nonnull_int_ptr_typedef_typedef _Null_unspecified conflicting_3; // expected-error{{nullability specifier '_Null_unspecified' conflicts with existing specifier '_Nonnull'}} // Nullability applies to all pointer types. -typedef int (* __nonnull function_pointer_type_1)(int, int); -typedef int (^ __nonnull block_type_1)(int, int); +typedef int (* _Nonnull function_pointer_type_1)(int, int); +typedef int (^ _Nonnull block_type_1)(int, int); // Nullability must be on a pointer type. -typedef int __nonnull int_type_1; // expected-error{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'int'}} +typedef int _Nonnull int_type_1; // expected-error{{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'int'}} // Nullability can move out to a pointer/block pointer declarator // (with a suppressed warning). -typedef __nonnull int * nonnull_int_ptr_2; -typedef int __nullable * nullable_int_ptr_2; -typedef __nonnull int (* function_pointer_type_2)(int, int); -typedef __nonnull int (^ block_type_2)(int, int); -typedef __nonnull int * * __nullable nonnull_int_ptr_ptr_1; -typedef __nonnull int *(^ block_type_3)(int, int); -typedef __nonnull int *(* function_pointer_type_3)(int, int); -typedef __nonnull int_ptr (^ block_type_4)(int, int); -typedef __nonnull int_ptr (* function_pointer_type_4)(int, int); - -void acceptFunctionPtr(__nonnull int *(*)(void)); -void acceptBlockPtr(__nonnull int *(^)(void)); +typedef _Nonnull int * nonnull_int_ptr_2; +typedef int _Nullable * nullable_int_ptr_2; +typedef _Nonnull int (* function_pointer_type_2)(int, int); +typedef _Nonnull int (^ block_type_2)(int, int); +typedef _Nonnull int * * _Nullable nonnull_int_ptr_ptr_1; +typedef _Nonnull int *(^ block_type_3)(int, int); +typedef _Nonnull int *(* function_pointer_type_3)(int, int); +typedef _Nonnull int_ptr (^ block_type_4)(int, int); +typedef _Nonnull int_ptr (* function_pointer_type_4)(int, int); + +void acceptFunctionPtr(_Nonnull int *(*)(void)); +void acceptBlockPtr(_Nonnull int *(^)(void)); void testBlockFunctionPtrNullability() { float *fp; - fp = (function_pointer_type_3)0; // expected-warning{{from 'function_pointer_type_3' (aka 'int * __nonnull (*)(int, int)')}} - fp = (block_type_3)0; // expected-error{{from incompatible type 'block_type_3' (aka 'int * __nonnull (^)(int, int)')}} - fp = (function_pointer_type_4)0; // expected-warning{{from 'function_pointer_type_4' (aka 'int_ptr __nonnull (*)(int, int)')}} - fp = (block_type_4)0; // expected-error{{from incompatible type 'block_type_4' (aka 'int_ptr __nonnull (^)(int, int)')}} + fp = (function_pointer_type_3)0; // expected-warning{{from 'function_pointer_type_3' (aka 'int * _Nonnull (*)(int, int)')}} + fp = (block_type_3)0; // expected-error{{from incompatible type 'block_type_3' (aka 'int * _Nonnull (^)(int, int)')}} + fp = (function_pointer_type_4)0; // expected-warning{{from 'function_pointer_type_4' (aka 'int_ptr _Nonnull (*)(int, int)')}} + fp = (block_type_4)0; // expected-error{{from incompatible type 'block_type_4' (aka 'int_ptr _Nonnull (^)(int, int)')}} acceptFunctionPtr(0); // no-warning acceptBlockPtr(0); // no-warning } // Moving nullability where it creates a conflict. -typedef __nonnull int * __nullable * conflict_int_ptr_ptr_2; // expected-error{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'int'}} +typedef _Nonnull int * _Nullable * conflict_int_ptr_ptr_2; // expected-error{{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'int'}} // Nullability is not part of the canonical type. -typedef int * __nonnull ambiguous_int_ptr; +typedef int * _Nonnull ambiguous_int_ptr; typedef int * ambiguous_int_ptr; -typedef int * __nullable ambiguous_int_ptr; +typedef int * _Nullable ambiguous_int_ptr; // Printing of nullability. float f; -int * __nonnull ip_1 = &f; // expected-warning{{incompatible pointer types initializing 'int * __nonnull' with an expression of type 'float *'}} +int * _Nonnull ip_1 = &f; // expected-warning{{incompatible pointer types initializing 'int * _Nonnull' with an expression of type 'float *'}} // Check printing of nullability specifiers. void printing_nullability(void) { - int * __nonnull iptr; - float *fptr = iptr; // expected-warning{{incompatible pointer types initializing 'float *' with an expression of type 'int * __nonnull'}} + int * _Nonnull iptr; + float *fptr = iptr; // expected-warning{{incompatible pointer types initializing 'float *' with an expression of type 'int * _Nonnull'}} - int * * __nonnull iptrptr; - float **fptrptr = iptrptr; // expected-warning{{incompatible pointer types initializing 'float **' with an expression of type 'int ** __nonnull'}} + int * * _Nonnull iptrptr; + float **fptrptr = iptrptr; // expected-warning{{incompatible pointer types initializing 'float **' with an expression of type 'int ** _Nonnull'}} - int * __nullable * __nonnull iptrptr2; - float * *fptrptr2 = iptrptr2; // expected-warning{{incompatible pointer types initializing 'float **' with an expression of type 'int * __nullable * __nonnull'}} + int * _Nullable * _Nonnull iptrptr2; + float * *fptrptr2 = iptrptr2; // expected-warning{{incompatible pointer types initializing 'float **' with an expression of type 'int * _Nullable * _Nonnull'}} } -// Check passing null to a __nonnull argument. -void accepts_nonnull_1(__nonnull int *ptr); -void (*accepts_nonnull_2)(__nonnull int *ptr); -void (^accepts_nonnull_3)(__nonnull int *ptr); +// Check passing null to a _Nonnull argument. +void accepts_nonnull_1(_Nonnull int *ptr); +void (*accepts_nonnull_2)(_Nonnull int *ptr); +void (^accepts_nonnull_3)(_Nonnull int *ptr); void test_accepts_nonnull_null_pointer_literal() { accepts_nonnull_1(0); // expected-warning{{null passed to a callee that requires a non-null argument}} @@ -97,17 +97,17 @@ void test_accepts_nonnull_null_pointer_literal() { accepts_nonnull_3(0); // expected-warning{{null passed to a callee that requires a non-null argument}} } -// Check returning nil from a __nonnull-returning function. -__nonnull int *returns_int_ptr(int x) { +// Check returning nil from a _Nonnull-returning function. +_Nonnull int *returns_int_ptr(int x) { if (x) { return 0; // expected-warning{{null returned from function that requires a non-null return value}} } - return (__nonnull int *)0; + return (_Nonnull int *)0; } // Check nullable-to-nonnull conversions. -void nullable_to_nonnull(__nullable int *ptr) { +void nullable_to_nonnull(_Nullable int *ptr) { int *a = ptr; // okay - __nonnull int *b = ptr; // expected-warning{{implicit conversion from nullable pointer 'int * __nullable' to non-nullable pointer type 'int * __nonnull'}} + _Nonnull int *b = ptr; // expected-warning{{implicit conversion from nullable pointer 'int * _Nullable' to non-nullable pointer type 'int * _Nonnull'}} } diff --git a/test/Sema/typo-correction.c b/test/Sema/typo-correction.c index d457257..ff43064 100644 --- a/test/Sema/typo-correction.c +++ b/test/Sema/typo-correction.c @@ -40,3 +40,12 @@ int PR23101(__m128i __x) { return foo((__v2di)__x); // expected-warning {{implicit declaration of function 'foo'}} \ // expected-error {{use of undeclared identifier '__v2di'}} } + +void f(long *a, long b) { + __atomic_or_fetch(a, b, c); // expected-error {{use of undeclared identifier 'c'}} +} + +extern double cabs(_Complex double z); +void fn1() { + cabs(errij); // expected-error {{use of undeclared identifier 'errij'}} +} diff --git a/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp b/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp index a78f022..9456dd7 100644 --- a/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp +++ b/test/SemaCXX/cxx0x-initializer-stdinitializerlist.cpp @@ -275,3 +275,10 @@ namespace TemporaryInitListSourceRange_PR22367 { {0} ); } + +namespace ParameterPackNestedInitializerLists_PR23904c3 { + template <typename ...T> + void f(std::initializer_list<std::initializer_list<T>> ...tt); + + void foo() { f({{0}}, {{'\0'}}); } +} diff --git a/test/SemaCXX/cxx1y-generic-lambdas.cpp b/test/SemaCXX/cxx1y-generic-lambdas.cpp index f4c67fb..b49a641 100644 --- a/test/SemaCXX/cxx1y-generic-lambdas.cpp +++ b/test/SemaCXX/cxx1y-generic-lambdas.cpp @@ -933,3 +933,18 @@ namespace PR22117 { }; }(0)(0); } + +namespace PR23716 { +template<typename T> +auto f(T x) { + auto g = [](auto&&... args) { + auto h = [args...]() -> int { + return 0; + }; + return h; + }; + return g; +} + +auto x = f(0)(); +} diff --git a/test/SemaCXX/nullability-declspec.cpp b/test/SemaCXX/nullability-declspec.cpp index ef1a171..1a3a321 100644 --- a/test/SemaCXX/nullability-declspec.cpp +++ b/test/SemaCXX/nullability-declspec.cpp @@ -2,8 +2,8 @@ struct X { }; -__nullable int *ip1; // expected-error{{nullability specifier '__nullable' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the pointer?}} -__nullable int (*fp1)(int); // expected-error{{nullability specifier '__nullable' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the function pointer?}} -__nonnull int (^bp1)(int); // expected-error{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the block pointer?}} -__nonnull int X::*pmd1; // expected-error{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the member pointer?}} -__nonnull int (X::*pmf1)(int); // expected-error{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the member function pointer?}} +_Nullable int *ip1; // expected-error{{nullability specifier '_Nullable' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the pointer?}} +_Nullable int (*fp1)(int); // expected-error{{nullability specifier '_Nullable' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the function pointer?}} +_Nonnull int (^bp1)(int); // expected-error{{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the block pointer?}} +_Nonnull int X::*pmd1; // expected-error{{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the member pointer?}} +_Nonnull int (X::*pmf1)(int); // expected-error{{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'int'; did you mean to apply the specifier to the member function pointer?}} diff --git a/test/SemaCXX/nullability.cpp b/test/SemaCXX/nullability.cpp index f0aa13b..edce6b0 100644 --- a/test/SemaCXX/nullability.cpp +++ b/test/SemaCXX/nullability.cpp @@ -1,29 +1,34 @@ // RUN: %clang_cc1 -std=c++11 -fsyntax-only -Wno-nullability-declspec %s -verify +#if __has_feature(nullability) +#else +# error nullability feature should be defined +#endif + typedef decltype(nullptr) nullptr_t; class X { }; // Nullability applies to all pointer types. -typedef int (X::* __nonnull member_function_type_1)(int); -typedef int X::* __nonnull member_data_type_1; -typedef nullptr_t __nonnull nonnull_nullptr_t; // expected-error{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'nullptr_t'}} +typedef int (X::* _Nonnull member_function_type_1)(int); +typedef int X::* _Nonnull member_data_type_1; +typedef nullptr_t _Nonnull nonnull_nullptr_t; // expected-error{{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'nullptr_t'}} // Nullability can move into member pointers (this is suppressing a warning). -typedef __nonnull int (X::* member_function_type_2)(int); -typedef int (X::* __nonnull member_function_type_3)(int); -typedef __nonnull int X::* member_data_type_2; +typedef _Nonnull int (X::* member_function_type_2)(int); +typedef int (X::* _Nonnull member_function_type_3)(int); +typedef _Nonnull int X::* member_data_type_2; // Adding non-null via a template. template<typename T> struct AddNonNull { - typedef __nonnull T type; // expected-error{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'int'}} - // expected-error@-1{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'nullptr_t'}} + typedef _Nonnull T type; // expected-error{{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'int'}} + // expected-error@-1{{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'nullptr_t'}} }; typedef AddNonNull<int *>::type nonnull_int_ptr_1; -typedef AddNonNull<int * __nullable>::type nonnull_int_ptr_2; // FIXME: check that it was overridden +typedef AddNonNull<int * _Nullable>::type nonnull_int_ptr_2; // FIXME: check that it was overridden typedef AddNonNull<nullptr_t>::type nonnull_int_ptr_3; // expected-note{{in instantiation of template class}} typedef AddNonNull<int>::type nonnull_non_pointer_1; // expected-note{{in instantiation of template class 'AddNonNull<int>' requested here}} @@ -31,22 +36,22 @@ typedef AddNonNull<int>::type nonnull_non_pointer_1; // expected-note{{in instan // Non-null checking within a template. template<typename T> struct AddNonNull2 { - typedef __nonnull AddNonNull<T> invalid1; // expected-error{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'AddNonNull<T>'}} - typedef __nonnull AddNonNull2 invalid2; // expected-error{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'AddNonNull2<T>'}} - typedef __nonnull AddNonNull2<T> invalid3; // expected-error{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'AddNonNull2<T>'}} - typedef __nonnull typename AddNonNull<T>::type okay1; + typedef _Nonnull AddNonNull<T> invalid1; // expected-error{{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'AddNonNull<T>'}} + typedef _Nonnull AddNonNull2 invalid2; // expected-error{{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'AddNonNull2<T>'}} + typedef _Nonnull AddNonNull2<T> invalid3; // expected-error{{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'AddNonNull2<T>'}} + typedef _Nonnull typename AddNonNull<T>::type okay1; // Don't move past a dependent type even if we know that nullability // cannot apply to that specific dependent type. - typedef __nonnull AddNonNull<T> (*invalid4); // expected-error{{nullability specifier '__nonnull' cannot be applied to non-pointer type 'AddNonNull<T>'}} + typedef _Nonnull AddNonNull<T> (*invalid4); // expected-error{{nullability specifier '_Nonnull' cannot be applied to non-pointer type 'AddNonNull<T>'}} }; -// Check passing null to a __nonnull argument. -void (*accepts_nonnull_1)(__nonnull int *ptr); -void (*& accepts_nonnull_2)(__nonnull int *ptr) = accepts_nonnull_1; -void (X::* accepts_nonnull_3)(__nonnull int *ptr); -void accepts_nonnull_4(__nonnull int *ptr); -void (&accepts_nonnull_5)(__nonnull int *ptr) = accepts_nonnull_4; +// Check passing null to a _Nonnull argument. +void (*accepts_nonnull_1)(_Nonnull int *ptr); +void (*& accepts_nonnull_2)(_Nonnull int *ptr) = accepts_nonnull_1; +void (X::* accepts_nonnull_3)(_Nonnull int *ptr); +void accepts_nonnull_4(_Nonnull int *ptr); +void (&accepts_nonnull_5)(_Nonnull int *ptr) = accepts_nonnull_4; void test_accepts_nonnull_null_pointer_literal(X *x) { accepts_nonnull_1(0); // expected-warning{{null passed to a callee that requires a non-null argument}} @@ -56,7 +61,7 @@ void test_accepts_nonnull_null_pointer_literal(X *x) { accepts_nonnull_5(0); // expected-warning{{null passed to a callee that requires a non-null argument}} } -template<void FP(__nonnull int*)> +template<void FP(_Nonnull int*)> void test_accepts_nonnull_null_pointer_literal_template() { FP(0); // expected-warning{{null passed to a callee that requires a non-null argument}} } diff --git a/test/SemaCXX/openmp_default_simd_align.cpp b/test/SemaCXX/openmp_default_simd_align.cpp new file mode 100644 index 0000000..c869a94 --- /dev/null +++ b/test/SemaCXX/openmp_default_simd_align.cpp @@ -0,0 +1,83 @@ +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -triple x86_64-unknown-unknown -verify %s + +struct S0 { + int x; + static const int test0 = __builtin_omp_required_simd_align(x); // expected-error {{invalid application of '__builtin_omp_required_simd_align' to an expression, only type is allowed}} + static const int test1 = __builtin_omp_required_simd_align(decltype(S0::x)); + auto test2() -> char(&)[__builtin_omp_required_simd_align(decltype(x))]; +}; + +struct S1; // expected-note 6 {{forward declaration}} +extern S1 s1; +const int test3 = __builtin_omp_required_simd_align(decltype(s1)); // expected-error {{invalid application of '__builtin_omp_required_simd_align' to an incomplete type 'decltype(s1)' (aka 'S1')}} + +struct S2 { + S2(); + S1 &s; + int x; + + int test4 = __builtin_omp_required_simd_align(decltype(x)); // ok + int test5 = __builtin_omp_required_simd_align(decltype(s)); // expected-error {{invalid application of '__builtin_omp_required_simd_align' to an incomplete type 'S1'}} +}; + +const int test6 = __builtin_omp_required_simd_align(decltype(S2::x)); +const int test7 = __builtin_omp_required_simd_align(decltype(S2::s)); // expected-error {{invalid application of '__builtin_omp_required_simd_align' to an incomplete type 'S1'}} + +// Arguably, these should fail like the S1 cases do: the alignment of +// 's2.x' should depend on the alignment of both x-within-S2 and +// s2-within-S3 and thus require 'S3' to be complete. If we start +// doing the appropriate recursive walk to do that, we should make +// sure that these cases don't explode. +struct S3 { + S2 s2; + + static const int test8 = __builtin_omp_required_simd_align(decltype(s2.x)); + static const int test9 = __builtin_omp_required_simd_align(decltype(s2.s)); // expected-error {{invalid application of '__builtin_omp_required_simd_align' to an incomplete type 'S1'}} + auto test10() -> char(&)[__builtin_omp_required_simd_align(decltype(s2.x))]; + static const int test11 = __builtin_omp_required_simd_align(decltype(S3::s2.x)); + static const int test12 = __builtin_omp_required_simd_align(decltype(S3::s2.s)); // expected-error {{invalid application of '__builtin_omp_required_simd_align' to an incomplete type 'S1'}} + auto test13() -> char(&)[__builtin_omp_required_simd_align(decltype(s2.x))]; +}; + +// Same reasoning as S3. +struct S4 { + union { + int x; + }; + static const int test0 = __builtin_omp_required_simd_align(decltype(x)); + static const int test1 = __builtin_omp_required_simd_align(decltype(S0::x)); + auto test2() -> char(&)[__builtin_omp_required_simd_align(decltype(x))]; +}; + +// Regression test for asking for the alignment of a field within an invalid +// record. +struct S5 { + S1 s; // expected-error {{incomplete type}} + int x; +}; +const int test8 = __builtin_omp_required_simd_align(decltype(S5::x)); + +long long int test14[2]; + +static_assert(__builtin_omp_required_simd_align(decltype(test14)) == 16, "foo"); + +static_assert(__builtin_omp_required_simd_align(int[2]) == __builtin_omp_required_simd_align(int), ""); // ok + +namespace __builtin_omp_required_simd_align_array_expr { + alignas(32) extern int n[2]; + static_assert(__builtin_omp_required_simd_align(decltype(n)) == 16, ""); + + template<int> struct S { + static int a[]; + }; + template<int N> int S<N>::a[N]; + static_assert(__builtin_omp_required_simd_align(decltype(S<1>::a)) == __builtin_omp_required_simd_align(int), ""); + static_assert(__builtin_omp_required_simd_align(decltype(S<1128>::a)) == __builtin_omp_required_simd_align(int), ""); +} + +template <typename T> void n(T) { + alignas(T) int T1; + char k[__builtin_omp_required_simd_align(decltype(T1))]; + static_assert(sizeof(k) == __builtin_omp_required_simd_align(long long), ""); +} +template void n(long long); diff --git a/test/SemaCXX/typo-correction-cxx11.cpp b/test/SemaCXX/typo-correction-cxx11.cpp index 99cb166..8c58820 100644 --- a/test/SemaCXX/typo-correction-cxx11.cpp +++ b/test/SemaCXX/typo-correction-cxx11.cpp @@ -32,3 +32,29 @@ void f() { } } } + +namespace NewTypoExprFromResolvingTypoAmbiguity { +struct A { + void Swap(A *other); +}; + +struct pair { + int first; + A *second; +}; + +struct map { +public: + void swap(map &x); + pair find(int x); +}; + +void run(A *annotations) { + map new_annotations; + + auto &annotation = *annotations; + auto new_it = new_annotations.find(5); + auto &new_anotation = new_it.second; // expected-note {{'new_anotation' declared here}} + new_annotation->Swap(&annotation); // expected-error {{use of undeclared identifier 'new_annotation'; did you mean 'new_anotation'?}} +} +} diff --git a/test/SemaCXX/virtual-function-in-union.cpp b/test/SemaCXX/virtual-function-in-union.cpp new file mode 100644 index 0000000..0c4ba5d --- /dev/null +++ b/test/SemaCXX/virtual-function-in-union.cpp @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +union x { + virtual void f(); // expected-error {{unions cannot have virtual functions}} +}; diff --git a/test/SemaCXX/virtuals.cpp b/test/SemaCXX/virtuals.cpp index 6b8231d..f818074 100644 --- a/test/SemaCXX/virtuals.cpp +++ b/test/SemaCXX/virtuals.cpp @@ -51,3 +51,13 @@ namespace pr8264 { virtual virtual void func(); // expected-warning {{duplicate 'virtual' declaration specifier}} }; } + +namespace VirtualFriend { + // DR (filed but no number yet): reject meaningless pure-specifier on a friend declaration. + struct A { virtual int f(); }; + struct B { friend int A::f() = 0; }; // expected-error {{friend declaration cannot have a pure-specifier}} + struct C { + virtual int f(); + friend int C::f() = 0; // expected-error {{friend declaration cannot have a pure-specifier}} + }; +} diff --git a/test/SemaObjC/arc-unavailable-for-weakref.m b/test/SemaObjC/arc-unavailable-for-weakref.m index 53ceaa1..35d5d98 100644 --- a/test/SemaObjC/arc-unavailable-for-weakref.m +++ b/test/SemaObjC/arc-unavailable-for-weakref.m @@ -56,7 +56,7 @@ __attribute__((objc_arc_weak_reference_unavailable)) @interface I { } -@property (weak) NSFont *font; // expected-error {{synthesizing __weak instance variable of type 'NSFont * __nullable', which does not support weak references}} +@property (weak) NSFont *font; // expected-error {{synthesizing __weak instance variable of type 'NSFont * _Nullable', which does not support weak references}} @end @implementation I // expected-note {{when implemented by class I}} @@ -65,7 +65,7 @@ __attribute__((objc_arc_weak_reference_unavailable)) // rdar://13676793 @protocol MyProtocol -@property (weak) NSFont *font; // expected-error {{synthesizing __weak instance variable of type 'NSFont * __nullable', which does not support weak references}} +@property (weak) NSFont *font; // expected-error {{synthesizing __weak instance variable of type 'NSFont * _Nullable', which does not support weak references}} @end @interface I1 <MyProtocol> @@ -76,7 +76,7 @@ __attribute__((objc_arc_weak_reference_unavailable)) @end @interface Super -@property (weak) NSFont *font; // expected-error {{synthesizing __weak instance variable of type 'NSFont * __nullable', which does not support weak references}} +@property (weak) NSFont *font; // expected-error {{synthesizing __weak instance variable of type 'NSFont * _Nullable', which does not support weak references}} @end diff --git a/test/SemaObjC/format-strings-objc.m b/test/SemaObjC/format-strings-objc.m index f4c528c..079460c 100644 --- a/test/SemaObjC/format-strings-objc.m +++ b/test/SemaObjC/format-strings-objc.m @@ -251,3 +251,16 @@ void testUnicode() { NSLog(@"%C", 0x202200); // expected-warning{{format specifies type 'unichar' (aka 'unsigned short') but the argument has type 'int'}} } +// Test Objective-C modifier flags. +void testObjCModifierFlags() { + NSLog(@"%[]@", @"Foo"); // expected-warning {{missing object format flag}} + NSLog(@"%[", @"Foo"); // expected-warning {{incomplete format specifier}} + NSLog(@"%[tt", @"Foo"); // expected-warning {{incomplete format specifier}} + NSLog(@"%[tt]@", @"Foo"); // no-warning + NSLog(@"%[tt]@ %s", @"Foo", "hello"); // no-warning + NSLog(@"%s %[tt]@", "hello", @"Foo"); // no-warning + NSLog(@"%[blark]@", @"Foo"); // expected-warning {{'blark' is not a valid object format flag}} + NSLog(@"%2$[tt]@ %1$[tt]@", @"Foo", @"Bar"); // no-warning + NSLog(@"%2$[tt]@ %1$[tt]s", @"Foo", @"Bar"); // expected-warning {{object format flags cannot be used with 's' conversion specifier}} +} + diff --git a/test/SemaObjC/nullability-arc.m b/test/SemaObjC/nullability-arc.m index 917a808..1c303e8 100644 --- a/test/SemaObjC/nullability-arc.m +++ b/test/SemaObjC/nullability-arc.m @@ -5,6 +5,6 @@ __attribute__((objc_root_class)) @end // ARC qualifiers stacked with nullability. -void accepts_arc_qualified(NSFoo * __unsafe_unretained __nonnull obj) { +void accepts_arc_qualified(NSFoo * __unsafe_unretained _Nonnull obj) { accepts_arc_qualified(0); // expected-warning{{null passed to a callee that requires a non-null argument}} } diff --git a/test/SemaObjC/nullability.m b/test/SemaObjC/nullability.m index ca8c2fc..36ac6b9 100644 --- a/test/SemaObjC/nullability.m +++ b/test/SemaObjC/nullability.m @@ -2,29 +2,29 @@ __attribute__((objc_root_class)) @interface NSFoo -- (void)methodTakingIntPtr:(__nonnull int *)ptr; -- (__nonnull int *)methodReturningIntPtr; +- (void)methodTakingIntPtr:(_Nonnull int *)ptr; +- (_Nonnull int *)methodReturningIntPtr; @end // Nullability applies to all pointer types. -typedef NSFoo * __nonnull nonnull_NSFoo_ptr; -typedef id __nonnull nonnull_id; -typedef SEL __nonnull nonnull_SEL; +typedef NSFoo * _Nonnull nonnull_NSFoo_ptr; +typedef id _Nonnull nonnull_id; +typedef SEL _Nonnull nonnull_SEL; // Nullability can move into Objective-C pointer types. -typedef __nonnull NSFoo * nonnull_NSFoo_ptr_2; +typedef _Nonnull NSFoo * nonnull_NSFoo_ptr_2; // Conflicts from nullability moving into Objective-C pointer type. -typedef __nonnull NSFoo * __nullable conflict_NSFoo_ptr_2; // expected-error{{'__nonnull' cannot be applied to non-pointer type 'NSFoo'}} +typedef _Nonnull NSFoo * _Nullable conflict_NSFoo_ptr_2; // expected-error{{'_Nonnull' cannot be applied to non-pointer type 'NSFoo'}} -void testBlocksPrinting(NSFoo * __nullable (^bp)(int)) { - int *ip = bp; // expected-error{{'NSFoo * __nullable (^)(int)'}} +void testBlocksPrinting(NSFoo * _Nullable (^bp)(int)) { + int *ip = bp; // expected-error{{'NSFoo * _Nullable (^)(int)'}} } -// Check returning nil from a __nonnull-returning method. +// Check returning nil from a _Nonnull-returning method. @implementation NSFoo -- (void)methodTakingIntPtr:(__nonnull int *)ptr { } -- (__nonnull int *)methodReturningIntPtr { +- (void)methodTakingIntPtr:(_Nonnull int *)ptr { } +- (_Nonnull int *)methodReturningIntPtr { return 0; // no warning } @end @@ -35,15 +35,15 @@ __attribute__((objc_root_class)) - (nonnull NSFoo *)methodWithFoo:(nonnull NSFoo *)foo; - (nonnull NSFoo **)invalidMethod1; // expected-error{{nullability keyword 'nonnull' cannot be applied to multi-level pointer type 'NSFoo **'}} -// expected-note@-1{{use nullability type specifier '__nonnull' to affect the innermost pointer type of 'NSFoo **'}} -- (nonnull NSFoo * __nullable)conflictingMethod1; // expected-error{{nullability specifier '__nullable' conflicts with existing specifier '__nonnull'}} -- (nonnull NSFoo * __nonnull)redundantMethod1; // expected-warning{{duplicate nullability specifier '__nonnull'}} +// expected-note@-1{{use nullability type specifier '_Nonnull' to affect the innermost pointer type of 'NSFoo **'}} +- (nonnull NSFoo * _Nullable)conflictingMethod1; // expected-error{{nullability specifier '_Nullable' conflicts with existing specifier '_Nonnull'}} +- (nonnull NSFoo * _Nonnull)redundantMethod1; // expected-warning{{duplicate nullability specifier '_Nonnull'}} @property(nonnull,retain) NSFoo *property1; @property(nullable,assign) NSFoo ** invalidProperty1; // expected-error{{nullability keyword 'nullable' cannot be applied to multi-level pointer type 'NSFoo **'}} -// expected-note@-1{{use nullability type specifier '__nullable' to affect the innermost pointer type of 'NSFoo **'}} -@property(null_unspecified,retain) NSFoo * __nullable conflictingProperty1; // expected-error{{nullability specifier '__nullable' conflicts with existing specifier '__null_unspecified'}} -@property(retain,nonnull) NSFoo * __nonnull redundantProperty1; // expected-warning{{duplicate nullability specifier '__nonnull'}} +// expected-note@-1{{use nullability type specifier '_Nullable' to affect the innermost pointer type of 'NSFoo **'}} +@property(null_unspecified,retain) NSFoo * _Nullable conflictingProperty1; // expected-error{{nullability specifier '_Nullable' conflicts with existing specifier '_Null_unspecified'}} +@property(retain,nonnull) NSFoo * _Nonnull redundantProperty1; // expected-warning{{duplicate nullability specifier '_Nonnull'}} @property(null_unspecified,retain,nullable) NSFoo *conflictingProperty3; // expected-error{{nullability specifier 'nullable' conflicts with existing specifier 'null_unspecified'}} @property(nullable,retain,nullable) NSFoo *redundantProperty3; // expected-warning{{duplicate nullability specifier 'nullable'}} @@ -52,19 +52,19 @@ __attribute__((objc_root_class)) @interface NSBar () @property(nonnull,retain) NSFoo *property2; @property(nullable,assign) NSFoo ** invalidProperty2; // expected-error{{nullability keyword 'nullable' cannot be applied to multi-level pointer type 'NSFoo **'}} -// expected-note@-1{{use nullability type specifier '__nullable' to affect the innermost pointer type of 'NSFoo **'}} -@property(null_unspecified,retain) NSFoo * __nullable conflictingProperty2; // expected-error{{nullability specifier '__nullable' conflicts with existing specifier '__null_unspecified'}} -@property(retain,nonnull) NSFoo * __nonnull redundantProperty2; // expected-warning{{duplicate nullability specifier '__nonnull'}} +// expected-note@-1{{use nullability type specifier '_Nullable' to affect the innermost pointer type of 'NSFoo **'}} +@property(null_unspecified,retain) NSFoo * _Nullable conflictingProperty2; // expected-error{{nullability specifier '_Nullable' conflicts with existing specifier '_Null_unspecified'}} +@property(retain,nonnull) NSFoo * _Nonnull redundantProperty2; // expected-warning{{duplicate nullability specifier '_Nonnull'}} @end -void test_accepts_nonnull_null_pointer_literal(NSFoo *foo, __nonnull NSBar *bar) { +void test_accepts_nonnull_null_pointer_literal(NSFoo *foo, _Nonnull NSBar *bar) { [foo methodTakingIntPtr: 0]; // expected-warning{{null passed to a callee that requires a non-null argument}} [bar methodWithFoo: 0]; // expected-warning{{null passed to a callee that requires a non-null argument}} bar.property1 = 0; // expected-warning{{null passed to a callee that requires a non-null argument}} bar.property2 = 0; // expected-warning{{null passed to a callee that requires a non-null argument}} [bar setProperty1: 0]; // expected-warning{{null passed to a callee that requires a non-null argument}} [bar setProperty2: 0]; // expected-warning{{null passed to a callee that requires a non-null argument}} - int *ptr = bar.property1; // expected-warning{{incompatible pointer types initializing 'int *' with an expression of type 'NSFoo * __nonnull'}} + int *ptr = bar.property1; // expected-warning{{incompatible pointer types initializing 'int *' with an expression of type 'NSFoo * _Nonnull'}} } // Check returning nil from a nonnull-returning method. @@ -82,7 +82,7 @@ void test_accepts_nonnull_null_pointer_literal(NSFoo *foo, __nonnull NSBar *bar) } - (NSFoo *)redundantMethod1 { int *ip = 0; - return ip; // expected-warning{{result type 'NSFoo * __nonnull'}} + return ip; // expected-warning{{result type 'NSFoo * _Nonnull'}} } @end @@ -95,8 +95,8 @@ __attribute__((objc_root_class)) @implementation NSMerge - (NSFoo *)methodA:(NSFoo*)foo { - int *ptr = foo; // expected-warning{{incompatible pointer types initializing 'int *' with an expression of type 'NSFoo * __nonnull'}} - return ptr; // expected-warning{{result type 'NSFoo * __nonnull'}} + int *ptr = foo; // expected-warning{{incompatible pointer types initializing 'int *' with an expression of type 'NSFoo * _Nonnull'}} + return ptr; // expected-warning{{result type 'NSFoo * _Nonnull'}} } - (nullable NSFoo *)methodB:(null_unspecified NSFoo*)foo { // expected-error{{nullability specifier 'nullable' conflicts with existing specifier 'nonnull'}} \ @@ -106,7 +106,7 @@ __attribute__((objc_root_class)) - (nonnull NSFoo *)methodC:(nullable NSFoo*)foo { int *ip = 0; - return ip; // expected-warning{{result type 'NSFoo * __nonnull'}} + return ip; // expected-warning{{result type 'NSFoo * _Nonnull'}} } @end @@ -119,27 +119,27 @@ __attribute__((objc_root_class)) @end void test_receiver_merge(NSMergeReceiver *none, - __nonnull NSMergeReceiver *nonnull, - __nullable NSMergeReceiver *nullable, - __null_unspecified NSMergeReceiver *null_unspecified) { + _Nonnull NSMergeReceiver *nonnull, + _Nullable NSMergeReceiver *nullable, + _Null_unspecified NSMergeReceiver *null_unspecified) { int *ptr; - ptr = [nullable returnsNullable]; // expected-warning{{'id __nullable'}} - ptr = [nullable returnsNullUnspecified]; // expected-warning{{'id __nullable'}} - ptr = [nullable returnsNonNull]; // expected-warning{{'id __nullable'}} - ptr = [nullable returnsNone]; // expected-warning{{'id __nullable'}} + ptr = [nullable returnsNullable]; // expected-warning{{'id _Nullable'}} + ptr = [nullable returnsNullUnspecified]; // expected-warning{{'id _Nullable'}} + ptr = [nullable returnsNonNull]; // expected-warning{{'id _Nullable'}} + ptr = [nullable returnsNone]; // expected-warning{{'id _Nullable'}} - ptr = [null_unspecified returnsNullable]; // expected-warning{{'id __nullable'}} - ptr = [null_unspecified returnsNullUnspecified]; // expected-warning{{'id __null_unspecified'}} - ptr = [null_unspecified returnsNonNull]; // expected-warning{{'id __null_unspecified'}} + ptr = [null_unspecified returnsNullable]; // expected-warning{{'id _Nullable'}} + ptr = [null_unspecified returnsNullUnspecified]; // expected-warning{{'id _Null_unspecified'}} + ptr = [null_unspecified returnsNonNull]; // expected-warning{{'id _Null_unspecified'}} ptr = [null_unspecified returnsNone]; // expected-warning{{'id'}} - ptr = [nonnull returnsNullable]; // expected-warning{{'id __nullable'}} - ptr = [nonnull returnsNullUnspecified]; // expected-warning{{'id __null_unspecified'}} - ptr = [nonnull returnsNonNull]; // expected-warning{{'id __nonnull'}} + ptr = [nonnull returnsNullable]; // expected-warning{{'id _Nullable'}} + ptr = [nonnull returnsNullUnspecified]; // expected-warning{{'id _Null_unspecified'}} + ptr = [nonnull returnsNonNull]; // expected-warning{{'id _Nonnull'}} ptr = [nonnull returnsNone]; // expected-warning{{'id'}} - ptr = [none returnsNullable]; // expected-warning{{'id __nullable'}} + ptr = [none returnsNullable]; // expected-warning{{'id _Nullable'}} ptr = [none returnsNullUnspecified]; // expected-warning{{'id'}} ptr = [none returnsNonNull]; // expected-warning{{'id'}} ptr = [none returnsNone]; // expected-warning{{'id'}} @@ -157,19 +157,19 @@ __attribute__((objc_root_class)) - (nullable instancetype)returnMe; + (nullable instancetype)returnInstanceOfMe; -- (nonnull instancetype __nullable)initWithBlah2:(nonnull id)blah; // expected-error {{nullability specifier '__nullable' conflicts with existing specifier '__nonnull'}} -- (instancetype __nullable)returnMe2; -+ (__nonnull instancetype)returnInstanceOfMe2; +- (nonnull instancetype _Nullable)initWithBlah2:(nonnull id)blah; // expected-error {{nullability specifier '_Nullable' conflicts with existing specifier '_Nonnull'}} +- (instancetype _Nullable)returnMe2; ++ (_Nonnull instancetype)returnInstanceOfMe2; @end -void test_instancetype(InitializableClass * __nonnull ic, id __nonnull object) { - int *ip = [ic returnMe]; // expected-warning{{incompatible pointer types initializing 'int *' with an expression of type 'InitializableClass * __nullable'}} - ip = [InitializableClass returnMe]; // expected-warning{{incompatible pointer types assigning to 'int *' from 'id __nullable'}} - ip = [InitializableClass returnInstanceOfMe]; // expected-warning{{incompatible pointer types assigning to 'int *' from 'InitializableClass * __nullable'}} - ip = [object returnMe]; // expected-warning{{incompatible pointer types assigning to 'int *' from 'id __nullable'}} +void test_instancetype(InitializableClass * _Nonnull ic, id _Nonnull object) { + int *ip = [ic returnMe]; // expected-warning{{incompatible pointer types initializing 'int *' with an expression of type 'InitializableClass * _Nullable'}} + ip = [InitializableClass returnMe]; // expected-warning{{incompatible pointer types assigning to 'int *' from 'id _Nullable'}} + ip = [InitializableClass returnInstanceOfMe]; // expected-warning{{incompatible pointer types assigning to 'int *' from 'InitializableClass * _Nullable'}} + ip = [object returnMe]; // expected-warning{{incompatible pointer types assigning to 'int *' from 'id _Nullable'}} - ip = [ic returnMe2]; // expected-warning{{incompatible pointer types assigning to 'int *' from 'InitializableClass * __nullable'}} - ip = [InitializableClass returnInstanceOfMe2]; // expected-warning{{incompatible pointer types assigning to 'int *' from 'InitializableClass * __nonnull'}} + ip = [ic returnMe2]; // expected-warning{{incompatible pointer types assigning to 'int *' from 'InitializableClass * _Nullable'}} + ip = [InitializableClass returnInstanceOfMe2]; // expected-warning{{incompatible pointer types assigning to 'int *' from 'InitializableClass * _Nonnull'}} } // Check null_resettable getters/setters. @@ -184,14 +184,14 @@ __attribute__((objc_root_class)) @end void test_null_resettable(NSResettable *r, int *ip) { - [r setResettable1:ip]; // expected-warning{{incompatible pointer types sending 'int *' to parameter of type 'NSResettable * __nullable'}} - r.resettable1 = ip; // expected-warning{{incompatible pointer types assigning to 'NSResettable * __nullable' from 'int *'}} + [r setResettable1:ip]; // expected-warning{{incompatible pointer types sending 'int *' to parameter of type 'NSResettable * _Nullable'}} + r.resettable1 = ip; // expected-warning{{incompatible pointer types assigning to 'NSResettable * _Nullable' from 'int *'}} } @implementation NSResettable // expected-warning{{synthesized setter 'setResettable4:' for null_resettable property 'resettable4' does not handle nil}} - (NSResettable *)resettable1 { int *ip = 0; - return ip; // expected-warning{{result type 'NSResettable * __nonnull'}} + return ip; // expected-warning{{result type 'NSResettable * _Nonnull'}} } - (void)setResettable1:(NSResettable *)param { @@ -218,15 +218,15 @@ void test_null_resettable(NSResettable *r, int *ip) { void testMultiProp(MultiProp *foo) { int *ip; - ip = foo.a; // expected-warning{{from 'id __nullable'}} - ip = foo.d; // expected-warning{{from 'MultiProp * __nullable'}} - ip = foo.e; // expected-error{{incompatible type 'MultiProp *(^ __nullable)(int)'}} + ip = foo.a; // expected-warning{{from 'id _Nullable'}} + ip = foo.d; // expected-warning{{from 'MultiProp * _Nullable'}} + ip = foo.e; // expected-error{{incompatible type 'MultiProp *(^ _Nullable)(int)'}} } void testBlockLiterals() { (void)(^id(void) { return 0; }); - (void)(^id __nullable (void) { return 0; }); - (void)(^ __nullable id(void) { return 0; }); + (void)(^id _Nullable (void) { return 0; }); + (void)(^ _Nullable id(void) { return 0; }); - int *x = (^ __nullable id(void) { return 0; })(); // expected-warning{{incompatible pointer types initializing 'int *' with an expression of type 'id __nullable'}} + int *x = (^ _Nullable id(void) { return 0; })(); // expected-warning{{incompatible pointer types initializing 'int *' with an expression of type 'id _Nullable'}} } diff --git a/test/SemaObjC/nullable-weak-property.m b/test/SemaObjC/nullable-weak-property.m index 617ff4e..faafd20 100644 --- a/test/SemaObjC/nullable-weak-property.m +++ b/test/SemaObjC/nullable-weak-property.m @@ -5,7 +5,7 @@ @interface NSObject @end @class NSFoo; -void foo (NSFoo * __nonnull); +void foo (NSFoo * _Nonnull); @interface NSBar : NSObject @property(weak) NSFoo *property1; @@ -13,6 +13,6 @@ void foo (NSFoo * __nonnull); @implementation NSBar - (void) Meth { - foo (self.property1); // expected-warning {{implicit conversion from nullable pointer 'NSFoo * __nullable' to non-nullable pointer type 'NSFoo * __nonnull'}} + foo (self.property1); // expected-warning {{implicit conversion from nullable pointer 'NSFoo * _Nullable' to non-nullable pointer type 'NSFoo * _Nonnull'}} } @end diff --git a/test/SemaObjCXX/Inputs/nullability-consistency-1.h b/test/SemaObjCXX/Inputs/nullability-consistency-1.h index 4d6bf79..6ab48fe 100644 --- a/test/SemaObjCXX/Inputs/nullability-consistency-1.h +++ b/test/SemaObjCXX/Inputs/nullability-consistency-1.h @@ -1,6 +1,6 @@ void f1(int *ptr); // expected-warning{{pointer is missing a nullability type specifier}} -void f2(int * __nonnull); +void f2(int * _Nonnull); #include "nullability-consistency-2.h" diff --git a/test/SemaObjCXX/Inputs/nullability-consistency-2.h b/test/SemaObjCXX/Inputs/nullability-consistency-2.h index 8efdfa8..4517738 100644 --- a/test/SemaObjCXX/Inputs/nullability-consistency-2.h +++ b/test/SemaObjCXX/Inputs/nullability-consistency-2.h @@ -1,4 +1,4 @@ -void g1(int * __nonnull); +void g1(int * _Nonnull); void g2(int (^block)(int, int)); // expected-warning{{block pointer is missing a nullability type specifier}} diff --git a/test/SemaObjCXX/Inputs/nullability-consistency-3.h b/test/SemaObjCXX/Inputs/nullability-consistency-3.h index a0c0d38..520d1a4 100644 --- a/test/SemaObjCXX/Inputs/nullability-consistency-3.h +++ b/test/SemaObjCXX/Inputs/nullability-consistency-3.h @@ -1 +1 @@ -void double_declarator1(int *__nonnull *); // expected-warning{{pointer is missing a nullability type specifier (__nonnull, __nullable, or __null_unspecified)}} +void double_declarator1(int *_Nonnull *); // expected-warning{{pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)}} diff --git a/test/SemaObjCXX/Inputs/nullability-consistency-4.h b/test/SemaObjCXX/Inputs/nullability-consistency-4.h index 984280c..ac227a0 100644 --- a/test/SemaObjCXX/Inputs/nullability-consistency-4.h +++ b/test/SemaObjCXX/Inputs/nullability-consistency-4.h @@ -1 +1 @@ -void double_declarator1(int * * __nonnull); // expected-warning{{pointer is missing a nullability type specifier (__nonnull, __nullable, or __null_unspecified)}} +void double_declarator1(int * * _Nonnull); // expected-warning{{pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified)}} diff --git a/test/SemaObjCXX/Inputs/nullability-consistency-5.h b/test/SemaObjCXX/Inputs/nullability-consistency-5.h index 3a685af..1c74ab8 100644 --- a/test/SemaObjCXX/Inputs/nullability-consistency-5.h +++ b/test/SemaObjCXX/Inputs/nullability-consistency-5.h @@ -8,7 +8,7 @@ void suppress1(SUPPRESS_NULLABILITY_WARNING(int *) ptr); // no warning void shouldwarn5(int *ptr); //expected-warning{{missing a nullability type specifier}} -void trigger5(int * __nonnull); +void trigger5(int * _Nonnull); void suppress2(SUPPRESS_NULLABILITY_WARNING(int *) ptr); // no warning diff --git a/test/SemaObjCXX/Inputs/nullability-consistency-8.h b/test/SemaObjCXX/Inputs/nullability-consistency-8.h index 890bb4d..2425a70 100644 --- a/test/SemaObjCXX/Inputs/nullability-consistency-8.h +++ b/test/SemaObjCXX/Inputs/nullability-consistency-8.h @@ -1,4 +1,4 @@ -typedef int* __nonnull mynonnull; +typedef int* _Nonnull mynonnull; __attribute__((objc_root_class)) @interface typedefClass @@ -13,15 +13,15 @@ void func3(int *); // expected-warning{{pointer is missing a nullability type sp typedef void *CFTypeRef; void cf1(CFTypeRef * p CF_RETURNS_NOT_RETAINED); // expected-warning {{pointer is missing a nullability type specifier}} -void cf2(CFTypeRef * __nullable p CF_RETURNS_NOT_RETAINED); -void cf3(CFTypeRef * __nonnull p CF_RETURNS_NOT_RETAINED); +void cf2(CFTypeRef * _Nullable p CF_RETURNS_NOT_RETAINED); +void cf3(CFTypeRef * _Nonnull p CF_RETURNS_NOT_RETAINED); -void cf4(CFTypeRef __nullable * __nullable p CF_RETURNS_NOT_RETAINED); -void cf5(CFTypeRef __nonnull * __nullable p CF_RETURNS_NOT_RETAINED); +void cf4(CFTypeRef _Nullable * _Nullable p CF_RETURNS_NOT_RETAINED); +void cf5(CFTypeRef _Nonnull * _Nullable p CF_RETURNS_NOT_RETAINED); -void cf6(CFTypeRef * __nullable CF_RETURNS_NOT_RETAINED p); -void cf7(CF_RETURNS_NOT_RETAINED CFTypeRef * __nonnull p); +void cf6(CFTypeRef * _Nullable CF_RETURNS_NOT_RETAINED p); +void cf7(CF_RETURNS_NOT_RETAINED CFTypeRef * _Nonnull p); -typedef CFTypeRef __nullable *CFTypeRefPtr; +typedef CFTypeRef _Nullable *CFTypeRefPtr; void cfp1(CFTypeRefPtr p CF_RETURNS_NOT_RETAINED); // expected-warning {{pointer is missing a nullability type specifier}} -void cfp2(CFTypeRefPtr __nonnull p CF_RETURNS_NOT_RETAINED); +void cfp2(CFTypeRefPtr _Nonnull p CF_RETURNS_NOT_RETAINED); diff --git a/test/SemaObjCXX/Inputs/nullability-consistency-system/nullability-consistency-system.h b/test/SemaObjCXX/Inputs/nullability-consistency-system/nullability-consistency-system.h index 6dbca16..9161af1 100644 --- a/test/SemaObjCXX/Inputs/nullability-consistency-system/nullability-consistency-system.h +++ b/test/SemaObjCXX/Inputs/nullability-consistency-system/nullability-consistency-system.h @@ -5,4 +5,4 @@ void system1(int *ptr); // expected-warning@-2{{pointer is missing a nullability type specifier}} #endif -void system2(int * __nonnull); +void system2(int * _Nonnull); diff --git a/test/SemaObjCXX/Inputs/nullability-pragmas-1.h b/test/SemaObjCXX/Inputs/nullability-pragmas-1.h index 9501116..4ac813d 100644 --- a/test/SemaObjCXX/Inputs/nullability-pragmas-1.h +++ b/test/SemaObjCXX/Inputs/nullability-pragmas-1.h @@ -25,19 +25,19 @@ void f3(A* obj); void f4(int (^block)(int, int)); void f5(int_ptr x); void f6(A_ptr obj); -void f7(int * __nullable x); -void f8(A * __nullable obj); +void f7(int * _Nullable x); +void f8(A * _Nullable obj); void f9(int X::* mem_ptr); void f10(int (X::*mem_func)(int, int)); -void f11(int X::* __nullable mem_ptr); -void f12(int (X::* __nullable mem_func)(int, int)); +void f11(int X::* _Nullable mem_ptr); +void f12(int (X::* _Nullable mem_func)(int, int)); int_ptr f13(void); A *f14(void); -int * __null_unspecified f15(void); -A * __null_unspecified f16(void); -void f17(CFErrorRef *error); // expected-note{{no known conversion from 'A * __nonnull' to 'CFErrorRef __nullable * __nullable' (aka '__CFError **') for 1st argument}} +int * _Null_unspecified f15(void); +A * _Null_unspecified f16(void); +void f17(CFErrorRef *error); // expected-note{{no known conversion from 'A * _Nonnull' to 'CFErrorRef _Nullable * _Nullable' (aka '__CFError **') for 1st argument}} void f18(A **); // expected-warning 2{{pointer is missing a nullability type specifier}} void f19(CFErrorRefPtr error); // expected-warning{{pointer is missing a nullability type specifier}} @@ -64,14 +64,14 @@ void g5(int (**fp)(int, int)); // expected-warning 2{{pointer is missing a nulla int *global_int_ptr; -// typedefs not inferred __nonnull +// typedefs not inferred _Nonnull typedef int *int_ptr_2; typedef int * // expected-warning{{pointer is missing a nullability type specifier}} *int_ptr_ptr; static inline void f30(void) { - float *fp = global_int_ptr; // expected-error{{cannot initialize a variable of type 'float *' with an lvalue of type 'int * __nonnull'}} + float *fp = global_int_ptr; // expected-error{{cannot initialize a variable of type 'float *' with an lvalue of type 'int * _Nonnull'}} int_ptr_2 ip2; float *fp2 = ip2; // expected-error{{cannot initialize a variable of type 'float *' with an lvalue of type 'int_ptr_2' (aka 'int *')}} @@ -83,7 +83,7 @@ static inline void f30(void) { @interface AA : A { @public id ivar1; - __nonnull id ivar2; + _Nonnull id ivar2; } @end @@ -92,8 +92,8 @@ static inline void f30(void) { void f20(A *a); // expected-warning{{pointer is missing a nullability type specifier}} void f21(int_ptr x); // expected-warning{{pointer is missing a nullability type specifier}} void f22(A_ptr y); // expected-warning{{pointer is missing a nullability type specifier}} -void f23(int_ptr __nullable x); -void f24(A_ptr __nullable y); +void f23(int_ptr _Nullable x); +void f24(A_ptr _Nullable y); void f25(int_ptr_2 x); // expected-warning{{pointer is missing a nullability type specifier}} @interface A(OutsidePragmas1) diff --git a/test/SemaObjCXX/nullability-consistency.mm b/test/SemaObjCXX/nullability-consistency.mm index acb972d..6921d8b 100644 --- a/test/SemaObjCXX/nullability-consistency.mm +++ b/test/SemaObjCXX/nullability-consistency.mm @@ -13,4 +13,4 @@ void h1(int *ptr) { } // don't warn -void h2(int * __nonnull) { } +void h2(int * _Nonnull) { } diff --git a/test/SemaObjCXX/nullability-pragmas.mm b/test/SemaObjCXX/nullability-pragmas.mm index 0c61a30..dbf4f37 100644 --- a/test/SemaObjCXX/nullability-pragmas.mm +++ b/test/SemaObjCXX/nullability-pragmas.mm @@ -7,7 +7,11 @@ # error assume_nonnull feature is not set #endif -void test_pragmas_1(A * __nonnull a, AA * __nonnull aa) { +#if !__has_extension(assume_nonnull) +# error assume_nonnull extension is not set +#endif + +void test_pragmas_1(A * _Nonnull a, AA * _Nonnull aa) { f1(0); // okay: no nullability annotations f2(0); // expected-warning{{null passed to a callee that requires a non-null argument}} f3(0); // expected-warning{{null passed to a callee that requires a non-null argument}} @@ -23,19 +27,19 @@ void test_pragmas_1(A * __nonnull a, AA * __nonnull aa) { [a method1:0]; // expected-warning{{null passed to a callee that requires a non-null argument}} f17(a); // expected-error{{no matching function for call to 'f17'}} - [a method3: a]; // expected-error{{cannot initialize a parameter of type 'NSError * __nullable * __nullable' with an lvalue of type 'A * __nonnull'}} - [a method4: a]; // expected-error{{cannot initialize a parameter of type 'NSErrorPtr __nullable * __nullable' (aka 'NSError **') with an lvalue of type 'A * __nonnull'}} + [a method3: a]; // expected-error{{cannot initialize a parameter of type 'NSError * _Nullable * _Nullable' with an lvalue of type 'A * _Nonnull'}} + [a method4: a]; // expected-error{{cannot initialize a parameter of type 'NSErrorPtr _Nullable * _Nullable' (aka 'NSError **') with an lvalue of type 'A * _Nonnull'}} float *ptr; - ptr = f13(); // expected-error{{assigning to 'float *' from incompatible type 'int_ptr __nonnull' (aka 'int *')}} - ptr = f14(); // expected-error{{assigning to 'float *' from incompatible type 'A * __nonnull'}} - ptr = [a method1:a]; // expected-error{{assigning to 'float *' from incompatible type 'A * __nonnull'}} - ptr = a.aProp; // expected-error{{assigning to 'float *' from incompatible type 'A * __nonnull'}} - ptr = global_int_ptr; // expected-error{{assigning to 'float *' from incompatible type 'int * __nonnull'}} - ptr = f15(); // expected-error{{assigning to 'float *' from incompatible type 'int * __null_unspecified'}} - ptr = f16(); // expected-error{{assigning to 'float *' from incompatible type 'A * __null_unspecified'}} - ptr = [a method2]; // expected-error{{assigning to 'float *' from incompatible type 'A * __null_unspecified'}} + ptr = f13(); // expected-error{{assigning to 'float *' from incompatible type 'int_ptr _Nonnull' (aka 'int *')}} + ptr = f14(); // expected-error{{assigning to 'float *' from incompatible type 'A * _Nonnull'}} + ptr = [a method1:a]; // expected-error{{assigning to 'float *' from incompatible type 'A * _Nonnull'}} + ptr = a.aProp; // expected-error{{assigning to 'float *' from incompatible type 'A * _Nonnull'}} + ptr = global_int_ptr; // expected-error{{assigning to 'float *' from incompatible type 'int * _Nonnull'}} + ptr = f15(); // expected-error{{assigning to 'float *' from incompatible type 'int * _Null_unspecified'}} + ptr = f16(); // expected-error{{assigning to 'float *' from incompatible type 'A * _Null_unspecified'}} + ptr = [a method2]; // expected-error{{assigning to 'float *' from incompatible type 'A * _Null_unspecified'}} ptr = aa->ivar1; // expected-error{{from incompatible type 'id'}} - ptr = aa->ivar2; // expected-error{{from incompatible type 'id __nonnull'}} + ptr = aa->ivar2; // expected-error{{from incompatible type 'id _Nonnull'}} } diff --git a/test/SemaTemplate/instantiate-explicitly-after-fatal.cpp b/test/SemaTemplate/instantiate-explicitly-after-fatal.cpp new file mode 100644 index 0000000..9693d2f --- /dev/null +++ b/test/SemaTemplate/instantiate-explicitly-after-fatal.cpp @@ -0,0 +1,9 @@ +// RUN: not %clang_cc1 -fsyntax-only -std=c++11 -ferror-limit 1 %s 2>&1 | FileCheck %s +unknown_type foo(unknown_type); +// CHECK: fatal error: too many errors emitted, stopping now + +template <typename> +class Bar {}; + +extern template class Bar<int>; +template class Bar<int>; diff --git a/test/SemaTemplate/instantiate-local-class.cpp b/test/SemaTemplate/instantiate-local-class.cpp index f58d7a4..c0ea6a0 100644 --- a/test/SemaTemplate/instantiate-local-class.cpp +++ b/test/SemaTemplate/instantiate-local-class.cpp @@ -394,3 +394,57 @@ void f() { void g() { f<void>(); } } + + +namespace PR21332 { + template<typename T> void f1() { + struct S { // expected-note{{in instantiation of member class 'S' requested here}} + void g1(int n = T::error); // expected-error{{type 'int' cannot be used prior to '::' because it has no members}} + }; + } + template void f1<int>(); // expected-note{{in instantiation of function template specialization 'PR21332::f1<int>' requested here}} + + template<typename T> void f2() { + struct S { // expected-note{{in instantiation of member class 'S' requested here}} + void g2() noexcept(T::error); // expected-error{{type 'int' cannot be used prior to '::' because it has no members}} + }; + } + template void f2<int>(); // expected-note{{in instantiation of function template specialization 'PR21332::f2<int>' requested here}} + + template<typename T> void f3() { + enum S { + val = T::error; // expected-error{{expected '}' or ','}} expected-error{{type 'int' cannot be used prior to '::' because it has no members}} + }; + } + template void f3<int>(); //expected-note{{in instantiation of function template specialization 'PR21332::f3<int>' requested here}} + + template<typename T> void f4() { + enum class S { + val = T::error; // expected-error{{expected '}' or ','}} expected-error{{type 'int' cannot be used prior to '::' because it has no members}} + }; + } + template void f4<int>(); // expected-note{{in instantiation of function template specialization 'PR21332::f4<int>' requested here}} + + template<typename T> void f5() { + class S { // expected-note {{in instantiation of default member initializer 'PR21332::f5()::S::val' requested here}} + int val = T::error; // expected-error {{type 'int' cannot be used prior to '::' because it has no members}} + }; + } + template void f5<int>(); // expected-note {{in instantiation of function template specialization 'PR21332::f5<int>' requested here}} + + template<typename T> void f6() { + class S { // expected-note {{in instantiation of member function 'PR21332::f6()::S::get' requested here}} + void get() { + class S2 { // expected-note {{in instantiation of member class 'S2' requested here}} + void g1(int n = T::error); // expected-error {{type 'int' cannot be used prior to '::' because it has no members}} + }; + } + }; + } + template void f6<int>(); // expected-note{{in instantiation of function template specialization 'PR21332::f6<int>' requested here}} + + template<typename T> void f7() { + struct S { void g() noexcept(undefined_val); }; // expected-error{{use of undeclared identifier 'undefined_val'}} + } + template void f7<int>(); +} diff --git a/test/lit.cfg b/test/lit.cfg index 51e1e4f..0e947dd 100644 --- a/test/lit.cfg +++ b/test/lit.cfg @@ -452,14 +452,13 @@ if lit.util.which('xmllint'): config.available_features.add('xmllint') # Sanitizers. -if config.llvm_use_sanitizer == "Address": +if 'Address' in config.llvm_use_sanitizer: config.available_features.add("asan") else: config.available_features.add("not_asan") -if (config.llvm_use_sanitizer == "Memory" or - config.llvm_use_sanitizer == "MemoryWithOrigins"): +if 'Memory' in config.llvm_use_sanitizer: config.available_features.add("msan") -if config.llvm_use_sanitizer == "Undefined": +if 'Undefined' in config.llvm_use_sanitizer: config.available_features.add("ubsan") else: config.available_features.add("not_ubsan") |