diff options
Diffstat (limited to 'test/OpenMP')
382 files changed, 4894 insertions, 1014 deletions
diff --git a/test/OpenMP/Inputs/declare-simd-fix.h b/test/OpenMP/Inputs/declare-simd-fix.h new file mode 100644 index 0000000000..508818cf70 --- /dev/null +++ b/test/OpenMP/Inputs/declare-simd-fix.h @@ -0,0 +1,8 @@ +#ifndef LLVM_CLANG_TEST_OPENMP_INPUTS_DECLARE_SIMD_FIX_H +#define LLVM_CLANG_TEST_OPENMP_INPUTS_DECLARE_SIMD_FIX_H + +#pragma omp declare simd +float foo(float a, float b, int c); +float bar(float a, float b, int c); + +#endif diff --git a/test/OpenMP/allocate_allocator_ast_print.cpp b/test/OpenMP/allocate_allocator_ast_print.cpp new file mode 100644 index 0000000000..02c669e157 --- /dev/null +++ b/test/OpenMP/allocate_allocator_ast_print.cpp @@ -0,0 +1,94 @@ +// RUN: %clang_cc1 -verify -fopenmp -triple x86_64-apple-darwin10.6.0 -ast-print %s -o - | FileCheck %s +// RUN: %clang_cc1 -fopenmp -triple x86_64-apple-darwin10.6.0 -x c++ -std=c++11 -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -triple x86_64-apple-darwin10.6.0 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s +// RUN: %clang_cc1 -verify -fopenmp -triple x86_64-unknown-linux-gnu -ast-print %s -o - | FileCheck %s +// RUN: %clang_cc1 -fopenmp -fnoopenmp-use-tls -triple x86_64-unknown-linux-gnu -x c++ -std=c++11 -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fnoopenmp-use-tls -triple x86_64-unknown-linux-gnu -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -o - | FileCheck %s + +// RUN: %clang_cc1 -verify -fopenmp-simd -triple x86_64-apple-darwin10.6.0 -ast-print %s -o - | FileCheck %s +// RUN: %clang_cc1 -fopenmp-simd -triple x86_64-apple-darwin10.6.0 -x c++ -std=c++11 -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -triple x86_64-apple-darwin10.6.0 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s +// RUN: %clang_cc1 -verify -fopenmp-simd -triple x86_64-unknown-linux-gnu -ast-print %s -o - | FileCheck %s +// RUN: %clang_cc1 -fopenmp-simd -fnoopenmp-use-tls -triple x86_64-unknown-linux-gnu -x c++ -std=c++11 -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fnoopenmp-use-tls -triple x86_64-unknown-linux-gnu -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print -o - | FileCheck %s +// expected-no-diagnostics + +#ifndef HEADER +#define HEADER + +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + +struct St{ + int a; +}; + +struct St1{ + int a; + static int b; +// CHECK: static int b; +#pragma omp allocate(b) allocator(omp_default_mem_alloc) +// CHECK-NEXT: #pragma omp allocate(St1::b) allocator(omp_default_mem_alloc){{$}} +} d; + +int a, b, c; +// CHECK: int a; +// CHECK: int b; +// CHECK: int c; +#pragma omp allocate(a) allocator(omp_large_cap_mem_alloc) +#pragma omp allocate(b) allocator(omp_const_mem_alloc) +// CHECK-NEXT: #pragma omp allocate(a) allocator(omp_large_cap_mem_alloc) +// CHECK-NEXT: #pragma omp allocate(b) allocator(omp_const_mem_alloc) +#pragma omp allocate(c, d) allocator(omp_high_bw_mem_alloc) +// CHECK-NEXT: #pragma omp allocate(c,d) allocator(omp_high_bw_mem_alloc) + +template <class T> +struct ST { + static T m; + #pragma omp allocate(m) allocator(omp_low_lat_mem_alloc) +}; + +template <class T> T foo() { + T v; + #pragma omp allocate(v) allocator(omp_cgroup_mem_alloc) + v = ST<T>::m; + return v; +} +//CHECK: template <class T> T foo() { +//CHECK-NEXT: T v; +//CHECK-NEXT: #pragma omp allocate(v) allocator(omp_cgroup_mem_alloc) +//CHECK: template<> int foo<int>() { +//CHECK-NEXT: int v; +//CHECK-NEXT: #pragma omp allocate(v) allocator(omp_cgroup_mem_alloc) + +namespace ns{ + int a; +} +// CHECK: namespace ns { +// CHECK-NEXT: int a; +// CHECK-NEXT: } +#pragma omp allocate(ns::a) allocator(omp_pteam_mem_alloc) +// CHECK-NEXT: #pragma omp allocate(ns::a) allocator(omp_pteam_mem_alloc) + +int main () { + static int a; +// CHECK: static int a; +#pragma omp allocate(a) allocator(omp_thread_mem_alloc) +// CHECK-NEXT: #pragma omp allocate(a) allocator(omp_thread_mem_alloc) + a=2; + int b = 3; +// CHECK: int b = 3; +#pragma omp allocate(b) +// CHECK-NEXT: #pragma omp allocate(b) + return (foo<int>()); +} + +extern template int ST<int>::m; +#endif diff --git a/test/OpenMP/allocate_allocator_messages.cpp b/test/OpenMP/allocate_allocator_messages.cpp new file mode 100644 index 0000000000..5ba4f2a506 --- /dev/null +++ b/test/OpenMP/allocate_allocator_messages.cpp @@ -0,0 +1,47 @@ +// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp -ferror-limit 100 -o - %s + +// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp-simd -ferror-limit 100 -o - %s + +struct St{ + int a; +}; + +int sss; +#pragma omp allocate(sss) allocat // expected-warning {{extra tokens at the end of '#pragma omp allocate' are ignored}} +#pragma omp allocate(sss) allocate(sss) // expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp allocate'}} +#pragma omp allocate(sss) allocator // expected-error {{expected '(' after 'allocator'}} +#pragma omp allocate(sss) allocator(0, // expected-error {{expected ')'}} expected-error {{omp_allocator_handle_t type not found; include <omp.h>}} expected-note {{to match this '('}} +#pragma omp allocate(sss) allocator(0,sss // expected-error {{expected ')'}} expected-error {{omp_allocator_handle_t type not found; include <omp.h>}} expected-note {{to match this '('}} +#pragma omp allocate(sss) allocator(0,sss) // expected-error {{expected ')'}} expected-error {{omp_allocator_handle_t type not found; include <omp.h>}} expected-note {{to match this '('}} +#pragma omp allocate(sss) allocator(sss) // expected-error {{omp_allocator_handle_t type not found; include <omp.h>}} + +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + +struct St1{ + int a; + static int b; +#pragma omp allocate(b) allocator(sss) // expected-error {{initializing 'const omp_allocator_handle_t' (aka 'void **const') with an expression of incompatible type 'int'}} expected-note {{previous allocator is specified here}} +#pragma omp allocate(b) +#pragma omp allocate(b) allocator(omp_thread_mem_alloc) // expected-warning {{allocate directive specifies 'omp_thread_mem_alloc' allocator while previously used default}} +} d; // expected-note 2 {{'d' defined here}} + +// expected-error@+1 {{expected one of the predefined allocators for the variables with the static storage: 'omp_default_mem_alloc', 'omp_large_cap_mem_alloc', 'omp_const_mem_alloc', 'omp_high_bw_mem_alloc', 'omp_low_lat_mem_alloc', 'omp_cgroup_mem_alloc', 'omp_pteam_mem_alloc' or 'omp_thread_mem_alloc'}} +#pragma omp allocate(d) allocator(nullptr) +extern void **allocator; +// expected-error@+1 {{expected one of the predefined allocators for the variables with the static storage: 'omp_default_mem_alloc', 'omp_large_cap_mem_alloc', 'omp_const_mem_alloc', 'omp_high_bw_mem_alloc', 'omp_low_lat_mem_alloc', 'omp_cgroup_mem_alloc', 'omp_pteam_mem_alloc' or 'omp_thread_mem_alloc'}} +#pragma omp allocate(d) allocator(allocator) +#pragma omp allocate(d) allocator(omp_thread_mem_alloc) // expected-note {{previous allocator is specified here}} +#pragma omp allocate(d) // expected-warning {{allocate directive specifies default allocator while previously used 'omp_thread_mem_alloc'}} + +int c; +#pragma omp allocate(c) allocator(omp_thread_mem_alloc) // expected-note {{previous allocator is specified here}} +#pragma omp allocate(c) allocator(omp_high_bw_mem_alloc) // expected-warning {{allocate directive specifies 'omp_high_bw_mem_alloc' allocator while previously used 'omp_thread_mem_alloc'}} + diff --git a/test/OpenMP/allocate_ast_print.cpp b/test/OpenMP/allocate_ast_print.cpp new file mode 100644 index 0000000000..bd0a7e8994 --- /dev/null +++ b/test/OpenMP/allocate_ast_print.cpp @@ -0,0 +1,79 @@ +// RUN: %clang_cc1 -verify -fopenmp -triple x86_64-apple-darwin10.6.0 -ast-print %s | FileCheck %s +// RUN: %clang_cc1 -fopenmp -triple x86_64-apple-darwin10.6.0 -x c++ -std=c++11 -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -triple x86_64-apple-darwin10.6.0 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print +// RUN: %clang_cc1 -verify -fopenmp -triple x86_64-unknown-linux-gnu -ast-print %s | FileCheck %s +// RUN: %clang_cc1 -fopenmp -fnoopenmp-use-tls -triple x86_64-unknown-linux-gnu -x c++ -std=c++11 -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fnoopenmp-use-tls -triple x86_64-unknown-linux-gnu -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print + +// RUN: %clang_cc1 -verify -fopenmp-simd -triple x86_64-apple-darwin10.6.0 -ast-print %s | FileCheck %s +// RUN: %clang_cc1 -fopenmp-simd -triple x86_64-apple-darwin10.6.0 -x c++ -std=c++11 -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -triple x86_64-apple-darwin10.6.0 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print +// RUN: %clang_cc1 -verify -fopenmp-simd -triple x86_64-unknown-linux-gnu -ast-print %s | FileCheck %s +// RUN: %clang_cc1 -fopenmp-simd -fnoopenmp-use-tls -triple x86_64-unknown-linux-gnu -x c++ -std=c++11 -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fnoopenmp-use-tls -triple x86_64-unknown-linux-gnu -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print +// expected-no-diagnostics + +#ifndef HEADER +#define HEADER + +struct St{ + int a; +}; + +struct St1{ + int a; + static int b; +// CHECK: static int b; +#pragma omp allocate(b) +// CHECK-NEXT: #pragma omp allocate(St1::b){{$}} +} d; + +int a, b; +// CHECK: int a; +// CHECK: int b; +#pragma omp allocate(a) +#pragma omp allocate(a) +// CHECK-NEXT: #pragma omp allocate(a) +// CHECK-NEXT: #pragma omp allocate(a) +#pragma omp allocate(d, b) +// CHECK-NEXT: #pragma omp allocate(d,b) + +template <class T> +struct ST { + static T m; + #pragma omp allocate(m) +}; + +template <class T> T foo() { + T v; + #pragma omp allocate(v) + v = ST<T>::m; + return v; +} +//CHECK: template <class T> T foo() { +//CHECK-NEXT: T v; +//CHECK-NEXT: #pragma omp allocate(v) +//CHECK: template<> int foo<int>() { +//CHECK-NEXT: int v; +//CHECK-NEXT: #pragma omp allocate(v) + +namespace ns{ + int a; +} +// CHECK: namespace ns { +// CHECK-NEXT: int a; +// CHECK-NEXT: } +#pragma omp allocate(ns::a) +// CHECK-NEXT: #pragma omp allocate(ns::a) + +int main () { + static int a; +// CHECK: static int a; +#pragma omp allocate(a) +// CHECK-NEXT: #pragma omp allocate(a) + a=2; + return (foo<int>()); +} + +extern template int ST<int>::m; +#endif diff --git a/test/OpenMP/allocate_codegen.cpp b/test/OpenMP/allocate_codegen.cpp new file mode 100644 index 0000000000..c068589041 --- /dev/null +++ b/test/OpenMP/allocate_codegen.cpp @@ -0,0 +1,108 @@ +// RUN: %clang_cc1 -verify -fopenmp -triple x86_64-apple-darwin10.6.0 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -fopenmp -triple x86_64-apple-darwin10.6.0 -x c++ -std=c++11 -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -triple x86_64-apple-darwin10.6.0 -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s +// RUN: %clang_cc1 -verify -fopenmp -triple x86_64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -fopenmp -fnoopenmp-use-tls -triple x86_64-unknown-linux-gnu -x c++ -std=c++11 -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fnoopenmp-use-tls -triple x86_64-unknown-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s + +// RUN: %clang_cc1 -verify -fopenmp-simd -triple x86_64-apple-darwin10.6.0 -emit-llvm -o - %s | FileCheck --check-prefix SIMD-ONLY0 %s +// RUN: %clang_cc1 -fopenmp-simd -triple x86_64-apple-darwin10.6.0 -x c++ -std=c++11 -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -triple x86_64-apple-darwin10.6.0 -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s +// RUN: %clang_cc1 -verify -fopenmp-simd -triple x86_64-unknown-linux-gnu -emit-llvm -o - %s | FileCheck --check-prefix SIMD-ONLY0 %s +// RUN: %clang_cc1 -fopenmp-simd -fnoopenmp-use-tls -triple x86_64-unknown-linux-gnu -x c++ -std=c++11 -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fnoopenmp-use-tls -triple x86_64-unknown-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s +// SIMD-ONLY0-NOT: {{__kmpc|__tgt}} +// expected-no-diagnostics + +#ifndef HEADER +#define HEADER + +enum omp_allocator_handle_t { + omp_null_allocator = 0, + omp_default_mem_alloc = 1, + omp_large_cap_mem_alloc = 2, + omp_const_mem_alloc = 3, + omp_high_bw_mem_alloc = 4, + omp_low_lat_mem_alloc = 5, + omp_cgroup_mem_alloc = 6, + omp_pteam_mem_alloc = 7, + omp_thread_mem_alloc = 8, + KMP_ALLOCATOR_MAX_HANDLE = __UINTPTR_MAX__ +}; + +struct St{ + int a; +}; + +struct St1{ + int a; + static int b; +#pragma omp allocate(b) allocator(omp_default_mem_alloc) +} d; + +int a, b, c; +#pragma omp allocate(a) allocator(omp_large_cap_mem_alloc) +#pragma omp allocate(b) allocator(omp_const_mem_alloc) +#pragma omp allocate(d, c) allocator(omp_high_bw_mem_alloc) + +template <class T> +struct ST { + static T m; + #pragma omp allocate(m) allocator(omp_low_lat_mem_alloc) +}; + +template <class T> T foo() { + T v; + #pragma omp allocate(v) allocator(omp_cgroup_mem_alloc) + v = ST<T>::m; + return v; +} + +namespace ns{ + int a; +} +#pragma omp allocate(ns::a) allocator(omp_pteam_mem_alloc) + +// CHECK-NOT: call {{.+}} {{__kmpc_alloc|__kmpc_free}} + +// CHECK-LABEL: @main +int main () { + static int a; +#pragma omp allocate(a) allocator(omp_thread_mem_alloc) + a=2; + // CHECK-NOT: {{__kmpc_alloc|__kmpc_free}} + // CHECK: alloca double, + // CHECK-NOT: {{__kmpc_alloc|__kmpc_free}} + double b = 3; +#pragma omp allocate(b) + return (foo<int>()); +} + +// CHECK: define {{.*}}i32 @{{.+}}foo{{.+}}() +// CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num(%struct.ident_t* @{{.+}}) +// CHECK-NEXT: [[V_VOID_ADDR:%.+]] = call i8* @__kmpc_alloc(i32 [[GTID]], i64 4, i8* inttoptr (i64 6 to i8*)) +// CHECK-NEXT: [[V_ADDR:%.+]] = bitcast i8* [[V_VOID_ADDR]] to i32* +// CHECK-NOT: {{__kmpc_alloc|__kmpc_free}} +// CHECK: store i32 %{{.+}}, i32* [[V_ADDR]], +// CHECK-NEXT: [[V_VAL:%.+]] = load i32, i32* [[V_ADDR]], +// CHECK-NEXT: call void @__kmpc_free(i32 [[GTID]], i8* [[V_VOID_ADDR]], i8* inttoptr (i64 6 to i8*)) +// CHECK-NOT: {{__kmpc_alloc|__kmpc_free}} +// CHECK: ret i32 [[V_VAL]] + +// CHECK-NOT: call {{.+}} {{__kmpc_alloc|__kmpc_free}} +extern template int ST<int>::m; + +// CHECK: define void @{{.+}}bar{{.+}}(i32 %{{.+}}, float* {{.+}}) +void bar(int a, float &z) { +// CHECK: [[A_VOID_PTR:%.+]] = call i8* @__kmpc_alloc(i32 [[GTID:%.+]], i64 4, i8* inttoptr (i64 1 to i8*)) +// CHECK: [[A_ADDR:%.+]] = bitcast i8* [[A_VOID_PTR]] to i32* +// CHECK: store i32 %{{.+}}, i32* [[A_ADDR]], +// CHECK: [[Z_VOID_PTR:%.+]] = call i8* @__kmpc_alloc(i32 [[GTID]], i64 8, i8* inttoptr (i64 1 to i8*)) +// CHECK: [[Z_ADDR:%.+]] = bitcast i8* [[Z_VOID_PTR]] to float** +// CHECK: store float* %{{.+}}, float** [[Z_ADDR]], +#pragma omp allocate(a,z) allocator(omp_default_mem_alloc) +// CHECK: call void @__kmpc_free(i32 [[GTID]], i8* [[Z_VOID_PTR]], i8* inttoptr (i64 1 to i8*)) +// CHECK: call void @__kmpc_free(i32 [[GTID]], i8* [[A_VOID_PTR]], i8* inttoptr (i64 1 to i8*)) +// CHECK: ret void +} +#endif diff --git a/test/OpenMP/allocate_messages.cpp b/test/OpenMP/allocate_messages.cpp new file mode 100644 index 0000000000..cde714244c --- /dev/null +++ b/test/OpenMP/allocate_messages.cpp @@ -0,0 +1,151 @@ +// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp -fnoopenmp-use-tls -ferror-limit 100 -emit-llvm -o - %s +// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp -ferror-limit 100 -emit-llvm -o - %s + +// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp-simd -fnoopenmp-use-tls -ferror-limit 100 -emit-llvm -o - %s +// RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp-simd -ferror-limit 100 -emit-llvm -o - %s + +#pragma omp allocate // expected-error {{expected '(' after 'allocate'}} +#pragma omp allocate( // expected-error {{expected identifier}} expected-error {{expected ')'}} expected-note {{to match this '('}} +#pragma omp allocate() // expected-error {{expected identifier}} +#pragma omp allocate(1) // expected-error {{expected unqualified-id}} +struct CompleteSt { + int a; +}; + +struct CompleteSt1 { +#pragma omp allocate(1) // expected-error {{expected unqualified-id}} + int a; +} d; // expected-note {{'d' defined here}} + +int a; // expected-note {{'a' defined here}} + +#pragma omp allocate(a) +#pragma omp allocate(u) // expected-error {{use of undeclared identifier 'u'}} +#pragma omp allocate(d, a) +int foo() { // expected-note {{declared here}} + static int l; +#pragma omp allocate(l)) // expected-warning {{extra tokens at the end of '#pragma omp allocate' are ignored}} + return (a); +} + +#pragma omp allocate(a)( +// expected-warning@-1 {{extra tokens at the end of '#pragma omp allocate' are ignored}} +#pragma omp allocate(a)[ // expected-warning {{extra tokens at the end of '#pragma omp allocate' are ignored}} +#pragma omp allocate(a) { // expected-warning {{extra tokens at the end of '#pragma omp allocate' are ignored}} +#pragma omp allocate(a)) // expected-warning {{extra tokens at the end of '#pragma omp allocate' are ignored}} +#pragma omp allocate(a)] // expected-warning {{extra tokens at the end of '#pragma omp allocate' are ignored}} +#pragma omp allocate(a) } // expected-warning {{extra tokens at the end of '#pragma omp allocate' are ignored}} +#pragma omp allocate a // expected-error {{expected '(' after 'allocate'}} +#pragma omp allocate(d // expected-error {{expected ')'}} expected-note {{to match this '('}} +#pragma omp allocate(d)) // expected-warning {{extra tokens at the end of '#pragma omp allocate' are ignored}} +int x, y; +#pragma omp allocate(x)) // expected-warning {{extra tokens at the end of '#pragma omp allocate' are ignored}} +#pragma omp allocate(y)), +// expected-warning@-1 {{extra tokens at the end of '#pragma omp allocate' are ignored}} +#pragma omp allocate(a, d) +#pragma omp allocate(d.a) // expected-error {{expected identifier}} +#pragma omp allocate((float)a) // expected-error {{expected unqualified-id}} +int foa; // expected-note {{'foa' declared here}} +#pragma omp allocate(faa) // expected-error {{use of undeclared identifier 'faa'; did you mean 'foa'?}} +#pragma omp allocate(foo) // expected-error {{'foo' is not a global variable, static local variable or static data member}} +#pragma omp allocate(int a = 2) // expected-error {{expected unqualified-id}} + +struct IncompleteSt; + +extern IncompleteSt e; +#pragma omp allocate(e) + +int &f = a; +#pragma omp allocate(f) + +class TestClass { +private: + int a; // expected-note {{declared here}} + static int b; // expected-note {{'b' declared here}} + TestClass() : a(0) {} + +public: + TestClass(int aaa) : a(aaa) {} +#pragma omp allocate(b, a) // expected-error {{'a' is not a global variable, static local variable or static data member}} +} g(10); +#pragma omp allocate(b) // expected-error {{use of undeclared identifier 'b'}} +#pragma omp allocate(TestClass::b) // expected-error {{'#pragma omp allocate' must appear in the scope of the 'TestClass::b' variable declaration}} +#pragma omp allocate(g) + +namespace ns { +int m; +#pragma omp allocate(m, m) +} // namespace ns +#pragma omp allocate(m) // expected-error {{use of undeclared identifier 'm'}} +#pragma omp allocate(ns::m) +#pragma omp allocate(ns \ + : m) // expected-error {{unexpected ':' in nested name specifier; did you mean '::'?}} + +const int h = 12; +const volatile int i = 10; +#pragma omp allocate(h, i) + +template <class T> +class TempClass { +private: + T a; + TempClass() : a() {} + +public: + TempClass(T aaa) : a(aaa) {} + static T s; +#pragma omp allocate(s) +}; +#pragma omp allocate(s) // expected-error {{use of undeclared identifier 's'}} + +static __thread int t; +#pragma omp allocate(t) + +// Register "0" is currently an invalid register for global register variables. +// Use "esp" instead of "0". +// register int reg0 __asm__("0"); +register int reg0 __asm__("esp"); +#pragma omp allocate(reg0) + +int o; // expected-note {{candidate found by name lookup is 'o'}} +#pragma omp allocate(o) +namespace { +int o; // expected-note {{candidate found by name lookup is '(anonymous namespace)::o'}} +#pragma omp allocate(o) +#pragma omp allocate(o) +} // namespace +#pragma omp allocate(o) // expected-error {{reference to 'o' is ambiguous}} +#pragma omp allocate(::o) + +int main(int argc, char **argv) { + + int x, y = argc; + static double d1; + static double d2; + static double d3; // expected-note {{'d3' defined here}} + static double d4; + static TestClass LocalClass(y); +#pragma omp allocate(LocalClass) + + d.a = a; + d2++; + ; +#pragma omp allocate(argc + y) // expected-error {{expected identifier}} +#pragma omp allocate(argc, y) +#pragma omp allocate(d2) +#pragma omp allocate(d1) + { + ++a; + d2 = 0; +#pragma omp allocate(d3) // expected-error {{'#pragma omp allocate' must appear in the scope of the 'd3' variable declaration}} + } +#pragma omp allocate(d3) +label: +#pragma omp allocate(d4) // expected-error {{'#pragma omp allocate' cannot be an immediate substatement}} + +#pragma omp allocate(a) // expected-error {{'#pragma omp allocate' must appear in the scope of the 'a' variable declaration}} + return (y); +#pragma omp allocate(d) // expected-error {{'#pragma omp allocate' must appear in the scope of the 'd' variable declaration}} +#pragma omp parallel allocate(d) // expected-error {{the referenced item is not found in any private clause on the same directive}} + ; +} diff --git a/test/OpenMP/atomic_messages.c b/test/OpenMP/atomic_messages.c index 1234e8580c..92b7cd5b6a 100644 --- a/test/OpenMP/atomic_messages.c +++ b/test/OpenMP/atomic_messages.c @@ -59,8 +59,8 @@ int readint() { int readS() { struct S a, b; - // expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'read' clause}} -#pragma omp atomic read read + // expected-error@+1 {{directive '#pragma omp atomic' cannot contain more than one 'read' clause}} expected-error@+1 {{unexpected OpenMP clause 'allocate' in directive '#pragma omp atomic'}} +#pragma omp atomic read read allocate(a) // expected-error@+2 {{the statement for 'atomic read' must be an expression statement of form 'v = x;', where v and x are both lvalue expressions with scalar type}} // expected-note@+1 {{expected expression of scalar type}} a = b; diff --git a/test/OpenMP/barrier_messages.cpp b/test/OpenMP/barrier_messages.cpp index 137453a893..589b9c711a 100644 --- a/test/OpenMP/barrier_messages.cpp +++ b/test/OpenMP/barrier_messages.cpp @@ -6,6 +6,7 @@ template <class T> T tmain(T argc) { #pragma omp barrier ; +#pragma omp barrier allocate(argc) // expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp barrier'}} #pragma omp barrier untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp barrier'}} #pragma omp barrier unknown // expected-warning {{extra tokens at the end of '#pragma omp barrier' are ignored}} if (argc) @@ -29,7 +30,7 @@ T tmain(T argc) { #pragma omp barrier // expected-error {{'#pragma omp barrier' cannot be an immediate substatement}} switch (argc) case 1: -#pragma omp barrier +#pragma omp barrier // expected-error {{'#pragma omp barrier' cannot be an immediate substatement}} switch (argc) case 1: { #pragma omp barrier @@ -49,7 +50,7 @@ T tmain(T argc) { #pragma omp barrier } label: -#pragma omp barrier // expected-error {{'#pragma omp barrier' cannot be an immediate substatement}} +#pragma omp barrier label1 : { #pragma omp barrier } @@ -83,7 +84,7 @@ int main(int argc, char **argv) { #pragma omp barrier // expected-error {{'#pragma omp barrier' cannot be an immediate substatement}} switch (argc) case 1: -#pragma omp barrier +#pragma omp barrier // expected-error {{'#pragma omp barrier' cannot be an immediate substatement}} switch (argc) case 1: { #pragma omp barrier @@ -103,7 +104,7 @@ int main(int argc, char **argv) { #pragma omp barrier } label: -#pragma omp barrier // expected-error {{'#pragma omp barrier' cannot be an immediate substatement}} +#pragma omp barrier label1 : { #pragma omp barrier } diff --git a/test/OpenMP/cancel_messages.cpp b/test/OpenMP/cancel_messages.cpp index b14c42f395..df6dcdf2ff 100644 --- a/test/OpenMP/cancel_messages.cpp +++ b/test/OpenMP/cancel_messages.cpp @@ -45,7 +45,7 @@ int main(int argc, char **argv) { } #pragma omp sections { -#pragma omp cancel parallel // expected-error {{region cannot be closely nested inside 'sections' region}} +#pragma omp cancel parallel allocate(argc) // expected-error {{region cannot be closely nested inside 'sections' region}} expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp cancel'}} } while (argc) #pragma omp cancel for // expected-error {{'#pragma omp cancel' cannot be an immediate substatement}} expected-error {{orphaned 'omp cancel' directives are prohibited; perhaps you forget to enclose the directive into a region?}} @@ -63,7 +63,7 @@ int main(int argc, char **argv) { #pragma omp cancel parallel // expected-error {{'#pragma omp cancel' cannot be an immediate substatement}} expected-error {{orphaned 'omp cancel' directives are prohibited; perhaps you forget to enclose the directive into a region?}} switch (argc) case 1: -#pragma omp cancel sections // expected-error {{orphaned 'omp cancel' directives are prohibited; perhaps you forget to enclose the directive into a region?}} +#pragma omp cancel sections // expected-error {{'#pragma omp cancel' cannot be an immediate substatement}} expected-error {{orphaned 'omp cancel' directives are prohibited; perhaps you forget to enclose the directive into a region?}} switch (argc) case 1: { #pragma omp cancel for // expected-error {{orphaned 'omp cancel' directives are prohibited; perhaps you forget to enclose the directive into a region?}} @@ -83,7 +83,7 @@ int main(int argc, char **argv) { #pragma omp cancel taskgroup // expected-error {{orphaned 'omp cancel' directives are prohibited; perhaps you forget to enclose the directive into a region?}} } label: -#pragma omp cancel parallel // expected-error {{'#pragma omp cancel' cannot be an immediate substatement}} expected-error {{orphaned 'omp cancel' directives are prohibited; perhaps you forget to enclose the directive into a region?}} +#pragma omp cancel parallel // expected-error {{orphaned 'omp cancel' directives are prohibited; perhaps you forget to enclose the directive into a region?}} label1 : { #pragma omp cancel sections // expected-error {{orphaned 'omp cancel' directives are prohibited; perhaps you forget to enclose the directive into a region?}} } diff --git a/test/OpenMP/cancellation_point_messages.cpp b/test/OpenMP/cancellation_point_messages.cpp index 2bf667c407..268cab2d80 100644 --- a/test/OpenMP/cancellation_point_messages.cpp +++ b/test/OpenMP/cancellation_point_messages.cpp @@ -10,7 +10,7 @@ int main(int argc, char **argv) { { #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'}} expected-error {{orphaned 'omp cancellation point' directives are prohibited; perhaps you forget to enclose the directive into a region?}} +#pragma omp cancellation point parallel untied allocate(argc) // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp cancellation point'}} expected-error {{orphaned 'omp cancellation point' directives are prohibited; perhaps you forget to enclose the directive into a region?}} expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp cancellation point'}} #pragma omp cancellation point unknown // expected-error {{one of 'for', 'parallel', 'sections' or 'taskgroup' is expected}} #pragma omp parallel { @@ -63,7 +63,7 @@ int main(int argc, char **argv) { #pragma omp cancellation point parallel // expected-error {{'#pragma omp cancellation point' cannot be an immediate substatement}} expected-error {{orphaned 'omp cancellation point' directives are prohibited; perhaps you forget to enclose the directive into a region?}} switch (argc) case 1: -#pragma omp cancellation point sections // expected-error {{orphaned 'omp cancellation point' directives are prohibited; perhaps you forget to enclose the directive into a region?}} +#pragma omp cancellation point sections // expected-error {{'#pragma omp cancellation point' cannot be an immediate substatement}} expected-error {{orphaned 'omp cancellation point' directives are prohibited; perhaps you forget to enclose the directive into a region?}} switch (argc) case 1: { #pragma omp cancellation point for // expected-error {{orphaned 'omp cancellation point' directives are prohibited; perhaps you forget to enclose the directive into a region?}} @@ -83,7 +83,7 @@ int main(int argc, char **argv) { #pragma omp cancellation point taskgroup // expected-error {{orphaned 'omp cancellation point' directives are prohibited; perhaps you forget to enclose the directive into a region?}} } label: -#pragma omp cancellation point parallel // expected-error {{'#pragma omp cancellation point' cannot be an immediate substatement}} expected-error {{orphaned 'omp cancellation point' directives are prohibited; perhaps you forget to enclose the directive into a region?}} +#pragma omp cancellation point parallel // expected-error {{orphaned 'omp cancellation point' directives are prohibited; perhaps you forget to enclose the directive into a region?}} label1 : { #pragma omp cancellation point sections // expected-error {{orphaned 'omp cancellation point' directives are prohibited; perhaps you forget to enclose the directive into a region?}} } diff --git a/test/OpenMP/critical_ast_print.cpp b/test/OpenMP/critical_ast_print.cpp index f51145e584..20cb9bf99a 100644 --- a/test/OpenMP/critical_ast_print.cpp +++ b/test/OpenMP/critical_ast_print.cpp @@ -15,28 +15,46 @@ void foo() {} // CHECK: template <typename T, int N> int tmain(T argc, char **argv) // CHECK: static int a; // CHECK-NEXT: #pragma omp critical{{$}} -// CHECK-NEXT: a = 2; +// CHECK-NEXT: a = argv[0][0]; // CHECK-NEXT: ++a; +// CHECK-NEXT: #pragma omp critical{{$}} +// CHECK-NEXT: { +// CHECK-NEXT: int b = 10; +// CHECK-NEXT: T c = 100; +// CHECK-NEXT: a = b + c; +// CHECK-NEXT: } // CHECK-NEXT: #pragma omp critical (the_name) hint(N){{$}} // CHECK-NEXT: foo(); // CHECK-NEXT: return N; // CHECK: template<> int tmain<int, 4>(int argc, char **argv) template <typename T, int N> -int tmain (T argc, char **argv) { +int tmain(T argc, char **argv) { T b = argc, c, d, e, f, g; static int a; // CHECK: static int a; #pragma omp critical - a=2; -// CHECK-NEXT: #pragma omp critical -// CHECK-NEXT: a = 2; -// CHECK-NEXT: ++a; + a = argv[0][0]; ++a; -#pragma omp critical (the_name) hint(N) + // CHECK-NEXT: #pragma omp critical + // CHECK-NEXT: a = argv[0][0]; + // CHECK-NEXT: ++a; + // CHECK-NEXT: #pragma omp critical{{$}} + // CHECK-NEXT: { + // CHECK-NEXT: int b = 10; + // CHECK-NEXT: int c = 100; + // CHECK-NEXT: a = b + c; + // CHECK-NEXT: } +#pragma omp critical + { + int b = 10; + T c = 100; + a = b + c; + } +#pragma omp critical(the_name) hint(N) foo(); -// CHECK-NEXT: #pragma omp critical (the_name) hint(4) -// CHECK-NEXT: foo(); -// CHECK-NEXT: return 4; + // CHECK-NEXT: #pragma omp critical (the_name) hint(4) + // CHECK-NEXT: foo(); + // CHECK-NEXT: return 4; return N; } diff --git a/test/OpenMP/critical_messages.cpp b/test/OpenMP/critical_messages.cpp index a04d2e5223..9222233d4a 100644 --- a/test/OpenMP/critical_messages.cpp +++ b/test/OpenMP/critical_messages.cpp @@ -8,7 +8,7 @@ template<typename T, int N> int tmain(int argc, char **argv) { // expected-note {{declared here}} #pragma omp critical ; - #pragma omp critical untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp critical'}} + #pragma omp critical untied allocate(argc) // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp critical'}} expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp critical'}} #pragma omp critical unknown // expected-warning {{extra tokens at the end of '#pragma omp critical' are ignored}} #pragma omp critical ( // expected-error {{expected identifier}} expected-error {{expected ')'}} expected-note {{to match this '('}} #pragma omp critical ( + // expected-error {{expected identifier}} expected-error {{expected ')'}} expected-note {{to match this '('}} diff --git a/test/OpenMP/declare_mapper_ast_print.c b/test/OpenMP/declare_mapper_ast_print.c new file mode 100644 index 0000000000..e82bc4c2d3 --- /dev/null +++ b/test/OpenMP/declare_mapper_ast_print.c @@ -0,0 +1,58 @@ +// RUN: %clang_cc1 -verify -fopenmp -ast-print %s | FileCheck %s +// RUN: %clang_cc1 -fopenmp -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s + +// RUN: %clang_cc1 -verify -fopenmp-simd -ast-print %s | FileCheck %s +// RUN: %clang_cc1 -fopenmp-simd -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s +// expected-no-diagnostics + +#ifndef HEADER +#define HEADER + +// CHECK: struct vec { +struct vec { + int len; + double *data; +}; +// CHECK: }; + +// CHECK: struct dat { +struct dat { + int i; + double d; +#pragma omp declare mapper(id: struct vec v) map(v.len) +// CHECK: #pragma omp declare mapper (id : struct vec v) map(tofrom: v.len){{$}} +}; +// CHECK: }; + +#pragma omp declare mapper(id: struct vec v) map(v.len) +// CHECK: #pragma omp declare mapper (id : struct vec v) map(tofrom: v.len){{$}} +#pragma omp declare mapper(default : struct vec kk) map(kk.len) map(kk.data[0:2]) +// CHECK: #pragma omp declare mapper (default : struct vec kk) map(tofrom: kk.len) map(tofrom: kk.data[0:2]){{$}} +#pragma omp declare mapper(struct dat d) map(to: d.d) +// CHECK: #pragma omp declare mapper (default : struct dat d) map(to: d.d){{$}} + +// CHECK: int main() { +int main() { +#pragma omp declare mapper(id: struct vec v) map(v.len) +// CHECK: #pragma omp declare mapper (id : struct vec v) map(tofrom: v.len) + { +#pragma omp declare mapper(id: struct vec v) map(v.len) +// CHECK: #pragma omp declare mapper (id : struct vec v) map(tofrom: v.len) + struct vec vv; + struct dat dd[10]; +#pragma omp target map(mapper(id) alloc: vv) +// CHECK: #pragma omp target map(mapper(id),alloc: vv) + { vv.len++; } +#pragma omp target map(mapper(default), from: dd[0:10]) +// CHECK: #pragma omp target map(mapper(default),from: dd[0:10]) + { dd[0].i++; } +#pragma omp target update to(mapper(id): vv) from(mapper(default): dd[0:10]) +// CHECK: #pragma omp target update to(mapper(id): vv) from(mapper(default): dd[0:10]) + } + return 0; +} +// CHECK: } + +#endif diff --git a/test/OpenMP/declare_mapper_ast_print.cpp b/test/OpenMP/declare_mapper_ast_print.cpp new file mode 100644 index 0000000000..6462fa38d8 --- /dev/null +++ b/test/OpenMP/declare_mapper_ast_print.cpp @@ -0,0 +1,155 @@ +// 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 + +// RUN: %clang_cc1 -verify -fopenmp-simd -ast-print %s | FileCheck %s +// RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s +// expected-no-diagnostics + +#ifndef HEADER +#define HEADER + +// CHECK: namespace N1 { +namespace N1 +{ +// CHECK: class vec { +class vec { +public: + int len; + double *data; +}; +// CHECK: }; + +// CHECK: class vecchild : public N1::vec { +class vecchild : public vec { +public: + int lenc; +}; +// CHECK: }; + +#pragma omp declare mapper(id: vec v) map(v.len) +// CHECK: #pragma omp declare mapper (id : N1::vec v) map(tofrom: v.len){{$}} +}; +// CHECK: } +// CHECK: ; + +template <class T> +class dat { +public: + class datin { + public: + T in; + }; + int i; + T d; +#pragma omp declare mapper(id: N1::vec v) map(v.len) +#pragma omp declare mapper(id: datin v) map(v.in) +}; + +// CHECK: template <class T> class dat { +// CHECK: #pragma omp declare mapper (id : N1::vec v) map(tofrom: v.len){{$}} +// CHECK: #pragma omp declare mapper (id : dat::datin v) map(tofrom: v.in){{$}} +// CHECK: }; +// CHECK: template<> class dat<double> { +// CHECK: #pragma omp declare mapper (id : N1::vec v) map(tofrom: v.len){{$}} +// CHECK: #pragma omp declare mapper (id : dat<double>::datin v) map(tofrom: v.in){{$}} +// CHECK: }; + +#pragma omp declare mapper(default : N1::vec kk) map(kk.len) map(kk.data[0:2]) +// CHECK: #pragma omp declare mapper (default : N1::vec kk) map(tofrom: kk.len) map(tofrom: kk.data[0:2]){{$}} +#pragma omp declare mapper(dat<double> d) map(to: d.d) +// CHECK: #pragma omp declare mapper (default : dat<double> d) map(to: d.d){{$}} + +template <typename T> +T foo(T a) { + struct foodatchild { + T k; + }; + struct foodat { + T a; + struct foodatchild b; + }; +#pragma omp declare mapper(id: struct foodat v) map(v.a) +#pragma omp declare mapper(idd: struct foodatchild v) map(v.k) +#pragma omp declare mapper(id: N1::vec v) map(v.len) + { +#pragma omp declare mapper(id: N1::vec v) map(v.len) + } + struct foodat fd; +#pragma omp target map(mapper(id) alloc: fd) + { fd.a++; } +#pragma omp target map(mapper(idd) alloc: fd.b) + { fd.b.k++; } +#pragma omp target update to(mapper(id): fd) +#pragma omp target update to(mapper(idd): fd.b) +#pragma omp target update from(mapper(id): fd) +#pragma omp target update from(mapper(idd): fd.b) + return 0; +} + +// CHECK: template <typename T> T foo(T a) { +// CHECK: #pragma omp declare mapper (id : struct foodat v) map(tofrom: v.a) +// CHECK: #pragma omp declare mapper (idd : struct foodatchild v) map(tofrom: v.k) +// CHECK: #pragma omp declare mapper (id : N1::vec v) map(tofrom: v.len) +// CHECK: { +// CHECK: #pragma omp declare mapper (id : N1::vec v) map(tofrom: v.len) +// CHECK: } +// CHECK: #pragma omp target map(mapper(id),alloc: fd) +// CHECK: #pragma omp target map(mapper(idd),alloc: fd.b) +// CHECK: #pragma omp target update to(mapper(id): fd) +// CHECK: #pragma omp target update to(mapper(idd): fd.b) +// CHECK: #pragma omp target update from(mapper(id): fd) +// CHECK: #pragma omp target update from(mapper(idd): fd.b) +// CHECK: } +// CHECK: template<> int foo<int>(int a) { +// CHECK: #pragma omp declare mapper (id : struct foodat v) map(tofrom: v.a) +// CHECK: #pragma omp declare mapper (idd : struct foodatchild v) map(tofrom: v.k) +// CHECK: #pragma omp declare mapper (id : N1::vec v) map(tofrom: v.len) +// CHECK: { +// CHECK: #pragma omp declare mapper (id : N1::vec v) map(tofrom: v.len) +// CHECK: } +// CHECK: #pragma omp target map(mapper(id),alloc: fd) +// CHECK: #pragma omp target map(mapper(idd),alloc: fd.b) +// CHECK: #pragma omp target update to(mapper(id): fd) +// CHECK: #pragma omp target update to(mapper(idd): fd.b) +// CHECK: #pragma omp target update from(mapper(id): fd) +// CHECK: #pragma omp target update from(mapper(idd): fd.b) +// CHECK: } + +// CHECK: int main() { +int main() { + N1::vec vv, vvv; + N1::vecchild vc; + dat<double> dd; +#pragma omp target map(mapper(N1::id) tofrom: vv) map(mapper(dat<double>::id) alloc: vvv) +// CHECK: #pragma omp target map(mapper(N1::id),tofrom: vv) map(mapper(dat<double>::id),alloc: vvv) + { vv.len++; } +#pragma omp target map(mapper(N1::id) tofrom: vc) +// CHECK: #pragma omp target map(mapper(N1::id),tofrom: vc) + { vc.len++; } +#pragma omp target map(mapper(default) tofrom: dd) +// CHECK: #pragma omp target map(mapper(default),tofrom: dd) + { dd.d++; } + +#pragma omp target update to(mapper(N1::id) : vc) +// CHECK: #pragma omp target update to(mapper(N1::id): vc) +#pragma omp target update to(mapper(dat<double>::id): vvv) +// CHECK: #pragma omp target update to(mapper(dat<double>::id): vvv) + +#pragma omp target update from(mapper(N1::id) : vc) +// CHECK: #pragma omp target update from(mapper(N1::id): vc) +#pragma omp target update from(mapper(dat<double>::id): vvv) +// CHECK: #pragma omp target update from(mapper(dat<double>::id): vvv) + +#pragma omp declare mapper(id: N1::vec v) map(v.len) +// CHECK: #pragma omp declare mapper (id : N1::vec v) map(tofrom: v.len) + { +#pragma omp declare mapper(id: N1::vec v) map(v.len) +// CHECK: #pragma omp declare mapper (id : N1::vec v) map(tofrom: v.len) + } + return foo<int>(0); +} +// CHECK: } + +#endif diff --git a/test/OpenMP/declare_mapper_codegen.cpp b/test/OpenMP/declare_mapper_codegen.cpp new file mode 100644 index 0000000000..6f1d6ec8fd --- /dev/null +++ b/test/OpenMP/declare_mapper_codegen.cpp @@ -0,0 +1,92 @@ +///==========================================================================/// +// RUN: %clang_cc1 -verify -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s +// RUN: %clang_cc1 -verify -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap %s + +// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY0 %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=powerpc64le-ibm-linux-gnu -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY0 %s +// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY0 %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s +// RUN: %clang_cc1 -fopenmp-simd -fopenmp-targets=i386-pc-linux-gnu -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix SIMD-ONLY0 %s + +// SIMD-ONLY0-NOT: {{__kmpc|__tgt}} + +// expected-no-diagnostics +#ifndef HEADER +#define HEADER + +class C { +public: + int a; +}; + +#pragma omp declare mapper(id: C s) map(s.a) + +// CHECK-LABEL: @.__omp_offloading_{{.*}}foo{{.*}}_l54.region_id = weak constant i8 0 + +// CHECK: [[SIZES:@.+]] = {{.+}}constant [1 x i[[sz:64|32]]] [i{{64|32}} 4] +// CHECK: [[TYPES:@.+]] = {{.+}}constant [1 x i64] [i64 35] +// CHECK: [[TSIZES:@.+]] = {{.+}}constant [1 x i[[sz]]] [i[[sz]] 4] +// CHECK: [[TTYPES:@.+]] = {{.+}}constant [1 x i64] [i64 33] +// CHECK: [[FSIZES:@.+]] = {{.+}}constant [1 x i[[sz]]] [i[[sz]] 4] +// CHECK: [[FTYPES:@.+]] = {{.+}}constant [1 x i64] [i64 34] + +// CHECK-LABEL: foo{{.*}}( +void foo(int a){ + int i = a; + C c; + c.a = a; + + // CHECK-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}) + // CHECK-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 + // CHECK-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 + // CHECK-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 + // CHECK-DAG: [[P1:%.+]] = getelementptr inbounds {{.+}}[[PS]], i32 0, i32 0 + // CHECK-DAG: [[CBP1:%.+]] = bitcast i8** [[BP1]] to %class.C** + // CHECK-DAG: [[CP1:%.+]] = bitcast i8** [[P1]] to %class.C** + // CHECK-DAG: store %class.C* [[VAL:%[^,]+]], %class.C** [[CBP1]] + // CHECK-DAG: store %class.C* [[VAL]], %class.C** [[CP1]] + // CHECK: call void [[KERNEL:@.+]](%class.C* [[VAL]]) + #pragma omp target map(mapper(id),tofrom: c) + { + ++c.a; + } + + // CHECK-DAG: call void @__tgt_target_data_update(i64 -1, i32 1, i8** [[TGEPBP:%.+]], i8** [[TGEPP:%.+]], i[[sz]]* getelementptr {{.+}}[1 x i[[sz]]]* [[TSIZES]], i32 0, i32 0), {{.+}}getelementptr {{.+}}[1 x i64]* [[TTYPES]]{{.+}}) + // CHECK-DAG: [[TGEPBP]] = getelementptr inbounds {{.+}}[[TBP:%[^,]+]], i{{.+}} 0, i{{.+}} 0 + // CHECK-DAG: [[TGEPP]] = getelementptr inbounds {{.+}}[[TP:%[^,]+]], i{{.+}} 0, i{{.+}} 0 + // CHECK-DAG: [[TBP0:%.+]] = getelementptr inbounds {{.+}}[[TBP]], i{{.+}} 0, i{{.+}} 0 + // CHECK-DAG: [[TP0:%.+]] = getelementptr inbounds {{.+}}[[TP]], i{{.+}} 0, i{{.+}} 0 + // CHECK-DAG: [[TCBP0:%.+]] = bitcast i8** [[TBP0]] to %class.C** + // CHECK-DAG: [[TCP0:%.+]] = bitcast i8** [[TP0]] to %class.C** + // CHECK-DAG: store %class.C* [[VAL]], %class.C** [[TCBP0]] + // CHECK-DAG: store %class.C* [[VAL]], %class.C** [[TCP0]] + #pragma omp target update to(mapper(id): c) + + // CHECK-DAG: call void @__tgt_target_data_update(i64 -1, i32 1, i8** [[FGEPBP:%.+]], i8** [[FGEPP:%.+]], i[[sz]]* getelementptr {{.+}}[1 x i[[sz]]]* [[FSIZES]], i32 0, i32 0), {{.+}}getelementptr {{.+}}[1 x i64]* [[FTYPES]]{{.+}}) + // CHECK-DAG: [[FGEPBP]] = getelementptr inbounds {{.+}}[[FBP:%[^,]+]], i{{.+}} 0, i{{.+}} 0 + // CHECK-DAG: [[FGEPP]] = getelementptr inbounds {{.+}}[[FP:%[^,]+]], i{{.+}} 0, i{{.+}} 0 + // CHECK-DAG: [[FBP0:%.+]] = getelementptr inbounds {{.+}}[[FBP]], i{{.+}} 0, i{{.+}} 0 + // CHECK-DAG: [[FP0:%.+]] = getelementptr inbounds {{.+}}[[FP]], i{{.+}} 0, i{{.+}} 0 + // CHECK-DAG: [[FCBP0:%.+]] = bitcast i8** [[FBP0]] to %class.C** + // CHECK-DAG: [[FCP0:%.+]] = bitcast i8** [[FP0]] to %class.C** + // CHECK-DAG: store %class.C* [[VAL]], %class.C** [[FCBP0]] + // CHECK-DAG: store %class.C* [[VAL]], %class.C** [[FCP0]] + #pragma omp target update from(mapper(id): c) +} + + +// CHECK: define internal void [[KERNEL]](%class.C* {{.+}}[[ARG:%.+]]) +// CHECK: [[ADDR:%.+]] = alloca %class.C*, +// CHECK: store %class.C* [[ARG]], %class.C** [[ADDR]] +// CHECK: [[CADDR:%.+]] = load %class.C*, %class.C** [[ADDR]] +// CHECK: [[CAADDR:%.+]] = getelementptr inbounds %class.C, %class.C* [[CADDR]], i32 0, i32 0 +// CHECK: [[VAL:%[^,]+]] = load i32, i32* [[CAADDR]] +// CHECK: {{.+}} = add nsw i32 [[VAL]], 1 +// CHECK: } + +#endif diff --git a/test/OpenMP/declare_mapper_messages.c b/test/OpenMP/declare_mapper_messages.c new file mode 100644 index 0000000000..51b761e224 --- /dev/null +++ b/test/OpenMP/declare_mapper_messages.c @@ -0,0 +1,73 @@ +// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s + +// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s + +int temp; // expected-note {{'temp' declared here}} + +struct vec { // expected-note {{definition of 'struct vec' is not complete until the closing '}'}} + int len; +#pragma omp declare mapper(id: struct vec v) map(v.len) // expected-error {{incomplete definition of type 'struct vec'}} + double *data; +}; + +#pragma omp declare mapper // expected-error {{expected '(' after 'declare mapper'}} +#pragma omp declare mapper { // expected-error {{expected '(' after 'declare mapper'}} +#pragma omp declare mapper( // expected-error {{expected a type}} expected-error {{expected declarator on 'omp declare mapper' directive}} +#pragma omp declare mapper(# // expected-error {{expected a type}} expected-error {{expected declarator on 'omp declare mapper' directive}} +#pragma omp declare mapper(struct v // expected-error {{expected declarator on 'omp declare mapper' directive}} +#pragma omp declare mapper(struct vec // expected-error {{expected declarator on 'omp declare mapper' directive}} +#pragma omp declare mapper(S v // expected-error {{unknown type name 'S'}} +#pragma omp declare mapper(struct vec v // expected-error {{expected ')'}} expected-note {{to match this '('}} +#pragma omp declare mapper(aa:struct vec v) // expected-error {{expected at least one clause on '#pragma omp declare mapper' directive}} +#pragma omp declare mapper(bb:struct vec v) private(v) // expected-error {{expected at least one clause on '#pragma omp declare mapper' directive}} // expected-error {{unexpected OpenMP clause 'private' in directive '#pragma omp declare mapper'}} +#pragma omp declare mapper(cc:struct vec v) map(v) ( // expected-warning {{extra tokens at the end of '#pragma omp declare mapper' are ignored}} + +#pragma omp declare mapper(++: struct vec v) map(v.len) // expected-error {{illegal OpenMP user-defined mapper identifier}} +#pragma omp declare mapper(id1: struct vec v) map(v.len, temp) // expected-error {{only variable v is allowed in map clauses of this 'omp declare mapper' directive}} +#pragma omp declare mapper(default : struct vec kk) map(kk.data[0:2]) // expected-note {{previous definition is here}} +#pragma omp declare mapper(struct vec v) map(v.len) // expected-error {{redefinition of user-defined mapper for type 'struct vec' with name 'default'}} +#pragma omp declare mapper(int v) map(v) // expected-error {{mapper type must be of struct, union or class type}} + +int fun(int arg) { +#pragma omp declare mapper(id: struct vec v) map(v.len) + { +#pragma omp declare mapper(id: struct vec v) map(v.len) // expected-note {{previous definition is here}} +#pragma omp declare mapper(id: struct vec v) map(v.len) // expected-error {{redefinition of user-defined mapper for type 'struct vec' with name 'id'}} + { +#pragma omp declare mapper(id: struct vec v) map(v.len) allocate(v) // expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp declare mapper'}} + struct vec vv, v1; +#pragma omp target map(mapper) // expected-error {{use of undeclared identifier 'mapper'}} + {} +#pragma omp target map(mapper:vv) // expected-error {{expected '(' after 'mapper'}} + {} +#pragma omp target map(mapper( :vv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-warning {{implicit declaration of function 'mapper' is invalid in C99}} expected-note {{to match this '('}} + {} +#pragma omp target map(mapper(aa :vv) // expected-error {{use of undeclared identifier 'aa'}} expected-error {{expected ')'}} expected-warning {{implicit declaration of function 'mapper' is invalid in C99}} expected-note {{to match this '('}} + {} +#pragma omp target map(mapper(ab) :vv) // expected-error {{missing map type}} expected-error {{cannot find a valid user-defined mapper for type 'struct vec' with name 'ab'}} + {} +#pragma omp target map(mapper(aa) :vv) // expected-error {{missing map type}} + {} +#pragma omp target map(mapper(aa) to:vv) map(close mapper(aa) from:v1) + {} + +#pragma omp target update to(mapper) // expected-error {{expected '(' after 'mapper'}} expected-error {{expected expression}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update to(mapper() // expected-error {{illegal OpenMP user-defined mapper identifier}} expected-error {{expected expression}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update to(mapper:vv) // expected-error {{expected '(' after 'mapper'}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update to(mapper(:vv) // expected-error {{illegal OpenMP user-defined mapper identifier}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update to(mapper(aa :vv) // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update to(mapper(ab):vv) // expected-error {{cannot find a valid user-defined mapper for type 'struct vec' with name 'ab'}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update to(mapper(aa):vv) + +#pragma omp target update from(mapper) // expected-error {{expected '(' after 'mapper'}} expected-error {{expected expression}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update from(mapper() // expected-error {{illegal OpenMP user-defined mapper identifier}} expected-error {{expected expression}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update from(mapper:vv) // expected-error {{expected '(' after 'mapper'}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update from(mapper(:vv) // expected-error {{illegal OpenMP user-defined mapper identifier}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update from(mapper(aa :vv) // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update from(mapper(ab):vv) // expected-error {{cannot find a valid user-defined mapper for type 'struct vec' with name 'ab'}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update from(mapper(aa) a:vv) // expected-warning {{missing ':' after ) - ignoring}} +#pragma omp target update from(mapper(aa):vv) + } + } + return arg; +} diff --git a/test/OpenMP/declare_mapper_messages.cpp b/test/OpenMP/declare_mapper_messages.cpp new file mode 100644 index 0000000000..bcb5ac463a --- /dev/null +++ b/test/OpenMP/declare_mapper_messages.cpp @@ -0,0 +1,119 @@ +// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s +// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++98 %s +// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++11 %s + +// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s +// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 -std=c++98 %s +// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 -std=c++11 %s + +int temp; // expected-note {{'temp' declared here}} + +class vec { // expected-note {{definition of 'vec' is not complete until the closing '}'}} +private: + int p; // expected-note {{declared private here}} +public: + int len; +#pragma omp declare mapper(id: vec v) map(v.len) // expected-error {{member access into incomplete type 'vec'}} + double *data; +}; + +#pragma omp declare mapper // expected-error {{expected '(' after 'declare mapper'}} +#pragma omp declare mapper { // expected-error {{expected '(' after 'declare mapper'}} +#pragma omp declare mapper( // expected-error {{expected a type}} expected-error {{expected declarator on 'omp declare mapper' directive}} +#pragma omp declare mapper(# // expected-error {{expected a type}} expected-error {{expected declarator on 'omp declare mapper' directive}} +#pragma omp declare mapper(v // expected-error {{unknown type name 'v'}} expected-error {{expected declarator on 'omp declare mapper' directive}} +#pragma omp declare mapper(vec // expected-error {{expected declarator on 'omp declare mapper' directive}} +#pragma omp declare mapper(S v // expected-error {{unknown type name 'S'}} +#pragma omp declare mapper(vec v // expected-error {{expected ')'}} expected-note {{to match this '('}} +#pragma omp declare mapper(aa: vec v) // expected-error {{expected at least one clause on '#pragma omp declare mapper' directive}} +#pragma omp declare mapper(bb: vec v) private(v) // expected-error {{expected at least one clause on '#pragma omp declare mapper' directive}} // expected-error {{unexpected OpenMP clause 'private' in directive '#pragma omp declare mapper'}} +#pragma omp declare mapper(cc: vec v) map(v) ( // expected-warning {{extra tokens at the end of '#pragma omp declare mapper' are ignored}} + +#pragma omp declare mapper(++: vec v) map(v.len) // expected-error {{illegal OpenMP user-defined mapper identifier}} +#pragma omp declare mapper(id1: vec v) map(v.len, temp) // expected-error {{only variable v is allowed in map clauses of this 'omp declare mapper' directive}} +#pragma omp declare mapper(default : vec kk) map(kk.data[0:2]) // expected-note {{previous definition is here}} +#pragma omp declare mapper(vec v) map(v.len) // expected-error {{redefinition of user-defined mapper for type 'vec' with name 'default'}} +#pragma omp declare mapper(int v) map(v) // expected-error {{mapper type must be of struct, union or class type}} +#pragma omp declare mapper(id2: vec v) map(v.len, v.p) // expected-error {{'p' is a private member of 'vec'}} + +namespace N1 { +template <class T> +class stack { // expected-note {{template is declared here}} +public: + int len; + T *data; +#pragma omp declare mapper(id: vec v) map(v.len) // expected-note {{previous definition is here}} +#pragma omp declare mapper(id: vec v) map(v.len) // expected-error {{redefinition of user-defined mapper for type 'vec' with name 'id'}} +}; +}; + +#pragma omp declare mapper(default : N1::stack s) map(s.len) // expected-error {{use of class template 'N1::stack' requires template arguments}} +#pragma omp declare mapper(id1: N1::stack<int> s) map(s.data) +#pragma omp declare mapper(default : S<int> s) map(s.len) // expected-error {{no template named 'S'}} + +template <class T> +T foo(T a) { +#pragma omp declare mapper(id: vec v) map(v.len) // expected-note {{previous definition is here}} +#pragma omp declare mapper(id: vec v) map(v.len) // expected-error {{redefinition of user-defined mapper for type 'vec' with name 'id'}} +} + +int fun(int arg) { +#pragma omp declare mapper(id: vec v) map(v.len) + { +#pragma omp declare mapper(id: vec v) map(v.len) // expected-note {{previous definition is here}} + { +#pragma omp declare mapper(id: vec v) map(v.len) + vec vv, v1; +#pragma omp target map(mapper) // expected-error {{use of undeclared identifier 'mapper'}} + {} +#pragma omp target map(mapper:vv) // expected-error {{expected '(' after 'mapper'}} + {} +#pragma omp target map(mapper( :vv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} + {} +#pragma omp target map(mapper(aa :vv) // expected-error {{use of undeclared identifier 'aa'}} expected-error {{expected ')'}} expected-note {{to match this '('}} + {} +#pragma omp target map(mapper(ab) :vv) // expected-error {{missing map type}} expected-error {{cannot find a valid user-defined mapper for type 'vec' with name 'ab'}} + {} +#pragma omp target map(mapper(N2::) :vv) // expected-error {{use of undeclared identifier 'N2'}} expected-error {{illegal OpenMP user-defined mapper identifier}} + {} +#pragma omp target map(mapper(N1::) :vv) // expected-error {{illegal OpenMP user-defined mapper identifier}} + {} +#pragma omp target map(mapper(aa) :vv) // expected-error {{missing map type}} + {} +#pragma omp target map(mapper(N1::aa) alloc:vv) // expected-error {{cannot find a valid user-defined mapper for type 'vec' with name 'aa'}} + {} +#pragma omp target map(mapper(aa) to:vv) map(close mapper(aa) from:v1) + {} +#pragma omp target map(mapper(N1::stack<int>::id) to:vv) + {} + +#pragma omp target update to(mapper) // expected-error {{expected '(' after 'mapper'}} expected-error {{expected expression}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update to(mapper() // expected-error {{illegal OpenMP user-defined mapper identifier}} expected-error {{expected expression}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update to(mapper:vv) // expected-error {{expected '(' after 'mapper'}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update to(mapper(:vv) // expected-error {{illegal OpenMP user-defined mapper identifier}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update to(mapper(aa :vv) // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update to(mapper(N2:: :vv) // expected-error {{use of undeclared identifier 'N2'}} expected-error {{illegal OpenMP user-defined mapper identifier}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update to(mapper(N1:: :vv) // expected-error {{illegal OpenMP user-defined mapper identifier}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update to(mapper(N1::aa) :vv) // expected-error {{cannot find a valid user-defined mapper for type 'vec' with name 'aa'}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update to(mapper(ab):vv) // expected-error {{cannot find a valid user-defined mapper for type 'vec' with name 'ab'}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update to(mapper(aa) a:vv) // expected-warning {{missing ':' after ) - ignoring}} +#pragma omp target update to(mapper(aa):vv) +#pragma omp target update to(mapper(N1::stack<int>::id) :vv) + +#pragma omp target update from(mapper) // expected-error {{expected '(' after 'mapper'}} expected-error {{expected expression}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update from(mapper() // expected-error {{illegal OpenMP user-defined mapper identifier}} expected-error {{expected expression}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update from(mapper:vv) // expected-error {{expected '(' after 'mapper'}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update from(mapper(:vv) // expected-error {{illegal OpenMP user-defined mapper identifier}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update from(mapper(aa :vv) // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update from(mapper(N2:: :vv) // expected-error {{use of undeclared identifier 'N2'}} expected-error {{illegal OpenMP user-defined mapper identifier}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update from(mapper(N1:: :vv) // expected-error {{illegal OpenMP user-defined mapper identifier}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update from(mapper(N1::aa) :vv) // expected-error {{cannot find a valid user-defined mapper for type 'vec' with name 'aa'}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update from(mapper(ab):vv) // expected-error {{cannot find a valid user-defined mapper for type 'vec' with name 'ab'}} expected-error {{expected at least one 'to' clause or 'from' clause specified to '#pragma omp target update'}} +#pragma omp target update from(mapper(aa) a:vv) // expected-warning {{missing ':' after ) - ignoring}} +#pragma omp target update from(mapper(aa):vv) +#pragma omp target update from(mapper(N1::stack<int>::id) :vv) + } +#pragma omp declare mapper(id: vec v) map(v.len) // expected-error {{redefinition of user-defined mapper for type 'vec' with name 'id'}} + } + return arg; +} diff --git a/test/OpenMP/declare_reduction_ast_print.c b/test/OpenMP/declare_reduction_ast_print.c index 239b1cfd44..37b722e5f8 100644 --- a/test/OpenMP/declare_reduction_ast_print.c +++ b/test/OpenMP/declare_reduction_ast_print.c @@ -43,4 +43,17 @@ int main() { } // CHECK: } +#pragma omp declare reduction(mymin:int \ + : omp_out = omp_out > omp_in ? omp_in : omp_out) \ + initializer(omp_priv = 2147483647) + +int foo(int argc, char **argv) { + int x; +#pragma omp parallel for reduction(mymin : x) + for (int i = 0; i < 1000; i++) + ; + return 0; +} + +// CHECK: #pragma omp parallel for reduction(mymin: x) #endif diff --git a/test/OpenMP/declare_reduction_messages.c b/test/OpenMP/declare_reduction_messages.c index 39387c795a..27e9e6e2e2 100644 --- a/test/OpenMP/declare_reduction_messages.c +++ b/test/OpenMP/declare_reduction_messages.c @@ -41,7 +41,17 @@ int temp; // expected-note 6 {{'temp' declared here}} #pragma omp declare reduction(fun8 : long : omp_out += omp_in) initializer(omp_priv = 23)) // expected-warning {{extra tokens at the end of '#pragma omp declare reduction' are ignored}} expected-error {{redefinition of user-defined reduction for type 'long'}} #pragma omp declare reduction(fun9 : long : omp_out += omp_in) initializer(omp_priv = ) // expected-error {{expected expression}} +struct S { + int s; +}; +#pragma omp declare reduction(+: struct S: omp_out.s += omp_in.s) // initializer(omp_priv = { .s = 0 }) + int fun(int arg) { + struct S s;// expected-note {{'s' defined here}} + s.s = 0; +#pragma omp parallel for reduction(+ : s) // expected-error {{list item of type 'struct S' is not valid for specified reduction operation: unable to provide default initialization value}} + for (arg = 0; arg < 10; ++arg) + s.s += arg; #pragma omp declare reduction(red : int : omp_out++) { #pragma omp declare reduction(red : int : omp_out++) // expected-note {{previous definition is here}} diff --git a/test/OpenMP/declare_reduction_messages.cpp b/test/OpenMP/declare_reduction_messages.cpp index 21c03fac22..0a79d6a0a6 100644 --- a/test/OpenMP/declare_reduction_messages.cpp +++ b/test/OpenMP/declare_reduction_messages.cpp @@ -147,7 +147,7 @@ struct A { int A_TEST() { A test; -#pragma omp declare reduction(+ : A : omp_out) initializer(omp_priv = A()) +#pragma omp declare reduction(+ : A : omp_out) initializer(omp_priv = A()) allocate(test) // expected-warning {{extra tokens at the end of '#pragma omp declare reduction' are ignored}} #pragma omp parallel reduction(+ : test) {} return 0; diff --git a/test/OpenMP/declare_simd_aarch64.c b/test/OpenMP/declare_simd_aarch64.c new file mode 100644 index 0000000000..eff0eed07d --- /dev/null +++ b/test/OpenMP/declare_simd_aarch64.c @@ -0,0 +1,191 @@ +// REQUIRES: aarch64-registered-target +// -fopemp and -fopenmp-simd behavior are expected to be the same. + +// RUN: %clang_cc1 -triple aarch64-linux-gnu -target-feature +neon -fopenmp -x c -emit-llvm %s -o - -femit-all-decls | FileCheck %s --check-prefix=AARCH64 +// RUN: %clang_cc1 -triple aarch64-linux-gnu -target-feature +neon -fopenmp-simd -x c -emit-llvm %s -o - -femit-all-decls | FileCheck %s --check-prefix=AARCH64 + +#pragma omp declare simd +#pragma omp declare simd simdlen(2) +#pragma omp declare simd simdlen(6) +#pragma omp declare simd simdlen(8) +double foo(float x); + +// AARCH64: "_ZGVnM2v_foo" "_ZGVnM4v_foo" "_ZGVnM8v_foo" "_ZGVnN2v_foo" "_ZGVnN4v_foo" "_ZGVnN8v_foo" +// AARCH64-NOT: _ZGVnN6v_foo + +void foo_loop(double *x, float *y, int N) { + for (int i = 0; i < N; ++i) { + x[i] = foo(y[i]); + } +} + +// make sure that the following two function by default gets generated +// with 4 and 2 lanes, as descrived in the vector ABI +#pragma omp declare simd notinbranch +float bar(double x); +#pragma omp declare simd notinbranch +double baz(float x); + +// AARCH64: "_ZGVnN2v_baz" "_ZGVnN4v_baz" +// AARCH64-NOT: baz +// AARCH64: "_ZGVnN2v_bar" "_ZGVnN4v_bar" +// AARCH64-NOT: bar + +void baz_bar_loop(double *x, float *y, int N) { + for (int i = 0; i < N; ++i) { + x[i] = baz(y[i]); + y[i] = bar(x[i]); + } +} + + /***************************/ + /* 32-bit integer tests */ + /***************************/ + +#pragma omp declare simd +#pragma omp declare simd simdlen(2) +#pragma omp declare simd simdlen(6) +#pragma omp declare simd simdlen(8) +long foo_int(int x); + +// AARCH64: "_ZGVnN2v_foo_int" "_ZGVnN4v_foo_int" "_ZGVnN8v_foo_int" +// No non power of two +// AARCH64-NOT: _ZGVnN6v_foo_int + +void foo_int_loop(long *x, int *y, int N) { + for (int i = 0; i < N; ++i) { + x[i] = foo_int(y[i]); + } +} + +#pragma omp declare simd +char simple_8bit(char); +// AARCH64: "_ZGVnM16v_simple_8bit" "_ZGVnM8v_simple_8bit" "_ZGVnN16v_simple_8bit" "_ZGVnN8v_simple_8bit" +#pragma omp declare simd +short simple_16bit(short); +// AARCH64: "_ZGVnM4v_simple_16bit" "_ZGVnM8v_simple_16bit" "_ZGVnN4v_simple_16bit" "_ZGVnN8v_simple_16bit" +#pragma omp declare simd +int simple_32bit(int); +// AARCH64: "_ZGVnM2v_simple_32bit" "_ZGVnM4v_simple_32bit" "_ZGVnN2v_simple_32bit" "_ZGVnN4v_simple_32bit" +#pragma omp declare simd +long simple_64bit(long); +// AARCH64: "_ZGVnM2v_simple_64bit" "_ZGVnN2v_simple_64bit" + +#pragma omp declare simd +#pragma omp declare simd simdlen(32) +char a01(int x); +// AARCH64: "_ZGVnN16v_a01" "_ZGVnN32v_a01" "_ZGVnN8v_a01" +// AARCH64-NOT: a01 + +#pragma omp declare simd +#pragma omp declare simd simdlen(2) +long a02(short x); +// AARCH64: "_ZGVnN2v_a02" "_ZGVnN4v_a02" "_ZGVnN8v_a02" + +// AARCH64-NOT: a02 +/************/ +/* pointers */ +/************/ + +#pragma omp declare simd +int b01(int *x); +// AARCH64: "_ZGVnN4v_b01" +// AARCH64-NOT: b01 + +#pragma omp declare simd +char b02(char *); +// AARCH64: "_ZGVnN16v_b02" "_ZGVnN8v_b02" +// AARCH64-NOT: b02 + +#pragma omp declare simd +double *b03(double *); +// AARCH64: "_ZGVnN2v_b03" +// AARCH64-NOT: b03 + +/***********/ +/* masking */ +/***********/ + +#pragma omp declare simd inbranch +int c01(double *x, short y); +// AARCH64: "_ZGVnM8vv_c01" +// AARCH64-NOT: c01 + +#pragma omp declare simd inbranch uniform(x) +double c02(double *x, char y); +// AARCH64: "_ZGVnM16uv_c02" "_ZGVnM8uv_c02" +// AARCH64-NOT: c02 + +/*************************/ +/* sincos-like signature */ +/*************************/ +#pragma omp declare simd linear(sin) linear(cos) +void sincos(double in, double *sin, double *cos); +// AARCH64: "_ZGVnN2vll_sincos" +// AARCH64-NOT: sincos + +#pragma omp declare simd linear(sin : 1) linear(cos : 2) +void SinCos(double in, double *sin, double *cos); +// AARCH64: "_ZGVnN2vll2_SinCos" +// AARCH64-NOT: SinCos + +// Selection of tests based on the examples provided in chapter 5 of +// the Vector Function ABI specifications for AArch64, at +// https://developer.arm.com/products/software-development-tools/hpc/arm-compiler-for-hpc/vector-function-abi. + +// Listing 2, p. 18 +#pragma omp declare simd inbranch uniform(x) linear(val(i) : 4) +int foo2(int *x, int i); +// AARCH64: "_ZGVnM2ul4_foo2" "_ZGVnM4ul4_foo2" +// AARCH64-NOT: foo2 + +// Listing 3, p. 18 +#pragma omp declare simd inbranch uniform(x, c) linear(i \ + : c) +int foo3(int *x, int i, unsigned char c); +// AARCH64: "_ZGVnM16uls2u_foo3" "_ZGVnM8uls2u_foo3" +// AARCH64-NOT: foo3 + +// Listing 6, p. 19 +#pragma omp declare simd linear(x) aligned(x : 16) simdlen(4) +int foo4(int *x, float y); +// AARCH64: "_ZGVnM4la16v_foo4" "_ZGVnN4la16v_foo4" +// AARCH64-NOT: foo4 + +static int *I; +static char *C; +static short *S; +static long *L; +static float *F; +static double *D; +void do_something() { + simple_8bit(*C); + simple_16bit(*S); + simple_32bit(*I); + simple_64bit(*L); + *C = a01(*I); + *L = a02(*S); + *I = b01(I); + *C = b02(C); + D = b03(D); + *I = c01(D, *S); + *D = c02(D, *S); + sincos(*D, D, D); + SinCos(*D, D, D); + foo2(I, *I); + foo3(I, *I, *C); + foo4(I, *F); +} + +typedef struct S { + char R, G, B; +} STy; +#pragma omp declare simd notinbranch +STy DoRGB(STy x); +// AARCH64: "_ZGVnN2v_DoRGB" + +static STy *RGBData; + +void do_rgb_stuff() { + DoRGB(*RGBData); +} diff --git a/test/OpenMP/declare_simd_aarch64.cpp b/test/OpenMP/declare_simd_aarch64.cpp new file mode 100644 index 0000000000..2cd6d3986f --- /dev/null +++ b/test/OpenMP/declare_simd_aarch64.cpp @@ -0,0 +1,38 @@ +// REQUIRES: aarch64-registered-target +// -fopemp and -fopenmp-simd behavior are expected to be the same. + +// RUN: %clang_cc1 -verify -triple aarch64-linux-gnu -target-feature +neon -fopenmp -x c++ -emit-llvm %s -o - -femit-all-decls -verify| FileCheck %s --check-prefix=ADVSIMD +// RUN: %clang_cc1 -verify -triple aarch64-linux-gnu -target-feature +sve -fopenmp -x c++ -emit-llvm %s -o - -femit-all-decls -verify| FileCheck %s --check-prefix=SVE + +// RUN: %clang_cc1 -verify -triple aarch64-linux-gnu -target-feature +neon -fopenmp-simd -x c++ -emit-llvm %s -o - -femit-all-decls -verify| FileCheck %s --check-prefix=ADVSIMD +// RUN: %clang_cc1 -verify -triple aarch64-linux-gnu -target-feature +sve -fopenmp-simd -x c++ -emit-llvm %s -o - -femit-all-decls -verify| FileCheck %s --check-prefix=SVE + +// expected-no-diagnostics + +#pragma omp declare simd +double f(double x); + +#pragma omp declare simd +float f(float x); + +void aaa(double *x, double *y, int N) { + for (int i = 0; i < N; ++i) { + x[i] = f(y[i]); + } +} + +void aaa(float *x, float *y, int N) { + for (int i = 0; i < N; ++i) { + x[i] = f(y[i]); + } +} + +// ADVSIMD: "_ZGVnN2v__Z1fd" +// ADVSIMD-NOT: _Z1fd +// ADVSIMD: "_ZGVnN4v__Z1ff" +// ADVSIMD-NOT: _Z1fF + +// SVE: "_ZGVsMxv__Z1fd" +// SVE-NOT: _Z1fd +// SVE: "_ZGVsMxv__Z1ff" +// SVE-NOT: _Z1ff diff --git a/test/OpenMP/declare_simd_aarch64_complex.c b/test/OpenMP/declare_simd_aarch64_complex.c new file mode 100644 index 0000000000..d2bf1c585b --- /dev/null +++ b/test/OpenMP/declare_simd_aarch64_complex.c @@ -0,0 +1,27 @@ +// REQUIRES: aarch64-registered-target +// RUN: %clang_cc1 -triple aarch64-linux-gnu -target-feature +neon -fopenmp -x c -std=c11 -emit-llvm %s -o - -femit-all-decls | FileCheck %s + +// RUN: %clang_cc1 -triple aarch64-linux-gnu -target-feature +sve -fopenmp -x c -std=c11 -emit-llvm %s -o - -femit-all-decls | FileCheck %s --check-prefix=SVE + +#pragma omp declare simd +#pragma omp declare simd simdlen(4) notinbranch +double _Complex double_complex(double _Complex); +// CHECK: "_ZGVnM2v_double_complex" "_ZGVnN2v_double_complex" "_ZGVnN4v_double_complex" +// CHECK-NOT: double_complex +// SVE: "_ZGVsM4v_double_complex" "_ZGVsMxv_double_complex" +// SVE-NOT: double_complex + +#pragma omp declare simd +#pragma omp declare simd simdlen(8) notinbranch +float _Complex float_complex(float _Complex); +// CHECK: "_ZGVnM2v_float_complex" "_ZGVnN2v_float_complex" "_ZGVnN8v_float_complex" +// CHECK-NOT: float_complex +// SVE: "_ZGVsM8v_float_complex" "_ZGVsMxv_float_complex" +// SVE-NOT: float_complex + +static double _Complex *DC; +static float _Complex *DF; +void call_the_complex_functions() { + double_complex(*DC); + float_complex(*DF); +} diff --git a/test/OpenMP/declare_simd_aarch64_fix.c b/test/OpenMP/declare_simd_aarch64_fix.c new file mode 100644 index 0000000000..87e39e524b --- /dev/null +++ b/test/OpenMP/declare_simd_aarch64_fix.c @@ -0,0 +1,38 @@ +// REQUIRES: aarch64-registered-target +// This test is making sure that no crash happens. + +// RUN: %clang -o - -fno-fast-math -S -target aarch64-linux-gnu \ +// RUN: -fopenmp -O3 -march=armv8-a -c %s | FileCheck %s + +// RUN: %clang -o - -fno-fast-math -S -target aarch64-linux-gnu \ +// RUN: -fopenmp-simd -O3 -march=armv8-a -c %s | FileCheck %s + +// RUN: %clang -o - -fno-fast-math -S -target aarch64-linux-gnu \ +// RUN: -fopenmp -O3 -march=armv8-a+sve -c %s | FileCheck %s + +// RUN: %clang -o - -fno-fast-math -S -target aarch64-linux-gnu \ +// RUN: -fopenmp-simd -O3 -march=armv8-a+sve -c %s | FileCheck %s + +// loop in the user code, in user_code.c +#include "Inputs/declare-simd-fix.h" + +// CHECK-LABEL: do_something: +void do_something(int *a, double *b, unsigned N) { + for (unsigned i = 0; i < N; ++i) { + a[i] = foo(b[0], b[0], 1); + } +} + +// CHECK-LABEL: do_something_else: +void do_something_else(int *a, double *b, unsigned N) { + for (unsigned i = 0; i < N; ++i) { + a[i] = foo(1.1, 1.2, 1); + } +} + +// CHECK-LABEL: do_something_more: +void do_something_more(int *a, double *b, unsigned N) { + for (unsigned i = 0; i < N; ++i) { + a[i] = foo(b[i], b[i], a[1]); + } +} diff --git a/test/OpenMP/declare_simd_aarch64_sve.c b/test/OpenMP/declare_simd_aarch64_sve.c new file mode 100644 index 0000000000..82f85c413b --- /dev/null +++ b/test/OpenMP/declare_simd_aarch64_sve.c @@ -0,0 +1,44 @@ +// REQUIRES: aarch64-registered-target +// -fopemp and -fopenmp-simd behavior are expected to be the same + +// RUN: %clang_cc1 -triple aarch64-linux-gnu -target-feature +sve \ +// RUN: -fopenmp -x c -emit-llvm %s -o - -femit-all-decls | FileCheck %s + +// RUN: %clang_cc1 -triple aarch64-linux-gnu -target-feature +sve \ +// RUN: -fopenmp-simd -x c -emit-llvm %s -o - -femit-all-decls | FileCheck %s + +#pragma omp declare simd +#pragma omp declare simd notinbranch +#pragma omp declare simd simdlen(2) +#pragma omp declare simd simdlen(4) +#pragma omp declare simd simdlen(5) // not a multiple of 128-bits +#pragma omp declare simd simdlen(6) +#pragma omp declare simd simdlen(8) +#pragma omp declare simd simdlen(32) +#pragma omp declare simd simdlen(34) // requires more than 2048 bits +double foo(float x); + +// CHECK-DAG: "_ZGVsM2v_foo" "_ZGVsM32v_foo" "_ZGVsM4v_foo" "_ZGVsM6v_foo" "_ZGVsM8v_foo" "_ZGVsMxv_foo" +// CHECK-NOT: _ZGVsN +// CHECK-NOT: _ZGVsM5v_foo +// CHECK-NOT: _ZGVsM34v_foo +// CHECK-NOT: foo + +void foo_loop(double *x, float *y, int N) { + for (int i = 0; i < N; ++i) { + x[i] = foo(y[i]); + } +} + + // test integers + +#pragma omp declare simd notinbranch +char a01_fun(int x); +// CHECK-DAG: _ZGVsMxv_a01_fun +// CHECK-NOT: a01_fun + +static int *in; +static char *out; +void do_something() { + *out = a01_fun(*in); +} diff --git a/test/OpenMP/declare_simd_aarch64_warning_advsimd.c b/test/OpenMP/declare_simd_aarch64_warning_advsimd.c new file mode 100644 index 0000000000..594013d25b --- /dev/null +++ b/test/OpenMP/declare_simd_aarch64_warning_advsimd.c @@ -0,0 +1,17 @@ +// REQUIRES: aarch64-registered-target +// RUN: %clang_cc1 -triple aarch64-linux-gnu -target-feature +neon -fopenmp %s -S -o %t -verify +// RUN: %clang_cc1 -triple aarch64-linux-gnu -target-feature +neon -fopenmp-simd %s -S -o %t -verify + +#pragma omp declare simd simdlen(6) +double foo(float x); +// expected-warning@-2{{The value specified in simdlen must be a power of 2 when targeting Advanced SIMD.}} +#pragma omp declare simd simdlen(1) +float bar(double x); +// expected-warning@-2{{The clause simdlen(1) has no effect when targeting aarch64.}} + +void foo_loop(double *x, float *y, int N) { + for (int i = 0; i < N; ++i) { + x[i] = foo(y[i]); + y[i] = bar(x[i]); + } +} diff --git a/test/OpenMP/declare_simd_aarch64_warning_sve.c b/test/OpenMP/declare_simd_aarch64_warning_sve.c new file mode 100644 index 0000000000..0d66ce143c --- /dev/null +++ b/test/OpenMP/declare_simd_aarch64_warning_sve.c @@ -0,0 +1,13 @@ +// REQUIRES: aarch64-registered-target +// RUN: %clang_cc1 -triple aarch64-linux-gnu -target-feature +sve -fopenmp %s -S -o %t -verify +// RUN: %clang_cc1 -triple aarch64-linux-gnu -target-feature +sve -fopenmp-simd %s -S -o %t -verify + +#pragma omp declare simd simdlen(66) +double foo(float x); +//expected-warning@-2{{The clause simdlen must fit the 64-bit lanes in the architectural constraints for SVE (min is 128-bit, max is 2048-bit, by steps of 128-bit)}} + +void foo_loop(double *x, float *y, int N) { + for (int i = 0; i < N; ++i) { + x[i] = foo(y[i]); + } +} diff --git a/test/OpenMP/declare_simd_messages.cpp b/test/OpenMP/declare_simd_messages.cpp index dab7d054e7..d5451aba4f 100644 --- a/test/OpenMP/declare_simd_messages.cpp +++ b/test/OpenMP/declare_simd_messages.cpp @@ -195,8 +195,8 @@ void test() { #pragma omp declare simd linear(uval(b)) // expected-error@+1 {{variable of non-reference type 'int *' can be used only with 'val' modifier, but used with 'ref'}} #pragma omp declare simd linear(ref(b)) -// expected-error@+1 {{expected one of 'ref', val' or 'uval' modifiers}} -#pragma omp declare simd linear(uref(b)) +// expected-error@+1 {{expected one of 'ref', val' or 'uval' modifiers}} expected-warning@+1 {{extra tokens at the end of '#pragma omp declare simd' are ignored}} +#pragma omp declare simd linear(uref(b)) allocate(b) void bar(int a, int *b); template <class T> diff --git a/test/OpenMP/declare_target_codegen.cpp b/test/OpenMP/declare_target_codegen.cpp index cc7525a44b..933af34d84 100644 --- a/test/OpenMP/declare_target_codegen.cpp +++ b/test/OpenMP/declare_target_codegen.cpp @@ -17,6 +17,7 @@ // CHECK-NOT: @{{hhh|ggg|fff|eee}} = // CHECK-DAG: @aaa = external global i32, // CHECK-DAG: @bbb = global i32 0, +// CHECK-DAG: weak constant %struct.__tgt_offload_entry { i8* bitcast (i32* @bbb to i8*), // CHECK-DAG: @ccc = external global i32, // CHECK-DAG: @ddd = global i32 0, // CHECK-DAG: @hhh_decl_tgt_link_ptr = common global i32* null @@ -31,24 +32,35 @@ // CHECK-DAG: [[STAT:@.+stat]] = internal global %struct.S zeroinitializer, // CHECK-DAG: [[STAT_REF:@.+]] = internal constant %struct.S* [[STAT]] // CHECK-DAG: @out_decl_target = global i32 0, -// CHECK-DAG: @llvm.used = appending global [6 x i8*] [i8* bitcast (void ()* @__omp_offloading__{{.+}}_globals_l[[@LINE+69]]_ctor to i8*), i8* bitcast (void ()* @__omp_offloading__{{.+}}_stat_l[[@LINE+70]]_ctor to i8*), +// CHECK-DAG: @llvm.used = appending global [6 x i8*] [i8* bitcast (void ()* @__omp_offloading__{{.+}}_globals_l[[@LINE+80]]_ctor to i8*), i8* bitcast (void ()* @__omp_offloading__{{.+}}_stat_l[[@LINE+81]]_ctor to i8*), // CHECK-DAG: @llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (%struct.S** [[STAT_REF]] to i8*)], // CHECK-DAG: define {{.*}}i32 @{{.*}}{{foo|bar|baz2|baz3|FA|f_method}}{{.*}}() // CHECK-DAG: define {{.*}}void @{{.*}}TemplateClass{{.*}}(%class.TemplateClass* %{{.*}}) // CHECK-DAG: define {{.*}}i32 @{{.*}}TemplateClass{{.*}}f_method{{.*}}(%class.TemplateClass* %{{.*}}) -// CHECK-DAG: define {{.*}}void @__omp_offloading__{{.*}}_globals_l[[@LINE+63]]_ctor() +// CHECK-DAG: define {{.*}}void @__omp_offloading__{{.*}}_globals_l[[@LINE+74]]_ctor() #ifndef HEADER #define HEADER #pragma omp declare target +extern int bbb; +#pragma omp end declare target +#pragma omp declare target +extern int bbb; +#pragma omp end declare target + +#pragma omp declare target extern int aaa; int bbb = 0; extern int ccc; int ddd = 0; #pragma omp end declare target +#pragma omp declare target +extern int bbb; +#pragma omp end declare target + extern int eee; int fff = 0; extern int ggg; diff --git a/test/OpenMP/declare_target_link_codegen.cpp b/test/OpenMP/declare_target_link_codegen.cpp index 564581c259..36c295b2de 100644 --- a/test/OpenMP/declare_target_link_codegen.cpp +++ b/test/OpenMP/declare_target_link_codegen.cpp @@ -37,10 +37,13 @@ int maini1() { { a = c; } +#pragma omp target +#pragma omp teams + c = a; return 0; } -// DEVICE: define weak void @__omp_offloading_{{.*}}_{{.*}}maini1{{.*}}_l[[@LINE-7]](i32* dereferenceable{{[^,]*}} +// DEVICE: define weak void @__omp_offloading_{{.*}}_{{.*}}maini1{{.*}}_l[[@LINE-10]](i32* dereferenceable{{[^,]*}} // DEVICE: [[C_REF:%.+]] = load i32*, i32** @c_decl_tgt_link_ptr, // DEVICE: [[C:%.+]] = load i32, i32* [[C_REF]], // DEVICE: store i32 [[C]], i32* % @@ -59,9 +62,10 @@ int maini1() { // HOST: [[BP0:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[BASEPTRS]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // HOST: [[P0:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[PTRS]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // HOST: call i32 @__tgt_target(i64 -1, i8* @{{[^,]+}}, i32 2, i8** [[BP0]], i8** [[P0]], i64* getelementptr inbounds ([2 x i64], [2 x i64]* [[SIZES]], i{{[0-9]+}} 0, i{{[0-9]+}} 0), i64* getelementptr inbounds ([2 x i64], [2 x i64]* [[MAPTYPES]], i{{[0-9]+}} 0, i{{[0-9]+}} 0)) -// HOST: call void @__omp_offloading_{{.*}}_{{.*}}maini1{{.*}}_l[[@LINE-26]](i32* %{{[^,]+}}) +// HOST: call void @__omp_offloading_{{.*}}_{{.*}}maini1{{.*}}_l[[@LINE-29]](i32* %{{[^,]+}}) +// HOST: call i32 @__tgt_target_teams(i64 -1, i8* @.__omp_offloading_{{.+}}_l40.region_id, i32 2, {{.+}}) -// HOST: define internal void @__omp_offloading_{{.*}}_{{.*}}maini1{{.*}}_l[[@LINE-28]](i32* dereferenceable{{.*}}) +// HOST: define internal void @__omp_offloading_{{.*}}_{{.*}}maini1{{.*}}_l[[@LINE-32]](i32* dereferenceable{{.*}}) // HOST: [[C:%.*]] = load i32, i32* @c, // HOST: store i32 [[C]], i32* % diff --git a/test/OpenMP/declare_target_messages.cpp b/test/OpenMP/declare_target_messages.cpp index 0c001d265f..642d3e8727 100644 --- a/test/OpenMP/declare_target_messages.cpp +++ b/test/OpenMP/declare_target_messages.cpp @@ -23,7 +23,7 @@ void c(); void func() {} // expected-note {{'func' defined here}} -#pragma omp declare target link(func) // expected-error {{function name is not allowed in 'link' clause}} +#pragma omp declare target link(func) allocate(a) // expected-error {{function name is not allowed in 'link' clause}} expected-error {{unexpected 'allocate' clause, only 'to' or 'link' clauses expected}} extern int b; diff --git a/test/OpenMP/distribute_ast_print.cpp b/test/OpenMP/distribute_ast_print.cpp index 1bd0a41662..560e227653 100644 --- a/test/OpenMP/distribute_ast_print.cpp +++ b/test/OpenMP/distribute_ast_print.cpp @@ -29,14 +29,14 @@ public: S7(typename T::type v) : a(v) { #pragma omp target #pragma omp teams -#pragma omp distribute private(a) private(this->a) private(T::a) +#pragma omp distribute private(a) private(this->a) private(T::a) allocate(a) for (int k = 0; k < a.a; ++k) ++this->a.a; } S7 &operator=(S7 &s) { #pragma omp target #pragma omp teams -#pragma omp distribute private(a) private(this->a) +#pragma omp distribute allocate(a) private(a) private(this->a) for (int k = 0; k < s.a.a; ++k) ++s.a.a; return *this; @@ -45,13 +45,13 @@ public: // CHECK: #pragma omp target // CHECK-NEXT: #pragma omp teams -// CHECK-NEXT: #pragma omp distribute private(this->a) private(this->a) private(T::a) +// CHECK-NEXT: #pragma omp distribute private(this->a) private(this->a) private(T::a) allocate(this->a) // CHECK: #pragma omp target // CHECK-NEXT: #pragma omp teams -// CHECK-NEXT: #pragma omp distribute private(this->a) private(this->a) +// CHECK-NEXT: #pragma omp distribute allocate(this->a) private(this->a) private(this->a) // CHECK: #pragma omp target // CHECK-NEXT: #pragma omp teams -// CHECK-NEXT: #pragma omp distribute private(this->a) private(this->a) private(this->S::a) +// CHECK-NEXT: #pragma omp distribute private(this->a) private(this->a) private(this->S::a) allocate(this->a) class S8 : public S7<S> { S8() {} diff --git a/test/OpenMP/distribute_collapse_messages.cpp b/test/OpenMP/distribute_collapse_messages.cpp index b852fd2826..e4164daaed 100644 --- a/test/OpenMP/distribute_collapse_messages.cpp +++ b/test/OpenMP/distribute_collapse_messages.cpp @@ -42,7 +42,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} // expected-note@+5 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif // expected-error@+3 2 {{directive '#pragma omp distribute' cannot contain more than one 'collapse' clause}} - // expected-error@+2 2 {{argument to 'collapse' clause must be a strictly positive integer value}} + // expected-error@+2 {{argument to 'collapse' clause must be a strictly positive integer value}} // expected-error@+1 2 {{expression is not an integral constant expression}} #pragma omp distribute collapse (foobool(argc)), collapse (true), collapse (-5) for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; @@ -85,7 +85,7 @@ int main(int argc, char **argv) { #endif // expected-error@+3 {{expression is not an integral constant expression}} // expected-error@+2 2 {{directive '#pragma omp distribute' cannot contain more than one 'collapse' clause}} - // expected-error@+1 2 {{argument to 'collapse' clause must be a strictly positive integer value}} + // expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}} #pragma omp distribute collapse (foobool(argc)), collapse (true), collapse (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; #pragma omp distribute collapse (S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/distribute_firstprivate_messages.cpp b/test/OpenMP/distribute_firstprivate_messages.cpp index 8acc6b643f..e6dfd71c55 100644 --- a/test/OpenMP/distribute_firstprivate_messages.cpp +++ b/test/OpenMP/distribute_firstprivate_messages.cpp @@ -54,6 +54,8 @@ public: S6() : a(0) { } }; +extern int omp_default_mem_alloc; + S3 h; #pragma omp threadprivate(h) // expected-note {{defined as threadprivate or thread local}} @@ -85,7 +87,7 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); #pragma omp target #pragma omp teams - #pragma omp distribute firstprivate (argc) + #pragma omp distribute firstprivate (argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (i = 0; i < argc; ++i) foo(); #pragma omp target #pragma omp teams diff --git a/test/OpenMP/distribute_parallel_for_ast_print.cpp b/test/OpenMP/distribute_parallel_for_ast_print.cpp index 5cfc081737..3b32d08eb3 100644 --- a/test/OpenMP/distribute_parallel_for_ast_print.cpp +++ b/test/OpenMP/distribute_parallel_for_ast_print.cpp @@ -78,15 +78,15 @@ T tmain(T argc) { #pragma omp threadprivate(g) #pragma omp target #pragma omp teams -#pragma omp distribute parallel for dist_schedule(static, a) schedule(dynamic) default(none) copyin(g) firstprivate(a) - // CHECK: #pragma omp distribute parallel for dist_schedule(static, a) schedule(dynamic) default(none) copyin(g) +#pragma omp distribute parallel for dist_schedule(static, a) schedule(dynamic) default(none) copyin(g) firstprivate(a) allocate(a) + // CHECK: #pragma omp distribute parallel for dist_schedule(static, a) schedule(dynamic) default(none) copyin(g) firstprivate(a) allocate(a) for (int i = 0; i < 2; ++i) a = 2; // CHECK-NEXT: for (int i = 0; i < 2; ++i) // CHECK-NEXT: a = 2; #pragma omp target #pragma omp teams -#pragma omp distribute parallel for private(argc, b), firstprivate(c, d), lastprivate(f) collapse(N) schedule(static, N) if (parallel :argc) num_threads(N) default(shared) shared(e) reduction(+ : h) dist_schedule(static,N) +#pragma omp distribute parallel for allocate(argc) private(argc, b), firstprivate(c, d), lastprivate(f) collapse(N) schedule(static, N) if (parallel :argc) num_threads(N) default(shared) shared(e) reduction(+ : h) dist_schedule(static,N) for (int i = 0; i < 2; ++i) for (int j = 0; j < 2; ++j) for (int j = 0; j < 2; ++j) @@ -98,7 +98,7 @@ T tmain(T argc) { for (int j = 0; j < 2; ++j) for (int j = 0; j < 2; ++j) a++; - // CHECK: #pragma omp distribute parallel for private(argc,b) firstprivate(c,d) lastprivate(f) collapse(N) schedule(static, N) if(parallel: argc) num_threads(N) default(shared) shared(e) reduction(+: h) dist_schedule(static, N) + // CHECK: #pragma omp distribute parallel for allocate(argc) private(argc,b) firstprivate(c,d) lastprivate(f) collapse(N) schedule(static, N) if(parallel: argc) num_threads(N) default(shared) shared(e) reduction(+: h) dist_schedule(static, N) // CHECK-NEXT: for (int i = 0; i < 2; ++i) // CHECK-NEXT: for (int j = 0; j < 2; ++j) // CHECK-NEXT: for (int j = 0; j < 2; ++j) @@ -122,8 +122,8 @@ void foo(int argc, char **argv) { [&]() { #pragma omp target #pragma omp teams -#pragma omp distribute parallel for schedule(guided, argc) default(none) copyin(g) dist_schedule(static, a) private(a) - // CHECK: #pragma omp distribute parallel for schedule(guided, argc) default(none) copyin(g) dist_schedule(static, a) private(a) +#pragma omp distribute parallel for schedule(guided, argc) default(none) copyin(g) dist_schedule(static, a) private(a) shared(argc) + // CHECK: #pragma omp distribute parallel for schedule(guided, argc) default(none) copyin(g) dist_schedule(static, a) private(a) shared(argc) for (int i = 0; i < 2; ++i) // CHECK: for (int i = 0; i < 2; ++i) [&]() { @@ -156,8 +156,8 @@ int main(int argc, char **argv) { #pragma omp threadprivate(g) #pragma omp target #pragma omp teams -#pragma omp distribute parallel for schedule(guided, argc) default(none) copyin(g) dist_schedule(static, a) private(a) - // CHECK: #pragma omp distribute parallel for schedule(guided, argc) default(none) copyin(g) dist_schedule(static, a) private(a) +#pragma omp distribute parallel for schedule(guided, argc) default(none) copyin(g) dist_schedule(static, a) private(a) shared(argc) + // CHECK: #pragma omp distribute parallel for schedule(guided, argc) default(none) copyin(g) dist_schedule(static, a) private(a) shared(argc) for (int i = 0; i < 2; ++i) a = 2; // CHECK-NEXT: for (int i = 0; i < 2; ++i) diff --git a/test/OpenMP/distribute_parallel_for_collapse_messages.cpp b/test/OpenMP/distribute_parallel_for_collapse_messages.cpp index f01dfeea5c..c3298f1756 100644 --- a/test/OpenMP/distribute_parallel_for_collapse_messages.cpp +++ b/test/OpenMP/distribute_parallel_for_collapse_messages.cpp @@ -53,7 +53,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} #pragma omp distribute parallel for collapse ((ST > 0) ? 1 + ST : 2) // expected-note 2 {{as specified in 'collapse' clause}} for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; // expected-error 2 {{expected 2 for loops after '#pragma omp distribute parallel for', but found only 1}} // expected-error@+8 2 {{directive '#pragma omp distribute parallel for' cannot contain more than one 'collapse' clause}} - // expected-error@+7 2 {{argument to 'collapse' clause must be a strictly positive integer value}} + // expected-error@+7 {{argument to 'collapse' clause must be a strictly positive integer value}} // expected-error@+6 2 {{expression is not an integral constant expression}} #if __cplusplus >= 201103L // expected-note@+4 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} @@ -124,7 +124,7 @@ int main(int argc, char **argv) { // expected-note@+6{{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif // expected-error@+4 2 {{directive '#pragma omp distribute parallel for' cannot contain more than one 'collapse' clause}} - // expected-error@+3 2 {{argument to 'collapse' clause must be a strictly positive integer value}} + // expected-error@+3 {{argument to 'collapse' clause must be a strictly positive integer value}} #pragma omp target #pragma omp teams #pragma omp distribute parallel for collapse (foobool(argc)), collapse (true), collapse (-5) diff --git a/test/OpenMP/distribute_parallel_for_default_messages.cpp b/test/OpenMP/distribute_parallel_for_default_messages.cpp index cb9cbcf6ba..19042ef8a5 100644 --- a/test/OpenMP/distribute_parallel_for_default_messages.cpp +++ b/test/OpenMP/distribute_parallel_for_default_messages.cpp @@ -24,7 +24,7 @@ T tmain(T argc) { foo(); #pragma omp target #pragma omp teams -#pragma omp distribute parallel for default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} +#pragma omp distribute parallel for default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-note 2 {{explicit data sharing attribute requested here}} for (i = 0; i < argc; ++i) // expected-error 2 {{variable 'argc' must have explicitly specified data sharing attributes}} foo(); #pragma omp target @@ -39,7 +39,7 @@ T tmain(T argc) { foo(); #pragma omp target #pragma omp teams -#pragma omp distribute parallel for default(none) +#pragma omp distribute parallel for default(none) // expected-note 2 {{explicit data sharing attribute requested here}} for (i = 0; i < argc; ++i) // expected-error 2 {{variable 'argc' must have explicitly specified data sharing attributes}} foo(); @@ -72,7 +72,7 @@ int main(int argc, char **argv) { foo(); #pragma omp target #pragma omp teams -#pragma omp distribute parallel for default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} +#pragma omp distribute parallel for default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-note {{explicit data sharing attribute requested here}} for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} foo(); #pragma omp target @@ -87,7 +87,7 @@ int main(int argc, char **argv) { foo(); #pragma omp target #pragma omp teams -#pragma omp distribute parallel for default(none) +#pragma omp distribute parallel for default(none) // expected-note {{explicit data sharing attribute requested here}} for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} foo(); diff --git a/test/OpenMP/distribute_parallel_for_firstprivate_messages.cpp b/test/OpenMP/distribute_parallel_for_firstprivate_messages.cpp index 35579d3537..3cebf0cd67 100644 --- a/test/OpenMP/distribute_parallel_for_firstprivate_messages.cpp +++ b/test/OpenMP/distribute_parallel_for_firstprivate_messages.cpp @@ -8,6 +8,7 @@ void foo() { bool foobool(int argc) { return argc; } +extern int omp_default_mem_alloc; struct S1; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}} extern S1 a; @@ -100,7 +101,7 @@ int foomain(int argc, char **argv) { ++k; #pragma omp target #pragma omp teams -#pragma omp distribute parallel for firstprivate(argc) +#pragma omp distribute parallel for firstprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target diff --git a/test/OpenMP/distribute_parallel_for_lastprivate_messages.cpp b/test/OpenMP/distribute_parallel_for_lastprivate_messages.cpp index 8d93fbbee6..4039982ef5 100644 --- a/test/OpenMP/distribute_parallel_for_lastprivate_messages.cpp +++ b/test/OpenMP/distribute_parallel_for_lastprivate_messages.cpp @@ -8,7 +8,7 @@ void foo() { bool foobool(int argc) { return argc; } - +extern int omp_default_mem_alloc; struct S1; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}} extern S1 a; class S2 { @@ -102,7 +102,7 @@ int foomain(int argc, char **argv) { ++k; #pragma omp target #pragma omp teams -#pragma omp distribute parallel for lastprivate(argc) +#pragma omp distribute parallel for lastprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target diff --git a/test/OpenMP/distribute_parallel_for_messages.cpp b/test/OpenMP/distribute_parallel_for_messages.cpp index 5ea73a88fc..6bda5d106b 100644 --- a/test/OpenMP/distribute_parallel_for_messages.cpp +++ b/test/OpenMP/distribute_parallel_for_messages.cpp @@ -81,7 +81,7 @@ L1: } #pragma omp target #pragma omp teams -#pragma omp distribute parallel for default(none) +#pragma omp distribute parallel for default(none) // expected-note {{explicit data sharing attribute requested here}} for (int i = 0; i < 10; ++i) ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} diff --git a/test/OpenMP/distribute_parallel_for_private_messages.cpp b/test/OpenMP/distribute_parallel_for_private_messages.cpp index 63d89a8c7c..6fadc12442 100644 --- a/test/OpenMP/distribute_parallel_for_private_messages.cpp +++ b/test/OpenMP/distribute_parallel_for_private_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; void foo() { } @@ -34,7 +35,7 @@ public: S4(int v) : a(v) { #pragma omp target #pragma omp teams -#pragma omp distribute parallel for private(a) private(this->a) +#pragma omp distribute parallel for private(a) private(this->a) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: a, allocate(omp_default_mem_alloc: a), allocate(a) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < v; ++k) ++this->a; } diff --git a/test/OpenMP/distribute_parallel_for_reduction_messages.cpp b/test/OpenMP/distribute_parallel_for_reduction_messages.cpp index e6be867f15..99f928a345 100644 --- a/test/OpenMP/distribute_parallel_for_reduction_messages.cpp +++ b/test/OpenMP/distribute_parallel_for_reduction_messages.cpp @@ -6,6 +6,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s +extern int omp_default_mem_alloc; void foo() { } @@ -150,7 +151,7 @@ T tmain(T argc) { foo(); #pragma omp target #pragma omp teams -#pragma omp distribute parallel for reduction(&& : argc) +#pragma omp distribute parallel for reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int i = 0; i < 10; ++i) foo(); #pragma omp target diff --git a/test/OpenMP/distribute_parallel_for_simd_ast_print.cpp b/test/OpenMP/distribute_parallel_for_simd_ast_print.cpp index 4ff0a49290..137a7460f5 100644 --- a/test/OpenMP/distribute_parallel_for_simd_ast_print.cpp +++ b/test/OpenMP/distribute_parallel_for_simd_ast_print.cpp @@ -79,15 +79,15 @@ T tmain(T argc) { #pragma omp threadprivate(g) #pragma omp target #pragma omp teams -#pragma omp distribute parallel for simd dist_schedule(static, a) schedule(dynamic) default(none) copyin(g) firstprivate(a) - // CHECK: #pragma omp distribute parallel for simd dist_schedule(static, a) schedule(dynamic) default(none) copyin(g) +#pragma omp distribute parallel for simd dist_schedule(static, a) schedule(dynamic) default(none) copyin(g) firstprivate(a) allocate(a) + // CHECK: #pragma omp distribute parallel for simd dist_schedule(static, a) schedule(dynamic) default(none) copyin(g) firstprivate(a) allocate(a) for (int i = 0; i < 2; ++i) a = 2; // CHECK-NEXT: for (int i = 0; i < 2; ++i) // CHECK-NEXT: a = 2; #pragma omp target #pragma omp teams -#pragma omp distribute parallel for simd private(argc, b), firstprivate(c, d), lastprivate(f) collapse(N) schedule(static, N) if (parallel :argc) num_threads(N) default(shared) shared(e) reduction(+ : h) dist_schedule(static,N) +#pragma omp distribute parallel for simd allocate(argc) private(argc, b), firstprivate(c, d), lastprivate(f) collapse(N) schedule(static, N) if (parallel :argc) num_threads(N) default(shared) shared(e) reduction(+ : h) dist_schedule(static,N) for (int i = 0; i < 2; ++i) for (int j = 0; j < 2; ++j) for (int j = 0; j < 2; ++j) @@ -99,7 +99,7 @@ T tmain(T argc) { for (int j = 0; j < 2; ++j) for (int j = 0; j < 2; ++j) a++; - // CHECK: #pragma omp distribute parallel for simd private(argc,b) firstprivate(c,d) lastprivate(f) collapse(N) schedule(static, N) if(parallel: argc) num_threads(N) default(shared) shared(e) reduction(+: h) dist_schedule(static, N) + // CHECK: #pragma omp distribute parallel for simd allocate(argc) private(argc,b) firstprivate(c,d) lastprivate(f) collapse(N) schedule(static, N) if(parallel: argc) num_threads(N) default(shared) shared(e) reduction(+: h) dist_schedule(static, N) // CHECK-NEXT: for (int i = 0; i < 2; ++i) // CHECK-NEXT: for (int j = 0; j < 2; ++j) // CHECK-NEXT: for (int j = 0; j < 2; ++j) @@ -123,8 +123,8 @@ int main(int argc, char **argv) { #pragma omp threadprivate(g) #pragma omp target #pragma omp teams -#pragma omp distribute parallel for simd schedule(guided, argc) default(none) copyin(g) dist_schedule(static, a) private(a) - // CHECK: #pragma omp distribute parallel for simd schedule(guided, argc) default(none) copyin(g) dist_schedule(static, a) private(a) +#pragma omp distribute parallel for simd schedule(guided, argc) default(none) copyin(g) dist_schedule(static, a) private(a) shared(argc) + // CHECK: #pragma omp distribute parallel for simd schedule(guided, argc) default(none) copyin(g) dist_schedule(static, a) private(a) shared(argc) for (int i = 0; i < 2; ++i) a = 2; // CHECK-NEXT: for (int i = 0; i < 2; ++i) diff --git a/test/OpenMP/distribute_parallel_for_simd_collapse_messages.cpp b/test/OpenMP/distribute_parallel_for_simd_collapse_messages.cpp index b12dcc19d0..9399594be2 100644 --- a/test/OpenMP/distribute_parallel_for_simd_collapse_messages.cpp +++ b/test/OpenMP/distribute_parallel_for_simd_collapse_messages.cpp @@ -53,7 +53,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} #pragma omp distribute parallel for simd collapse ((ST > 0) ? 1 + ST : 2) // expected-note 2 {{as specified in 'collapse' clause}} for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; // expected-error 2 {{expected 2 for loops after '#pragma omp distribute parallel for simd', but found only 1}} // expected-error@+8 2 {{directive '#pragma omp distribute parallel for simd' cannot contain more than one 'collapse' clause}} - // expected-error@+7 2 {{argument to 'collapse' clause must be a strictly positive integer value}} + // expected-error@+7 {{argument to 'collapse' clause must be a strictly positive integer value}} // expected-error@+6 2 {{expression is not an integral constant expression}} #if __cplusplus >= 201103L // expected-note@+4 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} @@ -124,7 +124,7 @@ int main(int argc, char **argv) { // expected-note@+6{{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif // expected-error@+4 2 {{directive '#pragma omp distribute parallel for simd' cannot contain more than one 'collapse' clause}} - // expected-error@+3 2 {{argument to 'collapse' clause must be a strictly positive integer value}} + // expected-error@+3 {{argument to 'collapse' clause must be a strictly positive integer value}} #pragma omp target #pragma omp teams #pragma omp distribute parallel for simd collapse (foobool(argc)), collapse (true), collapse (-5) diff --git a/test/OpenMP/distribute_parallel_for_simd_default_messages.cpp b/test/OpenMP/distribute_parallel_for_simd_default_messages.cpp index 3014d039d2..80f88a17ce 100644 --- a/test/OpenMP/distribute_parallel_for_simd_default_messages.cpp +++ b/test/OpenMP/distribute_parallel_for_simd_default_messages.cpp @@ -24,7 +24,7 @@ T tmain(T argc) { foo(); #pragma omp target #pragma omp teams -#pragma omp distribute parallel for simd default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} +#pragma omp distribute parallel for simd default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-note 2 {{explicit data sharing attribute requested here}} for (i = 0; i < argc; ++i) // expected-error 2 {{variable 'argc' must have explicitly specified data sharing attributes}} foo(); #pragma omp target @@ -39,7 +39,7 @@ T tmain(T argc) { foo(); #pragma omp target #pragma omp teams -#pragma omp distribute parallel for simd default(none) +#pragma omp distribute parallel for simd default(none) // expected-note 2 {{explicit data sharing attribute requested here}} for (i = 0; i < argc; ++i) // expected-error 2 {{variable 'argc' must have explicitly specified data sharing attributes}} foo(); @@ -72,7 +72,7 @@ int main(int argc, char **argv) { foo(); #pragma omp target #pragma omp teams -#pragma omp distribute parallel for simd default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} +#pragma omp distribute parallel for simd default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-note {{explicit data sharing attribute requested here}} for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} foo(); #pragma omp target @@ -87,7 +87,7 @@ int main(int argc, char **argv) { foo(); #pragma omp target #pragma omp teams -#pragma omp distribute parallel for simd default(none) +#pragma omp distribute parallel for simd default(none) // expected-note {{explicit data sharing attribute requested here}} for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} foo(); diff --git a/test/OpenMP/distribute_parallel_for_simd_firstprivate_messages.cpp b/test/OpenMP/distribute_parallel_for_simd_firstprivate_messages.cpp index e1b0f1466c..f574335baf 100644 --- a/test/OpenMP/distribute_parallel_for_simd_firstprivate_messages.cpp +++ b/test/OpenMP/distribute_parallel_for_simd_firstprivate_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wno-openmp-target +extern int omp_default_mem_alloc; void foo() { } @@ -222,7 +223,7 @@ int main(int argc, char **argv) { foo(); #pragma omp target #pragma omp teams -#pragma omp distribute parallel for simd firstprivate(argc) +#pragma omp distribute parallel for simd firstprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (i = 0; i < argc; ++i) foo(); #pragma omp target diff --git a/test/OpenMP/distribute_parallel_for_simd_lastprivate_messages.cpp b/test/OpenMP/distribute_parallel_for_simd_lastprivate_messages.cpp index e7f2b7da3f..71658a6650 100644 --- a/test/OpenMP/distribute_parallel_for_simd_lastprivate_messages.cpp +++ b/test/OpenMP/distribute_parallel_for_simd_lastprivate_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wno-openmp-target +extern int omp_default_mem_alloc; void foo() { } @@ -211,7 +212,7 @@ int main(int argc, char **argv) { foo(); #pragma omp target #pragma omp teams -#pragma omp distribute parallel for simd lastprivate(argc) +#pragma omp distribute parallel for simd lastprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (i = 0; i < argc; ++i) foo(); #pragma omp target diff --git a/test/OpenMP/distribute_parallel_for_simd_linear_messages.cpp b/test/OpenMP/distribute_parallel_for_simd_linear_messages.cpp index 6fb5944d2c..8f2df4215b 100644 --- a/test/OpenMP/distribute_parallel_for_simd_linear_messages.cpp +++ b/test/OpenMP/distribute_parallel_for_simd_linear_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wno-openmp-target +extern int omp_default_mem_alloc; namespace X { int x; }; @@ -283,7 +284,7 @@ int main(int argc, char **argv) { // expected-error@+3 {{only loop iteration variables are allowed in 'linear' clause in distribute directives}} #pragma omp target #pragma omp teams -#pragma omp distribute parallel for simd linear (argc) +#pragma omp distribute parallel for simd linear (argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target diff --git a/test/OpenMP/distribute_parallel_for_simd_private_messages.cpp b/test/OpenMP/distribute_parallel_for_simd_private_messages.cpp index 419e735f45..50a7fb5ac9 100644 --- a/test/OpenMP/distribute_parallel_for_simd_private_messages.cpp +++ b/test/OpenMP/distribute_parallel_for_simd_private_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; void foo() { } @@ -142,7 +143,7 @@ int foomain(I argc, C **argv) { ++k; #pragma omp target #pragma omp teams -#pragma omp distribute parallel for simd private(argc) +#pragma omp distribute parallel for simd private(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target diff --git a/test/OpenMP/distribute_parallel_for_simd_reduction_messages.cpp b/test/OpenMP/distribute_parallel_for_simd_reduction_messages.cpp index 046cce59dd..150f50171a 100644 --- a/test/OpenMP/distribute_parallel_for_simd_reduction_messages.cpp +++ b/test/OpenMP/distribute_parallel_for_simd_reduction_messages.cpp @@ -6,6 +6,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s -Wno-openmp-target // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s -Wno-openmp-target +extern int omp_default_mem_alloc; void foo() { } @@ -334,7 +335,7 @@ int main(int argc, char **argv) { foo(); #pragma omp target #pragma omp teams -#pragma omp distribute parallel for simd reduction(&& : argc) +#pragma omp distribute parallel for simd reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int i = 0; i < 10; ++i) foo(); #pragma omp target diff --git a/test/OpenMP/distribute_parallel_for_simd_safelen_messages.cpp b/test/OpenMP/distribute_parallel_for_simd_safelen_messages.cpp index 93766f9a6a..7e76c1f6ab 100644 --- a/test/OpenMP/distribute_parallel_for_simd_safelen_messages.cpp +++ b/test/OpenMP/distribute_parallel_for_simd_safelen_messages.cpp @@ -63,11 +63,14 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} argv[0][i] = argv[0][i] - argv[0][i-ST]; #if __cplusplus >= 201103L - // expected-note@+4 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} + // expected-note@+7 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif #pragma omp target #pragma omp teams -#pragma omp distribute parallel for simd safelen (foobool(argc)), safelen (true), safelen (-5) // expected-error 2 {{directive '#pragma omp distribute parallel for simd' cannot contain more than one 'safelen' clause}} expected-error 2 {{argument to 'safelen' clause must be a strictly positive integer value}} expected-error 2 {{expression is not an integral constant expression}} +// expected-error@+3 2 {{directive '#pragma omp distribute parallel for simd' cannot contain more than one 'safelen' clause}} +// expected-error@+2 {{argument to 'safelen' clause must be a strictly positive integer value}} +// expected-error@+1 2 {{expression is not an integral constant expression}} +#pragma omp distribute parallel for simd safelen (foobool(argc)), safelen (true), safelen (-5) for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; @@ -144,11 +147,14 @@ int main(int argc, char **argv) { argv[0][i] = argv[0][i] - argv[0][i-4]; #if __cplusplus >= 201103L - // expected-note@+4 {{non-constexpr function 'foobool' cannot be used in a constant expression}} + // expected-note@+7 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif #pragma omp target #pragma omp teams -#pragma omp parallel for simd safelen (foobool(argc)), safelen (true), safelen (-5) // expected-error 2 {{argument to 'safelen' clause must be a strictly positive integer value}} expected-error 2 {{directive '#pragma omp parallel for simd' cannot contain more than one 'safelen' clause}} expected-error {{expression is not an integral constant expression}} +// expected-error@+3 {{argument to 'safelen' clause must be a strictly positive integer value}} +// expected-error@+2 2 {{directive '#pragma omp parallel for simd' cannot contain more than one 'safelen' clause}} +// expected-error@+1 {{expression is not an integral constant expression}} +#pragma omp parallel for simd safelen (foobool(argc)), safelen (true), safelen (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; diff --git a/test/OpenMP/distribute_parallel_for_simd_simdlen_messages.cpp b/test/OpenMP/distribute_parallel_for_simd_simdlen_messages.cpp index 8e40e3547f..9c1c552033 100644 --- a/test/OpenMP/distribute_parallel_for_simd_simdlen_messages.cpp +++ b/test/OpenMP/distribute_parallel_for_simd_simdlen_messages.cpp @@ -66,11 +66,14 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} argv[0][i] = argv[0][i] - argv[0][i-ST]; #if __cplusplus >= 201103L - // expected-note@+4 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} + // expected-note@+7 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif #pragma omp target #pragma omp teams -#pragma omp distribute parallel for simd simdlen (foobool(argc)), simdlen (true), simdlen (-5) // expected-error 2 {{directive '#pragma omp distribute parallel for simd' cannot contain more than one 'simdlen' clause}} expected-error 2 {{argument to 'simdlen' clause must be a strictly positive integer value}} expected-error 2 {{expression is not an integral constant expression}} +// expected-error@+3 2 {{directive '#pragma omp distribute parallel for simd' cannot contain more than one 'simdlen' clause}} +// expected-error@+2 {{argument to 'simdlen' clause must be a strictly positive integer value}} +// expected-error@+1 2 {{expression is not an integral constant expression}} +#pragma omp distribute parallel for simd simdlen (foobool(argc)), simdlen (true), simdlen (-5) for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; @@ -148,11 +151,14 @@ int main(int argc, char **argv) { #if __cplusplus >= 201103L - // expected-note@+4 {{non-constexpr function 'foobool' cannot be used in a constant expression}} + // expected-note@+7 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif #pragma omp target #pragma omp teams -#pragma omp distribute parallel for simd simdlen (foobool(argc)), simdlen (true), simdlen (-5) // expected-error {{expression is not an integral constant expression}} expected-error 2 {{directive '#pragma omp distribute parallel for simd' cannot contain more than one 'simdlen' clause}} expected-error 2 {{argument to 'simdlen' clause must be a strictly positive integer value}} +// expected-error@+3 {{expression is not an integral constant expression}} +// expected-error@+2 2 {{directive '#pragma omp distribute parallel for simd' cannot contain more than one 'simdlen' clause}} +// expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}} +#pragma omp distribute parallel for simd simdlen (foobool(argc)), simdlen (true), simdlen (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; diff --git a/test/OpenMP/distribute_private_messages.cpp b/test/OpenMP/distribute_private_messages.cpp index 55c13a00bb..fe5c0257a9 100644 --- a/test/OpenMP/distribute_private_messages.cpp +++ b/test/OpenMP/distribute_private_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp-simd -ferror-limit 100 %s +extern int omp_default_mem_alloc; void foo() { } @@ -63,7 +64,7 @@ int main(int argc, char **argv) { for (int k = 0; k < argc; ++k) ++k; #pragma omp distribute private (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; - #pragma omp distribute private (argc) + #pragma omp distribute private (argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp distribute private (S1) // expected-error {{'S1' does not refer to a value}} for (int k = 0; k < argc; ++k) ++k; diff --git a/test/OpenMP/distribute_simd_ast_print.cpp b/test/OpenMP/distribute_simd_ast_print.cpp index 092c5cfd78..528f8da826 100644 --- a/test/OpenMP/distribute_simd_ast_print.cpp +++ b/test/OpenMP/distribute_simd_ast_print.cpp @@ -27,23 +27,23 @@ public: S7(typename T::type v) : a(v) { #pragma omp target #pragma omp teams -#pragma omp distribute simd private(a) private(this->a) private(T::a) +#pragma omp distribute simd private(a) private(this->a) private(T::a) allocate(T::a) for (int k = 0; k < a.a; ++k) ++this->a.a; } S7 &operator=(S7 &s) { #pragma omp target #pragma omp teams -#pragma omp distribute simd private(a) private(this->a) +#pragma omp distribute simd allocate(a) private(a) private(this->a) for (int k = 0; k < s.a.a; ++k) ++s.a.a; return *this; } }; -// CHECK: #pragma omp distribute simd private(this->a) private(this->a) private(T::a){{$}} -// CHECK: #pragma omp distribute simd private(this->a) private(this->a) -// CHECK: #pragma omp distribute simd private(this->a) private(this->a) private(this->S::a) +// CHECK: #pragma omp distribute simd private(this->a) private(this->a) private(T::a) allocate(T::a){{$}} +// CHECK: #pragma omp distribute simd allocate(this->a) private(this->a) private(this->a) +// CHECK: #pragma omp distribute simd private(this->a) private(this->a) private(this->S::a) allocate(this->S::a) class S8 : public S7<S> { S8() {} diff --git a/test/OpenMP/distribute_simd_collapse_messages.cpp b/test/OpenMP/distribute_simd_collapse_messages.cpp index f4d5b73634..204719a2e6 100644 --- a/test/OpenMP/distribute_simd_collapse_messages.cpp +++ b/test/OpenMP/distribute_simd_collapse_messages.cpp @@ -53,7 +53,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} #pragma omp distribute simd collapse ((ST > 0) ? 1 + ST : 2) // expected-note 2 {{as specified in 'collapse' clause}} for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; // expected-error 2 {{expected 2 for loops after '#pragma omp distribute simd', but found only 1}} // expected-error@+8 2 {{directive '#pragma omp distribute simd' cannot contain more than one 'collapse' clause}} - // expected-error@+7 2 {{argument to 'collapse' clause must be a strictly positive integer value}} + // expected-error@+7 {{argument to 'collapse' clause must be a strictly positive integer value}} // expected-error@+6 2 {{expression is not an integral constant expression}} #if __cplusplus >= 201103L // expected-note@+4 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} @@ -124,7 +124,7 @@ int main(int argc, char **argv) { // expected-note@+6{{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif // expected-error@+4 2 {{directive '#pragma omp distribute simd' cannot contain more than one 'collapse' clause}} - // expected-error@+3 2 {{argument to 'collapse' clause must be a strictly positive integer value}} + // expected-error@+3 {{argument to 'collapse' clause must be a strictly positive integer value}} #pragma omp target #pragma omp teams #pragma omp distribute simd collapse (foobool(argc)), collapse (true), collapse (-5) diff --git a/test/OpenMP/distribute_simd_firstprivate_messages.cpp b/test/OpenMP/distribute_simd_firstprivate_messages.cpp index 1cfc273256..6059415582 100644 --- a/test/OpenMP/distribute_simd_firstprivate_messages.cpp +++ b/test/OpenMP/distribute_simd_firstprivate_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; void foo() { } @@ -100,7 +101,7 @@ int foomain(int argc, char **argv) { ++k; #pragma omp target #pragma omp teams -#pragma omp distribute simd firstprivate(argc) +#pragma omp distribute simd firstprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target diff --git a/test/OpenMP/distribute_simd_lastprivate_messages.cpp b/test/OpenMP/distribute_simd_lastprivate_messages.cpp index 875210ed49..6037551c5b 100644 --- a/test/OpenMP/distribute_simd_lastprivate_messages.cpp +++ b/test/OpenMP/distribute_simd_lastprivate_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; void foo() { } @@ -211,7 +212,7 @@ int main(int argc, char **argv) { foo(); #pragma omp target #pragma omp teams -#pragma omp distribute simd lastprivate(argc) +#pragma omp distribute simd lastprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (i = 0; i < argc; ++i) foo(); #pragma omp target diff --git a/test/OpenMP/distribute_simd_linear_messages.cpp b/test/OpenMP/distribute_simd_linear_messages.cpp index 631b43a120..e5c2aceea8 100644 --- a/test/OpenMP/distribute_simd_linear_messages.cpp +++ b/test/OpenMP/distribute_simd_linear_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; namespace X { int x; }; @@ -272,7 +273,7 @@ int main(int argc, char **argv) { // expected-error@+3 {{only loop iteration variables are allowed in 'linear' clause in distribute directives}} #pragma omp target #pragma omp teams -#pragma omp distribute simd linear (argc) +#pragma omp distribute simd linear (argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target diff --git a/test/OpenMP/distribute_simd_private_messages.cpp b/test/OpenMP/distribute_simd_private_messages.cpp index 1fdb97dceb..47b1b0c74f 100644 --- a/test/OpenMP/distribute_simd_private_messages.cpp +++ b/test/OpenMP/distribute_simd_private_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; void foo() { } @@ -142,7 +143,7 @@ int foomain(I argc, C **argv) { ++k; #pragma omp target #pragma omp teams -#pragma omp distribute simd private(argc) +#pragma omp distribute simd private(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target diff --git a/test/OpenMP/distribute_simd_reduction_codegen.cpp b/test/OpenMP/distribute_simd_reduction_codegen.cpp index 85b0e80aad..63fb75e000 100644 --- a/test/OpenMP/distribute_simd_reduction_codegen.cpp +++ b/test/OpenMP/distribute_simd_reduction_codegen.cpp @@ -46,7 +46,7 @@ int main() { // LAMBDA: call void [[OUTER_LAMBDA:@.+]]( [&]() { // LAMBDA: define{{.*}} internal{{.*}} void [[OUTER_LAMBDA]]( - // LAMBDA: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 1, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 0, i32 0) + // LAMBDA: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 1, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 0, i32 1) // LAMBDA: call void @[[LOFFL1:.+]]( // LAMBDA: ret #pragma omp target @@ -123,7 +123,7 @@ int main() { } // CHECK: define {{.*}}i{{[0-9]+}} @main() -// CHECK: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 1, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 0, i32 0) +// CHECK: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 1, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 0, i32 1) // CHECK: call void @[[OFFL1:.+]](i{{64|32}} %{{.+}}) // CHECK: {{%.+}} = call{{.*}} i32 @[[TMAIN_INT:.+]]() // CHECK: ret diff --git a/test/OpenMP/distribute_simd_reduction_messages.cpp b/test/OpenMP/distribute_simd_reduction_messages.cpp index f960b18319..b1fe7f684d 100644 --- a/test/OpenMP/distribute_simd_reduction_messages.cpp +++ b/test/OpenMP/distribute_simd_reduction_messages.cpp @@ -6,6 +6,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s +extern int omp_default_mem_alloc; void foo() { } @@ -150,7 +151,7 @@ T tmain(T argc) { foo(); #pragma omp target #pragma omp teams -#pragma omp distribute simd reduction(&& : argc) +#pragma omp distribute simd reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int i = 0; i < 10; ++i) foo(); #pragma omp target diff --git a/test/OpenMP/distribute_simd_safelen_messages.cpp b/test/OpenMP/distribute_simd_safelen_messages.cpp index c95d121ca2..30c0976368 100644 --- a/test/OpenMP/distribute_simd_safelen_messages.cpp +++ b/test/OpenMP/distribute_simd_safelen_messages.cpp @@ -63,11 +63,14 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} argv[0][i] = argv[0][i] - argv[0][i-ST]; #if __cplusplus >= 201103L - // expected-note@+4 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} + // expected-note@+7 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif #pragma omp target #pragma omp teams -#pragma omp distribute simd safelen (foobool(argc)), safelen (true), safelen (-5) // expected-error 2 {{directive '#pragma omp distribute simd' cannot contain more than one 'safelen' clause}} expected-error 2 {{argument to 'safelen' clause must be a strictly positive integer value}} expected-error 2 {{expression is not an integral constant expression}} +// expected-error@+3 2 {{directive '#pragma omp distribute simd' cannot contain more than one 'safelen' clause}} +// expected-error@+2 {{argument to 'safelen' clause must be a strictly positive integer value}} +// expected-error@+1 2 {{expression is not an integral constant expression}} +#pragma omp distribute simd safelen (foobool(argc)), safelen (true), safelen (-5) for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; @@ -144,11 +147,14 @@ int main(int argc, char **argv) { argv[0][i] = argv[0][i] - argv[0][i-4]; #if __cplusplus >= 201103L - // expected-note@+4 {{non-constexpr function 'foobool' cannot be used in a constant expression}} + // expected-note@+7 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif #pragma omp target #pragma omp teams -#pragma omp parallel for simd safelen (foobool(argc)), safelen (true), safelen (-5) // expected-error 2 {{argument to 'safelen' clause must be a strictly positive integer value}} expected-error 2 {{directive '#pragma omp parallel for simd' cannot contain more than one 'safelen' clause}} expected-error {{expression is not an integral constant expression}} +// expected-error@+3 {{argument to 'safelen' clause must be a strictly positive integer value}} +// expected-error@+2 2 {{directive '#pragma omp parallel for simd' cannot contain more than one 'safelen' clause}} +// expected-error@+1 {{expression is not an integral constant expression}} +#pragma omp parallel for simd safelen (foobool(argc)), safelen (true), safelen (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; diff --git a/test/OpenMP/distribute_simd_simdlen_messages.cpp b/test/OpenMP/distribute_simd_simdlen_messages.cpp index c95d121ca2..30c0976368 100644 --- a/test/OpenMP/distribute_simd_simdlen_messages.cpp +++ b/test/OpenMP/distribute_simd_simdlen_messages.cpp @@ -63,11 +63,14 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} argv[0][i] = argv[0][i] - argv[0][i-ST]; #if __cplusplus >= 201103L - // expected-note@+4 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} + // expected-note@+7 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif #pragma omp target #pragma omp teams -#pragma omp distribute simd safelen (foobool(argc)), safelen (true), safelen (-5) // expected-error 2 {{directive '#pragma omp distribute simd' cannot contain more than one 'safelen' clause}} expected-error 2 {{argument to 'safelen' clause must be a strictly positive integer value}} expected-error 2 {{expression is not an integral constant expression}} +// expected-error@+3 2 {{directive '#pragma omp distribute simd' cannot contain more than one 'safelen' clause}} +// expected-error@+2 {{argument to 'safelen' clause must be a strictly positive integer value}} +// expected-error@+1 2 {{expression is not an integral constant expression}} +#pragma omp distribute simd safelen (foobool(argc)), safelen (true), safelen (-5) for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; @@ -144,11 +147,14 @@ int main(int argc, char **argv) { argv[0][i] = argv[0][i] - argv[0][i-4]; #if __cplusplus >= 201103L - // expected-note@+4 {{non-constexpr function 'foobool' cannot be used in a constant expression}} + // expected-note@+7 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif #pragma omp target #pragma omp teams -#pragma omp parallel for simd safelen (foobool(argc)), safelen (true), safelen (-5) // expected-error 2 {{argument to 'safelen' clause must be a strictly positive integer value}} expected-error 2 {{directive '#pragma omp parallel for simd' cannot contain more than one 'safelen' clause}} expected-error {{expression is not an integral constant expression}} +// expected-error@+3 {{argument to 'safelen' clause must be a strictly positive integer value}} +// expected-error@+2 2 {{directive '#pragma omp parallel for simd' cannot contain more than one 'safelen' clause}} +// expected-error@+1 {{expression is not an integral constant expression}} +#pragma omp parallel for simd safelen (foobool(argc)), safelen (true), safelen (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; diff --git a/test/OpenMP/flush_messages.cpp b/test/OpenMP/flush_messages.cpp index da1d0c2412..36a8ef6d49 100644 --- a/test/OpenMP/flush_messages.cpp +++ b/test/OpenMP/flush_messages.cpp @@ -8,7 +8,7 @@ struct S1 { // expected-note 2 {{declared here}} template <class T> T tmain(T argc) { -#pragma omp flush +#pragma omp flush allocate(argc) // expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp flush'}} ; #pragma omp flush untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp flush'}} #pragma omp flush unknown // expected-warning {{extra tokens at the end of '#pragma omp flush' are ignored}} @@ -33,7 +33,7 @@ T tmain(T argc) { #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} switch (argc) case 1: -#pragma omp flush +#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} switch (argc) case 1: { #pragma omp flush @@ -53,7 +53,7 @@ T tmain(T argc) { #pragma omp flush } label: -#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} +#pragma omp flush label1 : { #pragma omp flush } @@ -97,7 +97,7 @@ int main(int argc, char **argv) { #pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} switch (argc) case 1: -#pragma omp flush +#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} switch (argc) case 1: { #pragma omp flush @@ -117,7 +117,7 @@ int main(int argc, char **argv) { #pragma omp flush } label: -#pragma omp flush // expected-error {{'#pragma omp flush' cannot be an immediate substatement}} +#pragma omp flush label1 : { #pragma omp flush } diff --git a/test/OpenMP/for_ast_print.cpp b/test/OpenMP/for_ast_print.cpp index 760d44c1cf..cdbe9aaffd 100644 --- a/test/OpenMP/for_ast_print.cpp +++ b/test/OpenMP/for_ast_print.cpp @@ -105,14 +105,14 @@ T tmain(T argc) { T b = argc, c, d, e, f, g; static T a; // CHECK: static T a; -#pragma omp for schedule(dynamic) linear(a) - // CHECK-NEXT: #pragma omp for schedule(dynamic) linear(a) +#pragma omp for schedule(dynamic) linear(a) allocate(a) + // CHECK-NEXT: #pragma omp for schedule(dynamic) linear(a) allocate(a) for (int i = 0; i < 2; ++i) a = 2; // CHECK-NEXT: for (int i = 0; i < 2; ++i) // CHECK-NEXT: a = 2; #pragma omp parallel -#pragma omp for private(argc, b), firstprivate(c, d), lastprivate(d, f) collapse(N) schedule(static, N) ordered(N) nowait +#pragma omp for allocate(argc) private(argc, b), firstprivate(c, d), lastprivate(d, f) collapse(N) schedule(static, N) ordered(N) nowait for (int i = 0; i < 2; ++i) for (int j = 0; j < 2; ++j) for (int j = 0; j < 2; ++j) @@ -125,7 +125,7 @@ T tmain(T argc) { for (int j = 0; j < 2; ++j) foo(); // CHECK-NEXT: #pragma omp parallel - // CHECK-NEXT: #pragma omp for private(argc,b) firstprivate(c,d) lastprivate(d,f) collapse(N) schedule(static, N) ordered(N) nowait + // CHECK-NEXT: #pragma omp for allocate(argc) private(argc,b) firstprivate(c,d) lastprivate(d,f) collapse(N) schedule(static, N) ordered(N) nowait // CHECK-NEXT: for (int i = 0; i < 2; ++i) // CHECK-NEXT: for (int j = 0; j < 2; ++j) // CHECK-NEXT: for (int j = 0; j < 2; ++j) diff --git a/test/OpenMP/for_codegen.cpp b/test/OpenMP/for_codegen.cpp index 2e44478b63..47c5be9bec 100644 --- a/test/OpenMP/for_codegen.cpp +++ b/test/OpenMP/for_codegen.cpp @@ -203,7 +203,8 @@ void dynamic1(float *a, float *b, float *c, float *d) { // CHECK: [[IV:%.+]] = load i64, i64* [[OMP_IV]] // CHECK-NEXT: [[UB:%.+]] = load i64, i64* [[OMP_UB]] -// CHECK-NEXT: [[CMP:%.+]] = icmp ule i64 [[IV]], [[UB]] +// CHECK-NEXT: [[BOUND:%.+]] = add i64 [[UB]], 1 +// CHECK-NEXT: [[CMP:%.+]] = icmp ult i64 [[IV]], [[BOUND]] // CHECK-NEXT: br i1 [[CMP]], label %[[LOOP1_BODY:[^,]+]], label %[[LOOP1_END:[^,]+]] for (unsigned long long i = 131071; i < 2147483647; i += 127) { // CHECK: [[LOOP1_BODY]] @@ -244,7 +245,8 @@ void guided7(float *a, float *b, float *c, float *d) { // CHECK: [[IV:%.+]] = load i64, i64* [[OMP_IV]] // CHECK-NEXT: [[UB:%.+]] = load i64, i64* [[OMP_UB]] -// CHECK-NEXT: [[CMP:%.+]] = icmp ule i64 [[IV]], [[UB]] +// CHECK-NEXT: [[BOUND:%.+]] = add i64 [[UB]], 1 +// CHECK-NEXT: [[CMP:%.+]] = icmp ult i64 [[IV]], [[BOUND]] // CHECK-NEXT: br i1 [[CMP]], label %[[LOOP1_BODY:[^,]+]], label %[[LOOP1_END:[^,]+]] for (unsigned long long i = 131071; i < 2147483647; i += 127) { // CHECK: [[LOOP1_BODY]] diff --git a/test/OpenMP/for_collapse_messages.cpp b/test/OpenMP/for_collapse_messages.cpp index 230880b22d..5530ddcc6a 100644 --- a/test/OpenMP/for_collapse_messages.cpp +++ b/test/OpenMP/for_collapse_messages.cpp @@ -39,7 +39,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} #pragma omp for collapse ((ST > 0) ? 1 + ST : 2) // expected-note 2 {{as specified in 'collapse' clause}} for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; // expected-error 2 {{expected 2 for loops after '#pragma omp for', but found only 1}} // expected-error@+6 2 {{directive '#pragma omp for' cannot contain more than one 'collapse' clause}} - // expected-error@+5 2 {{argument to 'collapse' clause must be a strictly positive integer value}} + // expected-error@+5 {{argument to 'collapse' clause must be a strictly positive integer value}} // expected-error@+4 2 {{expression is not an integral constant expression}} #if __cplusplus >= 201103L // expected-note@+2 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} @@ -86,7 +86,7 @@ int main(int argc, char **argv) { // expected-note@+4 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif // expected-error@+2 2 {{directive '#pragma omp for' cannot contain more than one 'collapse' clause}} - // expected-error@+1 2 {{argument to 'collapse' clause must be a strictly positive integer value}} + // expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}} #pragma omp for collapse (foobool(argc)), collapse (true), collapse (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; #pragma omp for collapse (S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/for_firstprivate_messages.cpp b/test/OpenMP/for_firstprivate_messages.cpp index c34c918d12..22b034e0f2 100644 --- a/test/OpenMP/for_firstprivate_messages.cpp +++ b/test/OpenMP/for_firstprivate_messages.cpp @@ -1,6 +1,7 @@ // RUN: %clang_cc1 -verify -fopenmp %s // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; void foo() { } @@ -92,7 +93,7 @@ int foomain(int argc, char **argv) { for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel -#pragma omp for firstprivate(argc) +#pragma omp for firstprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel diff --git a/test/OpenMP/for_lastprivate_codegen.cpp b/test/OpenMP/for_lastprivate_codegen.cpp index f0eeb63128..57fb4ad9d5 100644 --- a/test/OpenMP/for_lastprivate_codegen.cpp +++ b/test/OpenMP/for_lastprivate_codegen.cpp @@ -14,6 +14,19 @@ #ifndef HEADER #define HEADER +enum omp_allocator_handle_t { + omp_null_allocator = 0, + omp_default_mem_alloc = 1, + omp_large_cap_mem_alloc = 2, + omp_const_mem_alloc = 3, + omp_high_bw_mem_alloc = 4, + omp_low_lat_mem_alloc = 5, + omp_cgroup_mem_alloc = 6, + omp_pteam_mem_alloc = 7, + omp_thread_mem_alloc = 8, + KMP_ALLOCATOR_MAX_HANDLE = __UINTPTR_MAX__ +}; + struct SS { int a; int b : 4; @@ -456,12 +469,12 @@ int main() { A::x++; } #pragma omp parallel -#pragma omp for firstprivate(f) lastprivate(f) +#pragma omp for allocate(omp_const_mem_alloc: f) firstprivate(f) lastprivate(f) for (int i = 0; i < 2; ++i) { A::x++; } #pragma omp parallel -#pragma omp for lastprivate(cnt) +#pragma omp for allocate(omp_const_mem_alloc :cnt) lastprivate(cnt) for (cnt = 0; cnt < 2; ++cnt) { A::x++; } @@ -590,15 +603,16 @@ int main() { // CHECK: ret void // CHECK: define internal void [[MAIN_MICROTASK2]](i{{[0-9]+}}* noalias [[GTID_ADDR:%.+]], i{{[0-9]+}}* noalias %{{.+}}) -// CHECK: [[F_PRIV:%.+]] = alloca float, // CHECK-NOT: alloca float // Check for default initialization. +// CHECK: [[GTID_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[GTID_ADDR_REF]] +// CHECK: [[GTID:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[GTID_REF]] +// CHECK: [[F_VOID_PTR:%.+]] = call i8* @__kmpc_alloc(i32 [[GTID]], i64 4, i8* inttoptr (i64 3 to i8*)) +// CHECK: [[F_PRIV:%.+]] = bitcast i8* [[F_VOID_PTR]] to float* // CHECK: [[F_VAL:%.+]] = load float, float* [[F]], // CHECK: store float [[F_VAL]], float* [[F_PRIV]], -// CHECK: [[GTID_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[GTID_ADDR_REF]] -// CHECK: [[GTID:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[GTID_REF]] // CHECK: call {{.+}} @__kmpc_for_static_init_4(%{{.+}}* @{{.+}}, i32 [[GTID]], i32 34, i32* [[IS_LAST_ADDR:%.+]], i32* %{{.+}}, i32* %{{.+}}, i32* %{{.+}}, i32 1, i32 1) // <Skip loop body> // CHECK: call void @__kmpc_for_static_fini(%{{.+}}* @{{.+}}, i32 [[GTID]]) @@ -617,15 +631,15 @@ int main() { // CHECK-NEXT: br label %[[LAST_DONE]] // CHECK: [[LAST_DONE]] -// CHECK: call void @__kmpc_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], i{{[0-9]+}} [[GTID]]) -// CHECK: ret void +// CHECK: call void @__kmpc_free(i32 [[GTID]], i8* [[F_VOID_PTR]], i8* inttoptr (i64 3 to i8*)) +// CHECK-NEXT: call void @__kmpc_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], i{{[0-9]+}} [[GTID]]) +// CHECK-NEXT: ret void // CHECK: define internal void [[MAIN_MICROTASK3]](i{{[0-9]+}}* noalias [[GTID_ADDR:%.+]], i{{[0-9]+}}* noalias %{{.+}}) -// CHECK: alloca i8, -// CHECK: [[CNT_PRIV:%.+]] = alloca i8, // CHECK: [[GTID_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[GTID_ADDR_REF]] // CHECK: [[GTID:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[GTID_REF]] +// CHECK: [[CNT_PRIV:%.+]] = call i8* @__kmpc_alloc(i32 [[GTID]], i64 1, i8* inttoptr (i64 3 to i8*)) // CHECK: call {{.+}} @__kmpc_for_static_init_4(%{{.+}}* @{{.+}}, i32 [[GTID]], i32 34, i32* [[IS_LAST_ADDR:%.+]], i32* [[OMP_LB:%[^,]+]], i32* [[OMP_UB:%[^,]+]], i32* [[OMP_ST:%[^,]+]], i32 1, i32 1) // UB = min(UB, GlobalUB) // CHECK-NEXT: [[UB:%.+]] = load i32, i32* [[OMP_UB]] @@ -653,8 +667,9 @@ int main() { // CHECK-NEXT: br label %[[LAST_DONE]] // CHECK: [[LAST_DONE]] -// CHECK: call void @__kmpc_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], i{{[0-9]+}} [[GTID]]) -// CHECK: ret void +// CHECK: call void @__kmpc_free(i32 [[GTID]], i8* [[CNT_PRIV]], i8* inttoptr (i64 3 to i8*)) +// CHECK-NEXT: call void @__kmpc_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], i{{[0-9]+}} [[GTID]]) +// CHECK-NEXT: ret void // CHECK: define {{.*}} i{{[0-9]+}} [[TMAIN_INT]]() // CHECK: [[TEST:%.+]] = alloca [[S_INT_TY]], diff --git a/test/OpenMP/for_lastprivate_messages.cpp b/test/OpenMP/for_lastprivate_messages.cpp index 1777335c9a..40222c1f5e 100644 --- a/test/OpenMP/for_lastprivate_messages.cpp +++ b/test/OpenMP/for_lastprivate_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; void foo() { } @@ -95,7 +96,7 @@ int foomain(int argc, char **argv) { for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel -#pragma omp for lastprivate(argc) +#pragma omp for lastprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel diff --git a/test/OpenMP/for_linear_codegen.cpp b/test/OpenMP/for_linear_codegen.cpp index a9bc621005..e424200400 100644 --- a/test/OpenMP/for_linear_codegen.cpp +++ b/test/OpenMP/for_linear_codegen.cpp @@ -14,6 +14,19 @@ #ifndef HEADER #define HEADER +enum omp_allocator_handle_t { + omp_null_allocator = 0, + omp_default_mem_alloc = 1, + omp_large_cap_mem_alloc = 2, + omp_const_mem_alloc = 3, + omp_high_bw_mem_alloc = 4, + omp_low_lat_mem_alloc = 5, + omp_cgroup_mem_alloc = 6, + omp_pteam_mem_alloc = 7, + omp_thread_mem_alloc = 8, + KMP_ALLOCATOR_MAX_HANDLE = __UINTPTR_MAX__ +}; + template <class T> struct S { T f; @@ -344,7 +357,7 @@ int main() { float *pvar = &test.f; long long lvar = 0; #pragma omp parallel -#pragma omp for linear(pvar, lvar : 3) +#pragma omp for linear(pvar, lvar : 3) allocate(omp_low_lat_mem_alloc: lvar) for (int i = 0; i < 2; ++i) { pvar += 3, lvar += 3; } @@ -370,7 +383,6 @@ int main() { // CHECK: alloca i{{[0-9]+}}, // CHECK: alloca i{{[0-9]+}}, // CHECK: [[PVAR_PRIV:%.+]] = alloca float*, -// CHECK: [[LVAR_PRIV:%.+]] = alloca i64, // CHECK: store i{{[0-9]+}}* [[GTID_ADDR]], i{{[0-9]+}}** [[GTID_ADDR_REF:%.+]] // Check for default initialization. @@ -380,7 +392,9 @@ int main() { // CHECK: store float* [[PVAR_VAL]], float** [[PVAR_START]], // CHECK: [[LVAR_VAL:%.+]] = load i64, i64* [[LVAR_REF]], // CHECK: store i64 [[LVAR_VAL]], i64* [[LVAR_START]], -// CHECK: call {{.+}} @__kmpc_for_static_init_4(%{{.+}}* @{{.+}}, i32 [[GTID:%.+]], i32 34, i32* [[IS_LAST_ADDR:%.+]], i32* %{{.+}}, i32* %{{.+}}, i32* %{{.+}}, i32 1, i32 1) +// CHECK: [[LVAR_VOID_PTR:%.+]] = call i8* @__kmpc_alloc(i32 [[GTID:%.+]], i64 8, i8* inttoptr (i64 5 to i8*)) +// CHECK: [[LVAR_PRIV:%.+]] = bitcast i8* [[LVAR_VOID_PTR]] to i64* +// CHECK: call {{.+}} @__kmpc_for_static_init_4(%{{.+}}* @{{.+}}, i32 [[GTID]], i32 34, i32* [[IS_LAST_ADDR:%.+]], i32* %{{.+}}, i32* %{{.+}}, i32* %{{.+}}, i32 1, i32 1) // CHECK: [[PVAR_VAL:%.+]] = load float*, float** [[PVAR_START]], // CHECK: [[CNT:%.+]] = load i32, i32* // CHECK: [[MUL:%.+]] = mul nsw i32 [[CNT]], 3 @@ -400,6 +414,7 @@ int main() { // CHECK: [[ADD:%.+]] = add nsw i64 [[LVAR_VAL]], 3 // CHECK: store i64 [[ADD]], i64* [[LVAR_PRIV]], // CHECK: call void @__kmpc_for_static_fini(%{{.+}}* @{{.+}}, i32 %{{.+}}) +// CHECK: call void @__kmpc_free(i32 [[GTID]], i8* [[LVAR_VOID_PTR]], i8* inttoptr (i64 5 to i8*)) // CHECK: call void @__kmpc_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], i{{[0-9]+}} [[GTID]]) // CHECK: ret void diff --git a/test/OpenMP/for_linear_messages.cpp b/test/OpenMP/for_linear_messages.cpp index f35e5343c3..c984aa5a9f 100644 --- a/test/OpenMP/for_linear_messages.cpp +++ b/test/OpenMP/for_linear_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; namespace X { int x; }; @@ -117,7 +118,7 @@ template<class I, class C> int foomain(I argc, C **argv) { for (int k = 0; k < argc; ++k) ++k; #pragma omp for linear (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; - #pragma omp for linear (argc : 5) + #pragma omp for linear (argc : 5) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp for linear (S1) // expected-error {{'S1' does not refer to a value}} for (int k = 0; k < argc; ++k) ++k; diff --git a/test/OpenMP/for_loop_messages.cpp b/test/OpenMP/for_loop_messages.cpp index 8817c77acf..f5ee0d4442 100644 --- a/test/OpenMP/for_loop_messages.cpp +++ b/test/OpenMP/for_loop_messages.cpp @@ -287,6 +287,26 @@ int test_iteration_spaces() { c[ii] = a[ii]; #pragma omp parallel +// expected-error@+3 {{the loop initializer expression depends on the current loop control variable}} +// expected-error@+2 2 {{the loop condition expression depends on the current loop control variable}} +#pragma omp for + for (ii = ii * 10 + 25; ii < ii / ii - 23; ii += 1) + c[ii] = a[ii]; + +// expected-error@+3 {{expected loop invariant expression or '<invariant1> * ii + <invariant2>' kind of expression}} +#pragma omp for collapse(2) + for (ii = 10 + 25; ii < 1000; ii += 1) + for (kk = ii * 10 + 25; kk < ii / ii - 23; kk += 1) + ; + +// expected-error@+4 {{expected loop invariant expression or '<invariant1> * ii + <invariant2>' kind of expression}} +#pragma omp for collapse(3) + for (ii = 10 + 25; ii < 1000; ii += 1) + for (jj = 10 + 25; jj < 1000; jj += 1) + for (kk = ii * 10 + 25; kk < jj - 23; kk += 1) + ; + +#pragma omp parallel // expected-note@+2 {{defined as firstprivate}} // expected-error@+2 {{loop iteration variable in the associated loop of 'omp for' directive may not be firstprivate, predetermined as private}} #pragma omp for firstprivate(ii) @@ -588,6 +608,14 @@ int test_with_random_access_iterator() { for (Iter1 I; I < end1; ++I) { } GoodIter1 I1, E1; +// expected-error@+4 {{expected an integer or a pointer type of the outer loop counter 'I' for non-rectangular nests}} +// expected-error@+4 {{expected an integer or a pointer type of the outer loop counter 'I' for non-rectangular nests}} +#pragma omp for collapse(3) + for (GoodIter1 I = I1; I < E1; I++) // expected-note 2 {{'I' declared here}} + for (int i = (I - I1) * 10 + 25; i < 23; i += 1) + for (int j = 10 + 25; j < 23 + (I - E1); j += 1) + ; + #pragma omp for for (GoodIter1 I = I1; I < E1; I++) ; @@ -596,9 +624,36 @@ int test_with_random_access_iterator() { template <typename IT, int ST> class TC { + int ii, iii, kk; public: int dotest_lt(IT begin, IT end) { #pragma omp parallel +// expected-error@+3 3 {{the loop initializer expression depends on the current loop control variable}} +// expected-error@+2 6 {{the loop condition expression depends on the current loop control variable}} +#pragma omp for + for (ii = ii * 10 + 25; ii < ii / ii - 23; ii += 1) + ; + +#pragma omp parallel +// expected-error@+4 2 {{expected loop invariant expression or '<invariant1> * ii + <invariant2>' kind of expression}} +// expected-error@+3 {{expected loop invariant expression or '<invariant1> * TC::ii + <invariant2>' kind of expression}} +#pragma omp for collapse(2) + for (ii = 10 + 25; ii < 1000; ii += 1) + for (iii = ii * 10 + 25; iii < ii / ii - 23; iii += 1) + ; + +#pragma omp parallel +// expected-error@+6 2 {{expected loop invariant expression or '<invariant1> * ii + <invariant2>' kind of expression}} +// expected-error@+5 {{expected loop invariant expression or '<invariant1> * TC::ii + <invariant2>' kind of expression}} +// expected-error@+5 2 {{expected loop invariant expression or '<invariant1> * ii + <invariant2>' kind of expression}} +// expected-error@+4 {{expected loop invariant expression or '<invariant1> * TC::ii + <invariant2>' kind of expression}} +#pragma omp for collapse(3) + for (ii = 10 + 25; ii < 1000; ii += 1) + for (iii = ii * 10 + 25; iii < ii / ii - 23; iii += 1) + for (kk = ii * 10 + 25; kk < iii - 23; kk += 1) + ; + +#pragma omp parallel // expected-note@+3 {{loop step is expected to be positive due to this condition}} // expected-error@+2 {{increment expression must cause 'I' to increase on each iteration of OpenMP for loop}} #pragma omp for @@ -659,7 +714,7 @@ void test_with_template() { GoodIter begin, end; TC<GoodIter, 100> t1; TC<GoodIter, -100> t2; - t1.dotest_lt(begin, end); + t1.dotest_lt(begin, end); // expected-note {{in instantiation of member function 'TC<GoodIter, 100>::dotest_lt' requested here}} t2.dotest_lt(begin, end); // expected-note {{in instantiation of member function 'TC<GoodIter, -100>::dotest_lt' requested here}} dotest_gt(begin, end); // expected-note {{in instantiation of function template specialization 'dotest_gt<GoodIter, 0>' requested here}} dotest_gt<unsigned, 10>(0, 100); // expected-note {{in instantiation of function template specialization 'dotest_gt<unsigned int, 10>' requested here}} diff --git a/test/OpenMP/for_ordered_clause.cpp b/test/OpenMP/for_ordered_clause.cpp index ec29a989d0..7ccf570def 100644 --- a/test/OpenMP/for_ordered_clause.cpp +++ b/test/OpenMP/for_ordered_clause.cpp @@ -47,7 +47,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here} for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i - ST]; // expected-error 2 {{expected 2 for loops after '#pragma omp for', but found only 1}} // expected-error@+6 2 {{directive '#pragma omp for' cannot contain more than one 'ordered' clause}} -// expected-error@+5 2 {{argument to 'ordered' clause must be a strictly positive integer value}} +// expected-error@+5 {{argument to 'ordered' clause must be a strictly positive integer value}} // expected-error@+4 2 {{expression is not an integral constant expression}} #if __cplusplus >= 201103L // expected-note@+2 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} @@ -113,7 +113,7 @@ int main(int argc, char **argv) { // expected-note@+4 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif // expected-error@+2 2 {{directive '#pragma omp for' cannot contain more than one 'ordered' clause}} -// expected-error@+1 2 {{argument to 'ordered' clause must be a strictly positive integer value}} +// expected-error@+1 {{argument to 'ordered' clause must be a strictly positive integer value}} #pragma omp for ordered(foobool(argc)), ordered(true), ordered(-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i - 4]; diff --git a/test/OpenMP/for_private_messages.cpp b/test/OpenMP/for_private_messages.cpp index 5b0b562869..44a05f709f 100644 --- a/test/OpenMP/for_private_messages.cpp +++ b/test/OpenMP/for_private_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; void foo() { } @@ -116,7 +117,7 @@ int foomain(I argc, C **argv) { #pragma omp for private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp for private(argc) +#pragma omp for private(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp for private(S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/for_reduction_codegen_UDR.cpp b/test/OpenMP/for_reduction_codegen_UDR.cpp index 7adca3eb80..8cb88f61c1 100644 --- a/test/OpenMP/for_reduction_codegen_UDR.cpp +++ b/test/OpenMP/for_reduction_codegen_UDR.cpp @@ -10,6 +10,19 @@ #ifndef HEADER #define HEADER +enum omp_allocator_handle_t { + omp_null_allocator = 0, + omp_default_mem_alloc = 1, + omp_large_cap_mem_alloc = 2, + omp_const_mem_alloc = 3, + omp_high_bw_mem_alloc = 4, + omp_low_lat_mem_alloc = 5, + omp_cgroup_mem_alloc = 6, + omp_pteam_mem_alloc = 7, + omp_thread_mem_alloc = 8, + KMP_ALLOCATOR_MAX_HANDLE = __UINTPTR_MAX__ +}; + volatile double g, g_orig; volatile double &g1 = g_orig; @@ -124,7 +137,7 @@ int main() { for (int i = 0; i < 10; ++i) ; #pragma omp parallel -#pragma omp for reduction(& : var3) +#pragma omp for reduction(& : var3) allocate(omp_cgroup_mem_alloc: var3) for (int i = 0; i < 10; ++i) ; return tmain<int, 42>(); @@ -778,7 +791,6 @@ int main() { // CHECK: define internal void [[MAIN_MICROTASK6]](i{{[0-9]+}}* noalias [[GTID_ADDR:%.+]], i{{[0-9]+}}* noalias %{{.+}}, [4 x [[S_FLOAT_TY]]]* dereferenceable(48) %{{.+}}) // CHECK: [[VAR3_ORIG_ADDR:%.+]] = alloca [4 x [[S_FLOAT_TY]]]*, -// CHECK: [[VAR3_PRIV:%.+]] = alloca [4 x [[S_FLOAT_TY]]], // Reduction list for runtime. // CHECK: [[RED_LIST:%.+]] = alloca [1 x i8*], @@ -788,12 +800,14 @@ int main() { // CHECK: [[VAR3_ORIG:%.+]] = load [4 x [[S_FLOAT_TY]]]*, [4 x [[S_FLOAT_TY]]]** [[VAR3_ORIG_ADDR]], // CHECK: store [4 x [[S_FLOAT_TY]]]* [[VAR3_ORIG]], [4 x [[S_FLOAT_TY]]]** [[VAR3_ORIG_ADDR:%.+]], // CHECK: [[VAR3_ORIG:%.+]] = load [4 x [[S_FLOAT_TY]]]*, [4 x [[S_FLOAT_TY]]]** [[VAR3_ORIG_ADDR]], +// CHECK: [[VAR3_VOID_PTR:%.+]] = call i8* @__kmpc_alloc(i32 [[GTID:%.+]], i64 48, i8* inttoptr (i64 6 to i8*)) +// CHECK: [[VAR3_PRIV:%.+]] = bitcast i8* [[VAR3_VOID_PTR]] to [4 x %struct.S]* // CHECK: getelementptr inbounds [4 x [[S_FLOAT_TY]]], [4 x [[S_FLOAT_TY]]]* [[VAR3_PRIV]], i32 0, i32 0 // CHECK: bitcast [4 x [[S_FLOAT_TY]]]* [[VAR3_ORIG]] to [[S_FLOAT_TY]]* // CHECK: getelementptr [[S_FLOAT_TY]], [[S_FLOAT_TY]]* %{{.+}}, i64 4 // CHECK: store [4 x [[S_FLOAT_TY]]]* [[VAR3_PRIV]], [4 x [[S_FLOAT_TY]]]** % - +// CHECK: call void @__kmpc_free(i32 [[GTID]], i8* [[VAR3_VOID_PTR]], i8* inttoptr (i64 6 to i8*)) // CHECK: ret void // CHECK: define {{.*}} i{{[0-9]+}} [[TMAIN_INT_42]]() diff --git a/test/OpenMP/for_reduction_messages.cpp b/test/OpenMP/for_reduction_messages.cpp index f575ee463d..397e54f1fc 100644 --- a/test/OpenMP/for_reduction_messages.cpp +++ b/test/OpenMP/for_reduction_messages.cpp @@ -6,6 +6,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s +extern int omp_default_mem_alloc; void foo() { } @@ -295,7 +296,7 @@ int main(int argc, char **argv) { for (int i = 0; i < 10; ++i) foo(); #pragma omp parallel -#pragma omp for reduction(&& : argc) +#pragma omp for reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int i = 0; i < 10; ++i) foo(); #pragma omp parallel diff --git a/test/OpenMP/for_simd_ast_print.cpp b/test/OpenMP/for_simd_ast_print.cpp index 13e82b4647..d626994bf8 100644 --- a/test/OpenMP/for_simd_ast_print.cpp +++ b/test/OpenMP/for_simd_ast_print.cpp @@ -90,7 +90,7 @@ template<class T> struct S { // CHECK: T res; // CHECK: T val; // CHECK: T lin = 0; - #pragma omp for simd private(val) safelen(7) linear(lin : -5) lastprivate(res) simdlen(5) + #pragma omp for simd private(val) safelen(7) linear(lin : -5) lastprivate(res) simdlen(5) allocate(res) // CHECK-NEXT: #pragma omp for simd private(val) safelen(7) linear(lin: -5) lastprivate(res) simdlen(5) for (T i = 7; i < m_a; ++i) { val = v[i-7] + m_a; @@ -117,7 +117,7 @@ template<class T> struct S { template<int LEN> struct S2 { static void func(int n, float *a, float *b, float *c) { int k1 = 0, k2 = 0; -#pragma omp for simd safelen(LEN) linear(k1,k2:LEN) aligned(a:LEN) simdlen(LEN) +#pragma omp for simd allocate(k1) safelen(LEN) linear(k1,k2:LEN) aligned(a:LEN) simdlen(LEN) for(int i = 0; i < n; i++) { c[i] = a[i] + b[i]; c[k1] = a[k1] + b[k1]; @@ -132,7 +132,7 @@ template<int LEN> struct S2 { // CHECK: template<> struct S2<4> { // CHECK-NEXT: static void func(int n, float *a, float *b, float *c) { // CHECK-NEXT: int k1 = 0, k2 = 0; -// CHECK-NEXT: #pragma omp for simd safelen(4) linear(k1,k2: 4) aligned(a: 4) simdlen(4) +// CHECK-NEXT: #pragma omp for simd allocate(k1) safelen(4) linear(k1,k2: 4) aligned(a: 4) simdlen(4) // CHECK-NEXT: for (int i = 0; i < n; i++) { // CHECK-NEXT: c[i] = a[i] + b[i]; // CHECK-NEXT: c[k1] = a[k1] + b[k1]; diff --git a/test/OpenMP/for_simd_collapse_messages.cpp b/test/OpenMP/for_simd_collapse_messages.cpp index 9e9b8ee675..f5c130f30a 100644 --- a/test/OpenMP/for_simd_collapse_messages.cpp +++ b/test/OpenMP/for_simd_collapse_messages.cpp @@ -39,7 +39,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} #pragma omp for simd collapse ((ST > 0) ? 1 + ST : 2) // expected-note 2 {{as specified in 'collapse' clause}} for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; // expected-error 2 {{expected 2 for loops after '#pragma omp for simd', but found only 1}} // expected-error@+6 2 {{directive '#pragma omp for simd' cannot contain more than one 'collapse' clause}} - // expected-error@+5 2 {{argument to 'collapse' clause must be a strictly positive integer value}} + // expected-error@+5 {{argument to 'collapse' clause must be a strictly positive integer value}} // expected-error@+4 2 {{expression is not an integral constant expression}} #if __cplusplus >= 201103L // expected-note@+2 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} @@ -86,7 +86,7 @@ int main(int argc, char **argv) { // expected-note@+4 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif // expected-error@+2 2 {{directive '#pragma omp for simd' cannot contain more than one 'collapse' clause}} - // expected-error@+1 2 {{argument to 'collapse' clause must be a strictly positive integer value}} + // expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}} #pragma omp for simd collapse (foobool(argc)), collapse (true), collapse (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; #pragma omp for simd collapse (S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/for_simd_firstprivate_messages.cpp b/test/OpenMP/for_simd_firstprivate_messages.cpp index ceacdb6a53..b6b51d8686 100644 --- a/test/OpenMP/for_simd_firstprivate_messages.cpp +++ b/test/OpenMP/for_simd_firstprivate_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; void foo() { } @@ -93,7 +94,7 @@ int foomain(int argc, char **argv) { for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel -#pragma omp for simd firstprivate(argc) +#pragma omp for simd firstprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel diff --git a/test/OpenMP/for_simd_lastprivate_messages.cpp b/test/OpenMP/for_simd_lastprivate_messages.cpp index a4bed93365..b3589d90d7 100644 --- a/test/OpenMP/for_simd_lastprivate_messages.cpp +++ b/test/OpenMP/for_simd_lastprivate_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; void foo() { } @@ -95,7 +96,7 @@ int foomain(int argc, char **argv) { for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel -#pragma omp for simd lastprivate(argc) +#pragma omp for simd lastprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel diff --git a/test/OpenMP/for_simd_linear_messages.cpp b/test/OpenMP/for_simd_linear_messages.cpp index a87b1ab115..ffa2233b55 100644 --- a/test/OpenMP/for_simd_linear_messages.cpp +++ b/test/OpenMP/for_simd_linear_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; namespace X { int x; }; @@ -117,7 +118,7 @@ template<class I, class C> int foomain(I argc, C **argv) { for (int k = 0; k < argc; ++k) ++k; #pragma omp for simd linear (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; - #pragma omp for simd linear (argc : 5) + #pragma omp for simd linear (argc : 5) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp for simd linear (S1) // expected-error {{'S1' does not refer to a value}} for (int k = 0; k < argc; ++k) ++k; diff --git a/test/OpenMP/for_simd_private_messages.cpp b/test/OpenMP/for_simd_private_messages.cpp index 8fe6d7b721..ff3249e64c 100644 --- a/test/OpenMP/for_simd_private_messages.cpp +++ b/test/OpenMP/for_simd_private_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; void foo() { } @@ -116,7 +117,7 @@ int foomain(I argc, C **argv) { #pragma omp for simd private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp for simd private(argc) +#pragma omp for simd private(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp for simd private(S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/for_simd_reduction_messages.cpp b/test/OpenMP/for_simd_reduction_messages.cpp index 12368efccf..c4bed65d98 100644 --- a/test/OpenMP/for_simd_reduction_messages.cpp +++ b/test/OpenMP/for_simd_reduction_messages.cpp @@ -6,6 +6,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 %s // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 %s +extern int omp_default_mem_alloc; void foo() { } @@ -137,7 +138,7 @@ T tmain(T argc) { for (int i = 0; i < 10; ++i) foo(); #pragma omp parallel -#pragma omp for simd reduction(&& : argc) +#pragma omp for simd reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int i = 0; i < 10; ++i) foo(); #pragma omp parallel diff --git a/test/OpenMP/for_simd_safelen_messages.cpp b/test/OpenMP/for_simd_safelen_messages.cpp index 31b0f84cba..6868b938c2 100644 --- a/test/OpenMP/for_simd_safelen_messages.cpp +++ b/test/OpenMP/for_simd_safelen_messages.cpp @@ -39,7 +39,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} #pragma omp for simd safelen ((ST > 0) ? 1 + ST : 2) for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; // expected-error@+6 2 {{directive '#pragma omp for simd' cannot contain more than one 'safelen' clause}} - // expected-error@+5 2 {{argument to 'safelen' clause must be a strictly positive integer value}} + // expected-error@+5 {{argument to 'safelen' clause must be a strictly positive integer value}} // expected-error@+4 2 {{expression is not an integral constant expression}} #if __cplusplus >= 201103L // expected-note@+2 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} @@ -84,7 +84,7 @@ int main(int argc, char **argv) { // expected-note@+4 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif // expected-error@+2 2 {{directive '#pragma omp for simd' cannot contain more than one 'safelen' clause}} - // expected-error@+1 2 {{argument to 'safelen' clause must be a strictly positive integer value}} + // expected-error@+1 {{argument to 'safelen' clause must be a strictly positive integer value}} #pragma omp for simd safelen (foobool(argc)), safelen (true), safelen (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; #pragma omp for simd safelen (S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/for_simd_simdlen_messages.cpp b/test/OpenMP/for_simd_simdlen_messages.cpp index 09954283a1..86cc4690a9 100644 --- a/test/OpenMP/for_simd_simdlen_messages.cpp +++ b/test/OpenMP/for_simd_simdlen_messages.cpp @@ -39,7 +39,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} #pragma omp for simd simdlen ((ST > 0) ? 1 + ST : 2) for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; // expected-error@+6 2 {{directive '#pragma omp for simd' cannot contain more than one 'simdlen' clause}} - // expected-error@+5 2 {{argument to 'simdlen' clause must be a strictly positive integer value}} + // expected-error@+5 {{argument to 'simdlen' clause must be a strictly positive integer value}} // expected-error@+4 2 {{expression is not an integral constant expression}} #if __cplusplus >= 201103L // expected-note@+2 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} @@ -84,7 +84,7 @@ int main(int argc, char **argv) { // expected-note@+4 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif // expected-error@+2 2 {{directive '#pragma omp for simd' cannot contain more than one 'simdlen' clause}} - // expected-error@+1 2 {{argument to 'simdlen' clause must be a strictly positive integer value}} + // expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}} #pragma omp for simd simdlen (foobool(argc)), simdlen (true), simdlen (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; #pragma omp for simd simdlen (S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/master_messages.cpp b/test/OpenMP/master_messages.cpp index 26d6bc8e9f..702da24b63 100644 --- a/test/OpenMP/master_messages.cpp +++ b/test/OpenMP/master_messages.cpp @@ -28,7 +28,7 @@ int main() { #pragma omp single for (int i = 0; i < 10; ++i) { foo(); - #pragma omp master // expected-error {{region cannot be closely nested inside 'single' region}} + #pragma omp master allocate(i) // expected-error {{region cannot be closely nested inside 'single' region}} expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp master'}} foo(); } #pragma omp master diff --git a/test/OpenMP/nesting_of_regions.cpp b/test/OpenMP/nesting_of_regions.cpp index 0955ee2155..fc9230c687 100644 --- a/test/OpenMP/nesting_of_regions.cpp +++ b/test/OpenMP/nesting_of_regions.cpp @@ -4080,6 +4080,13 @@ void foo() { } #pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}} { +#pragma omp teams // expected-note {{directive outside teams construct here}} + ++a; +#pragma omp teams // expected-note {{nested teams construct here}} + ++a; + } +#pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}} + { ++a; // expected-note {{statement outside teams construct here}} #pragma omp teams // expected-note {{nested teams construct here}} ++a; @@ -12693,6 +12700,13 @@ void foo() { } #pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}} { +#pragma omp teams // expected-note {{directive outside teams construct here}} + ++a; +#pragma omp teams // expected-note {{nested teams construct here}} + ++a; + } +#pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}} + { ++a; // expected-note {{statement outside teams construct here}} #pragma omp teams // expected-note {{nested teams construct here}} ++a; diff --git a/test/OpenMP/nvptx_SPMD_codegen.cpp b/test/OpenMP/nvptx_SPMD_codegen.cpp index 738bbf34f7..5fa820fcba 100644 --- a/test/OpenMP/nvptx_SPMD_codegen.cpp +++ b/test/OpenMP/nvptx_SPMD_codegen.cpp @@ -8,6 +8,8 @@ #ifndef HEADER #define HEADER +int a; + // CHECK-NOT: @__omp_offloading_{{.+}}_exec_mode = weak constant i8 1 // CHECK-DAG: [[DISTR_LIGHT:@.+]] = private unnamed_addr constant %struct.ident_t { i32 0, i32 2050, i32 3, i32 0, i8* getelementptr inbounds // CHECK-DAG: [[FOR_LIGHT:@.+]] = private unnamed_addr constant %struct.ident_t { i32 0, i32 514, i32 3, i32 0, i8* getelementptr inbounds @@ -43,7 +45,7 @@ void foo() { // CHECK: call void @__kmpc_spmd_kernel_init(i32 {{.+}}, i16 1, i16 {{.+}}) // CHECK-DAG: [[DISTR_FULL]] // CHECK-DAG: [[FULL]] -#pragma omp target teams distribute parallel for simd +#pragma omp target teams distribute parallel for simd if(a) for (int i = 0; i < 10; ++i) ; #pragma omp target teams distribute parallel for simd schedule(static) @@ -301,7 +303,7 @@ int a; // CHECK-DAG: [[FULL]] // CHECK: call void @__kmpc_spmd_kernel_init(i32 {{.+}}, i16 1, i16 {{.+}}) // CHECK-DAG: [[FULL]] -#pragma omp target parallel for +#pragma omp target parallel for if(a) for (int i = 0; i < 10; ++i) ; #pragma omp target parallel for schedule(static) @@ -346,7 +348,7 @@ int a; // CHECK: call void @__kmpc_spmd_kernel_init(i32 {{.+}}, i16 1, i16 {{.+}}) // CHECK-DAG: [[FULL]] // CHECK-DAG: [[BAR_FULL]] -#pragma omp target parallel +#pragma omp target parallel if(a) #pragma omp for simd for (int i = 0; i < 10; ++i) ; diff --git a/test/OpenMP/nvptx_allocate_codegen.cpp b/test/OpenMP/nvptx_allocate_codegen.cpp new file mode 100644 index 0000000000..9a285d0d09 --- /dev/null +++ b/test/OpenMP/nvptx_allocate_codegen.cpp @@ -0,0 +1,107 @@ +// RUN: %clang_cc1 -verify -fopenmp -triple x86_64-apple-darwin10.6.0 -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc -o %t-host.bc %s +// RUN: %clang_cc1 -verify -fopenmp -triple nvptx64-nvidia-cuda -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-host.bc -o - | FileCheck %s +// expected-no-diagnostics + +#ifndef HEADER +#define HEADER + +#pragma omp declare target +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + +// CHECK-DAG: @{{.+}}St1{{.+}}b{{.+}} = external global i32, +// CHECK-DAG: @a = global i32 0, +// CHECK-DAG: @b = addrspace(4) global i32 0, +// CHECK-DAG: @c = global i32 0, +// CHECK-DAG: @d = global %struct.St1 zeroinitializer, +// CHECK-DAG: @{{.+}}ns{{.+}}a{{.+}} = addrspace(3) global i32 0, +// CHECK-DAG: @{{.+}}main{{.+}}a{{.*}} = internal global i32 0, +// CHECK-DAG: @{{.+}}ST{{.+}}m{{.+}} = external global i32, +// CHECK-DAG: @bar_c = internal global i32 0, +// CHECK-DAG: @bar_b = internal addrspace(3) global double 0.000000e+00, +struct St{ + int a; +}; + +struct St1{ + int a; + static int b; +#pragma omp allocate(b) allocator(omp_default_mem_alloc) +} d; + +int a, b, c; +#pragma omp allocate(a) allocator(omp_large_cap_mem_alloc) +#pragma omp allocate(b) allocator(omp_const_mem_alloc) +#pragma omp allocate(d, c) allocator(omp_high_bw_mem_alloc) + +template <class T> +struct ST { + static T m; + #pragma omp allocate(m) allocator(omp_low_lat_mem_alloc) +}; + +template <class T> T foo() { + T v; + #pragma omp allocate(v) allocator(omp_cgroup_mem_alloc) + v = ST<T>::m; + return v; +} + +namespace ns{ + int a; +} +#pragma omp allocate(ns::a) allocator(omp_pteam_mem_alloc) + +// CHECK-LABEL: @main +int main () { + // CHECK: alloca double, + static int a; +#pragma omp allocate(a) allocator(omp_thread_mem_alloc) + a=2; + double b = 3; + float c; +#pragma omp allocate(b) allocator(omp_default_mem_alloc) +#pragma omp allocate(c) allocator(omp_cgroup_mem_alloc) + return (foo<int>()); +} + +// CHECK: define {{.*}}i32 @{{.+}}foo{{.+}}() +// CHECK-NOT: alloca i32, + +extern template int ST<int>::m; + +void baz(float &); + +// CHECK: define void @{{.+}}bar{{.+}}() +void bar() { + // CHECK: alloca float, + float bar_a; + // CHECK: alloca double, + double bar_b; + int bar_c; +#pragma omp allocate(bar_c) allocator(omp_cgroup_mem_alloc) + // CHECK: call void [[OUTLINED:@.+]](i32* %{{.+}}, i32* %{{.+}}) +#pragma omp parallel private(bar_a, bar_b) allocate(omp_thread_mem_alloc \ + : bar_a) allocate(omp_pteam_mem_alloc \ + : bar_b) + { + bar_b = bar_a; + baz(bar_a); + } +// CHECK: define internal void [[OUTLINED]](i32* noalias %{{.+}}, i32* noalias %{{.+}}) +// CHECK-NOT: alloca double, +// CHECK: alloca float, +// CHECK-NOT: alloca double, +// CHECK: load float, float* % +// CHECK: store double {{.+}}, double addrspace(3)* @bar_b, +} + +#pragma omp end declare target +#endif diff --git a/test/OpenMP/nvptx_allocate_messages.cpp b/test/OpenMP/nvptx_allocate_messages.cpp new file mode 100644 index 0000000000..e6fb83f634 --- /dev/null +++ b/test/OpenMP/nvptx_allocate_messages.cpp @@ -0,0 +1,91 @@ +// RUN: %clang_cc1 -verify -fopenmp -triple x86_64-apple-darwin10.6.0 -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc -o %t-host.bc %s +// RUN: %clang_cc1 -verify -DDEVICE -fopenmp -triple nvptx64-nvidia-cuda -fopenmp-targets=nvptx64-nvidia-cuda -fsyntax-only %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-host.bc +// RUN: %clang_cc1 -verify -DDEVICE -DREQUIRES -fopenmp -triple nvptx64-nvidia-cuda -fopenmp-targets=nvptx64-nvidia-cuda -fsyntax-only %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-host.bc +#if !defined(DEVICE) || defined(REQUIRES) +// expected-no-diagnostics +#endif // DEVICE + +#ifndef HEADER +#define HEADER + +#if defined(REQUIRES) && defined(DEVICE) +#pragma omp requires dynamic_allocators +#endif // REQUIRES && DEVICE + +int bar() { + int res = 0; +#if defined(DEVICE) && !defined(REQUIRES) +// expected-error@+2 {{expected an 'allocator' clause inside of the target region; provide an 'allocator' clause or use 'requires' directive with the 'dynamic_allocators' clause}} +#endif // DEVICE && !REQUIRES +#pragma omp allocate(res) + return 0; +} + +#pragma omp declare target +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + +struct St{ + int a; +}; + +struct St1{ + int a; + static int b; +#pragma omp allocate(b) allocator(omp_default_mem_alloc) +} d; + +int a, b, c; +#pragma omp allocate(a) allocator(omp_large_cap_mem_alloc) +#pragma omp allocate(b) allocator(omp_const_mem_alloc) +#pragma omp allocate(d, c) allocator(omp_high_bw_mem_alloc) + +template <class T> +struct ST { + static T m; + #pragma omp allocate(m) allocator(omp_low_lat_mem_alloc) +}; + +template <class T> T foo() { + T v; + #pragma omp allocate(v) allocator(omp_cgroup_mem_alloc) + v = ST<T>::m; +#if defined(DEVICE) && !defined(REQUIRES) +// expected-error@+2 2 {{expected an allocator expression inside of the target region; provide an allocator expression or use 'requires' directive with the 'dynamic_allocators' clause}} +#endif // DEVICE && !REQUIRES +#pragma omp parallel private(v) allocate(v) + v = 0; + return v; +} + +namespace ns{ + int a; +} +#pragma omp allocate(ns::a) allocator(omp_pteam_mem_alloc) + +int main () { + static int a; +#pragma omp allocate(a) allocator(omp_thread_mem_alloc) + a=2; + double b = 3; +#if defined(DEVICE) && !defined(REQUIRES) +// expected-error@+2 {{expected an 'allocator' clause inside of the target region; provide an 'allocator' clause or use 'requires' directive with the 'dynamic_allocators' clause}} +#endif // DEVICE && !REQUIRES +#pragma omp allocate(b) +#if defined(DEVICE) && !defined(REQUIRES) +// expected-note@+3 {{in instantiation of function template specialization 'foo<int>' requested here}} +// expected-note@+2 {{called by 'main'}} +#endif // DEVICE && !REQUIRES + return (foo<int>() + bar()); +} + +extern template int ST<int>::m; +#pragma omp end declare target +#endif diff --git a/test/OpenMP/nvptx_asm_delayed_diags.c b/test/OpenMP/nvptx_asm_delayed_diags.c new file mode 100644 index 0000000000..fa6128b60b --- /dev/null +++ b/test/OpenMP/nvptx_asm_delayed_diags.c @@ -0,0 +1,118 @@ +// RUN: %clang_cc1 -fopenmp -x c -triple i386-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm-bc %s -o %t-x86-host.bc +// RUN: %clang_cc1 -verify -fopenmp -x c -triple nvptx-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -fsyntax-only -Wuninitialized +// RUN: %clang_cc1 -verify -DDIAGS -DIMMEDIATE -fopenmp -x c -triple nvptx-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -fsyntax-only -Wuninitialized +// RUN: %clang_cc1 -verify -DDIAGS -DDELAYED -fopenmp -x c -triple nvptx-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -fsyntax-only -Wuninitialized +// REQUIRES: x86-registered-target +// REQUIRES: nvptx-registered-target + +#ifndef DIAGS +// expected-no-diagnostics +#endif // DIAGS + +#ifdef IMMEDIATE +#pragma omp declare target +#endif //IMMEDIATE +void t1(int r) { +#ifdef DIAGS +// expected-error@+4 {{invalid input constraint 'mx' in asm}} +#endif // DIAGS + __asm__("PR3908 %[lf] %[xx] %[li] %[r]" + : [ r ] "+r"(r) + : [ lf ] "mx"(0), [ li ] "mr"(0), [ xx ] "x"((double)(0))); +} + +unsigned t2(signed char input) { + unsigned output; +#ifdef DIAGS +// expected-error@+3 {{invalid output constraint '=a' in asm}} +#endif // DIAGS + __asm__("xyz" + : "=a"(output) + : "0"(input)); + return output; +} + +double t3(double x) { + register long double result; +#ifdef DIAGS +// expected-error@+3 {{invalid output constraint '=t' in asm}} +#endif // DIAGS + __asm __volatile("frndint" + : "=t"(result) + : "0"(x)); + return result; +} + +unsigned char t4(unsigned char a, unsigned char b) { + unsigned int la = a; + unsigned int lb = b; + unsigned int bigres; + unsigned char res; +#ifdef DIAGS +// expected-error@+3 {{invalid output constraint '=la' in asm}} +#endif // DIAGS + __asm__("0:\n1:\n" + : [ bigres ] "=la"(bigres) + : [ la ] "0"(la), [ lb ] "c"(lb) + : "edx", "cc"); + res = bigres; + return res; +} + +void t5(void) { +#ifdef DIAGS +// expected-error@+6 {{unknown register name 'st' in asm}} +#endif // DIAGS + __asm__ __volatile__( + "finit" + : + : + : "st", "st(1)", "st(2)", "st(3)", + "st(4)", "st(5)", "st(6)", "st(7)", + "fpsr", "fpcr"); +} + +typedef long long __m256i __attribute__((__vector_size__(32))); +void t6(__m256i *p) { +#ifdef DIAGS +// expected-error@+3 {{unknown register name 'ymm0' in asm}} +#endif // DIAGS + __asm__ volatile("vmovaps %0, %%ymm0" ::"m"(*(__m256i *)p) + : "ymm0"); +} +#ifdef IMMEDIATE +#pragma omp end declare target +#endif //IMMEDIATE + +int main() { +#ifdef DELAYED +#pragma omp target +#endif // DELAYED + { +#ifdef DELAYED +// expected-note@+2 {{called by 'main'}} +#endif // DELAYED + t1(0); +#ifdef DELAYED +// expected-note@+2 {{called by 'main'}} +#endif // DELAYED + t2(0); +#ifdef DELAYED +// expected-note@+2 {{called by 'main'}} +#endif // DELAYED + t3(0); +#ifdef DELAYED +// expected-note@+2 {{called by 'main'}} +#endif // DELAYED + t4(0, 0); +#ifdef DELAYED +// expected-note@+2 {{called by 'main'}} +#endif // DELAYED + t5(); +#ifdef DELAYED +// expected-note@+2 {{called by 'main'}} +#endif // DELAYED + t6(0); + } + return 0; +} diff --git a/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp b/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp index d9056eeff5..9470aa7972 100644 --- a/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp +++ b/test/OpenMP/nvptx_distribute_parallel_generic_mode_codegen.cpp @@ -24,29 +24,22 @@ int main(int argc, char **argv) { // CHECK: [[MEM_TY:%.+]] = type { [128 x i8] } // CHECK-DAG: [[SHARED_GLOBAL_RD:@.+]] = common addrspace(3) global [[MEM_TY]] zeroinitializer // CHECK-DAG: [[KERNEL_PTR:@.+]] = internal addrspace(3) global i8* null -// CHECK-DAG: [[KERNEL_SIZE:@.+]] = internal unnamed_addr constant i{{64|32}} 84 -// CHECK-DAG: @__omp_offloading_{{.*}}_main_l17_exec_mode = weak constant i8 1 - -// CHECK-LABEL: define internal void @__omp_offloading_{{.*}}_main_l17_worker( +// CHECK-DAG: [[KERNEL_SIZE:@.+]] = internal unnamed_addr constant i{{64|32}} 40 +// CHECK-DAG: @__omp_offloading_{{.*}}_main_l17_exec_mode = weak constant i8 0 // CHECK: define weak void @__omp_offloading_{{.*}}_main_l17([10 x i32]* dereferenceable(40) %{{.+}}, [10 x i32]* dereferenceable(40) %{{.+}}, i32* dereferenceable(4) %{{.+}}, i{{64|32}} %{{.+}}, [10 x i32]* dereferenceable(40) %{{.+}}) -// CHECK: call void @__kmpc_get_team_static_memory(i16 0, i8* addrspacecast (i8 addrspace(3)* getelementptr inbounds ([[MEM_TY]], [[MEM_TY]] addrspace(3)* [[SHARED_GLOBAL_RD]], i32 0, i32 0, i32 0) to i8*), i{{64|32}} 84, i16 1, i8** addrspacecast (i8* addrspace(3)* [[KERNEL_PTR]] to i8**)) +// CHECK: call void @__kmpc_get_team_static_memory(i16 1, i8* addrspacecast (i8 addrspace(3)* getelementptr inbounds ([[MEM_TY]], [[MEM_TY]] addrspace(3)* [[SHARED_GLOBAL_RD]], i32 0, i32 0, i32 0) to i8*), i{{64|32}} 40, i16 1, i8** addrspacecast (i8* addrspace(3)* [[KERNEL_PTR]] to i8**)) // CHECK: [[PTR:%.+]] = load i8*, i8* addrspace(3)* [[KERNEL_PTR]], // CHECK: [[STACK:%.+]] = bitcast i8* [[PTR]] to %struct._globalized_locals_ty* -// CHECK: [[ARGC:%.+]] = load i32, i32* %{{.+}}, align -// CHECK: [[ARGC_ADDR:%.+]] = getelementptr inbounds %struct._globalized_locals_ty, %struct._globalized_locals_ty* [[STACK]], i{{32|64}} 0, i{{32|64}} 0 -// CHECK: store i32 [[ARGC]], i32* [[ARGC_ADDR]], -// CHECK: getelementptr inbounds %struct._globalized_locals_ty, %struct._globalized_locals_ty* [[STACK]], i{{32|64}} 0, i{{32|64}} 1 -// CHECK: getelementptr inbounds %struct._globalized_locals_ty, %struct._globalized_locals_ty* [[STACK]], i{{32|64}} 0, i{{32|64}} 2 +// CHECK: getelementptr inbounds %struct._globalized_locals_ty, %struct._globalized_locals_ty* [[STACK]], i{{32|64}} 0, i{{32|64}} 0 +// CHECK-NOT: getelementptr inbounds %struct._globalized_locals_ty, %struct._globalized_locals_ty* [[STACK]], // CHECK: call void @__kmpc_for_static_init_4( -// CHECK: call void @__kmpc_serialized_parallel( // CHECK: call void [[PARALLEL:@.+]]( -// CHECK: call void @__kmpc_end_serialized_parallel( // CHECK: call void @__kmpc_for_static_fini(%struct.ident_t* @ -// CHECK: call void @__kmpc_restore_team_static_memory(i16 0, i16 1) +// CHECK: call void @__kmpc_restore_team_static_memory(i16 1, i16 1) // CHECK: define internal void [[PARALLEL]]( // CHECK-NOT: call i8* @__kmpc_data_sharing_push_stack( diff --git a/test/OpenMP/nvptx_target_codegen.cpp b/test/OpenMP/nvptx_target_codegen.cpp index b05ee9dee6..906ff928c4 100644 --- a/test/OpenMP/nvptx_target_codegen.cpp +++ b/test/OpenMP/nvptx_target_codegen.cpp @@ -5,21 +5,20 @@ // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple nvptx-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-32 // RUN: %clang_cc1 -verify -fopenmp -fexceptions -fcxx-exceptions -x c++ -triple nvptx-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-32 // expected-no-diagnostics + #ifndef HEADER #define HEADER // Check that the execution mode of all 7 target regions is set to Generic Mode. // CHECK-DAG: [[NONSPMD:@.+]] = private unnamed_addr constant %struct.ident_t { i32 0, i32 2, i32 0, i32 0, i8* getelementptr inbounds // CHECK-DAG: [[UNKNOWN:@.+]] = private unnamed_addr constant %struct.ident_t { i32 0, i32 2, i32 2, i32 0, i8* getelementptr inbounds -// CHECK-DAG: {{@__omp_offloading_.+l59}}_exec_mode = weak constant i8 1 -// CHECK-DAG: {{@__omp_offloading_.+l137}}_exec_mode = weak constant i8 1 -// CHECK-DAG: {{@__omp_offloading_.+l214}}_exec_mode = weak constant i8 1 -// CHECK-DAG: {{@__omp_offloading_.+l324}}_exec_mode = weak constant i8 1 -// CHECK-DAG: {{@__omp_offloading_.+l362}}_exec_mode = weak constant i8 1 -// CHECK-DAG: {{@__omp_offloading_.+l380}}_exec_mode = weak constant i8 1 -// CHECK-DAG: {{@__omp_offloading_.+l345}}_exec_mode = weak constant i8 1 -// CHECK-DAG: [[MAP_TY:%.+]] = type { [128 x i8] } -// CHECK-DAG: [[GLOB_TY:%.+]] = type { i32* } +// CHECK-DAG: {{@__omp_offloading_.+l45}}_exec_mode = weak constant i8 0 +// CHECK-DAG: {{@__omp_offloading_.+l123}}_exec_mode = weak constant i8 1 +// CHECK-DAG: {{@__omp_offloading_.+l200}}_exec_mode = weak constant i8 1 +// CHECK-DAG: {{@__omp_offloading_.+l310}}_exec_mode = weak constant i8 1 +// CHECK-DAG: {{@__omp_offloading_.+l348}}_exec_mode = weak constant i8 1 +// CHECK-DAG: {{@__omp_offloading_.+l366}}_exec_mode = weak constant i8 1 +// CHECK-DAG: {{@__omp_offloading_.+l331}}_exec_mode = weak constant i8 1 __thread int id; @@ -32,29 +31,16 @@ struct TT{ tx &operator[](int i) { return X; } }; -// CHECK: define weak void @__omp_offloading_{{.+}}_{{.+}}targetBar{{.+}}_l59(i32* [[PTR1:%.+]], i32** dereferenceable{{.*}} [[PTR2_REF:%.+]]) +// CHECK: define weak void @__omp_offloading_{{.+}}_{{.+}}targetBar{{.+}}_l45(i32* [[PTR1:%.+]], i32** dereferenceable{{.*}} [[PTR2_REF:%.+]]) // CHECK: store i32* [[PTR1]], i32** [[PTR1_ADDR:%.+]], // CHECK: store i32** [[PTR2_REF]], i32*** [[PTR2_REF_PTR:%.+]], // CHECK: [[PTR2_REF:%.+]] = load i32**, i32*** [[PTR2_REF_PTR]], -// CHECK: call void @__kmpc_kernel_init( -// CHECK: call void @__kmpc_get_team_static_memory(i16 0, i8* addrspacecast (i8 addrspace(3)* getelementptr inbounds ([[MAP_TY]], [[MAP_TY]] addrspace(3)* @{{.+}}, i32 0, i32 0, i32 0) to i8*), i{{64|32}} %{{.+}}, i16 %{{.+}}, i8** addrspacecast (i8* addrspace(3)* [[BUF_PTR:@.+]] to i8**)) -// CHECK: [[BUF:%.+]] = load i8*, i8* addrspace(3)* [[BUF_PTR]], -// CHECK: [[BUF_OFFS:%.+]] = getelementptr inbounds i8, i8* [[BUF]], i{{[0-9]+}} 0 -// CHECK: [[BUF:%.+]] = bitcast i8* [[BUF_OFFS]] to [[GLOB_TY]]* -// CHECK: [[PTR1:%.+]] = load i32*, i32** [[PTR1_ADDR]], -// CHECK: [[PTR1_GLOB_REF:%.+]] = getelementptr inbounds [[GLOB_TY]], [[GLOB_TY]]* [[BUF]], i32 0, i32 0 -// CHECK: store i32* [[PTR1]], i32** [[PTR1_GLOB_REF]], -// CHECK: call void @__kmpc_begin_sharing_variables(i8*** [[ARG_PTRS_REF:%.+]], i{{64|32}} 2) -// CHECK: [[ARG_PTRS:%.+]] = load i8**, i8*** [[ARG_PTRS_REF]], -// CHECK: [[ARG_PTR1:%.+]] = getelementptr inbounds i8*, i8** [[ARG_PTRS]], i{{[0-9]+}} 0 -// CHECK: [[BC:%.+]] = bitcast i32** [[PTR1_GLOB_REF]] to i8* -// CHECK: store i8* [[BC]], i8** [[ARG_PTR1]], -// CHECK: [[ARG_PTR2:%.+]] = getelementptr inbounds i8*, i8** [[ARG_PTRS]], i{{[0-9]+}} 1 -// CHECK: [[BC:%.+]] = bitcast i32** [[PTR2_REF]] to i8* -// CHECK: store i8* [[BC]], i8** [[ARG_PTR2]], -// CHECK: call void @__kmpc_barrier_simple_spmd(%struct.ident_t* null, i32 0) -// CHECK: call void @__kmpc_barrier_simple_spmd(%struct.ident_t* null, i32 0) -// CHECK: call void @__kmpc_end_sharing_variables() +// CHECK: call void @__kmpc_spmd_kernel_init( +// CHECK: call void @__kmpc_data_sharing_init_stack_spmd() +// CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num(%struct.ident_t* @{{.+}}) +// CHECK: store i32 [[GTID]], i32* [[THREADID:%.+]], +// CHECK: call void @{{.+}}(i32* [[THREADID]], i32* %{{.+}}, i32** [[PTR1_ADDR]], i32** [[PTR2_REF]]) +// CHECK: call void @__kmpc_spmd_kernel_deinit_v2(i16 1) void targetBar(int *Ptr1, int *Ptr2) { #pragma omp target map(Ptr1[:0], Ptr2) #pragma omp parallel num_threads(2) @@ -70,7 +56,7 @@ int foo(int n) { double cn[5][n]; TT<long long, char> d; - // CHECK-LABEL: define {{.*}}void {{@__omp_offloading_.+foo.+l137}}_worker() + // CHECK-LABEL: define {{.*}}void {{@__omp_offloading_.+foo.+l123}}_worker() // CHECK-DAG: [[OMP_EXEC_STATUS:%.+]] = alloca i8, // CHECK-DAG: [[OMP_WORK_FN:%.+]] = alloca i8*, // CHECK: store i8* null, i8** [[OMP_WORK_FN]], @@ -101,7 +87,7 @@ int foo(int n) { // CHECK: [[EXIT]] // CHECK: ret void - // CHECK: define {{.*}}void [[T1:@__omp_offloading_.+foo.+l137]]() + // CHECK: define {{.*}}void [[T1:@__omp_offloading_.+foo.+l123]]() // CHECK-DAG: [[TID:%.+]] = call i32 @llvm.nvvm.read.ptx.sreg.tid.x() // CHECK-DAG: [[NTH:%.+]] = call i32 @llvm.nvvm.read.ptx.sreg.ntid.x() // CHECK-DAG: [[WS:%.+]] = call i32 @llvm.nvvm.read.ptx.sreg.warpsize() @@ -143,7 +129,7 @@ int foo(int n) { { } - // CHECK-LABEL: define {{.*}}void {{@__omp_offloading_.+foo.+l214}}_worker() + // CHECK-LABEL: define {{.*}}void {{@__omp_offloading_.+foo.+l200}}_worker() // CHECK-DAG: [[OMP_EXEC_STATUS:%.+]] = alloca i8, // CHECK-DAG: [[OMP_WORK_FN:%.+]] = alloca i8*, // CHECK: store i8* null, i8** [[OMP_WORK_FN]], @@ -174,7 +160,7 @@ int foo(int n) { // CHECK: [[EXIT]] // CHECK: ret void - // CHECK: define {{.*}}void [[T2:@__omp_offloading_.+foo.+l214]](i[[SZ:32|64]] [[ARG1:%[a-zA-Z_]+]], i[[SZ:32|64]] [[ID:%[a-zA-Z_]+]]) + // CHECK: define {{.*}}void [[T2:@__omp_offloading_.+foo.+l200]](i[[SZ:32|64]] [[ARG1:%[a-zA-Z_]+]], i[[SZ:32|64]] [[ID:%[a-zA-Z_]+]]) // CHECK: [[AA_ADDR:%.+]] = alloca i[[SZ]], // CHECK: store i[[SZ]] [[ARG1]], i[[SZ]]* [[AA_ADDR]], // CHECK: [[AA_CADDR:%.+]] = bitcast i[[SZ]]* [[AA_ADDR]] to i16* @@ -217,7 +203,7 @@ int foo(int n) { id = aa; } - // CHECK-LABEL: define {{.*}}void {{@__omp_offloading_.+foo.+l324}}_worker() + // CHECK-LABEL: define {{.*}}void {{@__omp_offloading_.+foo.+l310}}_worker() // CHECK-DAG: [[OMP_EXEC_STATUS:%.+]] = alloca i8, // CHECK-DAG: [[OMP_WORK_FN:%.+]] = alloca i8*, // CHECK: store i8* null, i8** [[OMP_WORK_FN]], @@ -248,7 +234,7 @@ int foo(int n) { // CHECK: [[EXIT]] // CHECK: ret void - // CHECK: define {{.*}}void [[T3:@__omp_offloading_.+foo.+l324]](i[[SZ]] + // CHECK: define {{.*}}void [[T3:@__omp_offloading_.+foo.+l310]](i[[SZ]] // Create local storage for each capture. // CHECK: [[LOCAL_A:%.+]] = alloca i[[SZ]] // CHECK: [[LOCAL_B:%.+]] = alloca [10 x float]* @@ -409,7 +395,7 @@ int baz(int f, double &a) { return f; } - // CHECK-LABEL: define {{.*}}void {{@__omp_offloading_.+static.+362}}_worker() + // CHECK-LABEL: define {{.*}}void {{@__omp_offloading_.+static.+348}}_worker() // CHECK-DAG: [[OMP_EXEC_STATUS:%.+]] = alloca i8, // CHECK-DAG: [[OMP_WORK_FN:%.+]] = alloca i8*, // CHECK: store i8* null, i8** [[OMP_WORK_FN]], @@ -440,7 +426,7 @@ int baz(int f, double &a) { // CHECK: [[EXIT]] // CHECK: ret void - // CHECK: define {{.*}}void [[T4:@__omp_offloading_.+static.+l362]](i[[SZ]] + // CHECK: define {{.*}}void [[T4:@__omp_offloading_.+static.+l348]](i[[SZ]] // Create local storage for each capture. // CHECK: [[LOCAL_A:%.+]] = alloca i[[SZ]] // CHECK: [[LOCAL_AA:%.+]] = alloca i[[SZ]] @@ -495,7 +481,7 @@ int baz(int f, double &a) { - // CHECK-LABEL: define {{.*}}void {{@__omp_offloading_.+S1.+l380}}_worker() + // CHECK-LABEL: define {{.*}}void {{@__omp_offloading_.+S1.+l366}}_worker() // CHECK-DAG: [[OMP_EXEC_STATUS:%.+]] = alloca i8, // CHECK-DAG: [[OMP_WORK_FN:%.+]] = alloca i8*, // CHECK: store i8* null, i8** [[OMP_WORK_FN]], @@ -529,7 +515,7 @@ int baz(int f, double &a) { // CHECK: [[EXIT]] // CHECK: ret void - // CHECK: define {{.*}}void [[T5:@__omp_offloading_.+S1.+l380]]( + // CHECK: define {{.*}}void [[T5:@__omp_offloading_.+S1.+l366]]( // Create local storage for each capture. // CHECK: [[LOCAL_THIS:%.+]] = alloca [[S1:%struct.*]]* // CHECK: [[LOCAL_B:%.+]] = alloca i[[SZ]] @@ -648,7 +634,7 @@ int baz(int f, double &a) { // CHECK: ret i32 [[RES]] - // CHECK-LABEL: define {{.*}}void {{@__omp_offloading_.+template.+l345}}_worker() + // CHECK-LABEL: define {{.*}}void {{@__omp_offloading_.+template.+l331}}_worker() // CHECK-DAG: [[OMP_EXEC_STATUS:%.+]] = alloca i8, // CHECK-DAG: [[OMP_WORK_FN:%.+]] = alloca i8*, // CHECK: store i8* null, i8** [[OMP_WORK_FN]], @@ -679,7 +665,7 @@ int baz(int f, double &a) { // CHECK: [[EXIT]] // CHECK: ret void - // CHECK: define {{.*}}void [[T6:@__omp_offloading_.+template.+l345]](i[[SZ]] + // CHECK: define {{.*}}void [[T6:@__omp_offloading_.+template.+l331]](i[[SZ]] // Create local storage for each capture. // CHECK: [[LOCAL_A:%.+]] = alloca i[[SZ]] // CHECK: [[LOCAL_AA:%.+]] = alloca i[[SZ]] diff --git a/test/OpenMP/nvptx_target_exceptions_messages.cpp b/test/OpenMP/nvptx_target_exceptions_messages.cpp index 15c9522540..433ba13f73 100644 --- a/test/OpenMP/nvptx_target_exceptions_messages.cpp +++ b/test/OpenMP/nvptx_target_exceptions_messages.cpp @@ -68,4 +68,17 @@ int baz2() { return 2 + baz3(); } +int baz1() { throw 1; } // expected-error {{cannot use 'throw' with exceptions disabled}} + +int foobar1(); +int foobar2(); + +int (*A)() = &foobar1; +#pragma omp declare target +int (*B)() = &foobar2; +#pragma omp end declare target + +int foobar1() { throw 1; } +int foobar2() { throw 1; } // expected-error {{cannot use 'throw' with exceptions disabled}} + #endif // HEADER diff --git a/test/OpenMP/nvptx_target_firstprivate_codegen.cpp b/test/OpenMP/nvptx_target_firstprivate_codegen.cpp index 53b0f75885..2c15eb6780 100644 --- a/test/OpenMP/nvptx_target_firstprivate_codegen.cpp +++ b/test/OpenMP/nvptx_target_firstprivate_codegen.cpp @@ -13,25 +13,31 @@ struct TT { ty Y; }; -// TCHECK: [[TT:%.+]] = type { i64, i8 } -// TCHECK: [[S1:%.+]] = type { double } +// TCHECK-DAG: [[TT:%.+]] = type { i64, i8 } +// TCHECK-DAG: [[TTII:%.+]] = type { i32, i32 } +// TCHECK-DAG: [[S1:%.+]] = type { double } +// TCHECK: @__omp_offloading_firstprivate__{{.+}}_e_l27 = internal addrspace(4) global [[TTII]] zeroinitializer int foo(int n, double *ptr) { int a = 0; short aa = 0; float b[10]; double c[5][10]; TT<long long, char> d; + const TT<int, int> e = {n, n}; -#pragma omp target firstprivate(a) map(tofrom \ - : b) +#pragma omp target firstprivate(a, e) map(tofrom \ + : b) { b[a] = a; + b[a] += e.X; } - // TCHECK: define {{.*}}void @__omp_offloading_{{.+}}([10 x float] addrspace(1)* noalias [[B_IN:%.+]], i{{[0-9]+}} [[A_IN:%.+]]) + // TCHECK: define {{.*}}void @__omp_offloading_{{.+}}([10 x float] addrspace(1)* noalias [[B_IN:%.+]], i{{[0-9]+}} [[A_IN:%.+]], [[TTII]]* noalias [[E_IN:%.+]]) + // TCHECK-NOT: alloca [[TTII]], // TCHECK: [[A_ADDR:%.+]] = alloca i{{[0-9]+}}, - // TCHECK-NOT: alloca i{{[0-9]+}}, + // TCHECK-NOT: alloca [[TTII]], + // TCHECK-NOT: alloca i{{[0-9]+}}, // TCHECK-64: call void @llvm.dbg.declare(metadata [10 x float] addrspace(1)** %{{.+}}, metadata !{{[0-9]+}}, metadata !DIExpression()) // TCHECK: store i{{[0-9]+}} [[A_IN]], i{{[0-9]+}}* [[A_ADDR]], // TCHECK: ret void diff --git a/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp b/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp index 13a7fb289d..fc90d34da3 100644 --- a/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp +++ b/test/OpenMP/nvptx_target_parallel_num_threads_codegen.cpp @@ -9,8 +9,8 @@ #define HEADER // Check that the execution mode of all 2 target regions on the gpu is set to non-SPMD Mode. -// CHECK-DAG: {{@__omp_offloading_.+l21}}_exec_mode = weak constant i8 1 -// CHECK-DAG: {{@__omp_offloading_.+l26}}_exec_mode = weak constant i8 1 +// CHECK-DAG: {{@__omp_offloading_.+l21}}_exec_mode = weak constant i8 0 +// CHECK-DAG: {{@__omp_offloading_.+l26}}_exec_mode = weak constant i8 0 template<typename tx> tx ftemplate(int n) { @@ -46,13 +46,16 @@ int bar(int n){ // CHECK: store i16* {{%.+}}, i16** [[AA_ADDR]], align // CHECK: [[AA:%.+]] = load i16*, i16** [[AA_ADDR]], align // CHECK: [[THREAD_LIMIT:%.+]] = call i32 @llvm.nvvm.read.ptx.sreg.ntid.x() - // CHECK: call void @__kmpc_kernel_init(i32 - // CHECK: call void @__kmpc_push_num_threads - // CHECK: call void @__kmpc_kernel_deinit(i16 1) + // CHECK: call void @__kmpc_spmd_kernel_init(i32 [[THREAD_LIMIT]], i16 1, i16 0) + // CHECK: call void @__kmpc_data_sharing_init_stack_spmd() + // CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num(%struct.ident_t* @{{.+}}) + // CHECK: store i32 [[GTID]], i32* [[THREADID:%.+]], + // CHECK: call void [[OUTLINED:@.+]](i32* [[THREADID]], i32* %{{.+}}, i16* [[AA]]) + // CHECK: call void @__kmpc_spmd_kernel_deinit_v2(i16 1) // CHECK: ret void // CHECK: } - // CHECK: define internal void @{{.+}}(i32* noalias %{{.+}}, i32* noalias %{{.+}}, i16* {{[^%]*}}[[ARG:%.+]]) + // CHECK: define internal void [[OUTLINED]](i32* noalias %{{.+}}, i32* noalias %{{.+}}, i16* {{[^%]*}}[[ARG:%.+]]) // CHECK: = alloca i32*, align // CHECK: = alloca i32*, align // CHECK: [[AA_ADDR:%.+]] = alloca i16*, align @@ -63,11 +66,6 @@ int bar(int n){ // CHECK: ret void // CHECK: } - - - - - // CHECK-LABEL: define {{.*}}void {{@__omp_offloading_.+template.+l26}}( // CHECK: [[A_ADDR:%.+]] = alloca i32*, align // CHECK: [[AA_ADDR:%.+]] = alloca i16*, align @@ -79,13 +77,16 @@ int bar(int n){ // CHECK: [[AA:%.+]] = load i16*, i16** [[AA_ADDR]], align // CHECK: [[B:%.+]] = load [10 x i32]*, [10 x i32]** [[B_ADDR]], align // CHECK: [[THREAD_LIMIT:%.+]] = call i32 @llvm.nvvm.read.ptx.sreg.ntid.x() - // CHECK: call void @__kmpc_kernel_init(i32 - // CHECK: call void @__kmpc_push_num_threads - // CHECK: call void @__kmpc_kernel_deinit(i16 1) + // CHECK: call void @__kmpc_spmd_kernel_init(i32 [[THREAD_LIMIT]], i16 1, i16 0) + // CHECK: call void @__kmpc_data_sharing_init_stack_spmd() + // CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num(%struct.ident_t* @{{.+}}) + // CHECK: store i32 [[GTID]], i32* [[THREADID:%.+]], + // CHECK: call void [[OUTLINED:@.+]](i32* [[THREADID]], i32* %{{.+}}, i32* [[A]], i16* [[AA]], [10 x i32]* [[B]]) + // CHECK: call void @__kmpc_spmd_kernel_deinit_v2(i16 1) // CHECK: ret void // CHECK: } - // CHECK: define internal void @{{.+}}(i32* noalias %{{.+}}, i32* noalias %{{.+}}, i32* {{[^%]*}}[[ARG1:%.+]], i16* {{[^%]*}}[[ARG2:%.+]], [10 x i32]* {{[^%]*}}[[ARG3:%.+]]) + // CHECK: define internal void [[OUTLINED]](i32* noalias %{{.+}}, i32* noalias %{{.+}}, i32* {{[^%]*}}[[ARG1:%.+]], i16* {{[^%]*}}[[ARG2:%.+]], [10 x i32]* {{[^%]*}}[[ARG3:%.+]]) // CHECK: = alloca i32*, align // CHECK: = alloca i32*, align // CHECK: [[A_ADDR:%.+]] = alloca i32*, align diff --git a/test/OpenMP/nvptx_target_simd_codegen.cpp b/test/OpenMP/nvptx_target_simd_codegen.cpp index 89ea173add..073d6fa2f1 100644 --- a/test/OpenMP/nvptx_target_simd_codegen.cpp +++ b/test/OpenMP/nvptx_target_simd_codegen.cpp @@ -9,10 +9,10 @@ #define HEADER // Check that the execution mode of all 2 target regions on the gpu is set to NonSPMD Mode. -// CHECK-DAG: {{@__omp_offloading_.+l25}}_exec_mode = weak constant i8 1 -// CHECK-DAG: {{@__omp_offloading_.+l30}}_exec_mode = weak constant i8 1 -// CHECK-DAG: {{@__omp_offloading_.+l35}}_exec_mode = weak constant i8 1 -// CHECK-DAG: {{@__omp_offloading_.+l40}}_exec_mode = weak constant i8 1 +// CHECK-DAG: {{@__omp_offloading_.+l25}}_exec_mode = weak constant i8 0 +// CHECK-DAG: {{@__omp_offloading_.+l30}}_exec_mode = weak constant i8 0 +// CHECK-DAG: {{@__omp_offloading_.+l35}}_exec_mode = weak constant i8 0 +// CHECK-DAG: {{@__omp_offloading_.+l40}}_exec_mode = weak constant i8 0 #define N 1000 @@ -54,33 +54,33 @@ int bar(int n){ } // CHECK-LABEL: define {{.*}}void {{@__omp_offloading_.+l25}}( -// CHECK: call void @__kmpc_kernel_init(i32 %{{.+}}, i16 1) +// CHECK: call void @__kmpc_spmd_kernel_init(i32 %{{.+}}, i16 0, i16 0) // CHECK-NOT: call void @__kmpc_for_static_init // CHECK-NOT: call void @__kmpc_for_static_fini -// CHECK: call void @__kmpc_kernel_deinit(i16 1) +// CHECK: call void @__kmpc_spmd_kernel_deinit_v2(i16 0) // CHECK: ret void // CHECK-LABEL: define {{.*}}void {{@__omp_offloading_.+l30}}( -// CHECK: call void @__kmpc_kernel_init(i32 %{{.+}}, i16 1) +// CHECK: call void @__kmpc_spmd_kernel_init(i32 %{{.+}}, i16 0, i16 0) // CHECK-NOT: call void @__kmpc_for_static_init // CHECK-NOT: call void @__kmpc_for_static_fini -// CHECK: call void @__kmpc_kernel_deinit(i16 1) +// CHECK: call void @__kmpc_spmd_kernel_deinit_v2(i16 0) // CHECK: ret void // CHECK-LABEL: define {{.*}}void {{@__omp_offloading_.+l35}}( -// CHECK: call void @__kmpc_kernel_init(i32 %{{.+}}, i16 1) +// CHECK: call void @__kmpc_spmd_kernel_init(i32 %{{.+}}, i16 0, i16 0) // CHECK-NOT: call void @__kmpc_for_static_init // CHECK-NOT: call void @__kmpc_for_static_fini -// CHECK: call void @__kmpc_kernel_deinit(i16 1) +// CHECK: call void @__kmpc_spmd_kernel_deinit_v2(i16 0) // CHECK: ret void // CHECK-LABEL: define {{.*}}void {{@__omp_offloading_.+l40}}( -// CHECK: call void @__kmpc_kernel_init(i32 %{{.+}}, i16 1) +// CHECK: call void @__kmpc_spmd_kernel_init(i32 %{{.+}}, i16 0, i16 0) // CHECK-NOT: call void @__kmpc_for_static_init // CHECK-NOT: call void @__kmpc_for_static_fini // CHECK-NOT: call i32 @__kmpc_nvptx_simd_reduce_nowait( // CHECK-NOT: call void @__kmpc_nvptx_end_reduce_nowait( -// CHECK: call void @__kmpc_kernel_deinit(i16 1) +// CHECK: call void @__kmpc_spmd_kernel_deinit_v2(i16 0) // CHECK: ret void diff --git a/test/OpenMP/nvptx_target_teams_distribute_simd_codegen.cpp b/test/OpenMP/nvptx_target_teams_distribute_simd_codegen.cpp index 48f314785c..6051637d55 100644 --- a/test/OpenMP/nvptx_target_teams_distribute_simd_codegen.cpp +++ b/test/OpenMP/nvptx_target_teams_distribute_simd_codegen.cpp @@ -9,10 +9,10 @@ #define HEADER // Check that the execution mode of all 2 target regions on the gpu is set to NonSPMD Mode. -// CHECK-DAG: {{@__omp_offloading_.+l30}}_exec_mode = weak constant i8 1 -// CHECK-DAG: {{@__omp_offloading_.+l36}}_exec_mode = weak constant i8 1 -// CHECK-DAG: {{@__omp_offloading_.+l41}}_exec_mode = weak constant i8 1 -// CHECK-DAG: {{@__omp_offloading_.+l46}}_exec_mode = weak constant i8 1 +// CHECK-DAG: {{@__omp_offloading_.+l30}}_exec_mode = weak constant i8 0 +// CHECK-DAG: {{@__omp_offloading_.+l36}}_exec_mode = weak constant i8 0 +// CHECK-DAG: {{@__omp_offloading_.+l41}}_exec_mode = weak constant i8 0 +// CHECK-DAG: {{@__omp_offloading_.+l46}}_exec_mode = weak constant i8 0 #define N 1000 #define M 10 @@ -22,7 +22,7 @@ tx ftemplate(int n) { tx a[N]; short aa[N]; tx b[10]; - tx c[M][M]; + tx c[M][M]; tx f = n; tx l; int k; @@ -47,7 +47,7 @@ tx ftemplate(int n) { for(int i = 0; i < M; i++) { for(int j = 0; j < M; j++) { k = M; - c[i][j] = i+j*f+k; + c[i][j] = i + j * f + k; } } @@ -63,33 +63,33 @@ int bar(int n){ } // CHECK-LABEL: define {{.*}}void {{@__omp_offloading_.+}}_l30( -// CHECK: call void @__kmpc_kernel_init(i32 %{{.+}}, i16 1) +// CHECK: call void @__kmpc_spmd_kernel_init(i32 %{{.+}}, i16 0, i16 0) // CHECK: call void @__kmpc_for_static_init_4({{.+}}, {{.+}}, {{.+}} 91, // CHECK: call void @__kmpc_for_static_fini( -// CHECK: call void @__kmpc_kernel_deinit(i16 1) +// CHECK: call void @__kmpc_spmd_kernel_deinit_v2(i16 0) // CHECK: ret void // CHECK-LABEL: define {{.*}}void {{@__omp_offloading_.+}}_l36( -// CHECK: call void @__kmpc_kernel_init(i32 %{{.+}}, i16 1) -// CHECK: call void @__kmpc_for_static_init_4({{.+}}, {{.+}}, {{.+}} 92, +// CHECK: call void @__kmpc_spmd_kernel_init(i32 %{{.+}}, i16 0, i16 0) +// CHECK: call void @__kmpc_for_static_init_4({{.+}}, {{.+}}, {{.+}} 91, // CHECK: call void @__kmpc_for_static_fini( -// CHECK: call void @__kmpc_kernel_deinit(i16 1) +// CHECK: call void @__kmpc_spmd_kernel_deinit_v2(i16 0) // CHECK: ret void // CHECK-LABEL: define {{.*}}void {{@__omp_offloading_.+}}_l41( -// CHECK: call void @__kmpc_kernel_init(i32 %{{.+}}, i16 1) -// CHECK: call void @__kmpc_for_static_init_4({{.+}}, {{.+}}, {{.+}} 92, +// CHECK: call void @__kmpc_spmd_kernel_init(i32 %{{.+}}, i16 0, i16 0) +// CHECK: call void @__kmpc_for_static_init_4({{.+}}, {{.+}}, {{.+}} 91, // CHECK: call void @__kmpc_for_static_fini( -// CHECK: call void @__kmpc_kernel_deinit(i16 1) +// CHECK: call void @__kmpc_spmd_kernel_deinit_v2(i16 0) // CHECK: ret void // CHECK: define {{.*}}void {{@__omp_offloading_.+}}_l46({{.+}}, i{{32|64}} [[F_IN:%.+]]) // CHECK: store {{.+}} [[F_IN]], {{.+}}* {{.+}}, -// CHECK: call void @__kmpc_kernel_init(i32 %{{.+}}, i16 1) +// CHECK: call void @__kmpc_spmd_kernel_init(i32 %{{.+}}, i16 0, i16 0) // CHECK: store {{.+}} 99, {{.+}}* [[COMB_UB:%.+]], align -// CHECK: call void @__kmpc_for_static_init_4({{.+}}, {{.+}}, {{.+}} 92, {{.+}}, {{.+}}, {{.+}}* [[COMB_UB]], +// CHECK: call void @__kmpc_for_static_init_4({{.+}}, {{.+}}, {{.+}} 91, {{.+}}, {{.+}}, {{.+}}* [[COMB_UB]], // CHECK: call void @__kmpc_for_static_fini( -// CHECK: call void @__kmpc_kernel_deinit(i16 1) +// CHECK: call void @__kmpc_spmd_kernel_deinit_v2(i16 0) // CHECK: ret void #endif diff --git a/test/OpenMP/nvptx_teams_reduction_codegen.cpp b/test/OpenMP/nvptx_teams_reduction_codegen.cpp index 0de25295a7..a8e22d82b2 100644 --- a/test/OpenMP/nvptx_teams_reduction_codegen.cpp +++ b/test/OpenMP/nvptx_teams_reduction_codegen.cpp @@ -3,28 +3,32 @@ // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-64 // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple i386-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm-bc %s -o %t-x86-host.bc // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple nvptx-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-32 -// RUN: %clang_cc1 -verify -fopenmp -fexceptions -fcxx-exceptions -x c++ -triple nvptx-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-32 +// RUN: %clang_cc1 -verify -fopenmp -fexceptions -fcxx-exceptions -x c++ -triple nvptx-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -fopenmp-cuda-teams-reduction-recs-num=2048 -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -o - | FileCheck %s --check-prefix CHECK --check-prefix CHECK-32 // expected-no-diagnostics #ifndef HEADER #define HEADER -// CHECK: [[MAP_TY:%.+]] = type { [128 x i8] } +// CHECK-DAG: [[TEAM1_REDUCE_TY:%.+]] = type { [{{1024|2048}} x double] } +// CHECK-DAG: [[TEAM2_REDUCE_TY:%.+]] = type { [{{1024|2048}} x i8], [{{1024|2048}} x float] } +// CHECK-DAG: [[TEAM3_REDUCE_TY:%.+]] = type { [{{1024|2048}} x i32], [{{1024|2048}} x i16] } +// CHECK-DAG: [[TEAMS_REDUCE_UNION_TY:%.+]] = type { [[TEAM1_REDUCE_TY]] } +// CHECK-DAG: [[MAP_TY:%.+]] = type { [128 x i8] } // CHECK-DAG: [[KERNEL_PTR:@.+]] = internal addrspace(3) global i8* null // CHECK-DAG: [[KERNEL_SHARED1:@.+]] = internal unnamed_addr constant i16 1 // CHECK-DAG: [[KERNEL_SHARED2:@.+]] = internal unnamed_addr constant i16 1 -// CHECK-DAG: [[KERNEL_SHARED3:@.+]] = internal unnamed_addr constant i16 1 // CHECK-DAG: [[KERNEL_SIZE1:@.+]] = internal unnamed_addr constant i{{64|32}} {{16|8}} // CHECK-DAG: [[KERNEL_SIZE2:@.+]] = internal unnamed_addr constant i{{64|32}} 16 -// CHECK-DAG: [[KERNEL_SIZE3:@.+]] = internal unnamed_addr constant i{{64|32}} 8 // Check for the data transfer medium in shared memory to transfer the reduction list to the first warp. // CHECK-DAG: [[TRANSFER_STORAGE:@.+]] = common addrspace([[SHARED_ADDRSPACE:[0-9]+]]) global [32 x i32] // Check that the execution mode of 2 target regions is set to Non-SPMD and the 3rd is in SPMD. -// CHECK-DAG: {{@__omp_offloading_.+l37}}_exec_mode = weak constant i8 1 -// CHECK-DAG: {{@__omp_offloading_.+l43}}_exec_mode = weak constant i8 1 -// CHECK-DAG: {{@__omp_offloading_.+l50}}_exec_mode = weak constant i8 0 +// CHECK-DAG: {{@__omp_offloading_.+l41}}_exec_mode = weak constant i8 1 +// CHECK-DAG: {{@__omp_offloading_.+l47}}_exec_mode = weak constant i8 1 +// CHECK-DAG: {{@__omp_offloading_.+l54}}_exec_mode = weak constant i8 0 + +// CHECK-DAG: [[TEAMS_RED_BUFFER:@.+]] = internal global [[TEAMS_REDUCE_UNION_TY]] zeroinitializer template<typename tx> tx ftemplate(int n) { @@ -66,9 +70,9 @@ int bar(int n){ return a; } - // CHECK-LABEL: define {{.*}}void {{@__omp_offloading_.+template.+l37}}_worker() + // CHECK-LABEL: define {{.*}}void {{@__omp_offloading_.+template.+l41}}_worker() - // CHECK: define {{.*}}void [[T1:@__omp_offloading_.+template.+l37]]( + // CHECK: define {{.*}}void [[T1:@__omp_offloading_.+template.+l41]]( // // CHECK: {{call|invoke}} void [[T1]]_worker() // @@ -78,7 +82,11 @@ int bar(int n){ // CHECK: [[EV:%.+]] = load double, double* [[E]], align // CHECK: [[ADD:%.+]] = fadd double [[EV]], 5 // CHECK: store double [[ADD]], double* [[E]], align - // CHECK: [[RET:%.+]] = call i32 @__kmpc_nvptx_teams_reduce_nowait_simple(%struct.ident_t* [[LOC:@.+]], i32 [[GTID:%.+]], [8 x i32]* [[LOCK:@.+]]) + // CHECK: [[GEP1:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[RED_LIST:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 + // CHECK: [[BC:%.+]] = bitcast double* [[E]] to i8* + // CHECK: store i8* [[BC]], i8** [[GEP1]], + // CHECK: [[BC_RED_LIST:%.+]] = bitcast [1 x i8*]* [[RED_LIST]] to i8* + // CHECK: [[RET:%.+]] = call i32 @__kmpc_nvptx_teams_reduce_nowait_v2(%struct.ident_t* [[LOC:@.+]], i32 [[GTID:%.+]], i8* bitcast ([[TEAMS_REDUCE_UNION_TY]]* [[TEAMS_RED_BUFFER]] to i8*), i32 {{1024|2048}}, i8* [[BC_RED_LIST]], void (i8*, i16, i16, i16)* [[SHUFFLE_AND_REDUCE:@.+]], void (i8*, i32)* [[INTER_WARP_COPY:@.+]], void (i8*, i32, i8*)* [[RED_LIST_TO_GLOBAL_COPY:@.+]], void (i8*, i32, i8*)* [[RED_LIST_TO_GLOBAL_RED:@.+]], void (i8*, i32, i8*)* [[GLOBAL_TO_RED_LIST_COPY:@.+]], void (i8*, i32, i8*)* [[GLOBAL_TO_RED_LIST_RED:@.+]]) // CHECK: [[COND:%.+]] = icmp eq i32 [[RET]], 1 // CHECK: br i1 [[COND]], label {{%?}}[[IFLABEL:.+]], label {{%?}}[[EXIT:.+]] // @@ -87,15 +95,250 @@ int bar(int n){ // CHECK: [[EV:%.+]] = load double, double* [[E]], align // CHECK: [[ADD:%.+]] = fadd double [[E_INV]], [[EV]] // CHECK: store double [[ADD]], double* [[E_IN]], align - // CHECK: call void @__kmpc_nvptx_teams_end_reduce_nowait_simple(%struct.ident_t* [[LOC]], i32 [[GTID]], [8 x i32]* [[LOCK]]) + // CHECK: call void @__kmpc_nvptx_end_reduce_nowait(i32 [[GTID]]) // CHECK: br label %[[EXIT]] // // CHECK: [[EXIT]] // CHECK: call void @__kmpc_kernel_deinit( - // CHECK-LABEL: define {{.*}}void {{@__omp_offloading_.+template.+l43}}_worker() + // + // Reduction function + // CHECK: define internal void [[REDUCTION_FUNC:@.+]](i8*, i8*) + // CHECK: [[VAR_RHS_REF:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[RED_LIST_RHS:%.+]], i{{32|64}} 0, i{{32|64}} 0 + // CHECK: [[VAR_RHS_VOID:%.+]] = load i8*, i8** [[VAR_RHS_REF]], + // CHECK: [[VAR_RHS:%.+]] = bitcast i8* [[VAR_RHS_VOID]] to double* + // + // CHECK: [[VAR_LHS_REF:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[RED_LIST_LHS:%.+]], i{{32|64}} 0, i{{32|64}} 0 + // CHECK: [[VAR_LHS_VOID:%.+]] = load i8*, i8** [[VAR_LHS_REF]], + // CHECK: [[VAR_LHS:%.+]] = bitcast i8* [[VAR_LHS_VOID]] to double* + // + // CHECK: [[VAR_LHS_VAL:%.+]] = load double, double* [[VAR_LHS]], + // CHECK: [[VAR_RHS_VAL:%.+]] = load double, double* [[VAR_RHS]], + // CHECK: [[RES:%.+]] = fadd double [[VAR_LHS_VAL]], [[VAR_RHS_VAL]] + // CHECK: store double [[RES]], double* [[VAR_LHS]], + // CHECK: ret void + + // + // Shuffle and reduce function + // CHECK: define internal void [[SHUFFLE_AND_REDUCE]](i8*, i16 {{.*}}, i16 {{.*}}, i16 {{.*}}) + // CHECK: [[REMOTE_RED_LIST:%.+]] = alloca [1 x i8*], align + // CHECK: [[REMOTE_ELT:%.+]] = alloca double + // + // CHECK: [[LANEID:%.+]] = load i16, i16* {{.+}}, align + // CHECK: [[LANEOFFSET:%.+]] = load i16, i16* {{.+}}, align + // CHECK: [[ALGVER:%.+]] = load i16, i16* {{.+}}, align + // + // CHECK: [[ELT_REF:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[RED_LIST:%.+]], i{{32|64}} 0, i{{32|64}} 0 + // CHECK: [[ELT_VOID:%.+]] = load i8*, i8** [[ELT_REF]], + // CHECK: [[REMOTE_ELT_REF:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[REMOTE_RED_LIST:%.+]], i{{32|64}} 0, i{{32|64}} 0 + // CHECK: [[ELT:%.+]] = bitcast i8* [[ELT_VOID]] to double* + // + // CHECK: [[ELT_CAST:%.+]] = bitcast double* [[ELT]] to i64* + // CHECK: [[REMOTE_ELT_CAST:%.+]] = bitcast double* [[REMOTE_ELT]] to i64* + // CHECK: [[ELT_VAL:%.+]] = load i64, i64* [[ELT_CAST]], align + // CHECK: [[WS32:%.+]] = call i32 @llvm.nvvm.read.ptx.sreg.warpsize() + // CHECK: [[WS:%.+]] = trunc i32 [[WS32]] to i16 + // CHECK: [[REMOTE_ELT_VAL64:%.+]] = call i64 @__kmpc_shuffle_int64(i64 [[ELT_VAL]], i16 [[LANEOFFSET]], i16 [[WS]]) + // + // CHECK: store i64 [[REMOTE_ELT_VAL64]], i64* [[REMOTE_ELT_CAST]], align + // CHECK: [[REMOTE_ELT_VOID:%.+]] = bitcast double* [[REMOTE_ELT]] to i8* + // CHECK: store i8* [[REMOTE_ELT_VOID]], i8** [[REMOTE_ELT_REF]], align + // + // Condition to reduce + // CHECK: [[CONDALG0:%.+]] = icmp eq i16 [[ALGVER]], 0 + // + // CHECK: [[COND1:%.+]] = icmp eq i16 [[ALGVER]], 1 + // CHECK: [[COND2:%.+]] = icmp ult i16 [[LANEID]], [[LANEOFFSET]] + // CHECK: [[CONDALG1:%.+]] = and i1 [[COND1]], [[COND2]] + // + // CHECK: [[COND3:%.+]] = icmp eq i16 [[ALGVER]], 2 + // CHECK: [[COND4:%.+]] = and i16 [[LANEID]], 1 + // CHECK: [[COND5:%.+]] = icmp eq i16 [[COND4]], 0 + // CHECK: [[COND6:%.+]] = and i1 [[COND3]], [[COND5]] + // CHECK: [[COND7:%.+]] = icmp sgt i16 [[LANEOFFSET]], 0 + // CHECK: [[CONDALG2:%.+]] = and i1 [[COND6]], [[COND7]] + // + // CHECK: [[COND8:%.+]] = or i1 [[CONDALG0]], [[CONDALG1]] + // CHECK: [[SHOULD_REDUCE:%.+]] = or i1 [[COND8]], [[CONDALG2]] + // CHECK: br i1 [[SHOULD_REDUCE]], label {{%?}}[[DO_REDUCE:.+]], label {{%?}}[[REDUCE_ELSE:.+]] + // + // CHECK: [[DO_REDUCE]] + // CHECK: [[RED_LIST1_VOID:%.+]] = bitcast [1 x i8*]* [[RED_LIST]] to i8* + // CHECK: [[RED_LIST2_VOID:%.+]] = bitcast [1 x i8*]* [[REMOTE_RED_LIST]] to i8* + // CHECK: call void [[REDUCTION_FUNC]](i8* [[RED_LIST1_VOID]], i8* [[RED_LIST2_VOID]]) + // CHECK: br label {{%?}}[[REDUCE_CONT:.+]] + // + // CHECK: [[REDUCE_ELSE]] + // CHECK: br label {{%?}}[[REDUCE_CONT]] + // + // CHECK: [[REDUCE_CONT]] + // Now check if we should just copy over the remote reduction list + // CHECK: [[COND1:%.+]] = icmp eq i16 [[ALGVER]], 1 + // CHECK: [[COND2:%.+]] = icmp uge i16 [[LANEID]], [[LANEOFFSET]] + // CHECK: [[SHOULD_COPY:%.+]] = and i1 [[COND1]], [[COND2]] + // CHECK: br i1 [[SHOULD_COPY]], label {{%?}}[[DO_COPY:.+]], label {{%?}}[[COPY_ELSE:.+]] + // + // CHECK: [[DO_COPY]] + // CHECK: [[REMOTE_ELT_REF:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[REMOTE_RED_LIST]], i{{32|64}} 0, i{{32|64}} 0 + // CHECK: [[REMOTE_ELT_VOID:%.+]] = load i8*, i8** [[REMOTE_ELT_REF]], + // CHECK: [[ELT_REF:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[RED_LIST]], i{{32|64}} 0, i{{32|64}} 0 + // CHECK: [[ELT_VOID:%.+]] = load i8*, i8** [[ELT_REF]], + // CHECK: [[REMOTE_ELT:%.+]] = bitcast i8* [[REMOTE_ELT_VOID]] to double* + // CHECK: [[ELT:%.+]] = bitcast i8* [[ELT_VOID]] to double* + // CHECK: [[REMOTE_ELT_VAL:%.+]] = load double, double* [[REMOTE_ELT]], align + // CHECK: store double [[REMOTE_ELT_VAL]], double* [[ELT]], align + // CHECK: br label {{%?}}[[COPY_CONT:.+]] + // + // CHECK: [[COPY_ELSE]] + // CHECK: br label {{%?}}[[COPY_CONT]] + // + // CHECK: [[COPY_CONT]] + // CHECK: void + + // + // Inter warp copy function + // CHECK: define internal void [[INTER_WARP_COPY]](i8*, i32) + // CHECK-DAG: [[LANEID:%.+]] = and i32 {{.+}}, 31 + // CHECK-DAG: [[WARPID:%.+]] = ashr i32 {{.+}}, 5 + // CHECK-DAG: [[RED_LIST:%.+]] = bitcast i8* {{.+}} to [1 x i8*]* + // CHECK: store i32 0, i32* [[CNT_ADDR:%.+]], + // CHECK: br label + // CHECK: [[CNT:%.+]] = load i32, i32* [[CNT_ADDR]], + // CHECK: [[DONE_COPY:%.+]] = icmp ult i32 [[CNT]], 2 + // CHECK: br i1 [[DONE_COPY]], label + // CHECK: call void @__kmpc_barrier(%struct.ident_t* @ + // CHECK: [[IS_WARP_MASTER:%.+]] = icmp eq i32 [[LANEID]], 0 + // CHECK: br i1 [[IS_WARP_MASTER]], label {{%?}}[[DO_COPY:.+]], label {{%?}}[[COPY_ELSE:.+]] + // + // [[DO_COPY]] + // CHECK: [[ELT_REF:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[RED_LIST]], i{{32|64}} 0, i{{32|64}} 0 + // CHECK: [[ELT_VOID:%.+]] = load i8*, i8** [[ELT_REF]], + // CHECK: [[BASE_ELT:%.+]] = bitcast i8* [[ELT_VOID]] to i32* + // CHECK: [[ELT:%.+]] = getelementptr i32, i32* [[BASE_ELT]], i32 [[CNT]] + // + // CHECK: [[MEDIUM_ELT:%.+]] = getelementptr inbounds [32 x i32], [32 x i32] addrspace([[SHARED_ADDRSPACE]])* [[TRANSFER_STORAGE]], i64 0, i32 [[WARPID]] + // CHECK: [[ELT_VAL:%.+]] = load i32, i32* [[ELT]], + // CHECK: store volatile i32 [[ELT_VAL]], i32 addrspace([[SHARED_ADDRSPACE]])* [[MEDIUM_ELT]], + // CHECK: br label {{%?}}[[COPY_CONT:.+]] + // + // CHECK: [[COPY_ELSE]] + // CHECK: br label {{%?}}[[COPY_CONT]] + // + // Barrier after copy to shared memory storage medium. + // CHECK: [[COPY_CONT]] + // CHECK: call void @__kmpc_barrier(%struct.ident_t* @ + // CHECK: [[ACTIVE_WARPS:%.+]] = load i32, i32* + // + // Read into warp 0. + // CHECK: [[IS_W0_ACTIVE_THREAD:%.+]] = icmp ult i32 [[TID:%.+]], [[ACTIVE_WARPS]] + // CHECK: br i1 [[IS_W0_ACTIVE_THREAD]], label {{%?}}[[DO_READ:.+]], label {{%?}}[[READ_ELSE:.+]] + // + // CHECK: [[DO_READ]] + // CHECK: [[MEDIUM_ELT:%.+]] = getelementptr inbounds [32 x i32], [32 x i32] addrspace([[SHARED_ADDRSPACE]])* [[TRANSFER_STORAGE]], i64 0, i32 [[TID]] + // CHECK: [[ELT_REF:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[RED_LIST:%.+]], i{{32|64}} 0, i{{32|64}} 0 + // CHECK: [[ELT_VOID:%.+]] = load i8*, i8** [[ELT_REF]], + // CHECK: [[ELT_BASE:%.+]] = bitcast i8* [[ELT_VOID]] to i32* + // CHECK: [[ELT:%.+]] = getelementptr i32, i32* [[ELT_BASE]], i32 [[CNT]] + // CHECK: [[MEDIUM_ELT_VAL:%.+]] = load volatile i32, i32 addrspace([[SHARED_ADDRSPACE]])* [[MEDIUM_ELT]], + // CHECK: store i32 [[MEDIUM_ELT_VAL]], i32* [[ELT]], + // CHECK: br label {{%?}}[[READ_CONT:.+]] + // + // CHECK: [[READ_ELSE]] + // CHECK: br label {{%?}}[[READ_CONT]] + // + // CHECK: [[READ_CONT]] + // CHECK: [[NEXT:%.+]] = add nsw i32 [[CNT]], 1 + // CHECK: store i32 [[NEXT]], i32* [[CNT_ADDR]], + // CHECK: br label + // CHECK: ret + + // CHECK: define internal void [[RED_LIST_TO_GLOBAL_COPY]](i8*, i32, i8*) + // CHECK: [[GLOBAL_PTR:%.+]] = alloca i8*, + // CHECK: [[IDX_PTR:%.+]] = alloca i32, + // CHECK: [[RL_PTR:%.+]] = alloca i8*, + // CHECK: store i8* %{{.+}}, i8** [[GLOBAL_PTR]], + // CHECK: store i32 %{{.+}}, i32* [[IDX_PTR]], + // CHECK: store i8* %{{.+}}, i8** [[RL_PTR]], + // CHECK: [[RL_BC:%.+]] = load i8*, i8** [[RL_PTR]], + // CHECK: [[RL:%.+]] = bitcast i8* [[RL_BC]] to [1 x i8*]* + // CHECK: [[GLOBAL_BC:%.+]] = load i8*, i8** [[GLOBAL_PTR]], + // CHECK: [[GLOBAL:%.+]] = bitcast i8* [[GLOBAL_BC]] to [[TEAM1_REDUCE_TY]]* + // CHECK: [[IDX:%.+]] = load i32, i32* [[IDX_PTR]], + // CHECK: [[RL_RED1_PTR:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[RL]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 + // CHECK: [[RL_RED1_BC:%.+]] = load i8*, i8** [[RL_RED1_PTR]], + // CHECK: [[RL_RED1:%.+]] = bitcast i8* [[RL_RED1_BC]] to double* + // CHECK: [[GLOBAL_RED1_PTR:%.+]] = getelementptr inbounds [[TEAM1_REDUCE_TY]], [[TEAM1_REDUCE_TY]]* [[GLOBAL]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 + // CHECK: [[GLOBAL_RED1_IDX_PTR:%.+]] = getelementptr inbounds [{{1024|2048}} x double], [{{1024|2048}} x double]* [[GLOBAL_RED1_PTR]], i{{[0-9]+}} 0, i32 [[IDX]] + // CHECK: [[LOC_RED1:%.+]] = load double, double* [[RL_RED1]], + // CHECK: store double [[LOC_RED1]], double* [[GLOBAL_RED1_IDX_PTR]], + // CHECK: ret void + + // CHECK: define internal void [[RED_LIST_TO_GLOBAL_RED]](i8*, i32, i8*) + // CHECK: [[GLOBAL_PTR:%.+]] = alloca i8*, + // CHECK: [[IDX_PTR:%.+]] = alloca i32, + // CHECK: [[RL_PTR:%.+]] = alloca i8*, + // CHECK: [[LOCAL_RL:%.+]] = alloca [1 x i8*], + // CHECK: store i8* %{{.+}}, i8** [[GLOBAL_PTR]], + // CHECK: store i32 %{{.+}}, i32* [[IDX_PTR]], + // CHECK: store i8* %{{.+}}, i8** [[RL_PTR]], + // CHECK: [[GLOBAL_BC:%.+]] = load i8*, i8** [[GLOBAL_PTR]], + // CHECK: [[GLOBAL:%.+]] = bitcast i8* [[GLOBAL_BC]] to [[TEAM1_REDUCE_TY]]* + // CHECK: [[IDX:%.+]] = load i32, i32* [[IDX_PTR]], + // CHECK: [[LOCAL_RL_RED1_PTR:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[LOCAL_RL]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 + // CHECK: [[GLOBAL_RED1_PTR:%.+]] = getelementptr inbounds [[TEAM1_REDUCE_TY]], [[TEAM1_REDUCE_TY]]* [[GLOBAL]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 + // CHECK: [[GLOBAL_RED1_IDX_PTR:%.+]] = getelementptr inbounds [{{1024|2048}} x double], [{{1024|2048}} x double]* [[GLOBAL_RED1_PTR]], i{{[0-9]+}} 0, i32 [[IDX]] + // CHECK: [[GLOBAL_RED1_IDX_PTR_BC:%.+]] = bitcast double* [[GLOBAL_RED1_IDX_PTR]] to i8* + // CHECK: store i8* [[GLOBAL_RED1_IDX_PTR_BC]], i8** [[LOCAL_RL_RED1_PTR]] + // CHECK: [[LOCAL_RL_BC:%.+]] = bitcast [1 x i8*]* [[LOCAL_RL]] to i8* + // CHECK: [[RL_BC:%.+]] = load i8*, i8** [[RL_PTR]], + // CHECK: call void [[REDUCTION_FUNC]](i8* [[LOCAL_RL_BC]], i8* [[RL_BC]]) + // CHECK: ret void + + // CHECK: define internal void [[GLOBAL_TO_RED_LIST_COPY]](i8*, i32, i8*) + // CHECK: [[GLOBAL_PTR:%.+]] = alloca i8*, + // CHECK: [[IDX_PTR:%.+]] = alloca i32, + // CHECK: [[RL_PTR:%.+]] = alloca i8*, + // CHECK: store i8* %{{.+}}, i8** [[GLOBAL_PTR]], + // CHECK: store i32 %{{.+}}, i32* [[IDX_PTR]], + // CHECK: store i8* %{{.+}}, i8** [[RL_PTR]], + // CHECK: [[RL_BC:%.+]] = load i8*, i8** [[RL_PTR]], + // CHECK: [[RL:%.+]] = bitcast i8* [[RL_BC]] to [1 x i8*]* + // CHECK: [[GLOBAL_BC:%.+]] = load i8*, i8** [[GLOBAL_PTR]], + // CHECK: [[GLOBAL:%.+]] = bitcast i8* [[GLOBAL_BC]] to [[TEAM1_REDUCE_TY]]* + // CHECK: [[IDX:%.+]] = load i32, i32* [[IDX_PTR]], + // CHECK: [[RL_RED1_PTR:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[RL]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 + // CHECK: [[RL_RED1_BC:%.+]] = load i8*, i8** [[RL_RED1_PTR]], + // CHECK: [[RL_RED1:%.+]] = bitcast i8* [[RL_RED1_BC]] to double* + // CHECK: [[GLOBAL_RED1_PTR:%.+]] = getelementptr inbounds [[TEAM1_REDUCE_TY]], [[TEAM1_REDUCE_TY]]* [[GLOBAL]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 + // CHECK: [[GLOBAL_RED1_IDX_PTR:%.+]] = getelementptr inbounds [{{1024|2048}} x double], [{{1024|2048}} x double]* [[GLOBAL_RED1_PTR]], i{{[0-9]+}} 0, i32 [[IDX]] + // CHECK: [[GLOBAL_RED1:%.+]] = load double, double* [[GLOBAL_RED1_IDX_PTR]], + // CHECK: store double [[GLOBAL_RED1]], double* [[RL_RED1]], + // CHECK: ret void + + // CHECK: define internal void [[GLOBAL_TO_RED_LIST_RED]](i8*, i32, i8*) + // CHECK: [[GLOBAL_PTR:%.+]] = alloca i8*, + // CHECK: [[IDX_PTR:%.+]] = alloca i32, + // CHECK: [[RL_PTR:%.+]] = alloca i8*, + // CHECK: [[LOCAL_RL:%.+]] = alloca [1 x i8*], + // CHECK: store i8* %{{.+}}, i8** [[GLOBAL_PTR]], + // CHECK: store i32 %{{.+}}, i32* [[IDX_PTR]], + // CHECK: store i8* %{{.+}}, i8** [[RL_PTR]], + // CHECK: [[GLOBAL_BC:%.+]] = load i8*, i8** [[GLOBAL_PTR]], + // CHECK: [[GLOBAL:%.+]] = bitcast i8* [[GLOBAL_BC]] to [[TEAM1_REDUCE_TY]]* + // CHECK: [[IDX:%.+]] = load i32, i32* [[IDX_PTR]], + // CHECK: [[LOCAL_RL_RED1_PTR:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[LOCAL_RL]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 + // CHECK: [[GLOBAL_RED1_PTR:%.+]] = getelementptr inbounds [[TEAM1_REDUCE_TY]], [[TEAM1_REDUCE_TY]]* [[GLOBAL]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 + // CHECK: [[GLOBAL_RED1_IDX_PTR:%.+]] = getelementptr inbounds [{{1024|2048}} x double], [{{1024|2048}} x double]* [[GLOBAL_RED1_PTR]], i{{[0-9]+}} 0, i32 [[IDX]] + // CHECK: [[GLOBAL_RED1_IDX_PTR_BC:%.+]] = bitcast double* [[GLOBAL_RED1_IDX_PTR]] to i8* + // CHECK: store i8* [[GLOBAL_RED1_IDX_PTR_BC]], i8** [[LOCAL_RL_RED1_PTR]] + // CHECK: [[LOCAL_RL_BC:%.+]] = bitcast [1 x i8*]* [[LOCAL_RL]] to i8* + // CHECK: [[RL_BC:%.+]] = load i8*, i8** [[RL_PTR]], + // CHECK: call void [[REDUCTION_FUNC]](i8* [[RL_BC]], i8* [[LOCAL_RL_BC]]) + // CHECK: ret void + + // CHECK-LABEL: define {{.*}}void {{@__omp_offloading_.+template.+l47}}_worker() - // CHECK: define {{.*}}void [[T2:@__omp_offloading_.+template.+l43]]( + // CHECK: define {{.*}}void [[T2:@__omp_offloading_.+template.+l47]]( // // CHECK: {{call|invoke}} void [[T2]]_worker() @@ -111,7 +354,13 @@ int bar(int n){ // CHECK: [[DV:%.+]] = load float, float* [[D]], align // CHECK: [[MUL:%.+]] = fmul float [[DV]], {{[0-9e\.\+]+}} // CHECK: store float [[MUL]], float* [[D]], align - // CHECK: [[RET:%.+]] = call i32 @__kmpc_nvptx_teams_reduce_nowait_simple(%struct.ident_t* [[LOC:@.+]], i32 [[GTID:%.+]], [8 x i32]* [[LOCK:@.+]]) + // CHECK: [[GEP1:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[RED_LIST:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 + // CHECK: store i8* [[C]], i8** [[GEP1]], + // CHECK: [[GEP2:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[RED_LIST:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 1 + // CHECK: [[BC:%.+]] = bitcast float* [[D]] to i8* + // CHECK: store i8* [[BC]], i8** [[GEP2]], + // CHECK: [[BC_RED_LIST:%.+]] = bitcast [2 x i8*]* [[RED_LIST]] to i8* + // CHECK: [[RET:%.+]] = call i32 @__kmpc_nvptx_teams_reduce_nowait_v2(%struct.ident_t* [[LOC:@.+]], i32 [[GTID:%.+]], i8* bitcast ([[TEAMS_REDUCE_UNION_TY]]* [[TEAMS_RED_BUFFER]] to i8*), i32 {{1024|2048}}, i8* [[BC_RED_LIST]], void (i8*, i16, i16, i16)* [[SHUFFLE_AND_REDUCE:@.+]], void (i8*, i32)* [[INTER_WARP_COPY:@.+]], void (i8*, i32, i8*)* [[RED_LIST_TO_GLOBAL_COPY:@.+]], void (i8*, i32, i8*)* [[RED_LIST_TO_GLOBAL_RED:@.+]], void (i8*, i32, i8*)* [[GLOBAL_TO_RED_LIST_COPY:@.+]], void (i8*, i32, i8*)* [[GLOBAL_TO_RED_LIST_RED:@.+]]) // CHECK: [[COND:%.+]] = icmp eq i32 [[RET]], 1 // CHECK: br i1 [[COND]], label {{%?}}[[IFLABEL:.+]], label {{%?}}[[EXIT:.+]] // @@ -127,25 +376,349 @@ int bar(int n){ // CHECK: [[DV:%.+]] = load float, float* [[D]], align // CHECK: [[MUL:%.+]] = fmul float [[D_INV]], [[DV]] // CHECK: store float [[MUL]], float* [[D_IN]], align - // CHECK: call void @__kmpc_nvptx_teams_end_reduce_nowait_simple(%struct.ident_t* [[LOC]], i32 [[GTID]], [8 x i32]* [[LOCK]]) + // CHECK: call void @__kmpc_nvptx_end_reduce_nowait(i32 [[GTID]]) // CHECK: br label %[[EXIT]] // // CHECK: [[EXIT]] // CHECK: call void @__kmpc_kernel_deinit( - // CHECK-LABEL: define {{.*}}void {{@__omp_offloading_.+template.+l50}}( + // + // Reduction function + // CHECK: define internal void [[REDUCTION_FUNC:@.+]](i8*, i8*) + // CHECK: [[VAR1_RHS_REF:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[RED_LIST_RHS:%.+]], i{{32|64}} 0, i{{32|64}} 0 + // CHECK: [[VAR1_RHS:%.+]] = load i8*, i8** [[VAR1_RHS_REF]], + // + // CHECK: [[VAR1_LHS_REF:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[RED_LIST_LHS:%.+]], i{{32|64}} 0, i{{32|64}} 0 + // CHECK: [[VAR1_LHS:%.+]] = load i8*, i8** [[VAR1_LHS_REF]], + // + // CHECK: [[VAR2_RHS_REF:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[RED_LIST_RHS]], i{{32|64}} 0, i{{32|64}} 1 + // CHECK: [[VAR2_RHS_VOID:%.+]] = load i8*, i8** [[VAR2_RHS_REF]], + // CHECK: [[VAR2_RHS:%.+]] = bitcast i8* [[VAR2_RHS_VOID]] to float* + // + // CHECK: [[VAR2_LHS_REF:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[RED_LIST_LHS]], i{{32|64}} 0, i{{32|64}} 1 + // CHECK: [[VAR2_LHS_VOID:%.+]] = load i8*, i8** [[VAR2_LHS_REF]], + // CHECK: [[VAR2_LHS:%.+]] = bitcast i8* [[VAR2_LHS_VOID]] to float* + // + // CHECK: [[VAR1_LHS_VAL8:%.+]] = load i8, i8* [[VAR1_LHS]], + // CHECK: [[VAR1_LHS_VAL:%.+]] = sext i8 [[VAR1_LHS_VAL8]] to i32 + // CHECK: [[VAR1_RHS_VAL8:%.+]] = load i8, i8* [[VAR1_RHS]], + // CHECK: [[VAR1_RHS_VAL:%.+]] = sext i8 [[VAR1_RHS_VAL8]] to i32 + // CHECK: [[XOR:%.+]] = xor i32 [[VAR1_LHS_VAL]], [[VAR1_RHS_VAL]] + // CHECK: [[RES:%.+]] = trunc i32 [[XOR]] to i8 + // CHECK: store i8 [[RES]], i8* [[VAR1_LHS]], + // + // CHECK: [[VAR2_LHS_VAL:%.+]] = load float, float* [[VAR2_LHS]], + // CHECK: [[VAR2_RHS_VAL:%.+]] = load float, float* [[VAR2_RHS]], + // CHECK: [[RES:%.+]] = fmul float [[VAR2_LHS_VAL]], [[VAR2_RHS_VAL]] + // CHECK: store float [[RES]], float* [[VAR2_LHS]], + // CHECK: ret void + + // + // Shuffle and reduce function + // CHECK: define internal void [[SHUFFLE_AND_REDUCE]](i8*, i16 {{.*}}, i16 {{.*}}, i16 {{.*}}) + // CHECK: [[REMOTE_RED_LIST:%.+]] = alloca [2 x i8*], align + // CHECK: [[REMOTE_ELT1:%.+]] = alloca i8 + // CHECK: [[REMOTE_ELT2:%.+]] = alloca float + // + // CHECK: [[LANEID:%.+]] = load i16, i16* {{.+}}, align + // CHECK: [[LANEOFFSET:%.+]] = load i16, i16* {{.+}}, align + // CHECK: [[ALGVER:%.+]] = load i16, i16* {{.+}}, align + // + // CHECK: [[ELT_REF:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[RED_LIST:%.+]], i{{32|64}} 0, i{{32|64}} 0 + // CHECK: [[ELT_VOID:%.+]] = load i8*, i8** [[ELT_REF]], + // CHECK: [[REMOTE_ELT_REF:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[REMOTE_RED_LIST:%.+]], i{{32|64}} 0, i{{32|64}} 0 + // CHECK: [[ELT_VAL:%.+]] = load i8, i8* [[ELT_VOID]], align + // + // CHECK: [[ELT_CAST:%.+]] = sext i8 [[ELT_VAL]] to i32 + // CHECK: [[WS32:%.+]] = call i32 @llvm.nvvm.read.ptx.sreg.warpsize() + // CHECK: [[WS:%.+]] = trunc i32 [[WS32]] to i16 + // CHECK: [[REMOTE_ELT1_VAL32:%.+]] = call i32 @__kmpc_shuffle_int32(i32 [[ELT_CAST]], i16 [[LANEOFFSET]], i16 [[WS]]) + // CHECK: [[REMOTE_ELT1_VAL:%.+]] = trunc i32 [[REMOTE_ELT1_VAL32]] to i8 + // + // CHECK: store i8 [[REMOTE_ELT1_VAL]], i8* [[REMOTE_ELT1]], align + // CHECK: store i8* [[REMOTE_ELT1]], i8** [[REMOTE_ELT_REF]], align + // + // CHECK: [[ELT_REF:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[RED_LIST]], i{{32|64}} 0, i{{32|64}} 1 + // CHECK: [[ELT_VOID:%.+]] = load i8*, i8** [[ELT_REF]], + // CHECK: [[REMOTE_ELT_REF:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[REMOTE_RED_LIST]], i{{32|64}} 0, i{{32|64}} 1 + // CHECK: [[ELT:%.+]] = bitcast i8* [[ELT_VOID]] to float* + // + // CHECK: [[ELT_CAST:%.+]] = bitcast float* [[ELT]] to i32* + // CHECK: [[REMOTE_ELT2_CAST:%.+]] = bitcast float* [[REMOTE_ELT2]] to i32* + // CHECK: [[ELT_VAL:%.+]] = load i32, i32* [[ELT_CAST]], align + // CHECK: [[WS32:%.+]] = call i32 @llvm.nvvm.read.ptx.sreg.warpsize() + // CHECK: [[WS:%.+]] = trunc i32 [[WS32]] to i16 + // CHECK: [[REMOTE_ELT2_VAL32:%.+]] = call i32 @__kmpc_shuffle_int32(i32 [[ELT_VAL]], i16 [[LANEOFFSET]], i16 [[WS]]) + // + // CHECK: store i32 [[REMOTE_ELT2_VAL32]], i32* [[REMOTE_ELT2_CAST]], align + // CHECK: [[REMOTE_ELT2C:%.+]] = bitcast float* [[REMOTE_ELT2]] to i8* + // CHECK: store i8* [[REMOTE_ELT2C]], i8** [[REMOTE_ELT_REF]], align + // + // Condition to reduce + // CHECK: [[CONDALG0:%.+]] = icmp eq i16 [[ALGVER]], 0 + // + // CHECK: [[COND1:%.+]] = icmp eq i16 [[ALGVER]], 1 + // CHECK: [[COND2:%.+]] = icmp ult i16 [[LANEID]], [[LANEOFFSET]] + // CHECK: [[CONDALG1:%.+]] = and i1 [[COND1]], [[COND2]] + // + // CHECK: [[COND3:%.+]] = icmp eq i16 [[ALGVER]], 2 + // CHECK: [[COND4:%.+]] = and i16 [[LANEID]], 1 + // CHECK: [[COND5:%.+]] = icmp eq i16 [[COND4]], 0 + // CHECK: [[COND6:%.+]] = and i1 [[COND3]], [[COND5]] + // CHECK: [[COND7:%.+]] = icmp sgt i16 [[LANEOFFSET]], 0 + // CHECK: [[CONDALG2:%.+]] = and i1 [[COND6]], [[COND7]] + // + // CHECK: [[COND8:%.+]] = or i1 [[CONDALG0]], [[CONDALG1]] + // CHECK: [[SHOULD_REDUCE:%.+]] = or i1 [[COND8]], [[CONDALG2]] + // CHECK: br i1 [[SHOULD_REDUCE]], label {{%?}}[[DO_REDUCE:.+]], label {{%?}}[[REDUCE_ELSE:.+]] + // + // CHECK: [[DO_REDUCE]] + // CHECK: [[RED_LIST1_VOID:%.+]] = bitcast [2 x i8*]* [[RED_LIST]] to i8* + // CHECK: [[RED_LIST2_VOID:%.+]] = bitcast [2 x i8*]* [[REMOTE_RED_LIST]] to i8* + // CHECK: call void [[REDUCTION_FUNC]](i8* [[RED_LIST1_VOID]], i8* [[RED_LIST2_VOID]]) + // CHECK: br label {{%?}}[[REDUCE_CONT:.+]] + // + // CHECK: [[REDUCE_ELSE]] + // CHECK: br label {{%?}}[[REDUCE_CONT]] + // + // CHECK: [[REDUCE_CONT]] + // Now check if we should just copy over the remote reduction list + // CHECK: [[COND1:%.+]] = icmp eq i16 [[ALGVER]], 1 + // CHECK: [[COND2:%.+]] = icmp uge i16 [[LANEID]], [[LANEOFFSET]] + // CHECK: [[SHOULD_COPY:%.+]] = and i1 [[COND1]], [[COND2]] + // CHECK: br i1 [[SHOULD_COPY]], label {{%?}}[[DO_COPY:.+]], label {{%?}}[[COPY_ELSE:.+]] + // + // CHECK: [[DO_COPY]] + // CHECK: [[REMOTE_ELT_REF:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[REMOTE_RED_LIST]], i{{32|64}} 0, i{{32|64}} 0 + // CHECK: [[REMOTE_ELT_VOID:%.+]] = load i8*, i8** [[REMOTE_ELT_REF]], + // CHECK: [[ELT_REF:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[RED_LIST]], i{{32|64}} 0, i{{32|64}} 0 + // CHECK: [[ELT_VOID:%.+]] = load i8*, i8** [[ELT_REF]], + // CHECK: [[REMOTE_ELT_VAL:%.+]] = load i8, i8* [[REMOTE_ELT_VOID]], align + // CHECK: store i8 [[REMOTE_ELT_VAL]], i8* [[ELT_VOID]], align + // + // CHECK: [[REMOTE_ELT_REF:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[REMOTE_RED_LIST]], i{{32|64}} 0, i{{32|64}} 1 + // CHECK: [[REMOTE_ELT_VOID:%.+]] = load i8*, i8** [[REMOTE_ELT_REF]], + // CHECK: [[ELT_REF:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[RED_LIST]], i{{32|64}} 0, i{{32|64}} 1 + // CHECK: [[ELT_VOID:%.+]] = load i8*, i8** [[ELT_REF]], + // CHECK: [[REMOTE_ELT:%.+]] = bitcast i8* [[REMOTE_ELT_VOID]] to float* + // CHECK: [[ELT:%.+]] = bitcast i8* [[ELT_VOID]] to float* + // CHECK: [[REMOTE_ELT_VAL:%.+]] = load float, float* [[REMOTE_ELT]], align + // CHECK: store float [[REMOTE_ELT_VAL]], float* [[ELT]], align + // CHECK: br label {{%?}}[[COPY_CONT:.+]] + // + // CHECK: [[COPY_ELSE]] + // CHECK: br label {{%?}}[[COPY_CONT]] + // + // CHECK: [[COPY_CONT]] + // CHECK: void + + // + // Inter warp copy function + // CHECK: define internal void [[INTER_WARP_COPY]](i8*, i32) + // CHECK-DAG: [[LANEID:%.+]] = and i32 {{.+}}, 31 + // CHECK-DAG: [[WARPID:%.+]] = ashr i32 {{.+}}, 5 + // CHECK-DAG: [[RED_LIST:%.+]] = bitcast i8* {{.+}} to [2 x i8*]* + // CHECK: call void @__kmpc_barrier(%struct.ident_t* @ + // CHECK: [[IS_WARP_MASTER:%.+]] = icmp eq i32 [[LANEID]], 0 + // CHECK: br i1 [[IS_WARP_MASTER]], label {{%?}}[[DO_COPY:.+]], label {{%?}}[[COPY_ELSE:.+]] + // + // [[DO_COPY]] + // CHECK: [[ELT_REF:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[RED_LIST]], i{{32|64}} 0, i{{32|64}} 0 + // CHECK: [[ELT_VOID:%.+]] = load i8*, i8** [[ELT_REF]], + // + // CHECK: [[MEDIUM_ELT64:%.+]] = getelementptr inbounds [32 x i32], [32 x i32] addrspace([[SHARED_ADDRSPACE]])* [[TRANSFER_STORAGE]], i64 0, i32 [[WARPID]] + // CHECK: [[MEDIUM_ELT:%.+]] = bitcast i32 addrspace([[SHARED_ADDRSPACE]])* [[MEDIUM_ELT64]] to i8 addrspace([[SHARED_ADDRSPACE]])* + // CHECK: [[ELT_VAL:%.+]] = load i8, i8* [[ELT_VOID]], align + // CHECK: store volatile i8 [[ELT_VAL]], i8 addrspace([[SHARED_ADDRSPACE]])* [[MEDIUM_ELT]], align + // CHECK: br label {{%?}}[[COPY_CONT:.+]] + // + // CHECK: [[COPY_ELSE]] + // CHECK: br label {{%?}}[[COPY_CONT]] + // + // Barrier after copy to shared memory storage medium. + // CHECK: [[COPY_CONT]] + // CHECK: call void @__kmpc_barrier(%struct.ident_t* @ + // CHECK: [[ACTIVE_WARPS:%.+]] = load i32, i32* + // + // Read into warp 0. + // CHECK: [[IS_W0_ACTIVE_THREAD:%.+]] = icmp ult i32 [[TID:%.+]], [[ACTIVE_WARPS]] + // CHECK: br i1 [[IS_W0_ACTIVE_THREAD]], label {{%?}}[[DO_READ:.+]], label {{%?}}[[READ_ELSE:.+]] + // + // CHECK: [[DO_READ]] + // CHECK: [[MEDIUM_ELT32:%.+]] = getelementptr inbounds [32 x i32], [32 x i32] addrspace([[SHARED_ADDRSPACE]])* [[TRANSFER_STORAGE]], i64 0, i32 [[TID]] + // CHECK: [[MEDIUM_ELT:%.+]] = bitcast i32 addrspace([[SHARED_ADDRSPACE]])* [[MEDIUM_ELT32]] to i8 addrspace([[SHARED_ADDRSPACE]])* + // CHECK: [[ELT_REF:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[RED_LIST:%.+]], i{{32|64}} 0, i{{32|64}} 0 + // CHECK: [[ELT_VOID:%.+]] = load i8*, i8** [[ELT_REF]], + // CHECK: [[MEDIUM_ELT_VAL:%.+]] = load volatile i8, i8 addrspace([[SHARED_ADDRSPACE]])* [[MEDIUM_ELT]], align + // CHECK: store i8 [[MEDIUM_ELT_VAL]], i8* [[ELT_VOID]], align + // CHECK: br label {{%?}}[[READ_CONT:.+]] + // + // CHECK: [[READ_ELSE]] + // CHECK: br label {{%?}}[[READ_CONT]] + // + // CHECK: [[READ_CONT]] + // CHECK: call void @__kmpc_barrier(%struct.ident_t* @ + // CHECK: [[IS_WARP_MASTER:%.+]] = icmp eq i32 [[LANEID]], 0 + // CHECK: br i1 [[IS_WARP_MASTER]], label {{%?}}[[DO_COPY:.+]], label {{%?}}[[COPY_ELSE:.+]] + // + // [[DO_COPY]] + // CHECK: [[ELT_REF:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[RED_LIST]], i{{32|64}} 0, i{{32|64}} 1 + // CHECK: [[ELT_VOID:%.+]] = load i8*, i8** [[ELT_REF]], + // CHECK: [[ELT:%.+]] = bitcast i8* [[ELT_VOID]] to i32* + // + // CHECK: [[MEDIUM_ELT:%.+]] = getelementptr inbounds [32 x i32], [32 x i32] addrspace([[SHARED_ADDRSPACE]])* [[TRANSFER_STORAGE]], i64 0, i32 [[WARPID]] + // CHECK: [[ELT_VAL:%.+]] = load i32, i32* [[ELT]], align + // CHECK: store volatile i32 [[ELT_VAL]], i32 addrspace([[SHARED_ADDRSPACE]])* [[MEDIUM_ELT]], align + // CHECK: br label {{%?}}[[COPY_CONT:.+]] + // + // CHECK: [[COPY_ELSE]] + // CHECK: br label {{%?}}[[COPY_CONT]] + // + // Barrier after copy to shared memory storage medium. + // CHECK: [[COPY_CONT]] + // CHECK: call void @__kmpc_barrier(%struct.ident_t* @ + // CHECK: [[ACTIVE_WARPS:%.+]] = load i32, i32* + // + // Read into warp 0. + // CHECK: [[IS_W0_ACTIVE_THREAD:%.+]] = icmp ult i32 [[TID:%.+]], [[ACTIVE_WARPS]] + // CHECK: br i1 [[IS_W0_ACTIVE_THREAD]], label {{%?}}[[DO_READ:.+]], label {{%?}}[[READ_ELSE:.+]] + // + // CHECK: [[DO_READ]] + // CHECK: [[MEDIUM_ELT:%.+]] = getelementptr inbounds [32 x i32], [32 x i32] addrspace([[SHARED_ADDRSPACE]])* [[TRANSFER_STORAGE]], i64 0, i32 [[TID]] + // CHECK: [[ELT_REF:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[RED_LIST:%.+]], i{{32|64}} 0, i{{32|64}} 1 + // CHECK: [[ELT_VOID:%.+]] = load i8*, i8** [[ELT_REF]], + // CHECK: [[ELT:%.+]] = bitcast i8* [[ELT_VOID]] to i32* + // CHECK: [[MEDIUM_ELT_VAL:%.+]] = load volatile i32, i32 addrspace([[SHARED_ADDRSPACE]])* [[MEDIUM_ELT]], align + // CHECK: store i32 [[MEDIUM_ELT_VAL]], i32* [[ELT]], align + // CHECK: br label {{%?}}[[READ_CONT:.+]] + // + // CHECK: [[READ_ELSE]] + // CHECK: br label {{%?}}[[READ_CONT]] + // + // CHECK: [[READ_CONT]] + // CHECK: ret + + // CHECK: define internal void [[RED_LIST_TO_GLOBAL_COPY]](i8*, i32, i8*) + // CHECK: [[GLOBAL_PTR:%.+]] = alloca i8*, + // CHECK: [[IDX_PTR:%.+]] = alloca i32, + // CHECK: [[RL_PTR:%.+]] = alloca i8*, + // CHECK: store i8* %{{.+}}, i8** [[GLOBAL_PTR]], + // CHECK: store i32 %{{.+}}, i32* [[IDX_PTR]], + // CHECK: store i8* %{{.+}}, i8** [[RL_PTR]], + // CHECK: [[RL_BC:%.+]] = load i8*, i8** [[RL_PTR]], + // CHECK: [[RL:%.+]] = bitcast i8* [[RL_BC]] to [2 x i8*]* + // CHECK: [[GLOBAL_BC:%.+]] = load i8*, i8** [[GLOBAL_PTR]], + // CHECK: [[GLOBAL:%.+]] = bitcast i8* [[GLOBAL_BC]] to [[TEAM2_REDUCE_TY]]* + // CHECK: [[IDX:%.+]] = load i32, i32* [[IDX_PTR]], + // CHECK: [[RL_RED1_PTR:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[RL]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 + // CHECK: [[RL_RED1:%.+]] = load i8*, i8** [[RL_RED1_PTR]], + // CHECK: [[GLOBAL_RED1_PTR:%.+]] = getelementptr inbounds [[TEAM2_REDUCE_TY]], [[TEAM2_REDUCE_TY]]* [[GLOBAL]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 + // CHECK: [[GLOBAL_RED1_IDX_PTR:%.+]] = getelementptr inbounds [{{1024|2048}} x i8], [{{1024|2048}} x i8]* [[GLOBAL_RED1_PTR]], i{{[0-9]+}} 0, i32 [[IDX]] + // CHECK: [[LOC_RED1:%.+]] = load i8, i8* [[RL_RED1]], + // CHECK: store i8 [[LOC_RED1]], i8* [[GLOBAL_RED1_IDX_PTR]], + // CHECK: [[RL_RED1_PTR:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[RL]], i{{[0-9]+}} 0, i{{[0-9]+}} 1 + // CHECK: [[RL_RED1_BC:%.+]] = load i8*, i8** [[RL_RED1_PTR]], + // CHECK: [[RL_RED1:%.+]] = bitcast i8* [[RL_RED1_BC]] to float* + // CHECK: [[GLOBAL_RED1_PTR:%.+]] = getelementptr inbounds [[TEAM2_REDUCE_TY]], [[TEAM2_REDUCE_TY]]* [[GLOBAL]], i{{[0-9]+}} 0, i{{[0-9]+}} 1 + // CHECK: [[GLOBAL_RED1_IDX_PTR:%.+]] = getelementptr inbounds [{{1024|2048}} x float], [{{1024|2048}} x float]* [[GLOBAL_RED1_PTR]], i{{[0-9]+}} 0, i32 [[IDX]] + // CHECK: [[LOC_RED1:%.+]] = load float, float* [[RL_RED1]], + // CHECK: store float [[LOC_RED1]], float* [[GLOBAL_RED1_IDX_PTR]], + // CHECK: ret void + + // CHECK: define internal void [[RED_LIST_TO_GLOBAL_RED]](i8*, i32, i8*) + // CHECK: [[GLOBAL_PTR:%.+]] = alloca i8*, + // CHECK: [[IDX_PTR:%.+]] = alloca i32, + // CHECK: [[RL_PTR:%.+]] = alloca i8*, + // CHECK: [[LOCAL_RL:%.+]] = alloca [2 x i8*], + // CHECK: store i8* %{{.+}}, i8** [[GLOBAL_PTR]], + // CHECK: store i32 %{{.+}}, i32* [[IDX_PTR]], + // CHECK: store i8* %{{.+}}, i8** [[RL_PTR]], + // CHECK: [[GLOBAL_BC:%.+]] = load i8*, i8** [[GLOBAL_PTR]], + // CHECK: [[GLOBAL:%.+]] = bitcast i8* [[GLOBAL_BC]] to [[TEAM2_REDUCE_TY]]* + // CHECK: [[IDX:%.+]] = load i32, i32* [[IDX_PTR]], + // CHECK: [[LOCAL_RL_RED1_PTR:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[LOCAL_RL]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 + // CHECK: [[GLOBAL_RED1_PTR:%.+]] = getelementptr inbounds [[TEAM2_REDUCE_TY]], [[TEAM2_REDUCE_TY]]* [[GLOBAL]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 + // CHECK: [[GLOBAL_RED1_IDX_PTR:%.+]] = getelementptr inbounds [{{1024|2048}} x i8], [{{1024|2048}} x i8]* [[GLOBAL_RED1_PTR]], i{{[0-9]+}} 0, i32 [[IDX]] + // CHECK: store i8* [[GLOBAL_RED1_IDX_PTR]], i8** [[LOCAL_RL_RED1_PTR]] + // CHECK: [[LOCAL_RL_RED1_PTR:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[LOCAL_RL]], i{{[0-9]+}} 0, i{{[0-9]+}} 1 + // CHECK: [[GLOBAL_RED1_PTR:%.+]] = getelementptr inbounds [[TEAM2_REDUCE_TY]], [[TEAM2_REDUCE_TY]]* [[GLOBAL]], i{{[0-9]+}} 0, i{{[0-9]+}} 1 + // CHECK: [[GLOBAL_RED1_IDX_PTR:%.+]] = getelementptr inbounds [{{1024|2048}} x float], [{{1024|2048}} x float]* [[GLOBAL_RED1_PTR]], i{{[0-9]+}} 0, i32 [[IDX]] + // CHECK: [[GLOBAL_RED1_IDX_PTR_BC:%.+]] = bitcast float* [[GLOBAL_RED1_IDX_PTR]] to i8* + // CHECK: store i8* [[GLOBAL_RED1_IDX_PTR_BC]], i8** [[LOCAL_RL_RED1_PTR]] + // CHECK: [[LOCAL_RL_BC:%.+]] = bitcast [2 x i8*]* [[LOCAL_RL]] to i8* + // CHECK: [[RL_BC:%.+]] = load i8*, i8** [[RL_PTR]], + // CHECK: call void [[REDUCTION_FUNC]](i8* [[LOCAL_RL_BC]], i8* [[RL_BC]]) + // CHECK: ret void + + // CHECK: define internal void [[GLOBAL_TO_RED_LIST_COPY]](i8*, i32, i8*) + // CHECK: [[GLOBAL_PTR:%.+]] = alloca i8*, + // CHECK: [[IDX_PTR:%.+]] = alloca i32, + // CHECK: [[RL_PTR:%.+]] = alloca i8*, + // CHECK: store i8* %{{.+}}, i8** [[GLOBAL_PTR]], + // CHECK: store i32 %{{.+}}, i32* [[IDX_PTR]], + // CHECK: store i8* %{{.+}}, i8** [[RL_PTR]], + // CHECK: [[RL_BC:%.+]] = load i8*, i8** [[RL_PTR]], + // CHECK: [[RL:%.+]] = bitcast i8* [[RL_BC]] to [2 x i8*]* + // CHECK: [[GLOBAL_BC:%.+]] = load i8*, i8** [[GLOBAL_PTR]], + // CHECK: [[GLOBAL:%.+]] = bitcast i8* [[GLOBAL_BC]] to [[TEAM2_REDUCE_TY]]* + // CHECK: [[IDX:%.+]] = load i32, i32* [[IDX_PTR]], + // CHECK: [[RL_RED1_PTR:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[RL]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 + // CHECK: [[RL_RED1:%.+]] = load i8*, i8** [[RL_RED1_PTR]], + // CHECK: [[GLOBAL_RED1_PTR:%.+]] = getelementptr inbounds [[TEAM2_REDUCE_TY]], [[TEAM2_REDUCE_TY]]* [[GLOBAL]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 + // CHECK: [[GLOBAL_RED1_IDX_PTR:%.+]] = getelementptr inbounds [{{1024|2048}} x i8], [{{1024|2048}} x i8]* [[GLOBAL_RED1_PTR]], i{{[0-9]+}} 0, i32 [[IDX]] + // CHECK: [[GLOBAL_RED1:%.+]] = load i8, i8* [[GLOBAL_RED1_IDX_PTR]], + // CHECK: store i8 [[GLOBAL_RED1]], i8* [[RL_RED1]], + // CHECK: [[RL_RED1_PTR:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[RL]], i{{[0-9]+}} 0, i{{[0-9]+}} 1 + // CHECK: [[RL_RED1_BC:%.+]] = load i8*, i8** [[RL_RED1_PTR]], + // CHECK: [[RL_RED1:%.+]] = bitcast i8* [[RL_RED1_BC]] to float* + // CHECK: [[GLOBAL_RED1_PTR:%.+]] = getelementptr inbounds [[TEAM2_REDUCE_TY]], [[TEAM2_REDUCE_TY]]* [[GLOBAL]], i{{[0-9]+}} 0, i{{[0-9]+}} 1 + // CHECK: [[GLOBAL_RED1_IDX_PTR:%.+]] = getelementptr inbounds [{{1024|2048}} x float], [{{1024|2048}} x float]* [[GLOBAL_RED1_PTR]], i{{[0-9]+}} 0, i32 [[IDX]] + // CHECK: [[GLOBAL_RED1:%.+]] = load float, float* [[GLOBAL_RED1_IDX_PTR]], + // CHECK: store float [[GLOBAL_RED1]], float* [[RL_RED1]], + // CHECK: ret void + + // CHECK: define internal void [[GLOBAL_TO_RED_LIST_RED]](i8*, i32, i8*) + // CHECK: [[GLOBAL_PTR:%.+]] = alloca i8*, + // CHECK: [[IDX_PTR:%.+]] = alloca i32, + // CHECK: [[RL_PTR:%.+]] = alloca i8*, + // CHECK: [[LOCAL_RL:%.+]] = alloca [2 x i8*], + // CHECK: store i8* %{{.+}}, i8** [[GLOBAL_PTR]], + // CHECK: store i32 %{{.+}}, i32* [[IDX_PTR]], + // CHECK: store i8* %{{.+}}, i8** [[RL_PTR]], + // CHECK: [[GLOBAL_BC:%.+]] = load i8*, i8** [[GLOBAL_PTR]], + // CHECK: [[GLOBAL:%.+]] = bitcast i8* [[GLOBAL_BC]] to [[TEAM2_REDUCE_TY]]* + // CHECK: [[IDX:%.+]] = load i32, i32* [[IDX_PTR]], + // CHECK: [[LOCAL_RL_RED1_PTR:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[LOCAL_RL]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 + // CHECK: [[GLOBAL_RED1_PTR:%.+]] = getelementptr inbounds [[TEAM2_REDUCE_TY]], [[TEAM2_REDUCE_TY]]* [[GLOBAL]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 + // CHECK: [[GLOBAL_RED1_IDX_PTR:%.+]] = getelementptr inbounds [{{1024|2048}} x i8], [{{1024|2048}} x i8]* [[GLOBAL_RED1_PTR]], i{{[0-9]+}} 0, i32 [[IDX]] + // CHECK: store i8* [[GLOBAL_RED1_IDX_PTR]], i8** [[LOCAL_RL_RED1_PTR]] + // CHECK: [[LOCAL_RL_RED1_PTR:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[LOCAL_RL]], i{{[0-9]+}} 0, i{{[0-9]+}} 1 + // CHECK: [[GLOBAL_RED1_PTR:%.+]] = getelementptr inbounds [[TEAM2_REDUCE_TY]], [[TEAM2_REDUCE_TY]]* [[GLOBAL]], i{{[0-9]+}} 0, i{{[0-9]+}} 1 + // CHECK: [[GLOBAL_RED1_IDX_PTR:%.+]] = getelementptr inbounds [{{1024|2048}} x float], [{{1024|2048}} x float]* [[GLOBAL_RED1_PTR]], i{{[0-9]+}} 0, i32 [[IDX]] + // CHECK: [[GLOBAL_RED1_IDX_PTR_BC:%.+]] = bitcast float* [[GLOBAL_RED1_IDX_PTR]] to i8* + // CHECK: store i8* [[GLOBAL_RED1_IDX_PTR_BC]], i8** [[LOCAL_RL_RED1_PTR]] + // CHECK: [[LOCAL_RL_BC:%.+]] = bitcast [2 x i8*]* [[LOCAL_RL]] to i8* + // CHECK: [[RL_BC:%.+]] = load i8*, i8** [[RL_PTR]], + // CHECK: call void [[REDUCTION_FUNC]](i8* [[RL_BC]], i8* [[LOCAL_RL_BC]]) + // CHECK: ret void + + // CHECK-LABEL: define {{.*}}void {{@__omp_offloading_.+template.+l54}}( // // CHECK: call void @__kmpc_spmd_kernel_init( // CHECK: call void @__kmpc_data_sharing_init_stack_spmd() - // CHECK: call void @__kmpc_get_team_static_memory(i16 1, i8* addrspacecast (i8 addrspace(3)* getelementptr inbounds ([[MEM_TY:%.+]], %{{.+}} addrspace(3)* [[KERNEL_RD:@.+]], i32 0, i32 0, i32 0) to i8*), i{{64|32}} {{8|16}}, i16 1, i8** addrspacecast (i8* addrspace(3)* [[KERNEL_PTR:@.+]] to i8**)) - // CHECK: [[PTR:%.+]] = load i8*, i8* addrspace(3)* [[KERNEL_PTR]], - // CHECK: [[GLOBAL_REC:%.+]] = bitcast i8* [[PTR]] to [[GLOB_REC_TY:%.+]]* - // CHECK-DAG: [[A_ADDR:%.+]] = getelementptr inbounds [[GLOB_REC_TY]], [[GLOB_REC_TY]]* [[GLOBAL_REC]], i32 0, i32 0 - // CHECK-DAG: [[B_ADDR:%.+]] = getelementptr inbounds [[GLOB_REC_TY]], [[GLOB_REC_TY]]* [[GLOBAL_REC]], i32 0, i32 1 - // CHECK: store i32 0, i32* [[A_ADDR]], - // CHECK: store i16 -32768, i16* [[B_ADDR]], + // CHECK-NOT: call void @__kmpc_get_team_static_memory + // CHECK: store i32 0, + // CHECK: store i32 0, i32* [[A_ADDR:%.+]], align + // CHECK: store i16 -32768, i16* [[B_ADDR:%.+]], align // CHECK: call void [[OUTLINED:@.+]](i32* {{.+}}, i32* {{.+}}, i32* [[A_ADDR]], i16* [[B_ADDR]]) - // CHECK: [[RET:%.+]] = call i32 @__kmpc_nvptx_teams_reduce_nowait_simple(%struct.ident_t* [[LOC:@.+]], i32 [[GTID:%.+]], [8 x i32]* [[LOCK:@.+]]) + // CHECK: [[GEP1:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[RED_LIST:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 + // CHECK: [[BC:%.+]] = bitcast i32* [[A_ADDR]] to i8* + // CHECK: store i8* [[BC]], i8** [[GEP1]], + // CHECK: [[GEP2:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[RED_LIST:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 1 + // CHECK: [[BC:%.+]] = bitcast i16* [[B_ADDR]] to i8* + // CHECK: store i8* [[BC]], i8** [[GEP2]], + // CHECK: [[BC_RED_LIST:%.+]] = bitcast [2 x i8*]* [[RED_LIST]] to i8* + // CHECK: [[RET:%.+]] = call i32 @__kmpc_nvptx_teams_reduce_nowait_v2(%struct.ident_t* [[LOC:@.+]], i32 [[GTID:%.+]], i8* bitcast ([[TEAMS_REDUCE_UNION_TY]]* [[TEAMS_RED_BUFFER]] to i8*), i32 {{1024|2048}}, i8* [[BC_RED_LIST]], void (i8*, i16, i16, i16)* [[SHUFFLE_AND_REDUCE:@.+]], void (i8*, i32)* [[INTER_WARP_COPY:@.+]], void (i8*, i32, i8*)* [[RED_LIST_TO_GLOBAL_COPY:@.+]], void (i8*, i32, i8*)* [[RED_LIST_TO_GLOBAL_RED:@.+]], void (i8*, i32, i8*)* [[GLOBAL_TO_RED_LIST_COPY:@.+]], void (i8*, i32, i8*)* [[GLOBAL_TO_RED_LIST_RED:@.+]]) // CHECK: [[COND:%.+]] = icmp eq i32 [[RET]], 1 // CHECK: br i1 [[COND]], label {{%?}}[[IFLABEL:.+]], label {{%?}}[[EXIT:.+]] // @@ -172,11 +745,10 @@ int bar(int n){ // CHECK: [[MAX_CONT]] // CHECK: [[B_MAX:%.+]] = phi i16 [ [[MAX1]], %[[DO_MAX]] ], [ [[MAX2]], %[[MAX_ELSE]] ] // CHECK: store i16 [[B_MAX]], i16* [[B_IN]], align - // CHECK: call void @__kmpc_nvptx_teams_end_reduce_nowait_simple(%struct.ident_t* [[LOC]], i32 [[GTID]], [8 x i32]* [[LOCK]]) + // CHECK: call void @__kmpc_nvptx_end_reduce_nowait(i32 [[GTID]]) // CHECK: br label %[[EXIT]] // // CHECK: [[EXIT]] - // CHECK: call void @__kmpc_restore_team_static_memory(i16 1, i16 1) // CHECK: call void @__kmpc_spmd_kernel_deinit_v2(i16 1) // CHECK: define internal void [[OUTLINED]](i32* noalias %{{.+}}, i32* noalias %{{.+}}, i32* dereferenceable{{.+}}, i16* dereferenceable{{.+}}) @@ -475,4 +1047,346 @@ int bar(int n){ // CHECK: [[READ_CONT]] // CHECK: ret + // + // Reduction function + // CHECK: define internal void [[REDUCTION_FUNC:@.+]](i8*, i8*) + // CHECK: [[VAR1_RHS_REF:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[RED_LIST_RHS:%.+]], i[[SZ]] 0, i[[SZ]] 0 + // CHECK: [[VAR1_RHS_VOID:%.+]] = load i8*, i8** [[VAR1_RHS_REF]], + // CHECK: [[VAR1_RHS:%.+]] = bitcast i8* [[VAR1_RHS_VOID]] to i32* + // + // CHECK: [[VAR1_LHS_REF:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[RED_LIST_LHS:%.+]], i[[SZ]] 0, i[[SZ]] 0 + // CHECK: [[VAR1_LHS_VOID:%.+]] = load i8*, i8** [[VAR1_LHS_REF]], + // CHECK: [[VAR1_LHS:%.+]] = bitcast i8* [[VAR1_LHS_VOID]] to i32* + // + // CHECK: [[VAR2_RHS_REF:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[RED_LIST_RHS]], i[[SZ]] 0, i[[SZ]] 1 + // CHECK: [[VAR2_RHS_VOID:%.+]] = load i8*, i8** [[VAR2_RHS_REF]], + // CHECK: [[VAR2_RHS:%.+]] = bitcast i8* [[VAR2_RHS_VOID]] to i16* + // + // CHECK: [[VAR2_LHS_REF:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[RED_LIST_LHS]], i[[SZ]] 0, i[[SZ]] 1 + // CHECK: [[VAR2_LHS_VOID:%.+]] = load i8*, i8** [[VAR2_LHS_REF]], + // CHECK: [[VAR2_LHS:%.+]] = bitcast i8* [[VAR2_LHS_VOID]] to i16* + // + // CHECK: [[VAR1_LHS_VAL:%.+]] = load i32, i32* [[VAR1_LHS]], + // CHECK: [[VAR1_RHS_VAL:%.+]] = load i32, i32* [[VAR1_RHS]], + // CHECK: [[OR:%.+]] = or i32 [[VAR1_LHS_VAL]], [[VAR1_RHS_VAL]] + // CHECK: store i32 [[OR]], i32* [[VAR1_LHS]], + // + // CHECK: [[VAR2_LHS_VAL16:%.+]] = load i16, i16* [[VAR2_LHS]], + // CHECK: [[VAR2_LHS_VAL:%.+]] = sext i16 [[VAR2_LHS_VAL16]] to i32 + // CHECK: [[VAR2_RHS_VAL16:%.+]] = load i16, i16* [[VAR2_RHS]], + // CHECK: [[VAR2_RHS_VAL:%.+]] = sext i16 [[VAR2_RHS_VAL16]] to i32 + // + // CHECK: [[CMP:%.+]] = icmp sgt i32 [[VAR2_LHS_VAL]], [[VAR2_RHS_VAL]] + // CHECK: br i1 [[CMP]], label {{%?}}[[DO_MAX:.+]], label {{%?}}[[MAX_ELSE:.+]] + // + // CHECK: [[DO_MAX]] + // CHECK: [[MAX1:%.+]] = load i16, i16* [[VAR2_LHS]], align + // CHECK: br label {{%?}}[[MAX_CONT:.+]] + // + // CHECK: [[MAX_ELSE]] + // CHECK: [[MAX2:%.+]] = load i16, i16* [[VAR2_RHS]], align + // CHECK: br label {{%?}}[[MAX_CONT]] + // + // CHECK: [[MAX_CONT]] + // CHECK: [[MAXV:%.+]] = phi i16 [ [[MAX1]], %[[DO_MAX]] ], [ [[MAX2]], %[[MAX_ELSE]] ] + // CHECK: store i16 [[MAXV]], i16* [[VAR2_LHS]], + // CHECK: ret void + + // + // Shuffle and reduce function + // CHECK: define internal void [[SHUFFLE_AND_REDUCE]](i8*, i16 {{.*}}, i16 {{.*}}, i16 {{.*}}) + // CHECK: [[REMOTE_RED_LIST:%.+]] = alloca [2 x i8*], align + // CHECK: [[REMOTE_ELT1:%.+]] = alloca i32 + // CHECK: [[REMOTE_ELT2:%.+]] = alloca i16 + // + // CHECK: [[LANEID:%.+]] = load i16, i16* {{.+}}, align + // CHECK: [[LANEOFFSET:%.+]] = load i16, i16* {{.+}}, align + // CHECK: [[ALGVER:%.+]] = load i16, i16* {{.+}}, align + // + // CHECK: [[ELT_REF:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[RED_LIST:%.+]], i[[SZ]] 0, i[[SZ]] 0 + // CHECK: [[ELT_VOID:%.+]] = load i8*, i8** [[ELT_REF]], + // CHECK: [[REMOTE_ELT_REF:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[REMOTE_RED_LIST:%.+]], i[[SZ]] 0, i[[SZ]] 0 + // CHECK: [[ELT:%.+]] = bitcast i8* [[ELT_VOID]] to i32* + // CHECK: [[ELT_VAL:%.+]] = load i32, i32* [[ELT]], align + // + // CHECK: [[WS32:%.+]] = call i32 @llvm.nvvm.read.ptx.sreg.warpsize() + // CHECK: [[WS:%.+]] = trunc i32 [[WS32]] to i16 + // CHECK: [[REMOTE_ELT1_VAL:%.+]] = call i32 @__kmpc_shuffle_int32(i32 [[ELT_VAL]], i16 [[LANEOFFSET]], i16 [[WS]]) + // + // CHECK: store i32 [[REMOTE_ELT1_VAL]], i32* [[REMOTE_ELT1]], align + // CHECK: [[REMOTE_ELT1C:%.+]] = bitcast i32* [[REMOTE_ELT1]] to i8* + // CHECK: store i8* [[REMOTE_ELT1C]], i8** [[REMOTE_ELT_REF]], align + // + // CHECK: [[ELT_REF:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[RED_LIST]], i[[SZ]] 0, i[[SZ]] 1 + // CHECK: [[ELT_VOID:%.+]] = load i8*, i8** [[ELT_REF]], + // CHECK: [[REMOTE_ELT_REF:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[REMOTE_RED_LIST]], i[[SZ]] 0, i[[SZ]] 1 + // CHECK: [[ELT:%.+]] = bitcast i8* [[ELT_VOID]] to i16* + // CHECK: [[ELT_VAL:%.+]] = load i16, i16* [[ELT]], align + // + // CHECK: [[ELT_CAST:%.+]] = sext i16 [[ELT_VAL]] to i32 + // CHECK: [[WS32:%.+]] = call i32 @llvm.nvvm.read.ptx.sreg.warpsize() + // CHECK: [[WS:%.+]] = trunc i32 [[WS32]] to i16 + // CHECK: [[REMOTE_ELT2_VAL32:%.+]] = call i32 @__kmpc_shuffle_int32(i32 [[ELT_CAST]], i16 [[LANEOFFSET]], i16 [[WS]]) + // CHECK: [[REMOTE_ELT2_VAL:%.+]] = trunc i32 [[REMOTE_ELT2_VAL32]] to i16 + // + // CHECK: store i16 [[REMOTE_ELT2_VAL]], i16* [[REMOTE_ELT2]], align + // CHECK: [[REMOTE_ELT2C:%.+]] = bitcast i16* [[REMOTE_ELT2]] to i8* + // CHECK: store i8* [[REMOTE_ELT2C]], i8** [[REMOTE_ELT_REF]], align + // + // Condition to reduce + // CHECK: [[CONDALG0:%.+]] = icmp eq i16 [[ALGVER]], 0 + // + // CHECK: [[COND1:%.+]] = icmp eq i16 [[ALGVER]], 1 + // CHECK: [[COND2:%.+]] = icmp ult i16 [[LANEID]], [[LANEOFFSET]] + // CHECK: [[CONDALG1:%.+]] = and i1 [[COND1]], [[COND2]] + // + // CHECK: [[COND3:%.+]] = icmp eq i16 [[ALGVER]], 2 + // CHECK: [[COND4:%.+]] = and i16 [[LANEID]], 1 + // CHECK: [[COND5:%.+]] = icmp eq i16 [[COND4]], 0 + // CHECK: [[COND6:%.+]] = and i1 [[COND3]], [[COND5]] + // CHECK: [[COND7:%.+]] = icmp sgt i16 [[LANEOFFSET]], 0 + // CHECK: [[CONDALG2:%.+]] = and i1 [[COND6]], [[COND7]] + // + // CHECK: [[COND8:%.+]] = or i1 [[CONDALG0]], [[CONDALG1]] + // CHECK: [[SHOULD_REDUCE:%.+]] = or i1 [[COND8]], [[CONDALG2]] + // CHECK: br i1 [[SHOULD_REDUCE]], label {{%?}}[[DO_REDUCE:.+]], label {{%?}}[[REDUCE_ELSE:.+]] + // + // CHECK: [[DO_REDUCE]] + // CHECK: [[RED_LIST1_VOID:%.+]] = bitcast [2 x i8*]* [[RED_LIST]] to i8* + // CHECK: [[RED_LIST2_VOID:%.+]] = bitcast [2 x i8*]* [[REMOTE_RED_LIST]] to i8* + // CHECK: call void [[REDUCTION_FUNC]](i8* [[RED_LIST1_VOID]], i8* [[RED_LIST2_VOID]]) + // CHECK: br label {{%?}}[[REDUCE_CONT:.+]] + // + // CHECK: [[REDUCE_ELSE]] + // CHECK: br label {{%?}}[[REDUCE_CONT]] + // + // CHECK: [[REDUCE_CONT]] + // Now check if we should just copy over the remote reduction list + // CHECK: [[COND1:%.+]] = icmp eq i16 [[ALGVER]], 1 + // CHECK: [[COND2:%.+]] = icmp uge i16 [[LANEID]], [[LANEOFFSET]] + // CHECK: [[SHOULD_COPY:%.+]] = and i1 [[COND1]], [[COND2]] + // CHECK: br i1 [[SHOULD_COPY]], label {{%?}}[[DO_COPY:.+]], label {{%?}}[[COPY_ELSE:.+]] + // + // CHECK: [[DO_COPY]] + // CHECK: [[REMOTE_ELT_REF:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[REMOTE_RED_LIST]], i[[SZ]] 0, i[[SZ]] 0 + // CHECK: [[REMOTE_ELT_VOID:%.+]] = load i8*, i8** [[REMOTE_ELT_REF]], + // CHECK: [[ELT_REF:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[RED_LIST]], i[[SZ]] 0, i[[SZ]] 0 + // CHECK: [[ELT_VOID:%.+]] = load i8*, i8** [[ELT_REF]], + // CHECK: [[REMOTE_ELT:%.+]] = bitcast i8* [[REMOTE_ELT_VOID]] to i32* + // CHECK: [[ELT:%.+]] = bitcast i8* [[ELT_VOID]] to i32* + // CHECK: [[REMOTE_ELT_VAL:%.+]] = load i32, i32* [[REMOTE_ELT]], align + // CHECK: store i32 [[REMOTE_ELT_VAL]], i32* [[ELT]], align + // + // CHECK: [[REMOTE_ELT_REF:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[REMOTE_RED_LIST]], i[[SZ]] 0, i[[SZ]] 1 + // CHECK: [[REMOTE_ELT_VOID:%.+]] = load i8*, i8** [[REMOTE_ELT_REF]], + // CHECK: [[ELT_REF:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[RED_LIST]], i[[SZ]] 0, i[[SZ]] 1 + // CHECK: [[ELT_VOID:%.+]] = load i8*, i8** [[ELT_REF]], + // CHECK: [[REMOTE_ELT:%.+]] = bitcast i8* [[REMOTE_ELT_VOID]] to i16* + // CHECK: [[ELT:%.+]] = bitcast i8* [[ELT_VOID]] to i16* + // CHECK: [[REMOTE_ELT_VAL:%.+]] = load i16, i16* [[REMOTE_ELT]], align + // CHECK: store i16 [[REMOTE_ELT_VAL]], i16* [[ELT]], align + // CHECK: br label {{%?}}[[COPY_CONT:.+]] + // + // CHECK: [[COPY_ELSE]] + // CHECK: br label {{%?}}[[COPY_CONT]] + // + // CHECK: [[COPY_CONT]] + // CHECK: void + + // + // Inter warp copy function + // CHECK: define internal void [[INTER_WARP_COPY]](i8*, i32) + // CHECK-DAG: [[LANEID:%.+]] = and i32 {{.+}}, 31 + // CHECK-DAG: [[WARPID:%.+]] = ashr i32 {{.+}}, 5 + // CHECK-DAG: [[RED_LIST:%.+]] = bitcast i8* {{.+}} to [[RLT]]* + // CHECK: call void @__kmpc_barrier(%struct.ident_t* @ + // CHECK: [[IS_WARP_MASTER:%.+]] = icmp eq i32 [[LANEID]], 0 + // CHECK: br i1 [[IS_WARP_MASTER]], label {{%?}}[[DO_COPY:.+]], label {{%?}}[[COPY_ELSE:.+]] + // + // [[DO_COPY]] + // CHECK: [[ELT_REF:%.+]] = getelementptr inbounds [[RLT]], [[RLT]]* [[RED_LIST]], i{{32|64}} 0, i{{32|64}} 0 + // CHECK: [[ELT_VOID:%.+]] = load i8*, i8** [[ELT_REF]], + // CHECK: [[ELT:%.+]] = bitcast i8* [[ELT_VOID]] to i32* + // + // CHECK: [[MEDIUM_ELT:%.+]] = getelementptr inbounds [32 x i32], [32 x i32] addrspace([[SHARED_ADDRSPACE]])* [[TRANSFER_STORAGE]], i64 0, i32 [[WARPID]] + // CHECK: [[ELT_VAL:%.+]] = load i32, i32* [[ELT]], align + // CHECK: store volatile i32 [[ELT_VAL]], i32 addrspace([[SHARED_ADDRSPACE]])* [[MEDIUM_ELT]], align + // CHECK: br label {{%?}}[[COPY_CONT:.+]] + // + // CHECK: [[COPY_ELSE]] + // CHECK: br label {{%?}}[[COPY_CONT]] + // + // Barrier after copy to shared memory storage medium. + // CHECK: [[COPY_CONT]] + // CHECK: call void @__kmpc_barrier(%struct.ident_t* @ + // CHECK: [[ACTIVE_WARPS:%.+]] = load i32, i32* + // + // Read into warp 0. + // CHECK: [[IS_W0_ACTIVE_THREAD:%.+]] = icmp ult i32 [[TID:%.+]], [[ACTIVE_WARPS]] + // CHECK: br i1 [[IS_W0_ACTIVE_THREAD]], label {{%?}}[[DO_READ:.+]], label {{%?}}[[READ_ELSE:.+]] + // + // CHECK: [[DO_READ]] + // CHECK: [[MEDIUM_ELT:%.+]] = getelementptr inbounds [32 x i32], [32 x i32] addrspace([[SHARED_ADDRSPACE]])* [[TRANSFER_STORAGE]], i64 0, i32 [[TID]] + // CHECK: [[ELT_REF:%.+]] = getelementptr inbounds [[RLT]], [[RLT]]* [[RED_LIST:%.+]], i{{32|64}} 0, i{{32|64}} 0 + // CHECK: [[ELT_VOID:%.+]] = load i8*, i8** [[ELT_REF]], + // CHECK: [[ELT:%.+]] = bitcast i8* [[ELT_VOID]] to i32* + // CHECK: [[MEDIUM_ELT_VAL:%.+]] = load volatile i32, i32 addrspace([[SHARED_ADDRSPACE]])* [[MEDIUM_ELT]], align + // CHECK: store i32 [[MEDIUM_ELT_VAL]], i32* [[ELT]], align + // CHECK: br label {{%?}}[[READ_CONT:.+]] + // + // CHECK: [[READ_ELSE]] + // CHECK: br label {{%?}}[[READ_CONT]] + // + // CHECK: [[READ_CONT]] + // CHECK: call void @__kmpc_barrier(%struct.ident_t* @ + // CHECK: [[IS_WARP_MASTER:%.+]] = icmp eq i32 [[LANEID]], 0 + // CHECK: br i1 [[IS_WARP_MASTER]], label {{%?}}[[DO_COPY:.+]], label {{%?}}[[COPY_ELSE:.+]] + // + // [[DO_COPY]] + // CHECK: [[ELT_REF:%.+]] = getelementptr inbounds [[RLT]], [[RLT]]* [[RED_LIST]], i{{32|64}} 0, i{{32|64}} 1 + // CHECK: [[ELT_VOID:%.+]] = load i8*, i8** [[ELT_REF]], + // CHECK: [[ELT:%.+]] = bitcast i8* [[ELT_VOID]] to i16* + // + // CHECK: [[MEDIUM_ELT32:%.+]] = getelementptr inbounds [32 x i32], [32 x i32] addrspace([[SHARED_ADDRSPACE]])* [[TRANSFER_STORAGE]], i64 0, i32 [[WARPID]] + // CHECK: [[MEDIUM_ELT:%.+]] = bitcast i32 addrspace([[SHARED_ADDRSPACE]])* [[MEDIUM_ELT32]] to i16 addrspace([[SHARED_ADDRSPACE]])* + // CHECK: [[ELT_VAL:%.+]] = load i16, i16* [[ELT]], align + // CHECK: store volatile i16 [[ELT_VAL]], i16 addrspace([[SHARED_ADDRSPACE]])* [[MEDIUM_ELT]], align + // CHECK: br label {{%?}}[[COPY_CONT:.+]] + // + // CHECK: [[COPY_ELSE]] + // CHECK: br label {{%?}}[[COPY_CONT]] + // + // Barrier after copy to shared memory storage medium. + // CHECK: [[COPY_CONT]] + // CHECK: call void @__kmpc_barrier(%struct.ident_t* @ + // CHECK: [[ACTIVE_WARPS:%.+]] = load i32, i32* + // + // Read into warp 0. + // CHECK: [[IS_W0_ACTIVE_THREAD:%.+]] = icmp ult i32 [[TID:%.+]], [[ACTIVE_WARPS]] + // CHECK: br i1 [[IS_W0_ACTIVE_THREAD]], label {{%?}}[[DO_READ:.+]], label {{%?}}[[READ_ELSE:.+]] + // + // CHECK: [[DO_READ]] + // CHECK: [[MEDIUM_ELT32:%.+]] = getelementptr inbounds [32 x i32], [32 x i32] addrspace([[SHARED_ADDRSPACE]])* [[TRANSFER_STORAGE]], i64 0, i32 [[TID]] + // CHECK: [[MEDIUM_ELT:%.+]] = bitcast i32 addrspace([[SHARED_ADDRSPACE]])* [[MEDIUM_ELT32]] to i16 addrspace([[SHARED_ADDRSPACE]])* + // CHECK: [[ELT_REF:%.+]] = getelementptr inbounds [[RLT]], [[RLT]]* [[RED_LIST:%.+]], i{{32|64}} 0, i{{32|64}} 1 + // CHECK: [[ELT_VOID:%.+]] = load i8*, i8** [[ELT_REF]], + // CHECK: [[ELT:%.+]] = bitcast i8* [[ELT_VOID]] to i16* + // CHECK: [[MEDIUM_ELT_VAL:%.+]] = load volatile i16, i16 addrspace([[SHARED_ADDRSPACE]])* [[MEDIUM_ELT]], align + // CHECK: store i16 [[MEDIUM_ELT_VAL]], i16* [[ELT]], align + // CHECK: br label {{%?}}[[READ_CONT:.+]] + // + // CHECK: [[READ_ELSE]] + // CHECK: br label {{%?}}[[READ_CONT]] + // + // CHECK: [[READ_CONT]] + // CHECK: ret + + // CHECK: define internal void [[RED_LIST_TO_GLOBAL_COPY]](i8*, i32, i8*) + // CHECK: [[GLOBAL_PTR:%.+]] = alloca i8*, + // CHECK: [[IDX_PTR:%.+]] = alloca i32, + // CHECK: [[RL_PTR:%.+]] = alloca i8*, + // CHECK: store i8* %{{.+}}, i8** [[GLOBAL_PTR]], + // CHECK: store i32 %{{.+}}, i32* [[IDX_PTR]], + // CHECK: store i8* %{{.+}}, i8** [[RL_PTR]], + // CHECK: [[RL_BC:%.+]] = load i8*, i8** [[RL_PTR]], + // CHECK: [[RL:%.+]] = bitcast i8* [[RL_BC]] to [2 x i8*]* + // CHECK: [[GLOBAL_BC:%.+]] = load i8*, i8** [[GLOBAL_PTR]], + // CHECK: [[GLOBAL:%.+]] = bitcast i8* [[GLOBAL_BC]] to [[TEAM3_REDUCE_TY]]* + // CHECK: [[IDX:%.+]] = load i32, i32* [[IDX_PTR]], + // CHECK: [[RL_RED1_PTR:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[RL]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 + // CHECK: [[RL_RED1_BC:%.+]] = load i8*, i8** [[RL_RED1_PTR]], + // CHECK: [[RL_RED1:%.+]] = bitcast i8* [[RL_RED1_BC]] to i32* + // CHECK: [[GLOBAL_RED1_PTR:%.+]] = getelementptr inbounds [[TEAM3_REDUCE_TY]], [[TEAM3_REDUCE_TY]]* [[GLOBAL]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 + // CHECK: [[GLOBAL_RED1_IDX_PTR:%.+]] = getelementptr inbounds [{{1024|2048}} x i32], [{{1024|2048}} x i32]* [[GLOBAL_RED1_PTR]], i{{[0-9]+}} 0, i32 [[IDX]] + // CHECK: [[LOC_RED1:%.+]] = load i32, i32* [[RL_RED1]], + // CHECK: store i32 [[LOC_RED1]], i32* [[GLOBAL_RED1_IDX_PTR]], + // CHECK: [[RL_RED1_PTR:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[RL]], i{{[0-9]+}} 0, i{{[0-9]+}} 1 + // CHECK: [[RL_RED1_BC:%.+]] = load i8*, i8** [[RL_RED1_PTR]], + // CHECK: [[RL_RED1:%.+]] = bitcast i8* [[RL_RED1_BC]] to i16* + // CHECK: [[GLOBAL_RED1_PTR:%.+]] = getelementptr inbounds [[TEAM3_REDUCE_TY]], [[TEAM3_REDUCE_TY]]* [[GLOBAL]], i{{[0-9]+}} 0, i{{[0-9]+}} 1 + // CHECK: [[GLOBAL_RED1_IDX_PTR:%.+]] = getelementptr inbounds [{{1024|2048}} x i16], [{{1024|2048}} x i16]* [[GLOBAL_RED1_PTR]], i{{[0-9]+}} 0, i32 [[IDX]] + // CHECK: [[LOC_RED1:%.+]] = load i16, i16* [[RL_RED1]], + // CHECK: store i16 [[LOC_RED1]], i16* [[GLOBAL_RED1_IDX_PTR]], + // CHECK: ret void + + // CHECK: define internal void [[RED_LIST_TO_GLOBAL_RED]](i8*, i32, i8*) + // CHECK: [[GLOBAL_PTR:%.+]] = alloca i8*, + // CHECK: [[IDX_PTR:%.+]] = alloca i32, + // CHECK: [[RL_PTR:%.+]] = alloca i8*, + // CHECK: [[LOCAL_RL:%.+]] = alloca [2 x i8*], + // CHECK: store i8* %{{.+}}, i8** [[GLOBAL_PTR]], + // CHECK: store i32 %{{.+}}, i32* [[IDX_PTR]], + // CHECK: store i8* %{{.+}}, i8** [[RL_PTR]], + // CHECK: [[GLOBAL_BC:%.+]] = load i8*, i8** [[GLOBAL_PTR]], + // CHECK: [[GLOBAL:%.+]] = bitcast i8* [[GLOBAL_BC]] to [[TEAM3_REDUCE_TY]]* + // CHECK: [[IDX:%.+]] = load i32, i32* [[IDX_PTR]], + // CHECK: [[LOCAL_RL_RED1_PTR:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[LOCAL_RL]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 + // CHECK: [[GLOBAL_RED1_PTR:%.+]] = getelementptr inbounds [[TEAM3_REDUCE_TY]], [[TEAM3_REDUCE_TY]]* [[GLOBAL]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 + // CHECK: [[GLOBAL_RED1_IDX_PTR:%.+]] = getelementptr inbounds [{{1024|2048}} x i32], [{{1024|2048}} x i32]* [[GLOBAL_RED1_PTR]], i{{[0-9]+}} 0, i32 [[IDX]] + // CHECK: [[GLOBAL_RED1_IDX_PTR_BC:%.+]] = bitcast i32* [[GLOBAL_RED1_IDX_PTR]] to i8* + // CHECK: store i8* [[GLOBAL_RED1_IDX_PTR_BC]], i8** [[LOCAL_RL_RED1_PTR]] + // CHECK: [[LOCAL_RL_RED1_PTR:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[LOCAL_RL]], i{{[0-9]+}} 0, i{{[0-9]+}} 1 + // CHECK: [[GLOBAL_RED1_PTR:%.+]] = getelementptr inbounds [[TEAM3_REDUCE_TY]], [[TEAM3_REDUCE_TY]]* [[GLOBAL]], i{{[0-9]+}} 0, i{{[0-9]+}} 1 + // CHECK: [[GLOBAL_RED1_IDX_PTR:%.+]] = getelementptr inbounds [{{1024|2048}} x i16], [{{1024|2048}} x i16]* [[GLOBAL_RED1_PTR]], i{{[0-9]+}} 0, i32 [[IDX]] + // CHECK: [[GLOBAL_RED1_IDX_PTR_BC:%.+]] = bitcast i16* [[GLOBAL_RED1_IDX_PTR]] to i8* + // CHECK: store i8* [[GLOBAL_RED1_IDX_PTR_BC]], i8** [[LOCAL_RL_RED1_PTR]] + // CHECK: [[LOCAL_RL_BC:%.+]] = bitcast [2 x i8*]* [[LOCAL_RL]] to i8* + // CHECK: [[RL_BC:%.+]] = load i8*, i8** [[RL_PTR]], + // CHECK: call void [[REDUCTION_FUNC]](i8* [[LOCAL_RL_BC]], i8* [[RL_BC]]) + // CHECK: ret void + + // CHECK: define internal void [[GLOBAL_TO_RED_LIST_COPY]](i8*, i32, i8*) + // CHECK: [[GLOBAL_PTR:%.+]] = alloca i8*, + // CHECK: [[IDX_PTR:%.+]] = alloca i32, + // CHECK: [[RL_PTR:%.+]] = alloca i8*, + // CHECK: store i8* %{{.+}}, i8** [[GLOBAL_PTR]], + // CHECK: store i32 %{{.+}}, i32* [[IDX_PTR]], + // CHECK: store i8* %{{.+}}, i8** [[RL_PTR]], + // CHECK: [[RL_BC:%.+]] = load i8*, i8** [[RL_PTR]], + // CHECK: [[RL:%.+]] = bitcast i8* [[RL_BC]] to [2 x i8*]* + // CHECK: [[GLOBAL_BC:%.+]] = load i8*, i8** [[GLOBAL_PTR]], + // CHECK: [[GLOBAL:%.+]] = bitcast i8* [[GLOBAL_BC]] to [[TEAM3_REDUCE_TY]]* + // CHECK: [[IDX:%.+]] = load i32, i32* [[IDX_PTR]], + // CHECK: [[RL_RED1_PTR:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[RL]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 + // CHECK: [[RL_RED1_BC:%.+]] = load i8*, i8** [[RL_RED1_PTR]], + // CHECK: [[RL_RED1:%.+]] = bitcast i8* [[RL_RED1_BC]] to i32* + // CHECK: [[GLOBAL_RED1_PTR:%.+]] = getelementptr inbounds [[TEAM3_REDUCE_TY]], [[TEAM3_REDUCE_TY]]* [[GLOBAL]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 + // CHECK: [[GLOBAL_RED1_IDX_PTR:%.+]] = getelementptr inbounds [{{1024|2048}} x i32], [{{1024|2048}} x i32]* [[GLOBAL_RED1_PTR]], i{{[0-9]+}} 0, i32 [[IDX]] + // CHECK: [[GLOBAL_RED1:%.+]] = load i32, i32* [[GLOBAL_RED1_IDX_PTR]], + // CHECK: store i32 [[GLOBAL_RED1]], i32* [[RL_RED1]], + // CHECK: [[RL_RED1_PTR:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[RL]], i{{[0-9]+}} 0, i{{[0-9]+}} 1 + // CHECK: [[RL_RED1_BC:%.+]] = load i8*, i8** [[RL_RED1_PTR]], + // CHECK: [[RL_RED1:%.+]] = bitcast i8* [[RL_RED1_BC]] to i16* + // CHECK: [[GLOBAL_RED1_PTR:%.+]] = getelementptr inbounds [[TEAM3_REDUCE_TY]], [[TEAM3_REDUCE_TY]]* [[GLOBAL]], i{{[0-9]+}} 0, i{{[0-9]+}} 1 + // CHECK: [[GLOBAL_RED1_IDX_PTR:%.+]] = getelementptr inbounds [{{1024|2048}} x i16], [{{1024|2048}} x i16]* [[GLOBAL_RED1_PTR]], i{{[0-9]+}} 0, i32 [[IDX]] + // CHECK: [[GLOBAL_RED1:%.+]] = load i16, i16* [[GLOBAL_RED1_IDX_PTR]], + // CHECK: store i16 [[GLOBAL_RED1]], i16* [[RL_RED1]], + // CHECK: ret void + + // CHECK: define internal void [[GLOBAL_TO_RED_LIST_RED]](i8*, i32, i8*) + // CHECK: [[GLOBAL_PTR:%.+]] = alloca i8*, + // CHECK: [[IDX_PTR:%.+]] = alloca i32, + // CHECK: [[RL_PTR:%.+]] = alloca i8*, + // CHECK: [[LOCAL_RL:%.+]] = alloca [2 x i8*], + // CHECK: store i8* %{{.+}}, i8** [[GLOBAL_PTR]], + // CHECK: store i32 %{{.+}}, i32* [[IDX_PTR]], + // CHECK: store i8* %{{.+}}, i8** [[RL_PTR]], + // CHECK: [[GLOBAL_BC:%.+]] = load i8*, i8** [[GLOBAL_PTR]], + // CHECK: [[GLOBAL:%.+]] = bitcast i8* [[GLOBAL_BC]] to [[TEAM3_REDUCE_TY]]* + // CHECK: [[IDX:%.+]] = load i32, i32* [[IDX_PTR]], + // CHECK: [[LOCAL_RL_RED1_PTR:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[LOCAL_RL]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 + // CHECK: [[GLOBAL_RED1_PTR:%.+]] = getelementptr inbounds [[TEAM3_REDUCE_TY]], [[TEAM3_REDUCE_TY]]* [[GLOBAL]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 + // CHECK: [[GLOBAL_RED1_IDX_PTR:%.+]] = getelementptr inbounds [{{1024|2048}} x i32], [{{1024|2048}} x i32]* [[GLOBAL_RED1_PTR]], i{{[0-9]+}} 0, i32 [[IDX]] + // CHECK: [[GLOBAL_RED1_IDX_PTR_BC:%.+]] = bitcast i32* [[GLOBAL_RED1_IDX_PTR]] to i8* + // CHECK: store i8* [[GLOBAL_RED1_IDX_PTR_BC]], i8** [[LOCAL_RL_RED1_PTR]] + // CHECK: [[LOCAL_RL_RED1_PTR:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[LOCAL_RL]], i{{[0-9]+}} 0, i{{[0-9]+}} 1 + // CHECK: [[GLOBAL_RED1_PTR:%.+]] = getelementptr inbounds [[TEAM3_REDUCE_TY]], [[TEAM3_REDUCE_TY]]* [[GLOBAL]], i{{[0-9]+}} 0, i{{[0-9]+}} 1 + // CHECK: [[GLOBAL_RED1_IDX_PTR:%.+]] = getelementptr inbounds [{{1024|2048}} x i16], [{{1024|2048}} x i16]* [[GLOBAL_RED1_PTR]], i{{[0-9]+}} 0, i32 [[IDX]] + // CHECK: [[GLOBAL_RED1_IDX_PTR_BC:%.+]] = bitcast i16* [[GLOBAL_RED1_IDX_PTR]] to i8* + // CHECK: store i8* [[GLOBAL_RED1_IDX_PTR_BC]], i8** [[LOCAL_RL_RED1_PTR]] + // CHECK: [[LOCAL_RL_BC:%.+]] = bitcast [2 x i8*]* [[LOCAL_RL]] to i8* + // CHECK: [[RL_BC:%.+]] = load i8*, i8** [[RL_PTR]], + // CHECK: call void [[REDUCTION_FUNC]](i8* [[RL_BC]], i8* [[LOCAL_RL_BC]]) + // CHECK: ret void + #endif diff --git a/test/OpenMP/nvptx_unsupported_type_codegen.cpp b/test/OpenMP/nvptx_unsupported_type_codegen.cpp new file mode 100644 index 0000000000..61accc3c72 --- /dev/null +++ b/test/OpenMP/nvptx_unsupported_type_codegen.cpp @@ -0,0 +1,64 @@ +// Test target codegen - host bc file has to be created first. +// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple x86_64-unknown-linux -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-host.bc +// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -aux-triple x86_64-unknown-linux -emit-llvm %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-host.bc -o - | FileCheck %s +// expected-no-diagnostics + +// CHECK-DAG: [[T:%.+]] = type {{.+}}, fp128, +// CHECK-DAG: [[T1:%.+]] = type {{.+}}, i128, i128, + +struct T { + char a; + __float128 f; + char c; + T() : a(12), f(15) {} + T &operator+(T &b) { f += b.a; return *this;} +}; + +struct T1 { + char a; + __int128 f; + __int128 f1; + char c; + T1() : a(12), f(15) {} + T1 &operator+(T1 &b) { f += b.a; return *this;} +}; + +#pragma omp declare target +T a = T(); +T f = a; +// CHECK: define void @{{.+}}foo{{.+}}([[T]]* byval align {{.+}}) +void foo(T a = T()) { + return; +} +// CHECK: define [6 x i64] @{{.+}}bar{{.+}}() +T bar() { +// CHECK: bitcast [[T]]* %{{.+}} to [6 x i64]* +// CHECK-NEXT: load [6 x i64], [6 x i64]* %{{.+}}, +// CHECK-NEXT: ret [6 x i64] + return T(); +} +// CHECK: define void @{{.+}}baz{{.+}}() +void baz() { +// CHECK: call [6 x i64] @{{.+}}bar{{.+}}() +// CHECK-NEXT: bitcast [[T]]* %{{.+}} to [6 x i64]* +// CHECK-NEXT: store [6 x i64] %{{.+}}, [6 x i64]* %{{.+}}, + T t = bar(); +} +T1 a1 = T1(); +T1 f1 = a1; +// CHECK: define void @{{.+}}foo1{{.+}}([[T1]]* byval align {{.+}}) +void foo1(T1 a = T1()) { + return; +} +// CHECK: define [[T1]] @{{.+}}bar1{{.+}}() +T1 bar1() { +// CHECK: load [[T1]], [[T1]]* +// CHECK-NEXT: ret [[T1]] + return T1(); +} +// CHECK: define void @{{.+}}baz1{{.+}}() +void baz1() { +// CHECK: call [[T1]] @{{.+}}bar1{{.+}}() + T1 t = bar1(); +} +#pragma omp end declare target diff --git a/test/OpenMP/nvptx_unsupported_type_messages.cpp b/test/OpenMP/nvptx_unsupported_type_messages.cpp new file mode 100644 index 0000000000..6e0fa3b1d5 --- /dev/null +++ b/test/OpenMP/nvptx_unsupported_type_messages.cpp @@ -0,0 +1,47 @@ +// Test target codegen - host bc file has to be created first. +// RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-linux -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-host.bc +// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-host.bc -fsyntax-only + +struct T { + char a; + __float128 f; + char c; + T() : a(12), f(15) {} + T &operator+(T &b) { f += b.a; return *this;} // expected-error {{'__float128' is not supported on this target}} +}; + +struct T1 { + char a; + __int128 f; + __int128 f1; + char c; + T1() : a(12), f(15) {} + T1 &operator/(T1 &b) { f /= b.a; return *this;} +}; + +#pragma omp declare target +T a = T(); +T f = a; +void foo(T a = T()) { + a = a + f; // expected-note {{called by 'foo'}} + return; +} +T bar() { + return T(); +} +void baz() { + T t = bar(); +} +T1 a1 = T1(); +T1 f1 = a1; +void foo1(T1 a = T1()) { + a = a / f1; + return; +} +T1 bar1() { + return T1(); +} +void baz1() { + T1 t = bar1(); +} +#pragma omp end declare target diff --git a/test/OpenMP/nvptx_va_arg_delayed_diags.c b/test/OpenMP/nvptx_va_arg_delayed_diags.c new file mode 100644 index 0000000000..3420884d97 --- /dev/null +++ b/test/OpenMP/nvptx_va_arg_delayed_diags.c @@ -0,0 +1,40 @@ +// RUN: %clang_cc1 -fopenmp -x c -triple i386-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm-bc %s -o %t-x86-host.bc +// RUN: %clang_cc1 -verify -fopenmp -x c -triple nvptx-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -fsyntax-only +// RUN: %clang_cc1 -verify -DDIAGS -DIMMEDIATE -fopenmp -x c -triple nvptx-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -fsyntax-only +// RUN: %clang_cc1 -verify -DDIAGS -DDELAYED -fopenmp -x c -triple nvptx-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda %s -fopenmp-is-device -fopenmp-host-ir-file-path %t-x86-host.bc -fsyntax-only +// REQUIRES: x86-registered-target +// REQUIRES: nvptx-registered-target + +#ifndef DIAGS +// expected-no-diagnostics +#endif // DIAGS + +#ifdef IMMEDIATE +#pragma omp declare target +#endif //IMMEDIATE +void t1(int r, ...) { +#ifdef DIAGS +// expected-error@+4 {{CUDA device code does not support va_arg}} +#endif // DIAGS + __builtin_va_list list; + __builtin_va_start(list, r); + (void)__builtin_va_arg(list, int); + __builtin_va_end(list); +} + +#ifdef IMMEDIATE +#pragma omp end declare target +#endif //IMMEDIATE + +int main() { +#ifdef DELAYED +#pragma omp target +#endif // DELAYED + { +#ifdef DELAYED +// expected-note@+2 {{called by 'main'}} +#endif // DELAYED + t1(0); + } + return 0; +} diff --git a/test/OpenMP/ordered_codegen.cpp b/test/OpenMP/ordered_codegen.cpp index ef7d39dfd0..70da820c1f 100644 --- a/test/OpenMP/ordered_codegen.cpp +++ b/test/OpenMP/ordered_codegen.cpp @@ -78,7 +78,8 @@ void dynamic1(float *a, float *b, float *c, float *d) { // CHECK: [[IV:%.+]] = load i64, i64* [[OMP_IV]] // CHECK-NEXT: [[UB:%.+]] = load i64, i64* [[OMP_UB]] -// CHECK-NEXT: [[CMP:%.+]] = icmp ule i64 [[IV]], [[UB]] +// CHECK-NEXT: [[BOUND:%.+]] = add i64 [[UB]], 1 +// CHECK-NEXT: [[CMP:%.+]] = icmp ult i64 [[IV]], [[BOUND]] // CHECK-NEXT: br i1 [[CMP]], label %[[LOOP1_BODY:[^,]+]], label %[[LOOP1_END:[^,]+]] for (unsigned long long i = 131071; i < 2147483647; i += 127) { // CHECK: [[LOOP1_BODY]] diff --git a/test/OpenMP/ordered_doacross_codegen.c b/test/OpenMP/ordered_doacross_codegen.c index a6cd4fe48b..734d97a439 100644 --- a/test/OpenMP/ordered_doacross_codegen.c +++ b/test/OpenMP/ordered_doacross_codegen.c @@ -33,7 +33,7 @@ int main() { // CHECK: [[DIM:%.+]] = getelementptr inbounds [1 x [[KMP_DIM]]], [1 x [[KMP_DIM]]]* [[DIMS]], i64 0, i64 0 // CHECK: [[CAST:%.+]] = bitcast [[KMP_DIM]]* [[DIM]] to i8* // CHECK: call void @__kmpc_doacross_init([[IDENT]], i32 [[GTID]], i32 1, i8* [[CAST]]) -// CHECK: call void @__kmpc_for_static_init_4( +// CHECK: call void @__kmpc_for_static_init_4(%struct.ident_t* @{{.+}}, i32 [[GTID]], i32 33, i32* %{{.+}}, i32* %{{.+}}, i32* %{{.+}}, i32* %{{.+}}, i32 1, i32 1) #pragma omp for ordered(1) for (i = 0; i < n; ++i) { a[i] = b[i] + 1; diff --git a/test/OpenMP/ordered_doacross_codegen.cpp b/test/OpenMP/ordered_doacross_codegen.cpp index 2f19e9c2d5..2b610a270d 100644 --- a/test/OpenMP/ordered_doacross_codegen.cpp +++ b/test/OpenMP/ordered_doacross_codegen.cpp @@ -16,6 +16,17 @@ extern int n; int a[10], b[10], c[10], d[10]; void foo(); +// CHECK-LABEL:bar +void bar() { + int i,j; +// CHECK: call void @__kmpc_doacross_init( +// CHECK: call void @__kmpc_doacross_fini( +#pragma omp parallel for ordered(2) + for (i = 0; i < n; ++i) + for (j = 0; j < n; ++j) + a[i] = b[i] + 1; +} + // CHECK-LABEL: @main() int main() { int i; @@ -33,9 +44,9 @@ int main() { // CHECK: [[DIM:%.+]] = getelementptr inbounds [1 x [[KMP_DIM]]], [1 x [[KMP_DIM]]]* [[DIMS]], i64 0, i64 0 // CHECK: [[CAST:%.+]] = bitcast [[KMP_DIM]]* [[DIM]] to i8* // CHECK: call void @__kmpc_doacross_init([[IDENT]], i32 [[GTID]], i32 1, i8* [[CAST]]) -// CHECK: call void @__kmpc_for_static_init_4( +// CHECK: call void @__kmpc_for_static_init_4(%struct.ident_t* @{{.+}}, i32 [[GTID]], i32 33, i32* %{{.+}}, i32* %{{.+}}, i32* %{{.+}}, i32* %{{.+}}, i32 1, i32 1) #pragma omp for ordered(1) - for (i = 0; i < n; ++i) { + for (int i = 0; i < n; ++i) { a[i] = b[i] + 1; foo(); // CHECK: invoke void [[FOO:.+]]( @@ -102,7 +113,7 @@ struct TestStruct { // CHECK: [[DIM:%.+]] = getelementptr inbounds [2 x [[KMP_DIM]]], [2 x [[KMP_DIM]]]* [[DIMS]], i64 0, i64 0 // CHECK: [[CAST:%.+]] = bitcast [[KMP_DIM]]* [[DIM]] to i8* // CHECK: call void @__kmpc_doacross_init([[IDENT]], i32 [[GTID]], i32 2, i8* [[CAST]]) -// CHECK: call void @__kmpc_for_static_init_4( +// CHECK: call void @__kmpc_for_static_init_4(%struct.ident_t* @{{.+}}, i32 [[GTID]], i32 33, i32* %{{.+}}, i32* %{{.+}}, i32* %{{.+}}, i32* %{{.+}}, i32 1, i32 1) #pragma omp for ordered(2) for (T j = 0; j < M; j++) for (i = 0; i < n; i += 2) { diff --git a/test/OpenMP/ordered_messages.cpp b/test/OpenMP/ordered_messages.cpp index 43ac40efe6..294e7455af 100644 --- a/test/OpenMP/ordered_messages.cpp +++ b/test/OpenMP/ordered_messages.cpp @@ -262,7 +262,7 @@ int k; #pragma omp ordered simd depend(source) // expected-error {{'depend' clauses cannot be mixed with 'simd' clause}} #pragma omp ordered depend(source) depend(source) // expected-error {{directive '#pragma omp ordered' cannot contain more than one 'depend' clause with 'source' dependence}} #pragma omp ordered depend(in : i) // expected-error {{expected 'source' or 'sink' in OpenMP clause 'depend'}} expected-error {{'ordered' directive without any clauses cannot be closely nested inside ordered region with specified parameter}} -#pragma omp ordered depend(sink : i, j) +#pragma omp ordered depend(sink : i, j) allocate(i) // expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp ordered'}} #pragma omp ordered depend(sink : j, i) // expected-error {{expected 'i' loop iteration variable}} expected-error {{expected 'j' loop iteration variable}} #pragma omp ordered depend(sink : i, j, k) // expected-error {{unexpected expression: number of expressions is larger than the number of associated loops}} #pragma omp ordered depend(sink : i+foo(), j/4) // expected-error {{expression is not an integral constant expression}} expected-error {{expected '+' or '-' operation}} diff --git a/test/OpenMP/parallel_ast_print.cpp b/test/OpenMP/parallel_ast_print.cpp index 19ebb70483..fa96dfce67 100644 --- a/test/OpenMP/parallel_ast_print.cpp +++ b/test/OpenMP/parallel_ast_print.cpp @@ -205,13 +205,13 @@ int main (int argc, char **argv) { // CHECK-NEXT: #pragma omp parallel a=2; // CHECK-NEXT: a = 2; -#pragma omp parallel default(none), private(argc,b) firstprivate(argv) if (parallel: argc > 0) num_threads(ee) copyin(a) proc_bind(spread) reduction(| : c, d, arr1[argc]) reduction(* : e, arr[:10][0:argc]) -// CHECK-NEXT: #pragma omp parallel default(none) private(argc,b) firstprivate(argv) if(parallel: argc > 0) num_threads(ee) copyin(a) proc_bind(spread) reduction(|: c,d,arr1[argc]) reduction(*: e,arr[:10][0:argc]) +#pragma omp parallel default(none), private(argc,b) firstprivate(argv) if (parallel: argc > 0) num_threads(ee) copyin(a) proc_bind(spread) reduction(| : c, d, arr1[argc]) reduction(* : e, arr[:10][0:argc]) allocate(e) +// CHECK-NEXT: #pragma omp parallel default(none) private(argc,b) firstprivate(argv) if(parallel: argc > 0) num_threads(ee) copyin(a) proc_bind(spread) reduction(|: c,d,arr1[argc]) reduction(*: e,arr[:10][0:argc]) allocate(e) foo(); // CHECK-NEXT: foo(); -// CHECK-NEXT: #pragma omp parallel if(b) num_threads(c) proc_bind(close) reduction(^: e,f) reduction(&&: g,arr[0:argc][:10]) +// CHECK-NEXT: #pragma omp parallel allocate(e) if(b) num_threads(c) proc_bind(close) reduction(^: e,f) reduction(&&: g,arr[0:argc][:10]) // CHECK-NEXT: foo() -#pragma omp parallel if (b) num_threads(c) proc_bind(close) reduction(^:e, f) reduction(&& : g, arr[0:argc][:10]) +#pragma omp parallel allocate(e) if (b) num_threads(c) proc_bind(close) reduction(^:e, f) reduction(&& : g, arr[0:argc][:10]) foo(); return tmain<int, 5>(b, &b) + tmain<long, 1>(x, &x); } diff --git a/test/OpenMP/parallel_codegen.cpp b/test/OpenMP/parallel_codegen.cpp index 19eebc8289..ae117a0aad 100644 --- a/test/OpenMP/parallel_codegen.cpp +++ b/test/OpenMP/parallel_codegen.cpp @@ -82,9 +82,9 @@ int main (int argc, char **argv) { // CHECK-DEBUG-NEXT: } // CHECK-DAG: define linkonce_odr {{.*}}void [[FOO]]({{i32[ ]?[a-z]*}} %argc) -// CHECK-DAG: declare {{.*}}void @__kmpc_fork_call(%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) +// CHECK-DAG: declare !callback ![[cbid:[0-9]+]] {{.*}}void @__kmpc_fork_call(%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) // CHECK-DEBUG-DAG: define linkonce_odr void [[FOO]](i32 %argc) -// CHECK-DEBUG-DAG: declare void @__kmpc_fork_call(%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) +// CHECK-DEBUG-DAG: declare !callback ![[cbid:[0-9]+]] void @__kmpc_fork_call(%struct.ident_t*, i32, void (i32*, i32*, ...)*, ...) // CHECK-DEBUG-DAG: define internal void [[OMP_OUTLINED]](i32* noalias %.global_tid., i32* noalias %.bound_tid., i64 [[VLA_SIZE:%.+]], i32* {{.+}} [[VLA_ADDR:%[^)]+]]) // CHECK-DEBUG-DAG: call void [[OMP_OUTLINED_DEBUG]] @@ -131,5 +131,6 @@ int main (int argc, char **argv) { // CHECK: attributes #[[FN_ATTRS]] = {{.+}} nounwind // CHECK-DEBUG: attributes #[[FN_ATTRS]] = {{.+}} nounwind - +// CHECK: ![[cbid]] = !{![[cbidb:[0-9]+]]} +// CHECK: ![[cbidb]] = !{i64 2, i64 -1, i64 -1, i1 true} #endif diff --git a/test/OpenMP/parallel_default_messages.cpp b/test/OpenMP/parallel_default_messages.cpp index eb4b378f0d..440e91b103 100644 --- a/test/OpenMP/parallel_default_messages.cpp +++ b/test/OpenMP/parallel_default_messages.cpp @@ -18,14 +18,14 @@ int main(int argc, char **argv) { #pragma omp parallel default (x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} foo(); - #pragma omp parallel default(none) + #pragma omp parallel default(none) // expected-note {{explicit data sharing attribute requested here}} ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} - #pragma omp parallel default(none) + #pragma omp parallel default(none) // expected-note {{explicit data sharing attribute requested here}} #pragma omp parallel default(shared) ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} - #pragma omp parallel default(none) + #pragma omp parallel default(none) // ge40-note {{explicit data sharing attribute requested here}} (void)c; // ge40-error {{variable 'c' must have explicitly specified data sharing attributes}} return 0; } diff --git a/test/OpenMP/parallel_firstprivate_codegen.cpp b/test/OpenMP/parallel_firstprivate_codegen.cpp index 6772f61779..66964152aa 100644 --- a/test/OpenMP/parallel_firstprivate_codegen.cpp +++ b/test/OpenMP/parallel_firstprivate_codegen.cpp @@ -33,6 +33,19 @@ #ifndef HEADER #define HEADER +enum omp_allocator_handle_t { + omp_null_allocator = 0, + omp_default_mem_alloc = 1, + omp_large_cap_mem_alloc = 2, + omp_const_mem_alloc = 3, + omp_high_bw_mem_alloc = 4, + omp_low_lat_mem_alloc = 5, + omp_cgroup_mem_alloc = 6, + omp_pteam_mem_alloc = 7, + omp_thread_mem_alloc = 8, + KMP_ALLOCATOR_MAX_HANDLE = __UINTPTR_MAX__ +}; + struct St { int a, b; St() : a(0), b(0) {} @@ -322,7 +335,7 @@ int main() { s_arr[0] = var; sivar = 2; } -#pragma omp parallel firstprivate(t_var) +#pragma omp parallel allocate(omp_default_mem_alloc: t_var) firstprivate(t_var) {} return tmain<int>(); #endif @@ -333,6 +346,7 @@ int main() { // CHECK: [[T_VAR:%.+]] = alloca i32, // CHECK: [[T_VARCAST:%.+]] = alloca [[iz:i64|i32]], // CHECK: [[SIVARCAST:%.+]] = alloca [[iz]], +// CHECK: [[T_VARCAST1:%.+]] = alloca [[iz:i64|i32]], // CHECK: call {{.*}} [[S_FLOAT_TY_DEF_CONSTR:@.+]]([[S_FLOAT_TY]]* [[TEST]]) // CHECK: [[T_VARVAL:%.+]] = load i32, i32* [[T_VAR]], // CHECK-64: [[T_VARCONV:%.+]] = bitcast i64* [[T_VARCAST]] to i32* @@ -345,6 +359,12 @@ int main() { // CHECK-32: store i32 [[SIVARVAL]], i32* [[SIVARCAST]], // CHECK: [[SIVARPVT:%.+]] = load [[iz]], [[iz]]* [[SIVARCAST]], // CHECK: call {{.*}}void (%{{.+}}*, i{{[0-9]+}}, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)*, ...) @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{[0-9]+}} 5, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)* bitcast (void (i{{[0-9]+}}*, i{{[0-9]+}}*, [2 x i32]*, [[iz]], [2 x [[S_FLOAT_TY]]]*, [[S_FLOAT_TY]]*, i{{[0-9]+}})* [[MAIN_MICROTASK:@.+]] to void {{.*}}[[iz]] [[T_VARPVT]],{{.*}}[[iz]] [[SIVARPVT]] +// CHECK: [[T_VARVAL:%.+]] = load i32, i32* [[T_VAR]], +// CHECK-64: [[T_VARCONV:%.+]] = bitcast i64* [[T_VARCAST1]] to i32* +// CHECK-64: store i32 [[T_VARVAL]], i32* [[T_VARCONV]], +// CHECK-32: store i32 [[T_VARVAL]], i32* [[T_VARCAST1]], +// CHECK: [[T_VARPVT:%.+]] = load [[iz]], [[iz]]* [[T_VARCAST1]], +// 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]+}}*, [[iz]])* [[MAIN_MICROTASK1:@.+]] to void {{.*}}[[iz]] [[T_VARPVT]]) // CHECK: = call {{.*}}i{{.+}} [[TMAIN_INT:@.+]]() // CHECK: call {{.*}} [[S_FLOAT_TY_DESTR:@.+]]([[S_FLOAT_TY]]* // CHECK: ret @@ -387,6 +407,23 @@ int main() { // 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 + + +// CHECK: define internal void [[MAIN_MICROTASK1]](i{{[0-9]+}}* noalias [[GTID_ADDR:%.+]], i{{[0-9]+}}* noalias %{{.+}}, [[iz]] [[T_VAR:%.+]]) +// CHECK: [[GTID_ADDR:%.+]] = alloca i32*, +// CHECK: store [[iz]] [[T_VAR]], [[iz]]* [[T_VAR_ADDR:%.+]], +// CHECK-64: [[BC:%.+]] = bitcast [[iz]]* [[T_VAR_ADDR]] to i32* +// CHECK: [[GTID_PTR:%.+]] = load i32*, i32** [[GTID_ADDR]], +// CHECK: [[GTID:%.+]] = load i32, i32* [[GTID_PTR]], +// CHECK: [[T_VAR_VOID_PTR:%.+]] = call i8* @__kmpc_alloc(i32 [[GTID]], [[iz]] 4, i8* inttoptr ([[iz]] 1 to i8*)) +// CHECK: [[T_VAR_PRIV:%.+]] = bitcast i8* [[T_VAR_VOID_PTR]] to i32* +// CHECK-32: [[T_VAR_VAL:%.+]] = load i32, i32* [[T_VAR_ADDR]], +// CHECK-64: [[T_VAR_VAL:%.+]] = load i32, i32* [[BC]], +// CHECK: store i32 [[T_VAR_VAL]], i32* [[T_VAR_PRIV]], +// CHECK: call void @__kmpc_free(i32 [[GTID]], i8* [[T_VAR_VOID_PTR]], i8* inttoptr ([[iz]] 1 to i8*)) +// CHECK: ret void + + // CHECK: define {{.*}} i{{[0-9]+}} [[TMAIN_INT]]() // CHECK: [[TEST:%.+]] = alloca [[S_INT_TY]], // CHECK: call {{.*}} [[S_INT_TY_DEF_CONSTR:@.+]]([[S_INT_TY]]* [[TEST]]) @@ -480,6 +517,20 @@ int main() { #endif #else + +enum omp_allocator_handle_t { + omp_null_allocator = 0, + omp_default_mem_alloc = 1, + omp_large_cap_mem_alloc = 2, + omp_const_mem_alloc = 3, + omp_high_bw_mem_alloc = 4, + omp_low_lat_mem_alloc = 5, + omp_cgroup_mem_alloc = 6, + omp_pteam_mem_alloc = 7, + omp_thread_mem_alloc = 8, + KMP_ALLOCATOR_MAX_HANDLE = __UINTPTR_MAX__ +}; + struct St { int a, b; St() : a(0), b(0) {} @@ -488,7 +539,7 @@ struct St { void St_func(St s[2], int n, long double vla1[n]) { double vla2[n][n] __attribute__((aligned(128))); a = b; -#pragma omp parallel firstprivate(s, vla1, vla2) +#pragma omp parallel allocate(omp_thread_mem_alloc:vla2) firstprivate(s, vla1, vla2) vla1[b] = vla2[1][n - 1] = a = b; } }; @@ -521,9 +572,17 @@ void array_func(float a[3], St s[2], int n, long double vla1[n]) { // ARRAY-DAG: store %struct.St* %{{.+}}, %struct.St** [[PRIV_S]], // ARRAY-DAG: store x86_fp80* %{{.+}}, x86_fp80** [[PRIV_VLA1]], // ARRAY-DAG: store double* %{{.+}}, double** [[PRIV_VLA2]], -// ARRAY: call i8* @llvm.stacksave() // ARRAY: [[SIZE:%.+]] = mul nuw i64 %{{.+}}, 8 -// ARRAY: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 128 %{{.+}}, i8* align 128 %{{.+}}, i64 [[SIZE]], i1 false) +// ARRAY: [[SZ1:%.+]] = add nuw i64 [[SIZE]], 127 +// ARRAY: [[SZ2:%.+]] = udiv i64 [[SZ1]], 128 +// ARRAY: [[SIZE:%.+]] = mul nuw i64 [[SZ2]], 128 +// ARRAY: [[VLA2_VOID_PTR:%.+]] = call i8* @__kmpc_alloc(i32 [[GTID:%.+]], i64 [[SIZE]], i8* inttoptr (i64 8 to i8*)) +// ARRAY: [[VLA2_PTR:%.+]] = bitcast i8* [[VLA2_VOID_PTR]] to double* +// ARRAY: [[SIZE:%.+]] = mul nuw i64 %{{.+}}, 8 +// ARRAY: [[BC:%.+]] = bitcast double* [[VLA2_PTR]] to i8* +// ARRAY: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 128 [[BC]], i8* align 128 %{{.+}}, i64 [[SIZE]], i1 false) +// ARRAY: call void @__kmpc_free(i32 [[GTID]], i8* [[VLA2_VOID_PTR]], i8* inttoptr (i64 8 to i8*)) +// ARRAY-NEXT: ret void #endif diff --git a/test/OpenMP/parallel_firstprivate_messages.cpp b/test/OpenMP/parallel_firstprivate_messages.cpp index 7de268fb3b..6c5a41c589 100644 --- a/test/OpenMP/parallel_firstprivate_messages.cpp +++ b/test/OpenMP/parallel_firstprivate_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s +extern int omp_default_mem_alloc; void foo() { } @@ -71,7 +72,7 @@ int main(int argc, char **argv) { #pragma omp parallel firstprivate (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} #pragma omp parallel firstprivate (argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} #pragma omp parallel firstprivate (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} - #pragma omp parallel firstprivate (argc) + #pragma omp parallel firstprivate (argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} #pragma omp parallel firstprivate (S1) // expected-error {{'S1' does not refer to a value}} #pragma omp parallel firstprivate (a, b, c, d, f) // expected-error {{firstprivate variable with incomplete type 'S1'}} #pragma omp parallel firstprivate (d) diff --git a/test/OpenMP/parallel_for_ast_print.cpp b/test/OpenMP/parallel_for_ast_print.cpp index 036279030c..06b6ab3b66 100644 --- a/test/OpenMP/parallel_for_ast_print.cpp +++ b/test/OpenMP/parallel_for_ast_print.cpp @@ -70,13 +70,13 @@ T tmain(T argc) { // CHECK: static T a; static T g; #pragma omp threadprivate(g) -#pragma omp parallel for schedule(dynamic) default(none) copyin(g) linear(a) - // CHECK: #pragma omp parallel for schedule(dynamic) default(none) copyin(g) linear(a) +#pragma omp parallel for schedule(dynamic) default(none) copyin(g) linear(a) allocate(a) + // CHECK: #pragma omp parallel for schedule(dynamic) default(none) copyin(g) linear(a) allocate(a) for (int i = 0; i < 2; ++i) a = 2; // CHECK-NEXT: for (int i = 0; i < 2; ++i) // CHECK-NEXT: a = 2; -#pragma omp parallel for private(argc, b), firstprivate(c, d), lastprivate(d, f) collapse(N) schedule(static, N) ordered(N) if (parallel :argc) num_threads(N) default(shared) shared(e) reduction(+ : h) +#pragma omp parallel for allocate(argc) private(argc, b), firstprivate(c, d), lastprivate(d, f) collapse(N) schedule(static, N) ordered(N) if (parallel :argc) num_threads(N) default(shared) shared(e) reduction(+ : h) for (int i = 0; i < 2; ++i) for (int j = 0; j < 2; ++j) for (int j = 0; j < 2; ++j) @@ -88,7 +88,7 @@ T tmain(T argc) { for (int j = 0; j < 2; ++j) for (int j = 0; j < 2; ++j) foo(); - // CHECK-NEXT: #pragma omp parallel for private(argc,b) firstprivate(c,d) lastprivate(d,f) collapse(N) schedule(static, N) ordered(N) if(parallel: argc) num_threads(N) default(shared) shared(e) reduction(+: h) + // CHECK-NEXT: #pragma omp parallel for allocate(argc) private(argc,b) firstprivate(c,d) lastprivate(d,f) collapse(N) schedule(static, N) ordered(N) if(parallel: argc) num_threads(N) default(shared) shared(e) reduction(+: h) // CHECK-NEXT: for (int i = 0; i < 2; ++i) // CHECK-NEXT: for (int j = 0; j < 2; ++j) // CHECK-NEXT: for (int j = 0; j < 2; ++j) @@ -132,8 +132,8 @@ int main(int argc, char **argv) { // CHECK: static int a; static float g; #pragma omp threadprivate(g) -#pragma omp parallel for schedule(guided, argc) default(none) copyin(g) linear(a) - // CHECK: #pragma omp parallel for schedule(guided, argc) default(none) copyin(g) linear(a) +#pragma omp parallel for schedule(guided, argc) default(none) copyin(g) linear(a) shared(argc) + // CHECK: #pragma omp parallel for schedule(guided, argc) default(none) copyin(g) linear(a) shared(argc) for (int i = 0; i < 2; ++i) a = 2; // CHECK-NEXT: for (int i = 0; i < 2; ++i) diff --git a/test/OpenMP/parallel_for_codegen.cpp b/test/OpenMP/parallel_for_codegen.cpp index a3d307afac..fe1eb1ef11 100644 --- a/test/OpenMP/parallel_for_codegen.cpp +++ b/test/OpenMP/parallel_for_codegen.cpp @@ -197,7 +197,8 @@ void dynamic1(float *a, float *b, float *c, float *d) { // CHECK: [[IV:%.+]] = load i64, i64* [[OMP_IV]] // CHECK-NEXT: [[UB:%.+]] = load i64, i64* [[OMP_UB]] -// CHECK-NEXT: [[CMP:%.+]] = icmp ule i64 [[IV]], [[UB]] +// CHECK-NEXT: [[BOUND:%.+]] = add i64 [[UB]], 1 +// CHECK-NEXT: [[CMP:%.+]] = icmp ult i64 [[IV]], [[BOUND]] // CHECK-NEXT: br i1 [[CMP]], label %[[LOOP1_BODY:[^,]+]], label %[[LOOP1_END:[^,]+]] for (unsigned long long i = 131071; i < 2147483647; i += 127) { // CHECK: [[LOOP1_BODY]] @@ -239,7 +240,8 @@ void guided7(float *a, float *b, float *c, float *d) { // CHECK: [[IV:%.+]] = load i64, i64* [[OMP_IV]] // CHECK-NEXT: [[UB:%.+]] = load i64, i64* [[OMP_UB]] -// CHECK-NEXT: [[CMP:%.+]] = icmp ule i64 [[IV]], [[UB]] +// CHECK-NEXT: [[BOUND:%.+]] = add i64 [[UB]], 1 +// CHECK-NEXT: [[CMP:%.+]] = icmp ult i64 [[IV]], [[BOUND]] // CHECK-NEXT: br i1 [[CMP]], label %[[LOOP1_BODY:[^,]+]], label %[[LOOP1_END:[^,]+]] for (unsigned long long i = 131071; i < 2147483647; i += 127) { // CHECK: [[LOOP1_BODY]] diff --git a/test/OpenMP/parallel_for_collapse_messages.cpp b/test/OpenMP/parallel_for_collapse_messages.cpp index 9d99c25efa..192fa45c90 100644 --- a/test/OpenMP/parallel_for_collapse_messages.cpp +++ b/test/OpenMP/parallel_for_collapse_messages.cpp @@ -39,7 +39,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} #pragma omp parallel for collapse ((ST > 0) ? 1 + ST : 2) // expected-note 2 {{as specified in 'collapse' clause}} for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; // expected-error 2 {{expected 2 for loops after '#pragma omp parallel for', but found only 1}} // expected-error@+6 2 {{directive '#pragma omp parallel for' cannot contain more than one 'collapse' clause}} - // expected-error@+5 2 {{argument to 'collapse' clause must be a strictly positive integer value}} + // expected-error@+5 {{argument to 'collapse' clause must be a strictly positive integer value}} // expected-error@+4 2 {{expression is not an integral constant expression}} #if __cplusplus >= 201103L // expected-note@+2 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} @@ -86,7 +86,7 @@ int main(int argc, char **argv) { // expected-note@+4{{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif // expected-error@+2 2 {{directive '#pragma omp parallel for' cannot contain more than one 'collapse' clause}} - // expected-error@+1 2 {{argument to 'collapse' clause must be a strictly positive integer value}} + // expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}} #pragma omp parallel for collapse (foobool(argc)), collapse (true), collapse (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; #pragma omp parallel for collapse (S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/parallel_for_default_messages.cpp b/test/OpenMP/parallel_for_default_messages.cpp index 95f6c9193e..8baa2f6c04 100644 --- a/test/OpenMP/parallel_for_default_messages.cpp +++ b/test/OpenMP/parallel_for_default_messages.cpp @@ -15,7 +15,7 @@ int main(int argc, char **argv) { #pragma omp parallel for default() // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp parallel for default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} +#pragma omp parallel for default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-note {{explicit data sharing attribute requested here}} for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} foo(); #pragma omp parallel for default(shared), default(shared) // expected-error {{directive '#pragma omp parallel for' cannot contain more than one 'default' clause}} @@ -25,11 +25,11 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); -#pragma omp parallel for default(none) +#pragma omp parallel for default(none) // expected-note {{explicit data sharing attribute requested here}} for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} foo(); -#pragma omp parallel default(none) +#pragma omp parallel default(none) // expected-note {{explicit data sharing attribute requested here}} #pragma omp parallel for default(shared) for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} foo(); diff --git a/test/OpenMP/parallel_for_firstprivate_messages.cpp b/test/OpenMP/parallel_for_firstprivate_messages.cpp index 19b1ced757..752d0325e6 100644 --- a/test/OpenMP/parallel_for_firstprivate_messages.cpp +++ b/test/OpenMP/parallel_for_firstprivate_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; void foo() { } @@ -86,7 +87,7 @@ int foomain(int argc, char **argv) { #pragma omp parallel for firstprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp parallel for firstprivate(argc) +#pragma omp parallel for firstprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel for firstprivate(S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/parallel_for_lastprivate_messages.cpp b/test/OpenMP/parallel_for_lastprivate_messages.cpp index ae635f3421..5c782a5637 100644 --- a/test/OpenMP/parallel_for_lastprivate_messages.cpp +++ b/test/OpenMP/parallel_for_lastprivate_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; void foo() { } @@ -88,7 +89,7 @@ int foomain(int argc, char **argv) { #pragma omp parallel for lastprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp parallel for lastprivate(argc) +#pragma omp parallel for lastprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel for lastprivate(S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/parallel_for_linear_messages.cpp b/test/OpenMP/parallel_for_linear_messages.cpp index 6596814de6..0dfdb3d96f 100644 --- a/test/OpenMP/parallel_for_linear_messages.cpp +++ b/test/OpenMP/parallel_for_linear_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; namespace X { int x; }; @@ -42,7 +43,7 @@ void test_linear_colons() { #pragma omp parallel for linear(B, ::z, X::x) for (int i = 0; i < 10; ++i) ; -#pragma omp parallel for linear(::z) +#pragma omp parallel for linear(::z) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int i = 0; i < 10; ++i) ; // expected-error@+1 {{expected variable name}} diff --git a/test/OpenMP/parallel_for_messages.cpp b/test/OpenMP/parallel_for_messages.cpp index 9ab4bccfc9..f5aa6e6647 100644 --- a/test/OpenMP/parallel_for_messages.cpp +++ b/test/OpenMP/parallel_for_messages.cpp @@ -58,7 +58,7 @@ L1: break; } } -#pragma omp parallel for default(none) +#pragma omp parallel for default(none) // expected-note {{explicit data sharing attribute requested here}} for (int i = 0; i < 10; ++i) ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} diff --git a/test/OpenMP/parallel_for_ordered_messages.cpp b/test/OpenMP/parallel_for_ordered_messages.cpp index 381bc6ae1b..9681d780fb 100644 --- a/test/OpenMP/parallel_for_ordered_messages.cpp +++ b/test/OpenMP/parallel_for_ordered_messages.cpp @@ -46,7 +46,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here} for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i - ST]; // expected-error 2 {{expected 2 for loops after '#pragma omp parallel for', but found only 1}} // expected-error@+6 2 {{directive '#pragma omp parallel for' cannot contain more than one 'ordered' clause}} -// expected-error@+5 2 {{argument to 'ordered' clause must be a strictly positive integer value}} +// expected-error@+5 {{argument to 'ordered' clause must be a strictly positive integer value}} // expected-error@+4 2 {{expression is not an integral constant expression}} #if __cplusplus >= 201103L // expected-note@+2 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} @@ -104,7 +104,7 @@ int main(int argc, char **argv) { // expected-note@+4 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif // expected-error@+2 2 {{directive '#pragma omp parallel for' cannot contain more than one 'ordered' clause}} -// expected-error@+1 2 {{argument to 'ordered' clause must be a strictly positive integer value}} +// expected-error@+1 {{argument to 'ordered' clause must be a strictly positive integer value}} #pragma omp parallel for ordered(foobool(argc)), ordered(true), ordered(-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i - 4]; diff --git a/test/OpenMP/parallel_for_private_messages.cpp b/test/OpenMP/parallel_for_private_messages.cpp index 7efc6eeac8..4591043bbf 100644 --- a/test/OpenMP/parallel_for_private_messages.cpp +++ b/test/OpenMP/parallel_for_private_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; void foo() { } @@ -116,7 +117,7 @@ int foomain(I argc, C **argv) { #pragma omp parallel for private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp parallel for private(argc) +#pragma omp parallel for private(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel for private(S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/parallel_for_reduction_messages.cpp b/test/OpenMP/parallel_for_reduction_messages.cpp index c44ee676d6..87a5027f69 100644 --- a/test/OpenMP/parallel_for_reduction_messages.cpp +++ b/test/OpenMP/parallel_for_reduction_messages.cpp @@ -6,6 +6,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s +extern int omp_default_mem_alloc; void foo() { } @@ -130,7 +131,7 @@ T tmain(T argc) { #pragma omp parallel for reduction(foo : argc) //expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'float'}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int'}} for (int i = 0; i < 10; ++i) foo(); -#pragma omp parallel for reduction(&& : argc) +#pragma omp parallel for reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int i = 0; i < 10; ++i) foo(); #pragma omp parallel for reduction(^ : T) // expected-error {{'T' does not refer to a value}} diff --git a/test/OpenMP/parallel_for_schedule_messages.cpp b/test/OpenMP/parallel_for_schedule_messages.cpp index 5664529956..dfdd36dddd 100644 --- a/test/OpenMP/parallel_for_schedule_messages.cpp +++ b/test/OpenMP/parallel_for_schedule_messages.cpp @@ -50,6 +50,8 @@ T tmain(T argc, S **argv) { for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; #pragma omp parallel for schedule (static, N) // expected-error {{argument to 'schedule' clause must be a strictly positive integer value}} for (T i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; + #pragma omp parallel for schedule (static, argc+argv[0][0]) default(none) // expected-error 2 {{variable 'argv' must have explicitly specified data sharing attributes}} expected-error 2 {{variable 'argc' must have explicitly specified data sharing attributes}} expected-note 4 {{explicit data sharing attribute requested here}} + for (T i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; return argc; } diff --git a/test/OpenMP/parallel_for_simd_ast_print.cpp b/test/OpenMP/parallel_for_simd_ast_print.cpp index 597e66d22e..7ffecce30d 100644 --- a/test/OpenMP/parallel_for_simd_ast_print.cpp +++ b/test/OpenMP/parallel_for_simd_ast_print.cpp @@ -91,8 +91,8 @@ template<class T> struct S { // CHECK: T res; // CHECK: T val; // CHECK: T lin = 0; - #pragma omp parallel for simd private(val) safelen(7) linear(lin : -5) lastprivate(res) simdlen(5) if(7) -// CHECK-NEXT: #pragma omp parallel for simd private(val) safelen(7) linear(lin: -5) lastprivate(res) simdlen(5) if(7) + #pragma omp parallel for simd private(val) safelen(7) linear(lin : -5) lastprivate(res) simdlen(5) if(7) allocate(lin) +// CHECK-NEXT: #pragma omp parallel for simd private(val) safelen(7) linear(lin: -5) lastprivate(res) simdlen(5) if(7) allocate(lin) for (T i = 7; i < m_a; ++i) { val = v[i-7] + m_a; res = val; @@ -118,7 +118,7 @@ template<class T> struct S { template<int LEN> struct S2 { static void func(int n, float *a, float *b, float *c) { int k1 = 0, k2 = 0; -#pragma omp parallel for simd safelen(LEN) linear(k1,k2:LEN) aligned(a:LEN) simdlen(LEN) +#pragma omp parallel for simd allocate(k1) safelen(LEN) linear(k1,k2:LEN) aligned(a:LEN) simdlen(LEN) for(int i = 0; i < n; i++) { c[i] = a[i] + b[i]; c[k1] = a[k1] + b[k1]; @@ -133,7 +133,7 @@ template<int LEN> struct S2 { // CHECK: template<> struct S2<4> { // CHECK-NEXT: static void func(int n, float *a, float *b, float *c) { // CHECK-NEXT: int k1 = 0, k2 = 0; -// CHECK-NEXT: #pragma omp parallel for simd safelen(4) linear(k1,k2: 4) aligned(a: 4) simdlen(4) +// CHECK-NEXT: #pragma omp parallel for simd allocate(k1) safelen(4) linear(k1,k2: 4) aligned(a: 4) simdlen(4) // CHECK-NEXT: for (int i = 0; i < n; i++) { // CHECK-NEXT: c[i] = a[i] + b[i]; // CHECK-NEXT: c[k1] = a[k1] + b[k1]; diff --git a/test/OpenMP/parallel_for_simd_collapse_messages.cpp b/test/OpenMP/parallel_for_simd_collapse_messages.cpp index d23086b9e5..39d01b8c2f 100644 --- a/test/OpenMP/parallel_for_simd_collapse_messages.cpp +++ b/test/OpenMP/parallel_for_simd_collapse_messages.cpp @@ -39,7 +39,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} #pragma omp parallel for simd collapse ((ST > 0) ? 1 + ST : 2) // expected-note 2 {{as specified in 'collapse' clause}} for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; // expected-error 2 {{expected 2 for loops after '#pragma omp parallel for simd', but found only 1}} // expected-error@+6 2 {{directive '#pragma omp parallel for simd' cannot contain more than one 'collapse' clause}} - // expected-error@+5 2 {{argument to 'collapse' clause must be a strictly positive integer value}} + // expected-error@+5 {{argument to 'collapse' clause must be a strictly positive integer value}} // expected-error@+4 2 {{expression is not an integral constant expression}} #if __cplusplus >= 201103L // expected-note@+2 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} @@ -86,7 +86,7 @@ int main(int argc, char **argv) { // expected-note@+4 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif // expected-error@+2 2 {{directive '#pragma omp parallel for simd' cannot contain more than one 'collapse' clause}} - // expected-error@+1 2 {{argument to 'collapse' clause must be a strictly positive integer value}} + // expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}} #pragma omp parallel for simd collapse (foobool(argc)), collapse (true), collapse (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; #pragma omp parallel for simd collapse (S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/parallel_for_simd_default_messages.cpp b/test/OpenMP/parallel_for_simd_default_messages.cpp index 6d751449bc..7b30e4106a 100644 --- a/test/OpenMP/parallel_for_simd_default_messages.cpp +++ b/test/OpenMP/parallel_for_simd_default_messages.cpp @@ -15,7 +15,7 @@ int main(int argc, char **argv) { #pragma omp parallel for simd default() // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp parallel for simd default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} +#pragma omp parallel for simd default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-note {{explicit data sharing attribute requested here}} for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} foo(); #pragma omp parallel for simd default(shared), default(shared) // expected-error {{directive '#pragma omp parallel for simd' cannot contain more than one 'default' clause}} @@ -25,11 +25,11 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); -#pragma omp parallel for simd default(none) +#pragma omp parallel for simd default(none) // expected-note {{explicit data sharing attribute requested here}} for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} foo(); -#pragma omp parallel default(none) +#pragma omp parallel default(none) // expected-note 2 {{explicit data sharing attribute requested here}} #pragma omp parallel for simd default(shared) for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} expected-error {{variable 'i' must have explicitly specified data sharing attributes}} foo(); diff --git a/test/OpenMP/parallel_for_simd_firstprivate_messages.cpp b/test/OpenMP/parallel_for_simd_firstprivate_messages.cpp index e1e01aa661..ef3743bc79 100644 --- a/test/OpenMP/parallel_for_simd_firstprivate_messages.cpp +++ b/test/OpenMP/parallel_for_simd_firstprivate_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; void foo() { } @@ -86,7 +87,7 @@ int foomain(int argc, char **argv) { #pragma omp parallel for simd firstprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp parallel for simd firstprivate(argc) +#pragma omp parallel for simd firstprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel for simd firstprivate(S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/parallel_for_simd_lastprivate_messages.cpp b/test/OpenMP/parallel_for_simd_lastprivate_messages.cpp index 5759e835b2..45cc26b074 100644 --- a/test/OpenMP/parallel_for_simd_lastprivate_messages.cpp +++ b/test/OpenMP/parallel_for_simd_lastprivate_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; void foo() { } @@ -87,7 +88,7 @@ int foomain(int argc, char **argv) { #pragma omp parallel for simd lastprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp parallel for simd lastprivate(argc) +#pragma omp parallel for simd lastprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel for simd lastprivate(S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/parallel_for_simd_linear_messages.cpp b/test/OpenMP/parallel_for_simd_linear_messages.cpp index 792978e631..cf207f021a 100644 --- a/test/OpenMP/parallel_for_simd_linear_messages.cpp +++ b/test/OpenMP/parallel_for_simd_linear_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; namespace X { int x; }; @@ -117,7 +118,7 @@ template<class I, class C> int foomain(I argc, C **argv) { for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel for simd linear (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; - #pragma omp parallel for simd linear (argc : 5) + #pragma omp parallel for simd linear (argc : 5) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel for simd linear (S1) // expected-error {{'S1' does not refer to a value}} for (int k = 0; k < argc; ++k) ++k; diff --git a/test/OpenMP/parallel_for_simd_messages.cpp b/test/OpenMP/parallel_for_simd_messages.cpp index f1d4c5b935..77b9b0851e 100644 --- a/test/OpenMP/parallel_for_simd_messages.cpp +++ b/test/OpenMP/parallel_for_simd_messages.cpp @@ -58,7 +58,7 @@ L1: break; } } -#pragma omp parallel for simd default(none) +#pragma omp parallel for simd default(none) // expected-note {{explicit data sharing attribute requested here}} for (int i = 0; i < 10; ++i) ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} diff --git a/test/OpenMP/parallel_for_simd_private_messages.cpp b/test/OpenMP/parallel_for_simd_private_messages.cpp index 5d263d6cc2..c5f853fc5d 100644 --- a/test/OpenMP/parallel_for_simd_private_messages.cpp +++ b/test/OpenMP/parallel_for_simd_private_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; void foo() { } @@ -116,7 +117,7 @@ int foomain(I argc, C **argv) { #pragma omp parallel for simd private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp parallel for simd private(argc) +#pragma omp parallel for simd private(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel for simd private(S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/parallel_for_simd_reduction_messages.cpp b/test/OpenMP/parallel_for_simd_reduction_messages.cpp index 5be42461f0..5586a8b864 100644 --- a/test/OpenMP/parallel_for_simd_reduction_messages.cpp +++ b/test/OpenMP/parallel_for_simd_reduction_messages.cpp @@ -6,6 +6,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -o - %s // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -o - %s +extern int omp_default_mem_alloc; void foo() { } @@ -124,7 +125,7 @@ T tmain(T argc) { #pragma omp parallel for simd reduction(foo : argc) //expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'float'}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int'}} for (int i = 0; i < 10; ++i) foo(); -#pragma omp parallel for simd reduction(&& : argc) +#pragma omp parallel for simd reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int i = 0; i < 10; ++i) foo(); #pragma omp parallel for simd reduction(^ : T) // expected-error {{'T' does not refer to a value}} diff --git a/test/OpenMP/parallel_for_simd_safelen_messages.cpp b/test/OpenMP/parallel_for_simd_safelen_messages.cpp index 49ebf428f3..939a1dafb3 100644 --- a/test/OpenMP/parallel_for_simd_safelen_messages.cpp +++ b/test/OpenMP/parallel_for_simd_safelen_messages.cpp @@ -39,7 +39,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} #pragma omp parallel for simd safelen ((ST > 0) ? 1 + ST : 2) for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; // expected-error@+6 2 {{directive '#pragma omp parallel for simd' cannot contain more than one 'safelen' clause}} - // expected-error@+5 2 {{argument to 'safelen' clause must be a strictly positive integer value}} + // expected-error@+5 {{argument to 'safelen' clause must be a strictly positive integer value}} // expected-error@+4 2 {{expression is not an integral constant expression}} #if __cplusplus >= 201103L // expected-note@+2 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} @@ -84,7 +84,7 @@ int main(int argc, char **argv) { // expected-note@+4 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif // expected-error@+2 2 {{directive '#pragma omp parallel for simd' cannot contain more than one 'safelen' clause}} - // expected-error@+1 2 {{argument to 'safelen' clause must be a strictly positive integer value}} + // expected-error@+1 {{argument to 'safelen' clause must be a strictly positive integer value}} #pragma omp parallel for simd safelen (foobool(argc)), safelen (true), safelen (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; #pragma omp parallel for simd safelen (S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/parallel_for_simd_simdlen_messages.cpp b/test/OpenMP/parallel_for_simd_simdlen_messages.cpp index 167644e388..8cf196bf71 100644 --- a/test/OpenMP/parallel_for_simd_simdlen_messages.cpp +++ b/test/OpenMP/parallel_for_simd_simdlen_messages.cpp @@ -39,7 +39,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} #pragma omp parallel for simd simdlen ((ST > 0) ? 1 + ST : 2) for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; // expected-error@+6 2 {{directive '#pragma omp parallel for simd' cannot contain more than one 'simdlen' clause}} - // expected-error@+5 2 {{argument to 'simdlen' clause must be a strictly positive integer value}} + // expected-error@+5 {{argument to 'simdlen' clause must be a strictly positive integer value}} // expected-error@+4 2 {{expression is not an integral constant expression}} #if __cplusplus >= 201103L // expected-note@+2 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} @@ -84,7 +84,7 @@ int main(int argc, char **argv) { // expected-note@+4 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif // expected-error@+2 2 {{directive '#pragma omp parallel for simd' cannot contain more than one 'simdlen' clause}} - // expected-error@+1 2 {{argument to 'simdlen' clause must be a strictly positive integer value}} + // expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}} #pragma omp parallel for simd simdlen (foobool(argc)), simdlen (true), simdlen (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; #pragma omp parallel for simd simdlen (S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/parallel_messages.cpp b/test/OpenMP/parallel_messages.cpp index 8b0c0353c2..49fc2305ff 100644 --- a/test/OpenMP/parallel_messages.cpp +++ b/test/OpenMP/parallel_messages.cpp @@ -7,6 +7,7 @@ void foo() { #pragma omp parallel // expected-error {{unexpected OpenMP directive '#pragma omp parallel'}} +int a; struct S; S& bar(); int main(int argc, char **argv) { @@ -54,8 +55,11 @@ int main(int argc, char **argv) { break; } } - #pragma omp parallel default(none) - ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} +#pragma omp parallel default(none) // expected-note 2 {{explicit data sharing attribute requested here}} + { + ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} + ++a; // expected-error {{variable 'a' must have explicitly specified data sharing attributes}} + } goto L2; // expected-error {{use of undeclared label 'L2'}} #pragma omp parallel diff --git a/test/OpenMP/parallel_private_codegen.cpp b/test/OpenMP/parallel_private_codegen.cpp index 33a5b4cba0..ceceaf95d4 100644 --- a/test/OpenMP/parallel_private_codegen.cpp +++ b/test/OpenMP/parallel_private_codegen.cpp @@ -13,6 +13,20 @@ // expected-no-diagnostics #ifndef HEADER #define HEADER + +enum omp_allocator_handle_t { + omp_null_allocator = 0, + omp_default_mem_alloc = 1, + omp_large_cap_mem_alloc = 2, + omp_const_mem_alloc = 3, + omp_high_bw_mem_alloc = 4, + omp_low_lat_mem_alloc = 5, + omp_cgroup_mem_alloc = 6, + omp_pteam_mem_alloc = 7, + omp_thread_mem_alloc = 8, + KMP_ALLOCATOR_MAX_HANDLE = __UINTPTR_MAX__ +}; + template <class T> struct S { T f; @@ -54,7 +68,7 @@ template<typename T> struct SST { T a; SST() : a(T()) { -#pragma omp parallel private(a) +#pragma omp parallel private(a) allocate(omp_large_cap_mem_alloc:a) #ifdef LAMBDA [&]() { [&]() { @@ -343,12 +357,17 @@ int main() { // CHECK: ret // CHECK: define internal void [[SST_MICROTASK]](i{{[0-9]+}}* noalias [[GTID_ADDR:%.+]], i{{[0-9]+}}* noalias %{{.+}}, [[SST_TY]]* %{{.+}}) -// CHECK: [[A_PRIV:%.+]] = alloca i{{[0-9]+}}, +// CHECK: [[GTID_ADDR_PTR:%.+]] = alloca i32*, +// CHECK: [[GTID_ADDR:%.+]] = load i32*, i32** [[GTID_ADDR_PTR]], +// CHECK: [[GTID:%.+]] = load i32, i32* [[GTID_ADDR]], +// CHECK: [[A_VOID_PTR:%.+]] = call i8* @__kmpc_alloc(i32 [[GTID]], i64 4, i8* inttoptr (i64 2 to i8*)) +// CHECK: [[A_PRIV:%.+]] = bitcast i8* [[A_VOID_PTR]] to i32* // CHECK: store i{{[0-9]+}}* [[A_PRIV]], i{{[0-9]+}}** [[REF:%.+]], // CHECK-NEXT: [[A_PRIV:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[REF]], // CHECK-NEXT: [[A_VAL:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[A_PRIV]], // CHECK-NEXT: [[INC:%.+]] = add nsw i{{[0-9]+}} [[A_VAL]], 1 // CHECK-NEXT: store i{{[0-9]+}} [[INC]], i{{[0-9]+}}* [[A_PRIV]], +// CHECK-NEXT: call void @__kmpc_free(i32 [[GTID]], i8* [[A_VOID_PTR]], i8* inttoptr (i64 2 to i8*)) // CHECK-NEXT: ret void #endif diff --git a/test/OpenMP/parallel_private_messages.cpp b/test/OpenMP/parallel_private_messages.cpp index e8fd70d2ff..e210493741 100644 --- a/test/OpenMP/parallel_private_messages.cpp +++ b/test/OpenMP/parallel_private_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s +extern int omp_default_mem_alloc; void foo() { } @@ -68,7 +69,7 @@ int main(int argc, char **argv) { #pragma omp parallel private (S1) // expected-error {{'S1' does not refer to a value}} #pragma omp parallel private (a, b, c, d, f) // expected-error {{a private variable with incomplete type 'S1'}} expected-error 1 {{const-qualified variable without mutable fields cannot be private}} expected-error 2 {{const-qualified variable cannot be private}} #pragma omp parallel private (argv[1]) // expected-error {{expected variable name}} - #pragma omp parallel private(ba) + #pragma omp parallel private(ba) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} #pragma omp parallel private(ca) // expected-error {{const-qualified variable without mutable fields cannot be private}} #pragma omp parallel private(da) // expected-error {{const-qualified variable cannot be private}} #pragma omp parallel private(S2::S2s) // expected-error {{shared variable cannot be private}} diff --git a/test/OpenMP/parallel_reduction_codegen.cpp b/test/OpenMP/parallel_reduction_codegen.cpp index bd43a9328a..38be6c39fc 100644 --- a/test/OpenMP/parallel_reduction_codegen.cpp +++ b/test/OpenMP/parallel_reduction_codegen.cpp @@ -622,7 +622,7 @@ int main() { // CHECK-NOT: call i32 @__kmpc_reduce -// CHECK: ret void +// CHECK: } // CHECK: define {{.*}} i{{[0-9]+}} [[TMAIN_INT]]() // CHECK: [[TEST:%.+]] = alloca [[S_INT_TY]], diff --git a/test/OpenMP/parallel_reduction_messages.cpp b/test/OpenMP/parallel_reduction_messages.cpp index f520d4a0fa..2e90b63e0d 100644 --- a/test/OpenMP/parallel_reduction_messages.cpp +++ b/test/OpenMP/parallel_reduction_messages.cpp @@ -6,6 +6,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s +extern int omp_default_mem_alloc; void foo() { } @@ -112,7 +113,7 @@ T tmain(T argc) { foo(); #pragma omp parallel reduction(foo : argc) //expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'float'}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int'}} foo(); -#pragma omp parallel reduction(&& : argc) +#pragma omp parallel reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} foo(); #pragma omp parallel reduction(^ : T) // expected-error {{'T' does not refer to a value}} foo(); diff --git a/test/OpenMP/parallel_sections_ast_print.cpp b/test/OpenMP/parallel_sections_ast_print.cpp index 8c0bd0bae5..5692881634 100644 --- a/test/OpenMP/parallel_sections_ast_print.cpp +++ b/test/OpenMP/parallel_sections_ast_print.cpp @@ -41,11 +41,11 @@ T tmain(T argc, T *argv) { { a = 2; } -#pragma omp parallel sections default(none), private(argc, b) firstprivate(argv) shared(d) if (parallel: argc > 0) num_threads(C) copyin(S < T > ::TS) proc_bind(master) reduction(+ : c) reduction(max : e) +#pragma omp parallel sections default(none), private(argc, b) firstprivate(argv) shared(d) if (parallel: argc > 0) num_threads(C) copyin(S < T > ::TS) proc_bind(master) reduction(+ : c) reduction(max : e) allocate(e) { foo(); } -#pragma omp parallel sections if (C) num_threads(s) proc_bind(close) reduction(^ : e, f) reduction(&& : g) lastprivate(b, c) +#pragma omp parallel sections allocate(b) if (C) num_threads(s) proc_bind(close) reduction(^ : e, f) reduction(&& : g) lastprivate(b, c) { foo(); #pragma omp section @@ -62,11 +62,11 @@ T tmain(T argc, T *argv) { // CHECK-NEXT: { // CHECK-NEXT: a = 2; // CHECK-NEXT: } -// CHECK-NEXT: #pragma omp parallel sections default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(C) copyin(S<T>::TS) proc_bind(master) reduction(+: c) reduction(max: e) +// CHECK-NEXT: #pragma omp parallel sections default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(C) copyin(S<T>::TS) proc_bind(master) reduction(+: c) reduction(max: e) allocate(e) // CHECK-NEXT: { // CHECK-NEXT: foo(); // CHECK-NEXT: } -// CHECK-NEXT: #pragma omp parallel sections if(C) num_threads(s) proc_bind(close) reduction(^: e,f) reduction(&&: g) lastprivate(b,c) +// CHECK-NEXT: #pragma omp parallel sections allocate(b) if(C) num_threads(s) proc_bind(close) reduction(^: e,f) reduction(&&: g) lastprivate(b,c) // CHECK-NEXT: { // CHECK-NEXT: foo(); // CHECK-NEXT: #pragma omp section @@ -80,11 +80,11 @@ T tmain(T argc, T *argv) { // CHECK-NEXT: { // CHECK-NEXT: a = 2; // CHECK-NEXT: } -// CHECK-NEXT: #pragma omp parallel sections default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(5) copyin(S<int>::TS) proc_bind(master) reduction(+: c) reduction(max: e) +// CHECK-NEXT: #pragma omp parallel sections default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(5) copyin(S<int>::TS) proc_bind(master) reduction(+: c) reduction(max: e) allocate(e) // CHECK-NEXT: { // CHECK-NEXT: foo(); // CHECK-NEXT: } -// CHECK-NEXT: #pragma omp parallel sections if(5) num_threads(s) proc_bind(close) reduction(^: e,f) reduction(&&: g) lastprivate(b,c) +// CHECK-NEXT: #pragma omp parallel sections allocate(b) if(5) num_threads(s) proc_bind(close) reduction(^: e,f) reduction(&&: g) lastprivate(b,c) // CHECK-NEXT: { // CHECK-NEXT: foo(); // CHECK-NEXT: #pragma omp section @@ -98,11 +98,11 @@ T tmain(T argc, T *argv) { // CHECK-NEXT: { // CHECK-NEXT: a = 2; // CHECK-NEXT: } -// CHECK-NEXT: #pragma omp parallel sections default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(1) copyin(S<long>::TS) proc_bind(master) reduction(+: c) reduction(max: e) +// CHECK-NEXT: #pragma omp parallel sections default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(1) copyin(S<long>::TS) proc_bind(master) reduction(+: c) reduction(max: e) allocate(e) // CHECK-NEXT: { // CHECK-NEXT: foo(); // CHECK-NEXT: } -// CHECK-NEXT: #pragma omp parallel sections if(1) num_threads(s) proc_bind(close) reduction(^: e,f) reduction(&&: g) lastprivate(b,c) +// CHECK-NEXT: #pragma omp parallel sections allocate(b) if(1) num_threads(s) proc_bind(close) reduction(^: e,f) reduction(&&: g) lastprivate(b,c) // CHECK-NEXT: { // CHECK-NEXT: foo(); // CHECK-NEXT: #pragma omp section diff --git a/test/OpenMP/parallel_sections_default_messages.cpp b/test/OpenMP/parallel_sections_default_messages.cpp index b16e5f7369..3d2e74933f 100644 --- a/test/OpenMP/parallel_sections_default_messages.cpp +++ b/test/OpenMP/parallel_sections_default_messages.cpp @@ -25,12 +25,12 @@ int main(int argc, char **argv) { } } -#pragma omp parallel sections default(none) +#pragma omp parallel sections default(none) // expected-note {{explicit data sharing attribute requested here}} { ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} } -#pragma omp parallel sections default(none) +#pragma omp parallel sections default(none) // expected-note {{explicit data sharing attribute requested here}} { #pragma omp parallel sections default(shared) { diff --git a/test/OpenMP/parallel_sections_firstprivate_messages.cpp b/test/OpenMP/parallel_sections_firstprivate_messages.cpp index f8370f26b4..c161e6f747 100644 --- a/test/OpenMP/parallel_sections_firstprivate_messages.cpp +++ b/test/OpenMP/parallel_sections_firstprivate_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; void foo() { } @@ -92,7 +93,7 @@ int foomain(int argc, char **argv) { { foo(); } -#pragma omp parallel sections firstprivate(argc) +#pragma omp parallel sections firstprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} { foo(); } diff --git a/test/OpenMP/parallel_sections_lastprivate_messages.cpp b/test/OpenMP/parallel_sections_lastprivate_messages.cpp index 25ea4a51dd..b259b8a19e 100644 --- a/test/OpenMP/parallel_sections_lastprivate_messages.cpp +++ b/test/OpenMP/parallel_sections_lastprivate_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; void foo() { } @@ -93,7 +94,7 @@ int foomain(int argc, char **argv) { { foo(); } -#pragma omp parallel sections lastprivate(argc) +#pragma omp parallel sections lastprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} { foo(); } diff --git a/test/OpenMP/parallel_sections_messages.cpp b/test/OpenMP/parallel_sections_messages.cpp index 459953acd9..81f0c517cd 100644 --- a/test/OpenMP/parallel_sections_messages.cpp +++ b/test/OpenMP/parallel_sections_messages.cpp @@ -62,7 +62,7 @@ int main(int argc, char **argv) { break; } } -#pragma omp parallel sections default(none) +#pragma omp parallel sections default(none) // expected-note {{explicit data sharing attribute requested here}} { ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} } diff --git a/test/OpenMP/parallel_sections_private_messages.cpp b/test/OpenMP/parallel_sections_private_messages.cpp index 75e3f173ae..2161df33d8 100644 --- a/test/OpenMP/parallel_sections_private_messages.cpp +++ b/test/OpenMP/parallel_sections_private_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; void foo() { } @@ -134,7 +135,7 @@ int foomain(I argc, C **argv) { { foo(); } -#pragma omp parallel sections private(argc) +#pragma omp parallel sections private(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} { foo(); } diff --git a/test/OpenMP/parallel_sections_reduction_messages.cpp b/test/OpenMP/parallel_sections_reduction_messages.cpp index ae8384adf0..ac205cd076 100644 --- a/test/OpenMP/parallel_sections_reduction_messages.cpp +++ b/test/OpenMP/parallel_sections_reduction_messages.cpp @@ -6,6 +6,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s +extern int omp_default_mem_alloc; void foo() { } @@ -136,7 +137,7 @@ T tmain(T argc) { { foo(); } -#pragma omp parallel sections reduction(&& : argc) +#pragma omp parallel sections reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} { foo(); } diff --git a/test/OpenMP/report_default_DSA.cpp b/test/OpenMP/report_default_DSA.cpp index ba620a4ce8..d6f8158b0e 100644 --- a/test/OpenMP/report_default_DSA.cpp +++ b/test/OpenMP/report_default_DSA.cpp @@ -7,7 +7,7 @@ void foo(int x, int n) { for (int iter = 0; iter < x; iter++) { #pragma omp target teams distribute parallel for map( \ from \ - : vec [0:n]) default(none) + : vec [0:n]) default(none) // expected-note 4 {{explicit data sharing attribute requested here}} // expected-error@+1 {{variable 'n' must have explicitly specified data sharing attributes}} for (int ii = 0; ii < n; ii++) { // expected-error@+3 {{variable 'iter' must have explicitly specified data sharing attributes}} diff --git a/test/OpenMP/requires_messages.cpp b/test/OpenMP/requires_messages.cpp index 7404d3ea5f..edc98f1a14 100644 --- a/test/OpenMP/requires_messages.cpp +++ b/test/OpenMP/requires_messages.cpp @@ -1,12 +1,13 @@ // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s -#pragma omp requires unified_address // expected-note {{unified_address clause previously used here}} expected-note {{unified_address clause previously used here}} expected-note {{unified_address clause previously used here}} expected-note {{unified_address clause previously used here}} expected-note {{unified_address clause previously used here}} expected-note{{unified_address clause previously used here}} +int a; +#pragma omp requires unified_address allocate(a) // expected-note {{unified_address clause previously used here}} expected-note {{unified_address clause previously used here}} expected-note {{unified_address clause previously used here}} expected-note {{unified_address clause previously used here}} expected-note {{unified_address clause previously used here}} expected-note{{unified_address clause previously used here}} expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp requires'}} #pragma omp requires unified_shared_memory // expected-note {{unified_shared_memory clause previously used here}} expected-note{{unified_shared_memory clause previously used here}} #pragma omp requires unified_shared_memory, unified_shared_memory // expected-error {{Only one unified_shared_memory clause can appear on a requires directive in a single translation unit}} expected-error {{directive '#pragma omp requires' cannot contain more than one 'unified_shared_memory' clause}} -#pragma omp requires unified_address // expected-error {{Only one unified_address clause can appear on a requires directive in a single translation unit}} +#pragma omp requires unified_address // expected-error {{Only one unified_address clause can appear on a requires directive in a single translation unit}} #pragma omp requires unified_address, unified_address // expected-error {{Only one unified_address clause can appear on a requires directive in a single translation unit}} expected-error {{directive '#pragma omp requires' cannot contain more than one 'unified_address' clause}} @@ -28,13 +29,13 @@ #pragma omp requires atomic_default_mem_order( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected 'seq_cst', 'acq_rel' or 'relaxed' in OpenMP clause 'atomic_default_mem_order'}} expected-error {{expected at least one clause on '#pragma omp requires' directive}} -#pragma omp requires atomic_default_mem_order(seq_cst // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{Only one atomic_default_mem_order clause can appear on a requires directive in a single translation unit}} +#pragma omp requires atomic_default_mem_order(seq_cst // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{Only one atomic_default_mem_order clause can appear on a requires directive in a single translation unit}} -#pragma omp requires atomic_default_mem_order(invalid_modifier) // expected-error {{expected 'seq_cst', 'acq_rel' or 'relaxed' in OpenMP clause 'atomic_default_mem_order'}} expected-error {{expected at least one clause on '#pragma omp requires' directive}} +#pragma omp requires atomic_default_mem_order(invalid_modifier) // expected-error {{expected 'seq_cst', 'acq_rel' or 'relaxed' in OpenMP clause 'atomic_default_mem_order'}} expected-error {{expected at least one clause on '#pragma omp requires' directive}} #pragma omp requires atomic_default_mem_order(shared) // expected-error {{expected 'seq_cst', 'acq_rel' or 'relaxed' in OpenMP clause 'atomic_default_mem_order'}} expected-error {{expected at least one clause on '#pragma omp requires' directive}} -#pragma omp requires atomic_default_mem_order(acq_rel), atomic_default_mem_order(relaxed) // expected-error {{directive '#pragma omp requires' cannot contain more than one 'atomic_default_mem_order' claus}} expected-error {{Only one atomic_default_mem_order clause can appear on a requires directive in a single translation unit}} +#pragma omp requires atomic_default_mem_order(acq_rel), atomic_default_mem_order(relaxed) // expected-error {{directive '#pragma omp requires' cannot contain more than one 'atomic_default_mem_order' claus}} expected-error {{Only one atomic_default_mem_order clause can appear on a requires directive in a single translation unit}} #pragma omp requires // expected-error {{expected at least one clause on '#pragma omp requires' directive}} diff --git a/test/OpenMP/requires_target_messages.cpp b/test/OpenMP/requires_target_messages.cpp new file mode 100644 index 0000000000..ef65d98fed --- /dev/null +++ b/test/OpenMP/requires_target_messages.cpp @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s + +void foo2() { + int a; + #pragma omp target // expected-note 4 {{target previously encountered here}} + { + a = a + 1; + } +} + +#pragma omp requires atomic_default_mem_order(seq_cst) +#pragma omp requires unified_address //expected-error {{target region encountered before requires directive with 'unified_address' clause}} +#pragma omp requires unified_shared_memory //expected-error {{target region encountered before requires directive with 'unified_shared_memory' clause}} +#pragma omp requires reverse_offload //expected-error {{target region encountered before requires directive with 'reverse_offload' clause}} +#pragma omp requires dynamic_allocators //expected-error {{target region encountered before requires directive with 'dynamic_allocators' clause}} diff --git a/test/OpenMP/sections_ast_print.cpp b/test/OpenMP/sections_ast_print.cpp index 15c8c26e8c..1679b11311 100644 --- a/test/OpenMP/sections_ast_print.cpp +++ b/test/OpenMP/sections_ast_print.cpp @@ -18,12 +18,12 @@ T tmain(T argc) { static T a; // CHECK: static T a; #pragma omp parallel -#pragma omp sections private(argc, b), firstprivate(c, d), lastprivate(d, f) reduction(- : g) nowait +#pragma omp sections private(argc, b), firstprivate(c, d), lastprivate(d, f) reduction(- : g) nowait allocate(d) { foo(); } // CHECK-NEXT: #pragma omp parallel - // CHECK-NEXT: #pragma omp sections private(argc,b) firstprivate(c,d) lastprivate(d,f) reduction(-: g) nowait{{$}} + // CHECK-NEXT: #pragma omp sections private(argc,b) firstprivate(c,d) lastprivate(d,f) reduction(-: g) nowait allocate(d){{$}} // CHECK-NEXT: { // CHECK-NEXT: foo(); // CHECK-NEXT: } @@ -36,7 +36,7 @@ int main(int argc, char **argv) { static int a; // CHECK: static int a; #pragma omp parallel -#pragma omp sections private(argc, b), firstprivate(argv, c), lastprivate(d, f) reduction(+ : g) nowait +#pragma omp sections allocate(c) private(argc, b), firstprivate(argv, c), lastprivate(d, f) reduction(+ : g) nowait { #pragma omp section foo(); @@ -44,7 +44,7 @@ int main(int argc, char **argv) { foo(); } // CHECK-NEXT: #pragma omp parallel - // CHECK-NEXT: #pragma omp sections private(argc,b) firstprivate(argv,c) lastprivate(d,f) reduction(+: g) nowait + // CHECK-NEXT: #pragma omp sections allocate(c) private(argc,b) firstprivate(argv,c) lastprivate(d,f) reduction(+: g) nowait // CHECK-NEXT: { // CHECK-NEXT: #pragma omp section{{$}} // CHECK-NEXT: foo(); diff --git a/test/OpenMP/sections_firstprivate_messages.cpp b/test/OpenMP/sections_firstprivate_messages.cpp index 425125c11a..e2d9de3c31 100644 --- a/test/OpenMP/sections_firstprivate_messages.cpp +++ b/test/OpenMP/sections_firstprivate_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; void foo() { } @@ -99,7 +100,7 @@ int foomain(int argc, char **argv) { foo(); } #pragma omp parallel -#pragma omp sections firstprivate(argc) +#pragma omp sections firstprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} { foo(); } diff --git a/test/OpenMP/sections_lastprivate_messages.cpp b/test/OpenMP/sections_lastprivate_messages.cpp index 1f73260541..f7e0d1acf0 100644 --- a/test/OpenMP/sections_lastprivate_messages.cpp +++ b/test/OpenMP/sections_lastprivate_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; void foo() { } @@ -206,7 +207,7 @@ int main(int argc, char **argv) { foo(); } #pragma omp parallel -#pragma omp sections lastprivate(argc) +#pragma omp sections lastprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} { foo(); } diff --git a/test/OpenMP/sections_private_messages.cpp b/test/OpenMP/sections_private_messages.cpp index 81e3eb4779..3548590b0f 100644 --- a/test/OpenMP/sections_private_messages.cpp +++ b/test/OpenMP/sections_private_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; void foo() { } @@ -134,7 +135,7 @@ int foomain(I argc, C **argv) { { foo(); } -#pragma omp sections private(argc) +#pragma omp sections private(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} { foo(); } diff --git a/test/OpenMP/sections_reduction_messages.cpp b/test/OpenMP/sections_reduction_messages.cpp index 72a48c9c43..e0b285cbaf 100644 --- a/test/OpenMP/sections_reduction_messages.cpp +++ b/test/OpenMP/sections_reduction_messages.cpp @@ -6,6 +6,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s +extern int omp_default_mem_alloc; void foo() { } @@ -14,7 +15,7 @@ bool foobool(int argc) { } void foobar(int &ref) { -#pragma omp parallel +#pragma omp parallel #pragma omp sections reduction(+:ref) { foo(); @@ -149,7 +150,7 @@ T tmain(T argc) { foo(); } #pragma omp parallel -#pragma omp sections reduction(&& : argc) +#pragma omp sections reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} { foo(); } diff --git a/test/OpenMP/simd_ast_print.cpp b/test/OpenMP/simd_ast_print.cpp index ad16fe2de9..dcd5d7f2dc 100644 --- a/test/OpenMP/simd_ast_print.cpp +++ b/test/OpenMP/simd_ast_print.cpp @@ -94,8 +94,8 @@ template<class T> struct S { // CHECK: T val; // CHECK: T lin = 0; // CHECK: T &ref = res; - #pragma omp simd private(val) safelen(7) linear(lin : -5) lastprivate(res) simdlen(5) linear(ref(ref)) -// CHECK-NEXT: #pragma omp simd private(val) safelen(7) linear(lin: -5) lastprivate(res) simdlen(5) linear(ref(ref)) + #pragma omp simd allocate(res) private(val) safelen(7) linear(lin : -5) lastprivate(res) simdlen(5) linear(ref(ref)) +// CHECK-NEXT: #pragma omp simd allocate(res) private(val) safelen(7) linear(lin: -5) lastprivate(res) simdlen(5) linear(ref(ref)) for (T i = 7; i < m_a; ++i) { val = v[i-7] + m_a; res = val; @@ -121,7 +121,7 @@ template<class T> struct S { template<int LEN> struct S2 { static void func(int n, float *a, float *b, float *c) { int k1 = 0, k2 = 0; -#pragma omp simd safelen(LEN) linear(k1,k2:LEN) aligned(a:LEN) simdlen(LEN) +#pragma omp simd safelen(LEN) linear(k1,k2:LEN) aligned(a:LEN) simdlen(LEN) allocate(k1) for(int i = 0; i < n; i++) { c[i] = a[i] + b[i]; c[k1] = a[k1] + b[k1]; @@ -136,7 +136,7 @@ template<int LEN> struct S2 { // CHECK: template<> struct S2<4> { // CHECK-NEXT: static void func(int n, float *a, float *b, float *c) { // CHECK-NEXT: int k1 = 0, k2 = 0; -// CHECK-NEXT: #pragma omp simd safelen(4) linear(k1,k2: 4) aligned(a: 4) simdlen(4) +// CHECK-NEXT: #pragma omp simd safelen(4) linear(k1,k2: 4) aligned(a: 4) simdlen(4) allocate(k1) // CHECK-NEXT: for (int i = 0; i < n; i++) { // CHECK-NEXT: c[i] = a[i] + b[i]; // CHECK-NEXT: c[k1] = a[k1] + b[k1]; diff --git a/test/OpenMP/simd_collapse_messages.cpp b/test/OpenMP/simd_collapse_messages.cpp index b3100c097d..3e980d9492 100644 --- a/test/OpenMP/simd_collapse_messages.cpp +++ b/test/OpenMP/simd_collapse_messages.cpp @@ -39,7 +39,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} #pragma omp simd collapse ((ST > 0) ? 1 + ST : 2) // expected-note 2 {{as specified in 'collapse' clause}} for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; // expected-error 2 {{expected 2 for loops after '#pragma omp simd', but found only 1}} // expected-error@+6 2 {{directive '#pragma omp simd' cannot contain more than one 'collapse' clause}} - // expected-error@+5 2 {{argument to 'collapse' clause must be a strictly positive integer value}} + // expected-error@+5 {{argument to 'collapse' clause must be a strictly positive integer value}} // expected-error@+4 2 {{expression is not an integral constant expression}} #if __cplusplus >= 201103L // expected-note@+2 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} @@ -86,7 +86,7 @@ int main(int argc, char **argv) { // expected-note@+4 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif // expected-error@+2 2 {{directive '#pragma omp simd' cannot contain more than one 'collapse' clause}} - // expected-error@+1 2 {{argument to 'collapse' clause must be a strictly positive integer value}} + // expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}} #pragma omp simd collapse (foobool(argc)), collapse (true), collapse (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; #pragma omp simd collapse (S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/simd_lastprivate_messages.cpp b/test/OpenMP/simd_lastprivate_messages.cpp index bd5a237a60..9469c53b74 100644 --- a/test/OpenMP/simd_lastprivate_messages.cpp +++ b/test/OpenMP/simd_lastprivate_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; void foo() { } @@ -87,7 +88,7 @@ int foomain(I argc, C **argv) { #pragma omp simd lastprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp simd lastprivate(argc) +#pragma omp simd lastprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp simd lastprivate(S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/simd_linear_messages.cpp b/test/OpenMP/simd_linear_messages.cpp index 3a72ed26fc..fa2690616c 100644 --- a/test/OpenMP/simd_linear_messages.cpp +++ b/test/OpenMP/simd_linear_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; namespace X { int x; }; @@ -127,7 +128,7 @@ template<class I, class C> int foomain(I argc, C **argv) { for (int k = 0; k < argc; ++k) ++k; #pragma omp simd linear (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; - #pragma omp simd linear (argc : 5) + #pragma omp simd linear (argc : 5) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp simd linear (S1) // expected-error {{'S1' does not refer to a value}} for (int k = 0; k < argc; ++k) ++k; diff --git a/test/OpenMP/simd_metadata.c b/test/OpenMP/simd_metadata.c index 44a7e901a0..f0ae0200dd 100644 --- a/test/OpenMP/simd_metadata.c +++ b/test/OpenMP/simd_metadata.c @@ -147,16 +147,16 @@ void h3(float *c, float *a, float *b, int size) // CHECK: [[LOOP_H1_HEADER:![0-9]+]] = distinct !{[[LOOP_H1_HEADER]], [[LOOP_WIDTH_8:![0-9]+]], [[LOOP_VEC_ENABLE]]} // CHECK: [[LOOP_WIDTH_8]] = !{!"llvm.loop.vectorize.width", i32 8} // CHECK: ![[ACCESS_GROUP_7]] = distinct !{} -// CHECK: [[LOOP_H1_HEADER:![0-9]+]] = distinct !{[[LOOP_H1_HEADER]], [[LOOP_WIDTH_8]], [[LOOP_VEC_ENABLE]], ![[PARALLEL_ACCESSES_9:[0-9]+]]} +// CHECK: [[LOOP_H1_HEADER:![0-9]+]] = distinct !{[[LOOP_H1_HEADER]], ![[PARALLEL_ACCESSES_9:[0-9]+]], [[LOOP_WIDTH_8]], [[LOOP_VEC_ENABLE]]} // CHECK: ![[PARALLEL_ACCESSES_9]] = !{!"llvm.loop.parallel_accesses", ![[ACCESS_GROUP_7]]} // // Metadata for h2: // CHECK: ![[ACCESS_GROUP_10]] = distinct !{} -// CHECK: [[LOOP_H2_HEADER]] = distinct !{[[LOOP_H2_HEADER]], [[LOOP_VEC_ENABLE]], ![[PARALLEL_ACCESSES_12:[0-9]+]]} +// CHECK: [[LOOP_H2_HEADER]] = distinct !{[[LOOP_H2_HEADER]], ![[PARALLEL_ACCESSES_12:[0-9]+]], [[LOOP_VEC_ENABLE]]} // CHECK: ![[PARALLEL_ACCESSES_12]] = !{!"llvm.loop.parallel_accesses", ![[ACCESS_GROUP_10]]} // // Metadata for h3: // CHECK: ![[ACCESS_GROUP_13]] = distinct !{} -// CHECK: [[LOOP_H3_HEADER]] = distinct !{[[LOOP_H3_HEADER]], [[LOOP_VEC_ENABLE]], ![[PARALLEL_ACCESSES_15:[0-9]+]]} +// CHECK: [[LOOP_H3_HEADER]] = distinct !{[[LOOP_H3_HEADER]], ![[PARALLEL_ACCESSES_15:[0-9]+]], [[LOOP_VEC_ENABLE]]} // CHECK: ![[PARALLEL_ACCESSES_15]] = !{!"llvm.loop.parallel_accesses", ![[ACCESS_GROUP_13]]} // diff --git a/test/OpenMP/simd_private_messages.cpp b/test/OpenMP/simd_private_messages.cpp index bfa26d1645..99f76ceed5 100644 --- a/test/OpenMP/simd_private_messages.cpp +++ b/test/OpenMP/simd_private_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; void foo() { } @@ -105,7 +106,7 @@ template<class I, class C> int foomain(I argc, C **argv) { for (int k = 0; k < argc; ++k) ++k; #pragma omp simd private (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; - #pragma omp simd private (argc) + #pragma omp simd private (argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp simd private (S1) // expected-error {{'S1' does not refer to a value}} for (int k = 0; k < argc; ++k) ++k; diff --git a/test/OpenMP/simd_reduction_messages.cpp b/test/OpenMP/simd_reduction_messages.cpp index 1602aeb40f..f204ae1608 100644 --- a/test/OpenMP/simd_reduction_messages.cpp +++ b/test/OpenMP/simd_reduction_messages.cpp @@ -6,6 +6,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 %s // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 %s +extern int omp_default_mem_alloc; void foo() { } @@ -124,7 +125,7 @@ T tmain(T argc) { #pragma omp simd reduction(foo : argc) //expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'float'}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int'}} for (int i = 0; i < 10; ++i) foo(); -#pragma omp simd reduction(&& : argc) +#pragma omp simd reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int i = 0; i < 10; ++i) foo(); #pragma omp simd reduction(^ : T) // expected-error {{'T' does not refer to a value}} diff --git a/test/OpenMP/simd_safelen_messages.cpp b/test/OpenMP/simd_safelen_messages.cpp index b75a923e7f..f40873aeea 100644 --- a/test/OpenMP/simd_safelen_messages.cpp +++ b/test/OpenMP/simd_safelen_messages.cpp @@ -39,7 +39,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} #pragma omp simd safelen ((ST > 0) ? 1 + ST : 2) for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; // expected-error@+6 2 {{directive '#pragma omp simd' cannot contain more than one 'safelen' clause}} - // expected-error@+5 2 {{argument to 'safelen' clause must be a strictly positive integer value}} + // expected-error@+5 {{argument to 'safelen' clause must be a strictly positive integer value}} // expected-error@+4 2 {{expression is not an integral constant expression}} #if __cplusplus >= 201103L // expected-note@+2 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} @@ -84,7 +84,7 @@ int main(int argc, char **argv) { // expected-note@+4 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif // expected-error@+2 2 {{directive '#pragma omp simd' cannot contain more than one 'safelen' clause}} - // expected-error@+1 2 {{argument to 'safelen' clause must be a strictly positive integer value}} + // expected-error@+1 {{argument to 'safelen' clause must be a strictly positive integer value}} #pragma omp simd safelen (foobool(argc)), safelen (true), safelen (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; #pragma omp simd safelen (S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/simd_simdlen_messages.cpp b/test/OpenMP/simd_simdlen_messages.cpp index f34d628141..27ab4acf77 100644 --- a/test/OpenMP/simd_simdlen_messages.cpp +++ b/test/OpenMP/simd_simdlen_messages.cpp @@ -39,7 +39,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} #pragma omp simd simdlen ((ST > 0) ? 1 + ST : 2) for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; // expected-error@+6 2 {{directive '#pragma omp simd' cannot contain more than one 'simdlen' clause}} - // expected-error@+5 2 {{argument to 'simdlen' clause must be a strictly positive integer value}} + // expected-error@+5 {{argument to 'simdlen' clause must be a strictly positive integer value}} // expected-error@+4 2 {{expression is not an integral constant expression}} #if __cplusplus >= 201103L // expected-note@+2 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} @@ -84,7 +84,7 @@ int main(int argc, char **argv) { // expected-note@+4 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif // expected-error@+2 2 {{directive '#pragma omp simd' cannot contain more than one 'simdlen' clause}} - // expected-error@+1 2 {{argument to 'simdlen' clause must be a strictly positive integer value}} + // expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}} #pragma omp simd simdlen (foobool(argc)), simdlen (true), simdlen (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; #pragma omp simd simdlen (S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/single_ast_print.cpp b/test/OpenMP/single_ast_print.cpp index a8eaeb0bff..b8dfc51377 100644 --- a/test/OpenMP/single_ast_print.cpp +++ b/test/OpenMP/single_ast_print.cpp @@ -46,16 +46,16 @@ T tmain(T argc) { SST<T> sst; // CHECK: static T a; #pragma omp parallel private(g) -#pragma omp single private(argc, b), firstprivate(c, d), nowait +#pragma omp single private(argc, b), firstprivate(c, d), nowait allocate(d) foo(); // CHECK: #pragma omp parallel private(g) - // CHECK-NEXT: #pragma omp single private(argc,b) firstprivate(c,d) nowait + // CHECK-NEXT: #pragma omp single private(argc,b) firstprivate(c,d) nowait allocate(d) // CHECK-NEXT: foo(); #pragma omp parallel private(g) -#pragma omp single private(argc, b), firstprivate(c, d), copyprivate(g) +#pragma omp single allocate(argc) private(argc, b), firstprivate(c, d), copyprivate(g) foo(); // CHECK-NEXT: #pragma omp parallel private(g) - // CHECK-NEXT: #pragma omp single private(argc,b) firstprivate(c,d) copyprivate(g) + // CHECK-NEXT: #pragma omp single allocate(argc) private(argc,b) firstprivate(c,d) copyprivate(g) // CHECK-NEXT: foo(); return T(); } diff --git a/test/OpenMP/single_firstprivate_messages.cpp b/test/OpenMP/single_firstprivate_messages.cpp index 4c714e392f..cff4b9013b 100644 --- a/test/OpenMP/single_firstprivate_messages.cpp +++ b/test/OpenMP/single_firstprivate_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; void foo() { } @@ -87,7 +88,7 @@ int foomain(int argc, char **argv) { #pragma omp single firstprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} foo(); #pragma omp parallel -#pragma omp single firstprivate(argc) +#pragma omp single firstprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} foo(); #pragma omp parallel #pragma omp single firstprivate(S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/single_private_messages.cpp b/test/OpenMP/single_private_messages.cpp index 0a3ec2e667..6ae2a385a3 100644 --- a/test/OpenMP/single_private_messages.cpp +++ b/test/OpenMP/single_private_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; void foo() { } @@ -110,7 +111,7 @@ int foomain(I argc, C **argv) { foo(); #pragma omp single private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} foo(); -#pragma omp single private(argc) +#pragma omp single private(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} foo(); #pragma omp single private(S1) // expected-error {{'S1' does not refer to a value}} foo(); diff --git a/test/OpenMP/target_data_messages.c b/test/OpenMP/target_data_messages.c index 017a339cc0..936e3eaa64 100644 --- a/test/OpenMP/target_data_messages.c +++ b/test/OpenMP/target_data_messages.c @@ -10,7 +10,7 @@ int main(int argc, char **argv) { {} L1: foo(); - #pragma omp target data map(a) + #pragma omp target data map(a) allocate(a) // expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp target data'}} { foo(); goto L1; // expected-error {{use of undeclared label 'L1'}} diff --git a/test/OpenMP/target_depend_codegen.cpp b/test/OpenMP/target_depend_codegen.cpp index 588ab9757e..2ce7cbe559 100644 --- a/test/OpenMP/target_depend_codegen.cpp +++ b/test/OpenMP/target_depend_codegen.cpp @@ -98,7 +98,7 @@ int foo(int n) { // CHECK: getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 1 // CHECK: getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 2 // CHECK: getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 3 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call void @__kmpc_omp_wait_deps(%struct.ident_t* @0, i32 [[GTID]], i32 4, i8* [[DEP]], i32 0, i8* null) // CHECK: call void @__kmpc_omp_task_begin_if0(%struct.ident_t* @0, i32 [[GTID]], i8* [[TASK]]) @@ -138,7 +138,7 @@ int foo(int n) { // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 1 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 2 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call i32 @__kmpc_omp_task_with_deps(%struct.ident_t* @0, i32 [[GTID]], i8* [[TASK]], i32 3, i8* [[DEP]], i32 0, i8* null) // CHECK: br label %[[EXIT:.+]] @@ -154,7 +154,7 @@ int foo(int n) { // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 1 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 2 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call i32 @__kmpc_omp_task_with_deps(%struct.ident_t* @0, i32 [[GTID]], i8* [[TASK]], i32 3, i8* [[DEP]], i32 0, i8* null) // CHECK: br label %[[EXIT:.+]] @@ -170,7 +170,7 @@ int foo(int n) { // CHECK: [[TASK:%.+]] = call i8* @__kmpc_omp_task_alloc(%struct.ident_t* @0, i32 [[GTID]], i32 1, i[[SZ]] {{48|24}}, i[[SZ]] 4, i32 (i32, i8*)* bitcast (i32 (i32, %{{.+}}*)* [[TASK_ENTRY2:@.+]] to i32 (i32, i8*)*)) // CHECK: [[BC_TASK:%.+]] = bitcast i8* [[TASK]] to [[TASK_TY2:%.+]]* // CHECK: getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call void @__kmpc_omp_wait_deps(%struct.ident_t* @0, i32 [[GTID]], i32 1, i8* [[DEP]], i32 0, i8* null) // CHECK: call void @__kmpc_omp_task_begin_if0(%struct.ident_t* @0, i32 [[GTID]], i8* [[TASK]]) diff --git a/test/OpenMP/target_depend_messages.cpp b/test/OpenMP/target_depend_messages.cpp index 5fdf37daf7..d699080545 100644 --- a/test/OpenMP/target_depend_messages.cpp +++ b/test/OpenMP/target_depend_messages.cpp @@ -24,13 +24,13 @@ int main(int argc, char **argv, char *env[]) { #pragma omp target depend // expected-error {{expected '(' after 'depend'}} foo(); - #pragma omp target 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 target depend ( // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after dependency type - ignoring}} foo(); - #pragma omp target depend () // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} + #pragma omp target depend () // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} foo(); - #pragma omp target 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 target depend (argc // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}} foo(); - #pragma omp target depend (source : argc) // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} + #pragma omp target depend (source : argc) // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} foo(); #pragma omp target depend (source) // expected-error {{expected expression}} expected-warning {{missing ':' after dependency type - ignoring}} foo(); diff --git a/test/OpenMP/target_enter_data_depend_codegen.cpp b/test/OpenMP/target_enter_data_depend_codegen.cpp index e17150d576..6b04a20966 100644 --- a/test/OpenMP/target_enter_data_depend_codegen.cpp +++ b/test/OpenMP/target_enter_data_depend_codegen.cpp @@ -90,7 +90,7 @@ void foo(int arg) { // CK1: store i[[sz]] 4, i[[sz]]* [[DEP_SIZE]], // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2 // CK1: store i8 1, i8* [[DEP_ATTRS]] - // CK1: [[DEP:%.+]] = getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* [[MAIN_DEP]], i32 0, i32 0 + // CK1: [[DEP:%.+]] = getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 0 // CK1: [[BC:%.+]] = bitcast %struct.kmp_depend_info* [[DEP]] to i8* // CK1: = call i32 @__kmpc_omp_task_with_deps(%struct.ident_t* @{{.+}}, i32 %{{.+}}, i8* [[RES]], i32 1, i8* [[BC]], i32 0, i8* null) @@ -161,7 +161,7 @@ void foo(int arg) { // CK1: store i[[sz]] 800, i[[sz]]* [[DEP_SIZE]], // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2 // CK1: store i8 3, i8* [[DEP_ATTRS]] - // CK1: [[DEP:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* [[MAIN_DEP]], i32 0, i32 0 + // CK1: [[DEP:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 0 // CK1: [[BC:%.+]] = bitcast %struct.kmp_depend_info* [[DEP]] to i8* // CK1: call void @__kmpc_omp_wait_deps(%struct.ident_t* @{{.+}}, i32 %{{.+}}, i32 3, i8* [[BC]], i32 0, i8* null) // CK1: call void @__kmpc_omp_task_begin_if0(%struct.ident_t* @{{.+}}, i32 %{{.+}}, i8* [[RES]]) @@ -239,7 +239,7 @@ void foo(int arg) { // CK1: store i[[sz]] 800, i[[sz]]* [[DEP_SIZE]], // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2 // CK1: store i8 3, i8* [[DEP_ATTRS]] - // CK1: [[DEP:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* [[MAIN_DEP]], i32 0, i32 0 + // CK1: [[DEP:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 0 // CK1: [[BC:%.+]] = bitcast %struct.kmp_depend_info* [[DEP]] to i8* // CK1: call void @__kmpc_omp_wait_deps(%struct.ident_t* @{{.+}}, i32 %{{.+}}, i32 4, i8* [[BC]], i32 0, i8* null) // CK1: call void @__kmpc_omp_task_begin_if0(%struct.ident_t* @{{.+}}, i32 %{{.+}}, i8* [[RES]]) @@ -320,7 +320,7 @@ void foo(int arg) { // CK1: store i[[sz]] 4, i[[sz]]* [[DEP_SIZE]], // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2 // CK1: store i8 1, i8* [[DEP_ATTRS]] - // CK1: [[DEP:%.+]] = getelementptr inbounds [5 x %struct.kmp_depend_info], [5 x %struct.kmp_depend_info]* [[MAIN_DEP]], i32 0, i32 0 + // CK1: [[DEP:%.+]] = getelementptr inbounds [5 x %struct.kmp_depend_info], [5 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 0 // CK1: [[BC:%.+]] = bitcast %struct.kmp_depend_info* [[DEP]] to i8* // CK1: call void @__kmpc_omp_wait_deps(%struct.ident_t* @{{.+}}, i32 %{{.+}}, i32 5, i8* [[BC]], i32 0, i8* null) // CK1: call void @__kmpc_omp_task_begin_if0(%struct.ident_t* @{{.+}}, i32 %{{.+}}, i8* [[RES]]) diff --git a/test/OpenMP/target_enter_data_depend_messages.cpp b/test/OpenMP/target_enter_data_depend_messages.cpp index ccc29ea49a..c9a0d7ab3c 100644 --- a/test/OpenMP/target_enter_data_depend_messages.cpp +++ b/test/OpenMP/target_enter_data_depend_messages.cpp @@ -26,13 +26,13 @@ int tmain(T argc, S **argv, R *env[]) { int i; #pragma omp target enter data map(to: i) depend // expected-error {{expected '(' after 'depend'}} foo(); - #pragma omp target enter data map(to: i) 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 target enter data map(to: i) depend ( // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after dependency type - ignoring}} foo(); - #pragma omp target enter data map(to: i) depend () // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} + #pragma omp target enter data map(to: i) depend () // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} foo(); - #pragma omp target enter data map(to: i) 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 target enter data map(to: i) depend (argc // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}} foo(); - #pragma omp target enter data map(to: i) depend (source : argc) // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} + #pragma omp target enter data map(to: i) depend (source : argc) // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} foo(); #pragma omp target enter data map(to: i) depend (source) // expected-error {{expected expression}} expected-warning {{missing ':' after dependency type - ignoring}} foo(); @@ -101,13 +101,13 @@ int main(int argc, char **argv, char *env[]) { int i; #pragma omp target enter data map(to: i) depend // expected-error {{expected '(' after 'depend'}} foo(); - #pragma omp target enter data map(to: i) 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 target enter data map(to: i) depend ( // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after dependency type - ignoring}} foo(); - #pragma omp target enter data map(to: i) depend () // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} + #pragma omp target enter data map(to: i) depend () // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} foo(); - #pragma omp target enter data map(to: i) 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 target enter data map(to: i) depend (argc // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}} foo(); - #pragma omp target enter data map(to: i) depend (source : argc) // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} + #pragma omp target enter data map(to: i) depend (source : argc) // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} foo(); #pragma omp target enter data map(to: i) depend (source) // expected-error {{expected expression}} expected-warning {{missing ':' after dependency type - ignoring}} foo(); diff --git a/test/OpenMP/target_enter_data_map_messages.c b/test/OpenMP/target_enter_data_map_messages.c index 381c94bf39..7d03fcfa9a 100644 --- a/test/OpenMP/target_enter_data_map_messages.c +++ b/test/OpenMP/target_enter_data_map_messages.c @@ -12,7 +12,7 @@ int main(int argc, char **argv) { #pragma omp target enter data map(r) // expected-error {{map type must be specified for '#pragma omp target enter data'}} #pragma omp target enter data map(tofrom: r) // expected-error {{map type 'tofrom' is not allowed for '#pragma omp target enter data'}} - #pragma omp target enter data map(always, to: r) + #pragma omp target enter data map(always, to: r) allocate(r) // expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp target enter data'}} #pragma omp target enter data map(always, alloc: r) #pragma omp target enter data map(always, from: r) // expected-error {{map type 'from' is not allowed for '#pragma omp target enter data'}} #pragma omp target enter data map(release: r) // expected-error {{map type 'release' is not allowed for '#pragma omp target enter data'}} diff --git a/test/OpenMP/target_exit_data_depend_codegen.cpp b/test/OpenMP/target_exit_data_depend_codegen.cpp index fec750dde2..df6981c12a 100644 --- a/test/OpenMP/target_exit_data_depend_codegen.cpp +++ b/test/OpenMP/target_exit_data_depend_codegen.cpp @@ -90,7 +90,7 @@ void foo(int arg) { // CK1: store i[[sz]] 4, i[[sz]]* [[DEP_SIZE]], // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2 // CK1: store i8 1, i8* [[DEP_ATTRS]] - // CK1: [[DEP:%.+]] = getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* [[MAIN_DEP]], i32 0, i32 0 + // CK1: [[DEP:%.+]] = getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 0 // CK1: [[BC:%.+]] = bitcast %struct.kmp_depend_info* [[DEP]] to i8* // CK1: = call i32 @__kmpc_omp_task_with_deps(%struct.ident_t* @{{.+}}, i32 %{{.+}}, i8* [[RES]], i32 1, i8* [[BC]], i32 0, i8* null) @@ -161,7 +161,7 @@ void foo(int arg) { // CK1: store i[[sz]] 800, i[[sz]]* [[DEP_SIZE]], // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2 // CK1: store i8 3, i8* [[DEP_ATTRS]] - // CK1: [[DEP:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* [[MAIN_DEP]], i32 0, i32 0 + // CK1: [[DEP:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 0 // CK1: [[BC:%.+]] = bitcast %struct.kmp_depend_info* [[DEP]] to i8* // CK1: call void @__kmpc_omp_wait_deps(%struct.ident_t* @{{.+}}, i32 %{{.+}}, i32 3, i8* [[BC]], i32 0, i8* null) // CK1: call void @__kmpc_omp_task_begin_if0(%struct.ident_t* @{{.+}}, i32 %{{.+}}, i8* [[RES]]) @@ -239,7 +239,7 @@ void foo(int arg) { // CK1: store i[[sz]] 800, i[[sz]]* [[DEP_SIZE]], // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2 // CK1: store i8 3, i8* [[DEP_ATTRS]] - // CK1: [[DEP:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* [[MAIN_DEP]], i32 0, i32 0 + // CK1: [[DEP:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 0 // CK1: [[BC:%.+]] = bitcast %struct.kmp_depend_info* [[DEP]] to i8* // CK1: call void @__kmpc_omp_wait_deps(%struct.ident_t* @{{.+}}, i32 %{{.+}}, i32 4, i8* [[BC]], i32 0, i8* null) // CK1: call void @__kmpc_omp_task_begin_if0(%struct.ident_t* @{{.+}}, i32 %{{.+}}, i8* [[RES]]) @@ -320,7 +320,7 @@ void foo(int arg) { // CK1: store i[[sz]] 4, i[[sz]]* [[DEP_SIZE]], // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2 // CK1: store i8 1, i8* [[DEP_ATTRS]] - // CK1: [[DEP:%.+]] = getelementptr inbounds [5 x %struct.kmp_depend_info], [5 x %struct.kmp_depend_info]* [[MAIN_DEP]], i32 0, i32 0 + // CK1: [[DEP:%.+]] = getelementptr inbounds [5 x %struct.kmp_depend_info], [5 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 0 // CK1: [[BC:%.+]] = bitcast %struct.kmp_depend_info* [[DEP]] to i8* // CK1: call void @__kmpc_omp_wait_deps(%struct.ident_t* @{{.+}}, i32 %{{.+}}, i32 5, i8* [[BC]], i32 0, i8* null) // CK1: call void @__kmpc_omp_task_begin_if0(%struct.ident_t* @{{.+}}, i32 %{{.+}}, i8* [[RES]]) diff --git a/test/OpenMP/target_exit_data_depend_messages.cpp b/test/OpenMP/target_exit_data_depend_messages.cpp index 7334cd751f..07ff02fad4 100644 --- a/test/OpenMP/target_exit_data_depend_messages.cpp +++ b/test/OpenMP/target_exit_data_depend_messages.cpp @@ -26,13 +26,13 @@ int tmain(T argc, S **argv, R *env[]) { int i; #pragma omp target exit data map(from: i) depend // expected-error {{expected '(' after 'depend'}} foo(); - #pragma omp target exit data map(from: i) 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 target exit data map(from: i) depend ( // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after dependency type - ignoring}} foo(); - #pragma omp target exit data map(from: i) depend () // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} + #pragma omp target exit data map(from: i) depend () // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} foo(); - #pragma omp target exit data map(from: i) 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 target exit data map(from: i) depend (argc // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}} foo(); - #pragma omp target exit data map(from: i) depend (source : argc) // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} + #pragma omp target exit data map(from: i) depend (source : argc) // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} foo(); #pragma omp target exit data map(from: i) depend (source) // expected-error {{expected expression}} expected-warning {{missing ':' after dependency type - ignoring}} foo(); @@ -101,13 +101,13 @@ int main(int argc, char **argv, char *env[]) { int i; #pragma omp target exit data map(from: i) depend // expected-error {{expected '(' after 'depend'}} foo(); - #pragma omp target exit data map(from: i) 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 target exit data map(from: i) depend ( // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after dependency type - ignoring}} foo(); - #pragma omp target exit data map(from: i) depend () // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} + #pragma omp target exit data map(from: i) depend () // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} foo(); - #pragma omp target exit data map(from: i) 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 target exit data map(from: i) depend (argc // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}} foo(); - #pragma omp target exit data map(from: i) depend (source : argc) // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} + #pragma omp target exit data map(from: i) depend (source : argc) // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} foo(); #pragma omp target exit data map(from: i) depend (source) // expected-error {{expected expression}} expected-warning {{missing ':' after dependency type - ignoring}} foo(); diff --git a/test/OpenMP/target_exit_data_map_messages.c b/test/OpenMP/target_exit_data_map_messages.c index 1c15aac2e5..4a2df448d3 100644 --- a/test/OpenMP/target_exit_data_map_messages.c +++ b/test/OpenMP/target_exit_data_map_messages.c @@ -12,7 +12,7 @@ int main(int argc, char **argv) { #pragma omp target exit data map(r) // expected-error {{map type must be specified for '#pragma omp target exit data'}} #pragma omp target exit data map(tofrom: r) // expected-error {{map type 'tofrom' is not allowed for '#pragma omp target exit data'}} - #pragma omp target exit data map(always, from: r) + #pragma omp target exit data map(always, from: r) allocate(r) // expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp target exit data'}} #pragma omp target exit data map(delete: r) #pragma omp target exit data map(release: r) #pragma omp target exit data map(always, alloc: r) // expected-error {{map type 'alloc' is not allowed for '#pragma omp target exit data'}} diff --git a/test/OpenMP/target_firstprivate_codegen.cpp b/test/OpenMP/target_firstprivate_codegen.cpp index 4a2837b3c8..b28b6b83f6 100644 --- a/test/OpenMP/target_firstprivate_codegen.cpp +++ b/test/OpenMP/target_firstprivate_codegen.cpp @@ -38,30 +38,32 @@ #ifndef HEADER #define HEADER -template<typename tx, typename ty> -struct TT{ +template <typename tx, typename ty> +struct TT { tx X; ty Y; }; -// CHECK: [[TT:%.+]] = type { i64, i8 } -// CHECK: [[S1:%.+]] = type { double } +// CHECK-DAG: [[TT:%.+]] = type { i64, i8 } +// CHECK-DAG: [[TTII:%.+]] = type { i32, i32 } +// CHECK-DAG: [[S1:%.+]] = type { double } -// TCHECK: [[TT:%.+]] = type { i64, i8 } -// TCHECK: [[S1:%.+]] = type { double } +// TCHECK-DAG: [[TT:%.+]] = type { i64, i8 } +// TCHECK-DAG: [[TTII:%.+]] = type { i32, i32 } +// TCHECK-DAG: [[S1:%.+]] = type { double } -// CHECK-DAG: [[SIZET:@.+]] = private unnamed_addr constant [1 x i{{32|64}}] [i[[SZ:32|64]] 4] -// CHECK: [[MAPT:@.+]] = private unnamed_addr constant [1 x i64] [i64 800] +// CHECK-DAG: [[FP_E:@__omp_offloading_firstprivate_.+_e_l76]] = internal global [[TTII]] zeroinitializer +// CHECK-DAG: [[SIZET:@.+]] = private unnamed_addr constant [2 x i{{32|64}}] [i[[SZ:32|64]] 4, i{{64|32}} {{8|4}}] +// CHECK-DAG: [[MAPT:@.+]] = private unnamed_addr constant [2 x i64] [i64 800, i64 561] // CHECK-DAG: [[MAPT2:@.+]] = private unnamed_addr constant [9 x i64] [i64 800, i64 673, i64 288, i64 673, i64 673, i64 288, i64 288, i64 673, i64 673] -// CHECK-DAG: [[SIZET3:@.+]] = private unnamed_addr constant [1 x i{{32|64}}] zeroinitializer -// CHECK-DAG: [[MAPT3:@.+]] = private unnamed_addr constant [1 x i64] [i64 544] +// CHECK-DAG: [[SIZET3:@.+]] = private unnamed_addr constant [2 x i{{32|64}}] [i{{32|64}} 0, i{{32|64}} 8] +// CHECK-DAG: [[MAPT3:@.+]] = private unnamed_addr constant [2 x i64] [i64 544, i64 549] // CHECK-DAG: [[MAPT4:@.+]] = private unnamed_addr constant [6 x i64] [i64 32, i64 281474976711171, i64 800, i64 288, i64 288, i64 673] // CHECK-DAG: [[SIZET5:@.+]] = private unnamed_addr constant [3 x i{{32|64}}] [i[[SZ]] 4, i[[SZ]] 1, i[[SZ]] 40] // CHECK-DAG: [[MAPT5:@.+]] = private unnamed_addr constant [3 x i64] [i64 800, i64 800, i64 673] // CHECK-DAG: [[SIZET6:@.+]] = private unnamed_addr constant [2 x i{{32|64}}] [i[[SZ]] 4, i[[SZ]] 40] // CHECK-DAG: [[MAPT6:@.+]] = private unnamed_addr constant [2 x i64] [i64 800, i64 673] - // CHECK: define {{.*}}[[FOO:@.+]]( int foo(int n, double *ptr) { int a = 0; @@ -71,8 +73,10 @@ int foo(int n, double *ptr) { double c[5][10]; double cn[5][n]; TT<long long, char> d; - - #pragma omp target firstprivate(a) + const TT<int, int> e = {n, n}; + int *p __attribute__ ((aligned (64))) = &a; + +#pragma omp target firstprivate(a, p) { } @@ -85,21 +89,22 @@ int foo(int n, double *ptr) { // CHECK: [[SSTACK:%.+]] = alloca i8*, // CHECK: [[C:%.+]] = alloca [5 x [10 x double]], // CHECK: [[D:%.+]] = alloca [[TT]], + // CHECK: [[P:%.+]] = alloca i32*, align 64 // CHECK: [[ACAST:%.+]] = alloca i{{[0-9]+}}, - // CHECK: [[BASE_PTR_ARR:%.+]] = alloca [1 x i8*], - // CHECK: [[PTR_ARR:%.+]] = alloca [1 x i8*], + // CHECK: [[BASE_PTR_ARR:%.+]] = alloca [2 x i8*], + // CHECK: [[PTR_ARR:%.+]] = alloca [2 x i8*], // CHECK: [[A2CAST:%.+]] = alloca i{{[0-9]+}}, // CHECK: [[BASE_PTR_ARR2:%.+]] = alloca [9 x i8*], // CHECK: [[PTR_ARR2:%.+]] = alloca [9 x i8*], // CHECK: [[SIZET2:%.+]] = alloca [9 x i{{[0-9]+}}], - // CHECK: [[BASE_PTR_ARR3:%.+]] = alloca [1 x i8*], - // CHECK: [[PTR_ARR3:%.+]] = alloca [1 x i8*], + // CHECK: [[BASE_PTR_ARR3:%.+]] = alloca [2 x i8*], + // CHECK: [[PTR_ARR3:%.+]] = alloca [2 x i8*], // CHECK: [[N_ADDR_VAL:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[N_ADDR]], // CHECK-64: [[N_EXT:%.+]] = zext i{{[0-9]+}} [[N_ADDR_VAL]] to i{{[0-9]+}} // CHECK: [[SSAVE_RET:%.+]] = call i8* @llvm.stacksave() // CHECK: store i8* [[SSAVE_RET]], i8** [[SSTACK]], // CHECK-64: [[BN_VLA:%.+]] = alloca float, i{{[0-9]+}} [[N_EXT]], - // CHECK-32: [[BN_VLA:%.+]] = alloca float, i{{[0-9]+}} [[N_ADDR_VAL]], + // CHECK-32: [[BN_VLA:%.+]] = alloca float, i{{[0-9]+}} [[N_ADDR_VAL]], // CHECK: [[N_ADDR_VAL2:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[N_ADDR]], // CHECK-64: [[N_EXT2:%.+]] = zext i{{[0-9]+}} [[N_ADDR_VAL2]] to i{{[0-9]+}} // CHECK-64: [[CN_SIZE:%.+]] = mul{{.+}} i{{[0-9]+}} 5, [[N_EXT2]] @@ -110,24 +115,34 @@ int foo(int n, double *ptr) { // CHECK-64: store i{{[0-9]+}} [[AVAL]], i{{[0-9]+}}* [[CONV]], // CHECK-32: store i{{[0-9]+}} [[AVAL]], i{{[0-9]+}}* [[ACAST]], // CHECK: [[ACAST_VAL:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[ACAST]], - // CHECK: [[BASE_PTR_GEP:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BASE_PTR_ARR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 + // CHECK: [[P_PTR:%.+]] = load i32*, i32** [[P]], align 64 + // CHECK: [[BASE_PTR_GEP:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[BASE_PTR_ARR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // CHECK: [[ACAST_TOPTR:%.+]] = bitcast i8** [[BASE_PTR_GEP]] to i{{[0-9]+}}* // CHECK: store i{{[0-9]+}} [[ACAST_VAL]], i{{[0-9]+}}* [[ACAST_TOPTR]], - // CHECK: [[PTR_GEP:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[PTR_ARR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 + // CHECK: [[PTR_GEP:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[PTR_ARR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // CHECK: [[ACAST_TOPTR2:%.+]] = bitcast i8** [[PTR_GEP]] to i{{[0-9]+}}* // CHECK: store i{{[0-9]+}} [[ACAST_VAL]], i{{[0-9]+}}* [[ACAST_TOPTR2]], - // CHECK: [[BASE_PTR_GEP_ARG:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BASE_PTR_ARR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 - // CHECK: [[PTR_GEP_ARG:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[PTR_ARR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 - // CHECK: {{.+}} = call i32 @__tgt_target(i64 -1, {{.+}}, i32 1, i8** [[BASE_PTR_GEP_ARG]], i8** [[PTR_GEP_ARG]], i[[SZ]]* getelementptr inbounds ([1 x i[[SZ]]], [1 x i[[SZ]]]* [[SIZET]], i32 0, i32 0), i64* getelementptr inbounds ([1 x i64], [1 x i64]* [[MAPT]], i32 0, i32 0)) - - // TCHECK: define weak void @__omp_offloading_{{.+}}(i{{[0-9]+}} [[A_IN:%.+]]) + // CHECK: [[BASE_PTR_GEP:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[BASE_PTR_ARR]], i{{[0-9]+}} 0, i{{[0-9]+}} 1 + // CHECK: [[PCAST_TOPTR:%.+]] = bitcast i8** [[BASE_PTR_GEP]] to i32*** + // CHECK: store i32** [[P]], i32*** [[PCAST_TOPTR]], + // CHECK: [[PTR_GEP:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[PTR_ARR]], i{{[0-9]+}} 0, i{{[0-9]+}} 1 + // CHECK: [[PCAST_TOPTR2:%.+]] = bitcast i8** [[PTR_GEP]] to i32** + // CHECK: store i32* [[P_PTR]], i32** [[PCAST_TOPTR2]], + // CHECK: [[BASE_PTR_GEP_ARG:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[BASE_PTR_ARR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 + // CHECK: [[PTR_GEP_ARG:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[PTR_ARR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 + // CHECK: {{.+}} = call i32 @__tgt_target(i64 -1, {{.+}}, i32 2, i8** [[BASE_PTR_GEP_ARG]], i8** [[PTR_GEP_ARG]], i[[SZ]]* getelementptr inbounds ([2 x i[[SZ]]], [2 x i[[SZ]]]* [[SIZET]], i32 0, i32 0), i64* getelementptr inbounds ([2 x i64], [2 x i64]* [[MAPT]], i32 0, i32 0)) + + // TCHECK: define weak void @__omp_offloading_{{.+}}(i{{[0-9]+}} [[A_IN:%.+]], i32** dereferenceable{{.+}} [[P_IN:%.+]]) // TCHECK: [[A_ADDR:%.+]] = alloca i{{[0-9]+}}, - // TCHECK-NOT: alloca i{{[0-9]+}}, + // TCHECK: [[P_ADDR:%.+]] = alloca i32**, + // TCHECK: [[P_PRIV:%.+]] = alloca i32*, + // TCHECK-NOT: alloca i{{[0-9]+}} // TCHECK: store i{{[0-9]+}} [[A_IN]], i{{[0-9]+}}* [[A_ADDR]], + // TCHECK: store i32** [[P_IN]], i32*** [[P_ADDR]], // TCHECK-NOT: store i{{[0-9]+}} % - // TCHECK: ret void + // TCHECK: ret void -#pragma omp target firstprivate(aa,b,bn,c,cn,d) +#pragma omp target firstprivate(aa, b, bn, c, cn, d) { aa += 1; b[2] = 1.0; @@ -135,7 +150,7 @@ int foo(int n, double *ptr) { c[1][2] = 1.0; cn[1][3] = 1.0; d.X = 1; - d.Y = 1; + d.Y = 1; } // CHECK: [[A2VAL:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[A2]], @@ -143,7 +158,7 @@ int foo(int n, double *ptr) { // CHECK: store i{{[0-9]+}} [[A2VAL]], i{{[0-9]+}}* [[A2CASTCONV]], // CHECK: [[A2CAST_VAL:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[A2CAST]], // CHECK-64: [[BN_SIZE:%.+]] = mul{{.+}} i{{[0-9]+}} [[N_EXT]], 4 - // CHECK-32: [[BN_SIZE:%.+]] = mul{{.+}} i{{[0-9]+}} [[N_ADDR_VAL]], 4 + // CHECK-32: [[BN_SIZE:%.+]] = mul{{.+}} i{{[0-9]+}} [[N_ADDR_VAL]], 4 // CHECK-64: [[CN_SIZE_1:%.+]] = mul{{.+}} i{{[0-9]+}} 5, [[N_EXT2]] // CHECK-32: [[CN_SIZE_1:%.+]] = mul{{.+}} i{{[0-9]+}} 5, [[N_ADDR_VAL2]] // CHECK: [[CN_SIZE_2:%.+]] = mul{{.+}} i{{[0-9]+}} [[CN_SIZE_1]], 8 @@ -184,7 +199,7 @@ int foo(int n, double *ptr) { // CHECK: store float* [[BN_VLA]], float** [[BCAST_TOPTR]], // CHECK: [[SIZE_GEPBN_3:%.+]] = getelementptr inbounds [9 x i{{[0-9]+}}], [9 x i{{[0-9]+}}]* [[SIZET2]], i{{[0-9]+}} 0, i{{[0-9]+}} 3 // CHECK: store i{{[0-9]+}} [[BN_SIZE]], i{{[0-9]+}}* [[SIZE_GEPBN_3]] - + // firstprivate(c): base_ptr = &c[0], ptr = &c[0], size = 400 (5*10*sizeof(double)) // CHECK: [[BASE_PTR_GEP2_4:%.+]] = getelementptr inbounds [9 x i8*], [9 x i8*]* [[BASE_PTR_ARR2]], i{{[0-9]+}} 0, i{{[0-9]+}} 4 // CHECK: [[BCAST_TOPTR:%.+]] = bitcast i8** [[BASE_PTR_GEP2_4]] to [5 x [10 x double]]** @@ -194,7 +209,7 @@ int foo(int n, double *ptr) { // CHECK: store [5 x [10 x double]]* [[C]], [5 x [10 x double]]** [[BCAST_TOPTR]], // CHECK: [[SIZE_GEPC_4:%.+]] = getelementptr inbounds [9 x i{{[0-9]+}}], [9 x i{{[0-9]+}}]* [[SIZET2]], i{{[0-9]+}} 0, i{{[0-9]+}} 4 // CHECK: store i{{[0-9]+}} 400, i{{[0-9]+}}* [[SIZE_GEPC_4]], - + // firstprivate(cn), 3 entries, 5, n, cn: (1) base_ptr = 5, ptr = 5, size = 8; (2) (1) base_ptr = n, ptr = n, size = 8; (3) base_ptr = &cn[0], ptr = &cn[0], size = 5*n*sizeof(double) // CHECK: [[BASE_PTR_GEP2_5:%.+]] = getelementptr inbounds [9 x i8*], [9 x i8*]* [[BASE_PTR_ARR2]], i{{[0-9]+}} 0, i{{[0-9]+}} 5 // CHECK: [[BCAST_TOPTR:%.+]] = bitcast i8** [[BASE_PTR_GEP2_5]] to i{{[0-9]+}}* @@ -222,8 +237,8 @@ int foo(int n, double *ptr) { // CHECK: store double* [[CN_VLA]], double** [[BCAST_TOPTR]], // CHECK: [[SIZE_GEPCN_7:%.+]] = getelementptr inbounds [9 x i{{[0-9]+}}], [9 x i{{[0-9]+}}]* [[SIZET2]], i{{[0-9]+}} 0, i{{[0-9]+}} 7 // CHECK: store i{{[0-9]+}} [[CN_SIZE_2]], i{{[0-9]+}}* [[SIZE_GEPCN_7]], - - // firstprivate(d): base_ptr = &d, ptr = &d, size = 16 + + // firstprivate(d): base_ptr = &d, ptr = &d, size = 16 // CHECK: [[BASE_PTR_GEP2_8:%.+]] = getelementptr inbounds [9 x i8*], [9 x i8*]* [[BASE_PTR_ARR2]], i{{[0-9]+}} 0, i{{[0-9]+}} 8 // CHECK: [[BCAST_TOPTR:%.+]] = bitcast i8** [[BASE_PTR_GEP2_8]] to [[TT]]** // CHECK: store [[TT]]* [[D]], [[TT]]** [[BCAST_TOPTR]], @@ -232,13 +247,12 @@ int foo(int n, double *ptr) { // CHECK: store [[TT]]* [[D]], [[TT]]** [[BCAST_TOPTR]], // CHECK: [[SIZE_GEPCN_8:%.+]] = getelementptr inbounds [9 x i{{[0-9]+}}], [9 x i{{[0-9]+}}]* [[SIZET2]], i{{[0-9]+}} 0, i{{[0-9]+}} 8 // CHECK: store i{{[0-9]+}} {{[0-9]+}}, i{{[0-9]+}}* [[SIZE_GEPCN_8]], - - + // CHECK: [[BASE_PTR_GEP_ARG2:%.+]] = getelementptr inbounds [9 x i8*], [9 x i8*]* [[BASE_PTR_ARR2]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // CHECK: [[PTR_GEP_ARG2:%.+]] = getelementptr inbounds [9 x i8*], [9 x i8*]* [[PTR_ARR2]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // CHECK: [[SIZES_ARG2:%.+]] = getelementptr inbounds [9 x i[[SZ]]], [9 x i[[SZ]]]* [[SIZET2]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // CHECK: {{.+}} = call i32 @__tgt_target(i64 -1, {{.+}}, i32 9, i8** [[BASE_PTR_GEP_ARG2]], i8** [[PTR_GEP_ARG2]], i[[SZ]]* [[SIZES_ARG2]], i64* getelementptr inbounds ([9 x i64], [9 x i64]* [[MAPT2]], i32 0, i32 0)) - + // make sure that firstprivate variables are generated in all cases and that we use those instances for operations inside the // target region // TCHECK: define {{.*}}void @__omp_offloading_{{.+}}(i{{[0-9]+}} [[A2_IN:%.+]], [10 x float]* {{.+}} [[B_IN:%.+]], i{{[0-9]+}} [[BN_SZ:%.+]], float* {{.+}} [[BN_IN:%.+]], [5 x [10 x double]]* {{.+}} [[C_IN:%.+]], i{{[0-9]+}} [[CN_SZ1:%.+]], i{{[0-9]+}} [[CN_SZ2:%.+]], double* {{.+}} [[CN_IN:%.+]], [[TT]]* {{.+}} [[D_IN:%.+]]) @@ -297,7 +311,7 @@ int foo(int n, double *ptr) { // TCHECK: [[C_PRIV_BCAST:%.+]] = bitcast [5 x [10 x double]]* [[C_PRIV]] to i8* // TCHECK: [[C_IN_BCAST:%.+]] = bitcast [5 x [10 x double]]* [[C_ADDR_REF]] to i8* // TCHECK: call void @llvm.memcpy.{{.+}}(i8* align {{[0-9]+}} [[C_PRIV_BCAST]], i8* align {{[0-9]+}} [[C_IN_BCAST]],{{.+}}) - + // firstprivate(cn) // TCHECK: [[CN_SZ:%.+]] = mul{{.+}} i{{[0-9]+}} [[CN_SZ1_VAL]], [[CN_SZ2_VAL]] // TCHECK: [[CN_PRIV:%.+]] = alloca double, i{{[0-9]+}} [[CN_SZ]], @@ -306,32 +320,43 @@ int foo(int n, double *ptr) { // TCHECK: [[CN_PRIV_BCAST:%.+]] = bitcast double* [[CN_PRIV]] to i8* // TCHECK: [[CN_IN_BCAST:%.+]] = bitcast double* [[CN_ADDR_REF]] to i8* // TCHECK: call void @llvm.memcpy.{{.+}}(i8* align {{[0-9]+}} [[CN_PRIV_BCAST]], i8* align {{[0-9]+}} [[CN_IN_BCAST]], i{{[0-9]+}} [[CN_SZ2_CPY]],{{.+}}) - + // firstprivate(d) // TCHECK: [[D_PRIV_BCAST:%.+]] = bitcast [[TT]]* [[D_PRIV]] to i8* // TCHECK: [[D_IN_BCAST:%.+]] = bitcast [[TT]]* [[D_ADDR_REF]] to i8* // TCHECK: call void @llvm.memcpy.{{.+}}(i8* align {{[0-9]+}} [[D_PRIV_BCAST]], i8* align {{[0-9]+}} [[D_IN_BCAST]],{{.+}}) - - #pragma omp target firstprivate(ptr) +#pragma omp target firstprivate(ptr, e) { + ptr[0] = e.X; ptr[0]++; } // CHECK: [[PTR_ADDR_REF:%.+]] = load double*, double** [[PTR_ADDR]], - // CHECK: [[BASE_PTR_GEP3_0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BASE_PTR_ARR3]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 + // CHECK: [[FP_E_BC:%.+]] = bitcast [[TTII]]* [[FP_E]] to i8* + // CHECK: [[E_BC:%.+]] = bitcast [[TTII]]* [[E:%.+]] to i8* + // CHECK: call void @llvm.memcpy.p0i8.p0i8.i{{64|32}}(i8* {{.*}} [[FP_E_BC]], i8* {{.*}} [[E_BC]], i{{64|32}} 8, i1 false) + // CHECK: [[BASE_PTR_GEP3_0:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[BASE_PTR_ARR3]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // CHECK: [[BCAST_TOPTR:%.+]] = bitcast i8** [[BASE_PTR_GEP3_0]] to double** // CHECK: store double* [[PTR_ADDR_REF]], double** [[BCAST_TOPTR]], - // CHECK: [[PTR_GEP3_0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[PTR_ARR3]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 + // CHECK: [[PTR_GEP3_0:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[PTR_ARR3]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 // CHECK: [[BCAST_TOPTR:%.+]] = bitcast i8** [[PTR_GEP3_0]] to double** // CHECK: store double* [[PTR_ADDR_REF]], double** [[BCAST_TOPTR]], - - // CHECK: [[BASE_PTR_GEP_ARG3:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BASE_PTR_ARR3]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 - // CHECK: [[PTR_GEP_ARG3:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[PTR_ARR3]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 - // CHECK: {{.+}} = call i32 @__tgt_target(i64 -1, {{.+}}, i32 1, i8** [[BASE_PTR_GEP_ARG3]], i8** [[PTR_GEP_ARG3]], i[[SZ]]* getelementptr inbounds ([1 x i[[SZ]]], [1 x i[[SZ]]]* [[SIZET3]], i32 0, i32 0), i64* getelementptr inbounds ([1 x i64], [1 x i64]* [[MAPT3]], i32 0, i32 0)) - - // TCHECK: define weak void @__omp_offloading_{{.+}}(double* [[PTR_IN:%.+]]) + // CHECK: [[BASE_PTR_GEP3_1:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[BASE_PTR_ARR3]], i{{[0-9]+}} 0, i{{[0-9]+}} 1 + // CHECK: [[BCAST_TOPTR:%.+]] = bitcast i8** [[BASE_PTR_GEP3_1]] to [[TTII]]** + // CHECK: store [[TTII]]* [[FP_E]], [[TTII]]** [[BCAST_TOPTR]], + // CHECK: [[PTR_GEP3_1:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[PTR_ARR3]], i{{[0-9]+}} 0, i{{[0-9]+}} 1 + // CHECK: [[BCAST_TOPTR:%.+]] = bitcast i8** [[PTR_GEP3_1]] to [[TTII]]** + // CHECK: store [[TTII]]* [[FP_E]], [[TTII]]** [[BCAST_TOPTR]], + + // CHECK: [[BASE_PTR_GEP_ARG3:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[BASE_PTR_ARR3]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 + // CHECK: [[PTR_GEP_ARG3:%.+]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[PTR_ARR3]], i{{[0-9]+}} 0, i{{[0-9]+}} 0 + // CHECK: {{.+}} = call i32 @__tgt_target(i64 -1, {{.+}}, i32 2, i8** [[BASE_PTR_GEP_ARG3]], i8** [[PTR_GEP_ARG3]], i[[SZ]]* getelementptr inbounds ([2 x i[[SZ]]], [2 x i[[SZ]]]* [[SIZET3]], i32 0, i32 0), i64* getelementptr inbounds ([2 x i64], [2 x i64]* [[MAPT3]], i32 0, i32 0)) + + // TCHECK: define weak void @__omp_offloading_{{.+}}(double* [[PTR_IN:%.+]], [[TTII]]* dereferenceable{{.+}} [[E:%.+]]) + // TCHECK-NOT: alloca [[TTII]], // TCHECK: [[PTR_ADDR:%.+]] = alloca double*, + // TCHECK-NOT: alloca [[TTII]], // TCHECK-NOT: alloca double*, // TCHECK: store double* [[PTR_IN]], double** [[PTR_ADDR]], // TCHECK-NOT: store double* % @@ -339,13 +364,12 @@ int foo(int n, double *ptr) { return a; } - -template<typename tx> +template <typename tx> tx ftemplate(int n) { tx a = 0; tx b[10]; -#pragma omp target firstprivate(a,b) +#pragma omp target firstprivate(a, b) { a += 1; b[2] += 1; @@ -354,13 +378,12 @@ tx ftemplate(int n) { return a; } -static -int fstatic(int n) { +static int fstatic(int n) { int a = 0; char aaa = 0; int b[10]; -#pragma omp target firstprivate(a,aaa,b) +#pragma omp target firstprivate(a, aaa, b) { a += 1; aaa += 1; @@ -398,11 +421,11 @@ int fstatic(int n) { struct S1 { double a; - int r1(int n){ - int b = n+1; + int r1(int n) { + int b = n + 1; short int c[2][n]; -#pragma omp target firstprivate(b,c) +#pragma omp target firstprivate(b, c) { this->a = (double)b + 1.5; c[1][1] = ++a; @@ -499,7 +522,7 @@ struct S1 { // firstprivate(b) // TCHECK-NOT: store i{{[0-9]+}} % - + // TCHECK: [[RET_STACK:%.+]] = call i8* @llvm.stacksave() // TCHECK: store i8* [[RET_STACK:%.+]], i8** [[SSTACK]], @@ -517,7 +540,6 @@ struct S1 { // TCHECK: call void @llvm.stackrestore(i8* [[RELOAD_SSTACK]]) // TCHECK: ret void - // static host function // CHECK: define{{.+}} i32 {{.+}}(i{{[0-9]+}} {{.+}}) // CHECK: [[BASE_PTRS5:%.+]] = alloca [3 x i8*], @@ -551,9 +573,7 @@ struct S1 { // CHECK: call i32 @__tgt_target(i64 -1, {{.+}}, i32 3, i8** {{.+}}, i8** {{.+}}, i[[SZ]]* getelementptr inbounds ([3 x i[[SZ]]], [3 x i[[SZ]]]* [[SIZET5]], i32 0, i32 0), i64* getelementptr inbounds ([3 x i64], [3 x i64]* [[MAPT5]], i32 0, i32 0)) }; - - -int bar(int n, double *ptr){ +int bar(int n, double *ptr) { int a = 0; a += foo(n, ptr); S1 S; diff --git a/test/OpenMP/target_firstprivate_messages.cpp b/test/OpenMP/target_firstprivate_messages.cpp index 4f82c96e56..248751f789 100644 --- a/test/OpenMP/target_firstprivate_messages.cpp +++ b/test/OpenMP/target_firstprivate_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + struct S1; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}} extern S1 a; class S2 { @@ -103,7 +113,7 @@ int foomain(I argc, C **argv) { {} #pragma omp target firstprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} {} -#pragma omp target firstprivate(argc) +#pragma omp target firstprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} {} #pragma omp target firstprivate(S1) // expected-error {{'S1' does not refer to a value}} {} @@ -111,7 +121,7 @@ int foomain(I argc, C **argv) { {} #pragma omp target firstprivate(argv[1]) // expected-error {{expected variable name}} {} -#pragma omp target firstprivate(e, g) +#pragma omp target firstprivate(e, g) allocate(omp_thread_mem_alloc: e) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target' directive}} {} #pragma omp target firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}} {} diff --git a/test/OpenMP/target_map_codegen.cpp b/test/OpenMP/target_map_codegen.cpp index b267a72b4c..44d7ffc9cc 100644 --- a/test/OpenMP/target_map_codegen.cpp +++ b/test/OpenMP/target_map_codegen.cpp @@ -259,7 +259,7 @@ void implicit_maps_nested_integer (int a){ // CK4: define internal void [[KERNELP1]](i32* {{[^,]+}}, i32* {{[^,]+}}, i32* {{[^,]+}}) #pragma omp parallel { - // CK4-DAG: call i32 @__tgt_target(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}) + // CK4-DAG: call i32 @__tgt_target_teams(i64 {{.+}}, i8* {{.+}}, i32 1, i8** [[BPGEP:%[0-9]+]], i8** [[PGEP:%[0-9]+]], {{.+}}[[SIZES]]{{.+}}, {{.+}}[[TYPES]]{{.+}}, i32 1, i32 0) // CK4-DAG: [[BPGEP]] = getelementptr inbounds {{.+}}[[BPS:%[^,]+]], i32 0, i32 0 // CK4-DAG: [[PGEP]] = getelementptr inbounds {{.+}}[[PS:%[^,]+]], i32 0, i32 0 // CK4-DAG: [[BP1:%.+]] = getelementptr inbounds {{.+}}[[BPS]], i32 0, i32 0 @@ -1516,7 +1516,7 @@ void explicit_maps_single (int ii){ int b = a; // Region 00n - // CK19-DAG: call i32 @__tgt_target(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00n]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00n]]{{.+}}) + // CK19-DAG: call i32 @__tgt_target_teams(i64 {{[^,]+}}, i8* {{[^,]+}}, i32 1, i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[SIZE00n]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00n]]{{.+}}, i32 1, i32 0) // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]] // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]] diff --git a/test/OpenMP/target_map_messages.cpp b/test/OpenMP/target_map_messages.cpp index e81e61eaab..04e201d136 100644 --- a/test/OpenMP/target_map_messages.cpp +++ b/test/OpenMP/target_map_messages.cpp @@ -73,6 +73,8 @@ struct SA { {} #pragma omp target map(b[:-1]) // expected-error {{section length is evaluated to a negative value -1}} {} + #pragma omp target map(b[true:true]) + {} #pragma omp target map(: c,f) // expected-error {{missing map type}} {} @@ -110,17 +112,17 @@ struct SA { {} #pragma omp target map( , , : a) // expected-error {{missing map type modifier}} expected-error {{missing map type modifier}} expected-error {{missing map type}} {} - #pragma omp target map( d, f, bf: a) // expected-error {{incorrect map type modifier, expected 'always' or 'close'}} expected-error {{incorrect map type modifier, expected 'always' or 'close'}} expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}} + #pragma omp target map( d, f, bf: a) // expected-error {{incorrect map type modifier, expected 'always', 'close', or 'mapper'}} expected-error {{incorrect map type modifier, expected 'always', 'close', or 'mapper'}} expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}} {} - #pragma omp target map( , f, : a) // expected-error {{missing map type modifier}} expected-error {{incorrect map type modifier, expected 'always' or 'close'}} expected-error {{missing map type}} + #pragma omp target map( , f, : a) // expected-error {{missing map type modifier}} expected-error {{incorrect map type modifier, expected 'always', 'close', or 'mapper'}} expected-error {{missing map type}} {} #pragma omp target map(always close: a) // expected-error {{missing map type}} {} #pragma omp target map(always close bf: a) // expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}} {} - #pragma omp target map(always tofrom close: a) // expected-error {{incorrect map type modifier, expected 'always' or 'close'}} expected-error {{missing map type}} + #pragma omp target map(always tofrom close: a) // expected-error {{incorrect map type modifier, expected 'always', 'close', or 'mapper'}} expected-error {{missing map type}} {} - #pragma omp target map(tofrom from: a) // expected-error {{incorrect map type modifier, expected 'always' or 'close'}} + #pragma omp target map(tofrom from: a) // expected-error {{incorrect map type modifier, expected 'always', 'close', or 'mapper'}} {} #pragma omp target map(close bf: a) // expected-error {{incorrect map type, expected one of 'to', 'from', 'tofrom', 'alloc', 'release', or 'delete'}} {} @@ -516,14 +518,14 @@ T tmain(T argc) { #pragma omp target data map(always, tofrom: x) #pragma omp target data map(always: x) // expected-error {{missing map type}} -#pragma omp target data map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always' or 'close'}} expected-error {{missing map type}} +#pragma omp target data map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always', 'close', or 'mapper'}} expected-error {{missing map type}} #pragma omp target data map(always, tofrom: always, tofrom, x) #pragma omp target map(tofrom j) // expected-error {{expected ',' or ')' in 'map' clause}} foo(); #pragma omp target data map(close, tofrom: x) #pragma omp target data map(close: x) // expected-error {{missing map type}} -#pragma omp target data map(tofrom, close: x) // expected-error {{incorrect map type modifier, expected 'always' or 'close'}} expected-error {{missing map type}} +#pragma omp target data map(tofrom, close: x) // expected-error {{incorrect map type modifier, expected 'always', 'close', or 'mapper'}} expected-error {{missing map type}} #pragma omp target data map(close, tofrom: close, tofrom, x) foo(); return 0; @@ -613,13 +615,13 @@ int main(int argc, char **argv) { #pragma omp target data map(always, tofrom: x) #pragma omp target data map(always: x) // expected-error {{missing map type}} -#pragma omp target data map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always' or 'close'}} expected-error {{missing map type}} +#pragma omp target data map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always', 'close', or 'mapper'}} expected-error {{missing map type}} #pragma omp target data map(always, tofrom: always, tofrom, x) #pragma omp target map(tofrom j) // expected-error {{expected ',' or ')' in 'map' clause}} foo(); #pragma omp target data map(close, tofrom: x) #pragma omp target data map(close: x) // expected-error {{missing map type}} -#pragma omp target data map(tofrom, close: x) // expected-error {{incorrect map type modifier, expected 'always' or 'close'}} expected-error {{missing map type}} +#pragma omp target data map(tofrom, close: x) // expected-error {{incorrect map type modifier, expected 'always', 'close', or 'mapper'}} expected-error {{missing map type}} foo(); #pragma omp target private(j) map(j) // expected-error {{private variable cannot be in a map clause in '#pragma omp target' directive}} expected-note {{defined as private}} {} diff --git a/test/OpenMP/target_parallel_ast_print.cpp b/test/OpenMP/target_parallel_ast_print.cpp index 1b61f15330..fb206343cc 100644 --- a/test/OpenMP/target_parallel_ast_print.cpp +++ b/test/OpenMP/target_parallel_ast_print.cpp @@ -41,9 +41,9 @@ T tmain(T argc, T *argv) { T i, j, a[20]; #pragma omp target parallel h=2; -#pragma omp target parallel default(none), private(argc,b) firstprivate(argv) shared (d) if (parallel:argc > 0) num_threads(C) proc_bind(master) reduction(+:c, arr1[argc]) reduction(max:e, arr[:C][0:10]) +#pragma omp target parallel allocate(argv) default(none), private(argc,b) firstprivate(argv) shared (d) if (parallel:argc > 0) num_threads(C) proc_bind(master) reduction(+:c, arr1[argc]) reduction(max:e, arr[:C][0:10]) foo(); -#pragma omp target parallel if (C) num_threads(s) proc_bind(close) reduction(^:e, f, arr[0:C][:argc]) reduction(&& : g) +#pragma omp target parallel if (C) num_threads(s) proc_bind(close) reduction(^:e, f, arr[0:C][:argc]) reduction(&& : g) allocate(g) foo(); #pragma omp target parallel if (target:argc > 0) foo(); @@ -76,9 +76,9 @@ T tmain(T argc, T *argv) { // CHECK-NEXT: T i, j, a[20] // CHECK-NEXT: #pragma omp target parallel{{$}} // CHECK-NEXT: h = 2; -// CHECK-NEXT: #pragma omp target parallel default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(C) proc_bind(master) reduction(+: c,arr1[argc]) reduction(max: e,arr[:C][0:10]) +// CHECK-NEXT: #pragma omp target parallel allocate(argv) default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(C) proc_bind(master) reduction(+: c,arr1[argc]) reduction(max: e,arr[:C][0:10]) // CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target parallel if(C) num_threads(s) proc_bind(close) reduction(^: e,f,arr[0:C][:argc]) reduction(&&: g) +// CHECK-NEXT: #pragma omp target parallel if(C) num_threads(s) proc_bind(close) reduction(^: e,f,arr[0:C][:argc]) reduction(&&: g) allocate(g) // CHECK-NEXT: foo() // CHECK-NEXT: #pragma omp target parallel if(target: argc > 0) // CHECK-NEXT: foo() @@ -108,9 +108,9 @@ T tmain(T argc, T *argv) { // CHECK-NEXT: int i, j, a[20] // CHECK-NEXT: #pragma omp target parallel // CHECK-NEXT: h = 2; -// CHECK-NEXT: #pragma omp target parallel default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(5) proc_bind(master) reduction(+: c,arr1[argc]) reduction(max: e,arr[:5][0:10]) +// CHECK-NEXT: #pragma omp target parallel allocate(argv) default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(5) proc_bind(master) reduction(+: c,arr1[argc]) reduction(max: e,arr[:5][0:10]) // CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target parallel if(5) num_threads(s) proc_bind(close) reduction(^: e,f,arr[0:5][:argc]) reduction(&&: g) +// CHECK-NEXT: #pragma omp target parallel if(5) num_threads(s) proc_bind(close) reduction(^: e,f,arr[0:5][:argc]) reduction(&&: g) allocate(g) // CHECK-NEXT: foo() // CHECK-NEXT: #pragma omp target parallel if(target: argc > 0) // CHECK-NEXT: foo() @@ -140,9 +140,9 @@ T tmain(T argc, T *argv) { // CHECK-NEXT: char i, j, a[20] // CHECK-NEXT: #pragma omp target parallel // CHECK-NEXT: h = 2; -// CHECK-NEXT: #pragma omp target parallel default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(1) proc_bind(master) reduction(+: c,arr1[argc]) reduction(max: e,arr[:1][0:10]) +// CHECK-NEXT: #pragma omp target parallel allocate(argv) default(none) private(argc,b) firstprivate(argv) shared(d) if(parallel: argc > 0) num_threads(1) proc_bind(master) reduction(+: c,arr1[argc]) reduction(max: e,arr[:1][0:10]) // CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target parallel if(1) num_threads(s) proc_bind(close) reduction(^: e,f,arr[0:1][:argc]) reduction(&&: g) +// CHECK-NEXT: #pragma omp target parallel if(1) num_threads(s) proc_bind(close) reduction(^: e,f,arr[0:1][:argc]) reduction(&&: g) allocate(g) // CHECK-NEXT: foo() // CHECK-NEXT: #pragma omp target parallel if(target: argc > 0) // CHECK-NEXT: foo() diff --git a/test/OpenMP/target_parallel_default_messages.cpp b/test/OpenMP/target_parallel_default_messages.cpp index 9fb3fac697..0aab663b0b 100644 --- a/test/OpenMP/target_parallel_default_messages.cpp +++ b/test/OpenMP/target_parallel_default_messages.cpp @@ -18,14 +18,14 @@ int main(int argc, char **argv) { #pragma omp target parallel default (x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} foo(); - #pragma omp target parallel default(none) + #pragma omp target parallel default(none) // expected-note {{explicit data sharing attribute requested here}} ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} #pragma omp target parallel default(none) foo(); #pragma omp target parallel default(shared) ++argc; - #pragma omp target parallel default(none) + #pragma omp target parallel default(none) // expected-note {{explicit data sharing attribute requested here}} #pragma omp parallel default(shared) ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} return 0; diff --git a/test/OpenMP/target_parallel_depend_codegen.cpp b/test/OpenMP/target_parallel_depend_codegen.cpp index dc55ec15e5..abd71351e1 100644 --- a/test/OpenMP/target_parallel_depend_codegen.cpp +++ b/test/OpenMP/target_parallel_depend_codegen.cpp @@ -98,7 +98,7 @@ int foo(int n) { // CHECK: getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 1 // CHECK: getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 2 // CHECK: getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 3 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call void @__kmpc_omp_wait_deps(%struct.ident_t* @0, i32 [[GTID]], i32 4, i8* [[DEP]], i32 0, i8* null) // CHECK: call void @__kmpc_omp_task_begin_if0(%struct.ident_t* @0, i32 [[GTID]], i8* [[TASK]]) @@ -138,7 +138,7 @@ int foo(int n) { // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 1 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 2 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call i32 @__kmpc_omp_task_with_deps(%struct.ident_t* @0, i32 [[GTID]], i8* [[TASK]], i32 3, i8* [[DEP]], i32 0, i8* null) // CHECK: br label %[[EXIT:.+]] @@ -154,7 +154,7 @@ int foo(int n) { // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 1 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 2 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call i32 @__kmpc_omp_task_with_deps(%struct.ident_t* @0, i32 [[GTID]], i8* [[TASK]], i32 3, i8* [[DEP]], i32 0, i8* null) // CHECK: br label %[[EXIT:.+]] @@ -170,7 +170,7 @@ int foo(int n) { // CHECK: [[TASK:%.+]] = call i8* @__kmpc_omp_task_alloc(%struct.ident_t* @0, i32 [[GTID]], i32 1, i[[SZ]] {{48|24}}, i[[SZ]] 4, i32 (i32, i8*)* bitcast (i32 (i32, %{{.+}}*)* [[TASK_ENTRY2:@.+]] to i32 (i32, i8*)*)) // CHECK: [[BC_TASK:%.+]] = bitcast i8* [[TASK]] to [[TASK_TY2:%.+]]* // CHECK: getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call void @__kmpc_omp_wait_deps(%struct.ident_t* @0, i32 [[GTID]], i32 1, i8* [[DEP]], i32 0, i8* null) // CHECK: call void @__kmpc_omp_task_begin_if0(%struct.ident_t* @0, i32 [[GTID]], i8* [[TASK]]) diff --git a/test/OpenMP/target_parallel_depend_messages.cpp b/test/OpenMP/target_parallel_depend_messages.cpp index 746c223706..15e22134b3 100644 --- a/test/OpenMP/target_parallel_depend_messages.cpp +++ b/test/OpenMP/target_parallel_depend_messages.cpp @@ -24,13 +24,13 @@ int main(int argc, char **argv, char *env[]) { #pragma omp target parallel depend // expected-error {{expected '(' after 'depend'}} foo(); - #pragma omp target parallel 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 target parallel depend ( // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after dependency type - ignoring}} foo(); - #pragma omp target parallel depend () // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} + #pragma omp target parallel depend () // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} foo(); - #pragma omp target parallel 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 target parallel depend (argc // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}} foo(); - #pragma omp target parallel depend (source : argc) // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} + #pragma omp target parallel depend (source : argc) // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} foo(); #pragma omp target parallel depend (source) // expected-error {{expected expression}} expected-warning {{missing ':' after dependency type - ignoring}} foo(); diff --git a/test/OpenMP/target_parallel_firstprivate_messages.cpp b/test/OpenMP/target_parallel_firstprivate_messages.cpp index 02186e737b..d6c1bb2496 100644 --- a/test/OpenMP/target_parallel_firstprivate_messages.cpp +++ b/test/OpenMP/target_parallel_firstprivate_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -77,7 +87,7 @@ int main(int argc, char **argv) { foo(); #pragma omp target parallel firstprivate (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} foo(); - #pragma omp target parallel firstprivate (argc) + #pragma omp target parallel firstprivate (argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} foo(); #pragma omp target parallel firstprivate (S1) // expected-error {{'S1' does not refer to a value}} foo(); @@ -85,7 +95,7 @@ int main(int argc, char **argv) { foo(); #pragma omp target parallel firstprivate (argv[1]) // expected-error {{expected variable name}} foo(); - #pragma omp target parallel firstprivate(ba) + #pragma omp target parallel firstprivate(ba) allocate(omp_thread_mem_alloc: ba) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target parallel' directive}} foo(); #pragma omp target parallel firstprivate(ca) foo(); diff --git a/test/OpenMP/target_parallel_for_ast_print.cpp b/test/OpenMP/target_parallel_for_ast_print.cpp index c6c46c0031..80c20baca0 100644 --- a/test/OpenMP/target_parallel_for_ast_print.cpp +++ b/test/OpenMP/target_parallel_for_ast_print.cpp @@ -73,13 +73,13 @@ T tmain(T argc, T *argv) { // CHECK: static T a; static T g; #pragma omp threadprivate(g) -#pragma omp target parallel for schedule(dynamic) default(none) linear(a) - // CHECK: #pragma omp target parallel for schedule(dynamic) default(none) linear(a) +#pragma omp target parallel for schedule(dynamic) default(none) linear(a) allocate(a) + // CHECK: #pragma omp target parallel for schedule(dynamic) default(none) linear(a) allocate(a) for (int i = 0; i < 2; ++i) a = 2; // CHECK-NEXT: for (int i = 0; i < 2; ++i) // CHECK-NEXT: a = 2; -#pragma omp target parallel for private(argc, b), firstprivate(c, d), lastprivate(d, f) collapse(N) schedule(static, N) ordered(N) if (parallel :argc) num_threads(N) default(shared) shared(e) reduction(+ : h) +#pragma omp target parallel for allocate(b) private(argc, b), firstprivate(c, d), lastprivate(d, f) collapse(N) schedule(static, N) ordered(N) if (parallel :argc) num_threads(N) default(shared) shared(e) reduction(+ : h) for (int i = 0; i < 2; ++i) for (int j = 0; j < 2; ++j) for (int j = 0; j < 2; ++j) @@ -91,7 +91,7 @@ T tmain(T argc, T *argv) { for (int j = 0; j < 2; ++j) for (int j = 0; j < 2; ++j) foo(); - // CHECK-NEXT: #pragma omp target parallel for private(argc,b) firstprivate(c,d) lastprivate(d,f) collapse(N) schedule(static, N) ordered(N) if(parallel: argc) num_threads(N) default(shared) shared(e) reduction(+: h) + // CHECK-NEXT: #pragma omp target parallel for allocate(b) private(argc,b) firstprivate(c,d) lastprivate(d,f) collapse(N) schedule(static, N) ordered(N) if(parallel: argc) num_threads(N) default(shared) shared(e) reduction(+: h) // CHECK-NEXT: for (int i = 0; i < 2; ++i) // CHECK-NEXT: for (int j = 0; j < 2; ++j) // CHECK-NEXT: for (int j = 0; j < 2; ++j) @@ -176,8 +176,8 @@ int main(int argc, char **argv) { // CHECK: static int a; static float g; #pragma omp threadprivate(g) -#pragma omp target parallel for schedule(guided, argc) default(none) linear(a) - // CHECK: #pragma omp target parallel for schedule(guided, argc) default(none) linear(a) +#pragma omp target parallel for schedule(guided, argc) default(none) linear(a) shared(argc) + // CHECK: #pragma omp target parallel for schedule(guided, argc) default(none) linear(a) shared(argc) for (int i = 0; i < 2; ++i) a = 2; // CHECK-NEXT: for (int i = 0; i < 2; ++i) diff --git a/test/OpenMP/target_parallel_for_collapse_messages.cpp b/test/OpenMP/target_parallel_for_collapse_messages.cpp index d8ebdda81a..2e194ffbd0 100644 --- a/test/OpenMP/target_parallel_for_collapse_messages.cpp +++ b/test/OpenMP/target_parallel_for_collapse_messages.cpp @@ -39,7 +39,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} #pragma omp target parallel for collapse ((ST > 0) ? 1 + ST : 2) // expected-note 2 {{as specified in 'collapse' clause}} for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; // expected-error 2 {{expected 2 for loops after '#pragma omp target parallel for', but found only 1}} // expected-error@+3 2 {{directive '#pragma omp target parallel for' cannot contain more than one 'collapse' clause}} - // expected-error@+2 2 {{argument to 'collapse' clause must be a strictly positive integer value}} + // expected-error@+2 {{argument to 'collapse' clause must be a strictly positive integer value}} // expected-error@+1 2 {{expression is not an integral constant expression}} #pragma omp target parallel for collapse (foobool(argc)), collapse (true), collapse (-5) #if __cplusplus >= 201103L @@ -82,7 +82,7 @@ int main(int argc, char **argv) { for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; // expected-error@+3 {{expression is not an integral constant expression}} // expected-error@+2 2 {{directive '#pragma omp target parallel for' cannot contain more than one 'collapse' clause}} - // expected-error@+1 2 {{argument to 'collapse' clause must be a strictly positive integer value}} + // expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}} #pragma omp target parallel for collapse (foobool(argc)), collapse (true), collapse (-5) #if __cplusplus >= 201103L // expected-note@-2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} diff --git a/test/OpenMP/target_parallel_for_default_messages.cpp b/test/OpenMP/target_parallel_for_default_messages.cpp index 94049cd37b..aba3b30067 100644 --- a/test/OpenMP/target_parallel_for_default_messages.cpp +++ b/test/OpenMP/target_parallel_for_default_messages.cpp @@ -15,7 +15,7 @@ int main(int argc, char **argv) { #pragma omp target parallel for default() // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target parallel for default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} +#pragma omp target parallel for default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-note {{explicit data sharing attribute requested here}} for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} foo(); #pragma omp target parallel for default(shared), default(shared) // expected-error {{directive '#pragma omp target parallel for' cannot contain more than one 'default' clause}} @@ -25,7 +25,7 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); -#pragma omp target parallel for default(none) +#pragma omp target parallel for default(none) // expected-note {{explicit data sharing attribute requested here}} for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} foo(); diff --git a/test/OpenMP/target_parallel_for_depend_codegen.cpp b/test/OpenMP/target_parallel_for_depend_codegen.cpp index 85ec945c4f..107283a7ed 100644 --- a/test/OpenMP/target_parallel_for_depend_codegen.cpp +++ b/test/OpenMP/target_parallel_for_depend_codegen.cpp @@ -98,7 +98,7 @@ int foo(int n) { // CHECK: getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 1 // CHECK: getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 2 // CHECK: getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 3 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call void @__kmpc_omp_wait_deps(%struct.ident_t* [[IN]], i32 [[GTID]], i32 4, i8* [[DEP]], i32 0, i8* null) // CHECK: call void @__kmpc_omp_task_begin_if0(%struct.ident_t* [[IN]], i32 [[GTID]], i8* [[TASK]]) @@ -138,7 +138,7 @@ int foo(int n) { // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 1 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 2 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call i32 @__kmpc_omp_task_with_deps(%struct.ident_t* [[IN]], i32 [[GTID]], i8* [[TASK]], i32 3, i8* [[DEP]], i32 0, i8* null) // CHECK: br label %[[EXIT:.+]] @@ -154,7 +154,7 @@ int foo(int n) { // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 1 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 2 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call i32 @__kmpc_omp_task_with_deps(%struct.ident_t* [[IN]], i32 [[GTID]], i8* [[TASK]], i32 3, i8* [[DEP]], i32 0, i8* null) // CHECK: br label %[[EXIT:.+]] @@ -170,7 +170,7 @@ int foo(int n) { // CHECK: [[TASK:%.+]] = call i8* @__kmpc_omp_task_alloc(%struct.ident_t* [[IN]], i32 [[GTID]], i32 1, i[[SZ]] {{48|24}}, i[[SZ]] 4, i32 (i32, i8*)* bitcast (i32 (i32, %{{.+}}*)* [[TASK_ENTRY2:@.+]] to i32 (i32, i8*)*)) // CHECK: [[BC_TASK:%.+]] = bitcast i8* [[TASK]] to [[TASK_TY2:%.+]]* // CHECK: getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call void @__kmpc_omp_wait_deps(%struct.ident_t* [[IN]], i32 [[GTID]], i32 1, i8* [[DEP]], i32 0, i8* null) // CHECK: call void @__kmpc_omp_task_begin_if0(%struct.ident_t* [[IN]], i32 [[GTID]], i8* [[TASK]]) diff --git a/test/OpenMP/target_parallel_for_depend_messages.cpp b/test/OpenMP/target_parallel_for_depend_messages.cpp index d644711b5e..4b255ab0f3 100644 --- a/test/OpenMP/target_parallel_for_depend_messages.cpp +++ b/test/OpenMP/target_parallel_for_depend_messages.cpp @@ -25,13 +25,13 @@ int main(int argc, char **argv, char *env[]) { #pragma omp target parallel for depend // expected-error {{expected '(' after 'depend'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for 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 target parallel for depend ( // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after dependency type - ignoring}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for depend () // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} + #pragma omp target parallel for depend () // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for 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 target parallel for depend (argc // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for depend (source : argc) // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} + #pragma omp target parallel for depend (source : argc) // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} for (i = 0; i < argc; ++i) foo(); #pragma omp target parallel for depend (source) // expected-error {{expected expression}} expected-warning {{missing ':' after dependency type - ignoring}} for (i = 0; i < argc; ++i) foo(); diff --git a/test/OpenMP/target_parallel_for_firstprivate_messages.cpp b/test/OpenMP/target_parallel_for_firstprivate_messages.cpp index 350bb89108..286faec963 100644 --- a/test/OpenMP/target_parallel_for_firstprivate_messages.cpp +++ b/test/OpenMP/target_parallel_for_firstprivate_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -86,7 +96,7 @@ int foomain(int argc, char **argv) { #pragma omp target parallel for firstprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp target parallel for firstprivate(argc) +#pragma omp target parallel for firstprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target parallel for firstprivate(S1) // expected-error {{'S1' does not refer to a value}} @@ -171,7 +181,7 @@ int main(int argc, char **argv) { #pragma omp target parallel for firstprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target parallel for firstprivate(argc) +#pragma omp target parallel for allocate(omp_thread_mem_alloc: argc) firstprivate(argc) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target parallel for' directive}} for (i = 0; i < argc; ++i) foo(); #pragma omp target parallel for firstprivate(S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/target_parallel_for_lastprivate_messages.cpp b/test/OpenMP/target_parallel_for_lastprivate_messages.cpp index 7aff164b50..d01e393bae 100644 --- a/test/OpenMP/target_parallel_for_lastprivate_messages.cpp +++ b/test/OpenMP/target_parallel_for_lastprivate_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -88,7 +98,7 @@ int foomain(int argc, char **argv) { #pragma omp target parallel for lastprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp target parallel for lastprivate(argc) +#pragma omp target parallel for lastprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target parallel for lastprivate(S1) // expected-error {{'S1' does not refer to a value}} @@ -177,7 +187,7 @@ int main(int argc, char **argv) { #pragma omp target parallel for lastprivate(2 * 2) // expected-error {{expected variable name}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target parallel for lastprivate(ba) +#pragma omp target parallel for lastprivate(ba) allocate(omp_thread_mem_alloc: ba) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target parallel for' directive}} for (i = 0; i < argc; ++i) foo(); #pragma omp target parallel for lastprivate(ca) // expected-error {{const-qualified variable without mutable fields cannot be lastprivate}} diff --git a/test/OpenMP/target_parallel_for_linear_messages.cpp b/test/OpenMP/target_parallel_for_linear_messages.cpp index 79890c414a..3556faa3ca 100644 --- a/test/OpenMP/target_parallel_for_linear_messages.cpp +++ b/test/OpenMP/target_parallel_for_linear_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + namespace X { int x; }; @@ -139,7 +149,7 @@ int foomain(I argc, C **argv) { #pragma omp target parallel for linear(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp target parallel for linear(argc : 5) +#pragma omp target parallel for linear(argc : 5) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target parallel for linear(S1) // expected-error {{'S1' does not refer to a value}} @@ -153,7 +163,7 @@ int foomain(I argc, C **argv) { #pragma omp target parallel for linear(argv[1]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp target parallel for linear(e, g) +#pragma omp target parallel for allocate(omp_thread_mem_alloc: e) linear(e, g) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target parallel for' directive}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target parallel for linear(h) // expected-error {{threadprivate or thread local variable cannot be linear}} diff --git a/test/OpenMP/target_parallel_for_map_messages.cpp b/test/OpenMP/target_parallel_for_map_messages.cpp index 6d82921603..6ef87d442f 100644 --- a/test/OpenMP/target_parallel_for_map_messages.cpp +++ b/test/OpenMP/target_parallel_for_map_messages.cpp @@ -86,6 +86,8 @@ T tmain(T argc) { for (i = 0; i < argc; ++i) foo(); #pragma omp target parallel for map(l[:-1]) // expected-error 2 {{section length is evaluated to a negative value -1}} for (i = 0; i < argc; ++i) foo(); +#pragma omp target parallel for map(l[true:true]) + for (i = 0; i < argc; ++i) foo(); #pragma omp target parallel for map(x) for (i = 0; i < argc; ++i) foo(); #pragma omp target parallel for map(tofrom: t[:I]) @@ -163,7 +165,7 @@ T tmain(T argc) { for (i = 0; i < argc; ++i) foo(); #pragma omp target parallel for map(always: x) // expected-error {{missing map type}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target parallel for map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always' or 'close'}} expected-error {{missing map type}} +#pragma omp target parallel for map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always', 'close', or 'mapper'}} expected-error {{missing map type}} for (i = 0; i < argc; ++i) foo(); #pragma omp target parallel for map(always, tofrom: always, tofrom, x) for (i = 0; i < argc; ++i) foo(); @@ -206,6 +208,8 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); #pragma omp target parallel for map(l[:-1]) // expected-error {{section length is evaluated to a negative value -1}} for (i = 0; i < argc; ++i) foo(); +#pragma omp target parallel for map(l[true:true]) + for (i = 0; i < argc; ++i) foo(); #pragma omp target parallel for map(x) for (i = 0; i < argc; ++i) foo(); #pragma omp target parallel for map(to: x) @@ -271,7 +275,7 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); #pragma omp target parallel for map(always: x) // expected-error {{missing map type}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target parallel for map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always' or 'close'}} expected-error {{missing map type}} +#pragma omp target parallel for map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always', 'close', or 'mapper'}} expected-error {{missing map type}} for (i = 0; i < argc; ++i) foo(); #pragma omp target parallel for map(always, tofrom: always, tofrom, x) for (i = 0; i < argc; ++i) foo(); diff --git a/test/OpenMP/target_parallel_for_messages.cpp b/test/OpenMP/target_parallel_for_messages.cpp index 6bf4ac2807..c454987e25 100644 --- a/test/OpenMP/target_parallel_for_messages.cpp +++ b/test/OpenMP/target_parallel_for_messages.cpp @@ -61,7 +61,7 @@ L1: break; } } -#pragma omp target parallel for default(none) +#pragma omp target parallel for default(none) // expected-note {{explicit data sharing attribute requested here}} for (int i = 0; i < 10; ++i) ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} diff --git a/test/OpenMP/target_parallel_for_ordered_messages.cpp b/test/OpenMP/target_parallel_for_ordered_messages.cpp index 002e8e9a5c..38a977e293 100644 --- a/test/OpenMP/target_parallel_for_ordered_messages.cpp +++ b/test/OpenMP/target_parallel_for_ordered_messages.cpp @@ -49,7 +49,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here} // expected-note@+5 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif // expected-error@+3 2 {{directive '#pragma omp target parallel for' cannot contain more than one 'ordered' clause}} -// expected-error@+2 2 {{argument to 'ordered' clause must be a strictly positive integer value}} +// expected-error@+2 {{argument to 'ordered' clause must be a strictly positive integer value}} // expected-error@+1 2 {{expression is not an integral constant expression}} #pragma omp target parallel for ordered(foobool(argc)), ordered(true), ordered(-5) for (int i = ST; i < N; i++) @@ -103,7 +103,7 @@ int main(int argc, char **argv) { #endif // expected-error@+3 {{expression is not an integral constant expression}} // expected-error@+2 2 {{directive '#pragma omp target parallel for' cannot contain more than one 'ordered' clause}} -// expected-error@+1 2 {{argument to 'ordered' clause must be a strictly positive integer value}} +// expected-error@+1 {{argument to 'ordered' clause must be a strictly positive integer value}} #pragma omp target parallel for ordered(foobool(argc)), ordered(true), ordered(-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i - 4]; diff --git a/test/OpenMP/target_parallel_for_private_messages.cpp b/test/OpenMP/target_parallel_for_private_messages.cpp index dae4f17ccc..2e3848a600 100644 --- a/test/OpenMP/target_parallel_for_private_messages.cpp +++ b/test/OpenMP/target_parallel_for_private_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -116,7 +126,7 @@ int foomain(I argc, C **argv) { #pragma omp target parallel for private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp target parallel for private(argc) +#pragma omp target parallel for private(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target parallel for private(S1) // expected-error {{'S1' does not refer to a value}} @@ -128,7 +138,7 @@ int foomain(I argc, C **argv) { #pragma omp target parallel for private(argv[1]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp target parallel for private(e, g) +#pragma omp target parallel for private(e, g) allocate(omp_thread_mem_alloc: e) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target parallel for' directive}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target parallel for private(h) // expected-error {{threadprivate or thread local variable cannot be private}} diff --git a/test/OpenMP/target_parallel_for_reduction_messages.cpp b/test/OpenMP/target_parallel_for_reduction_messages.cpp index 7cb55129e2..3b201f2f2e 100644 --- a/test/OpenMP/target_parallel_for_reduction_messages.cpp +++ b/test/OpenMP/target_parallel_for_reduction_messages.cpp @@ -6,6 +6,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -124,7 +134,7 @@ T tmain(T argc) { #pragma omp target parallel for reduction(foo : argc) //expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'float'}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int'}} for (int i = 0; i < 10; ++i) foo(); -#pragma omp target parallel for reduction(&& : argc) +#pragma omp target parallel for reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int i = 0; i < 10; ++i) foo(); #pragma omp target parallel for reduction(^ : T) // expected-error {{'T' does not refer to a value}} @@ -315,7 +325,7 @@ int main(int argc, char **argv) { for (int i = 0; i < 10; ++i) foo(); static int m; -#pragma omp target parallel for reduction(+ : m) // OK +#pragma omp target parallel for allocate(omp_thread_mem_alloc: m) reduction(+ : m) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target parallel for' directive}} for (int i = 0; i < 10; ++i) m++; diff --git a/test/OpenMP/target_parallel_for_simd_ast_print.cpp b/test/OpenMP/target_parallel_for_simd_ast_print.cpp index de7fb12ab9..a368b8a088 100644 --- a/test/OpenMP/target_parallel_for_simd_ast_print.cpp +++ b/test/OpenMP/target_parallel_for_simd_ast_print.cpp @@ -75,20 +75,20 @@ T tmain(T argc, T *argv) { const T clen = 5; // CHECK: T clen = 5; #pragma omp threadprivate(g) -#pragma omp target parallel for simd schedule(dynamic) default(none) linear(a) - // CHECK: #pragma omp target parallel for simd schedule(dynamic) default(none) linear(a) +#pragma omp target parallel for simd schedule(dynamic) default(none) linear(a) allocate(a) + // CHECK: #pragma omp target parallel for simd schedule(dynamic) default(none) linear(a) allocate(a) for (T i = 0; i < 2; ++i) a = 2; // CHECK-NEXT: for (T i = 0; i < 2; ++i) // CHECK-NEXT: a = 2; -#pragma omp target parallel for simd private(argc, b), firstprivate(c, d), lastprivate(d, f) collapse(N) schedule(static, N) ordered if (parallel :argc) num_threads(N) default(shared) shared(e) reduction(+ : h) +#pragma omp target parallel for simd allocate(d) private(argc, b), firstprivate(c, d), lastprivate(d, f) collapse(N) schedule(static, N) ordered if (parallel :argc) num_threads(N) default(shared) shared(e) reduction(+ : h) for (int i = 0; i < 2; ++i) for (int j = 0; j < 2; ++j) for (int j = 0; j < 2; ++j) for (int j = 0; j < 2; ++j) for (int j = 0; j < 2; ++j) foo(); - // CHECK-NEXT: #pragma omp target parallel for simd private(argc,b) firstprivate(c,d) lastprivate(d,f) collapse(N) schedule(static, N) ordered if(parallel: argc) num_threads(N) default(shared) shared(e) reduction(+: h) + // CHECK-NEXT: #pragma omp target parallel for simd allocate(d) private(argc,b) firstprivate(c,d) lastprivate(d,f) collapse(N) schedule(static, N) ordered if(parallel: argc) num_threads(N) default(shared) shared(e) reduction(+: h) // CHECK-NEXT: for (int i = 0; i < 2; ++i) // CHECK-NEXT: for (int j = 0; j < 2; ++j) // CHECK-NEXT: for (int j = 0; j < 2; ++j) @@ -200,8 +200,8 @@ int main(int argc, char **argv) { // CHECK: int clen = 5; static float g; #pragma omp threadprivate(g) -#pragma omp target parallel for simd schedule(guided, argc) default(none) linear(a) - // CHECK: #pragma omp target parallel for simd schedule(guided, argc) default(none) linear(a) +#pragma omp target parallel for simd schedule(guided, argc) default(none) linear(a) shared(argc) + // CHECK: #pragma omp target parallel for simd schedule(guided, argc) default(none) linear(a) shared(argc) for (int i = 0; i < 2; ++i) a = 2; // CHECK-NEXT: for (int i = 0; i < 2; ++i) diff --git a/test/OpenMP/target_parallel_for_simd_collapse_messages.cpp b/test/OpenMP/target_parallel_for_simd_collapse_messages.cpp index f3f2aa9ace..24e30b3d3f 100644 --- a/test/OpenMP/target_parallel_for_simd_collapse_messages.cpp +++ b/test/OpenMP/target_parallel_for_simd_collapse_messages.cpp @@ -43,7 +43,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} // expected-note@+5 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif // expected-error@+3 2 {{directive '#pragma omp target parallel for simd' cannot contain more than one 'collapse' clause}} - // expected-error@+2 2 {{argument to 'collapse' clause must be a strictly positive integer value}} + // expected-error@+2 {{argument to 'collapse' clause must be a strictly positive integer value}} // expected-error@+1 2 {{expression is not an integral constant expression}} #pragma omp target parallel for simd collapse (foobool(argc)), collapse (true), collapse (-5) for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; @@ -84,7 +84,7 @@ int main(int argc, char **argv) { #endif // expected-error@+3 {{expression is not an integral constant expression}} // expected-error@+2 2 {{directive '#pragma omp target parallel for simd' cannot contain more than one 'collapse' clause}} - // expected-error@+1 2 {{argument to 'collapse' clause must be a strictly positive integer value}} + // expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}} #pragma omp target parallel for simd collapse (foobool(argc)), collapse (true), collapse (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; #pragma omp target parallel for simd collapse (S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/target_parallel_for_simd_default_messages.cpp b/test/OpenMP/target_parallel_for_simd_default_messages.cpp index b67bfc52e7..4b634e5116 100644 --- a/test/OpenMP/target_parallel_for_simd_default_messages.cpp +++ b/test/OpenMP/target_parallel_for_simd_default_messages.cpp @@ -15,7 +15,7 @@ int main(int argc, char **argv) { #pragma omp target parallel for simd default() // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target parallel for simd default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} +#pragma omp target parallel for simd default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-note {{explicit data sharing attribute requested here}} for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} foo(); #pragma omp target parallel for simd default(shared), default(shared) // expected-error {{directive '#pragma omp target parallel for simd' cannot contain more than one 'default' clause}} @@ -25,7 +25,7 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); -#pragma omp target parallel for simd default(none) +#pragma omp target parallel for simd default(none) // expected-note {{explicit data sharing attribute requested here}} for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} foo(); diff --git a/test/OpenMP/target_parallel_for_simd_depend_codegen.cpp b/test/OpenMP/target_parallel_for_simd_depend_codegen.cpp index 83d752d9ab..2a76e318ca 100644 --- a/test/OpenMP/target_parallel_for_simd_depend_codegen.cpp +++ b/test/OpenMP/target_parallel_for_simd_depend_codegen.cpp @@ -98,7 +98,7 @@ int foo(int n) { // CHECK: getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 1 // CHECK: getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 2 // CHECK: getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 3 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call void @__kmpc_omp_wait_deps(%struct.ident_t* [[IN]], i32 [[GTID]], i32 4, i8* [[DEP]], i32 0, i8* null) // CHECK: call void @__kmpc_omp_task_begin_if0(%struct.ident_t* [[IN]], i32 [[GTID]], i8* [[TASK]]) @@ -138,7 +138,7 @@ int foo(int n) { // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 1 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 2 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call i32 @__kmpc_omp_task_with_deps(%struct.ident_t* [[IN]], i32 [[GTID]], i8* [[TASK]], i32 3, i8* [[DEP]], i32 0, i8* null) // CHECK: br label %[[EXIT:.+]] @@ -154,7 +154,7 @@ int foo(int n) { // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 1 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 2 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call i32 @__kmpc_omp_task_with_deps(%struct.ident_t* [[IN]], i32 [[GTID]], i8* [[TASK]], i32 3, i8* [[DEP]], i32 0, i8* null) // CHECK: br label %[[EXIT:.+]] @@ -170,7 +170,7 @@ int foo(int n) { // CHECK: [[TASK:%.+]] = call i8* @__kmpc_omp_task_alloc(%struct.ident_t* [[IN]], i32 [[GTID]], i32 1, i[[SZ]] {{48|24}}, i[[SZ]] 4, i32 (i32, i8*)* bitcast (i32 (i32, %{{.+}}*)* [[TASK_ENTRY2:@.+]] to i32 (i32, i8*)*)) // CHECK: [[BC_TASK:%.+]] = bitcast i8* [[TASK]] to [[TASK_TY2:%.+]]* // CHECK: getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call void @__kmpc_omp_wait_deps(%struct.ident_t* [[IN]], i32 [[GTID]], i32 1, i8* [[DEP]], i32 0, i8* null) // CHECK: call void @__kmpc_omp_task_begin_if0(%struct.ident_t* [[IN]], i32 [[GTID]], i8* [[TASK]]) diff --git a/test/OpenMP/target_parallel_for_simd_depend_messages.cpp b/test/OpenMP/target_parallel_for_simd_depend_messages.cpp index 5a735fc77a..6410a6c35a 100644 --- a/test/OpenMP/target_parallel_for_simd_depend_messages.cpp +++ b/test/OpenMP/target_parallel_for_simd_depend_messages.cpp @@ -25,13 +25,13 @@ int main(int argc, char **argv, char *env[]) { #pragma omp target parallel for simd depend // expected-error {{expected '(' after 'depend'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for simd 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 target parallel for simd depend ( // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after dependency type - ignoring}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for simd depend () // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} + #pragma omp target parallel for simd depend () // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for simd 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 target parallel for simd depend (argc // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target parallel for simd depend (source : argc) // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} + #pragma omp target parallel for simd depend (source : argc) // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} for (i = 0; i < argc; ++i) foo(); #pragma omp target parallel for simd depend (source) // expected-error {{expected expression}} expected-warning {{missing ':' after dependency type - ignoring}} for (i = 0; i < argc; ++i) foo(); diff --git a/test/OpenMP/target_parallel_for_simd_firstprivate_messages.cpp b/test/OpenMP/target_parallel_for_simd_firstprivate_messages.cpp index 8a32c6ffc2..77661a3133 100644 --- a/test/OpenMP/target_parallel_for_simd_firstprivate_messages.cpp +++ b/test/OpenMP/target_parallel_for_simd_firstprivate_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -86,7 +96,7 @@ int foomain(int argc, char **argv) { #pragma omp target parallel for simd firstprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp target parallel for simd firstprivate(argc) +#pragma omp target parallel for simd firstprivate(argc) allocate(omp_thread_mem_alloc: argc) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target parallel for simd' directive}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target parallel for simd firstprivate(S1) // expected-error {{'S1' does not refer to a value}} @@ -171,7 +181,7 @@ int main(int argc, char **argv) { #pragma omp target parallel for simd firstprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target parallel for simd firstprivate(argc) +#pragma omp target parallel for simd firstprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (i = 0; i < argc; ++i) foo(); #pragma omp target parallel for simd firstprivate(S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/target_parallel_for_simd_lastprivate_messages.cpp b/test/OpenMP/target_parallel_for_simd_lastprivate_messages.cpp index 1c4d853431..750fa3b19a 100644 --- a/test/OpenMP/target_parallel_for_simd_lastprivate_messages.cpp +++ b/test/OpenMP/target_parallel_for_simd_lastprivate_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -88,7 +98,7 @@ int foomain(int argc, char **argv) { #pragma omp target parallel for simd lastprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp target parallel for simd lastprivate(argc) +#pragma omp target parallel for simd allocate(omp_thread_mem_alloc: argc) lastprivate(argc) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target parallel for simd' directive}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target parallel for simd lastprivate(S1) // expected-error {{'S1' does not refer to a value}} @@ -162,7 +172,7 @@ int main(int argc, char **argv) { #pragma omp target parallel for simd lastprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target parallel for simd lastprivate(argc) +#pragma omp target parallel for simd lastprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (i = 0; i < argc; ++i) foo(); #pragma omp target parallel for simd lastprivate(S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/target_parallel_for_simd_linear_messages.cpp b/test/OpenMP/target_parallel_for_simd_linear_messages.cpp index 166cd2bc0b..b5664dd317 100644 --- a/test/OpenMP/target_parallel_for_simd_linear_messages.cpp +++ b/test/OpenMP/target_parallel_for_simd_linear_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + namespace X { int x; }; @@ -42,7 +52,7 @@ void test_linear_colons() { #pragma omp target parallel for simd linear(B, ::z, X::x) for (int i = 0; i < 10; ++i) ; -#pragma omp target parallel for simd linear(::z) +#pragma omp target parallel for simd linear(::z) allocate(omp_thread_mem_alloc: ::z) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target parallel for simd' directive}} for (int i = 0; i < 10; ++i) ; // expected-error@+1 {{expected variable name}} @@ -139,7 +149,7 @@ int foomain(I argc, C **argv) { #pragma omp target parallel for simd linear(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp target parallel for simd linear(argc : 5) +#pragma omp target parallel for simd linear(argc : 5) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target parallel for simd linear(S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/target_parallel_for_simd_map_messages.cpp b/test/OpenMP/target_parallel_for_simd_map_messages.cpp index a5135559cc..f18cc9a5f8 100644 --- a/test/OpenMP/target_parallel_for_simd_map_messages.cpp +++ b/test/OpenMP/target_parallel_for_simd_map_messages.cpp @@ -86,6 +86,8 @@ T tmain(T argc) { for (i = 0; i < argc; ++i) foo(); #pragma omp target parallel for simd map(l[:-1]) // expected-error 2 {{section length is evaluated to a negative value -1}} for (i = 0; i < argc; ++i) foo(); +#pragma omp target parallel for simd map(l[true:true]) + for (i = 0; i < argc; ++i) foo(); #pragma omp target parallel for simd map(x) for (i = 0; i < argc; ++i) foo(); #pragma omp target parallel for simd map(tofrom: t[:I]) @@ -163,7 +165,7 @@ T tmain(T argc) { for (i = 0; i < argc; ++i) foo(); #pragma omp target parallel for simd map(always: x) // expected-error {{missing map type}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target parallel for simd map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always' or 'close'}} expected-error {{missing map type}} +#pragma omp target parallel for simd map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always', 'close', or 'mapper'}} expected-error {{missing map type}} for (i = 0; i < argc; ++i) foo(); #pragma omp target parallel for simd map(always, tofrom: always, tofrom, x) for (i = 0; i < argc; ++i) foo(); @@ -206,6 +208,8 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); #pragma omp target parallel map(l[:-1]) // expected-error {{section length is evaluated to a negative value -1}} for (i = 0; i < argc; ++i) foo(); +#pragma omp target parallel map(l[true:true]) + for (i = 0; i < argc; ++i) foo(); #pragma omp target parallel for simd map(x) for (i = 0; i < argc; ++i) foo(); #pragma omp target parallel for simd map(to: x) @@ -271,7 +275,7 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); #pragma omp target parallel for simd map(always: x) // expected-error {{missing map type}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target parallel for simd map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always' or 'close'}} expected-error {{missing map type}} +#pragma omp target parallel for simd map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always', 'close', or 'mapper'}} expected-error {{missing map type}} for (i = 0; i < argc; ++i) foo(); #pragma omp target parallel for simd map(always, tofrom: always, tofrom, x) for (i = 0; i < argc; ++i) foo(); diff --git a/test/OpenMP/target_parallel_for_simd_messages.cpp b/test/OpenMP/target_parallel_for_simd_messages.cpp index c0e03289d7..76090e8553 100644 --- a/test/OpenMP/target_parallel_for_simd_messages.cpp +++ b/test/OpenMP/target_parallel_for_simd_messages.cpp @@ -61,7 +61,7 @@ L1: break; } } -#pragma omp target parallel for simd default(none) +#pragma omp target parallel for simd default(none) // expected-note {{explicit data sharing attribute requested here}} for (int i = 0; i < 10; ++i) ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} diff --git a/test/OpenMP/target_parallel_for_simd_ordered_messages.cpp b/test/OpenMP/target_parallel_for_simd_ordered_messages.cpp index 3e3f6c26c3..08b9247c1b 100644 --- a/test/OpenMP/target_parallel_for_simd_ordered_messages.cpp +++ b/test/OpenMP/target_parallel_for_simd_ordered_messages.cpp @@ -47,7 +47,7 @@ T tmain(T argc, S **argv) { #pragma omp target parallel for simd ordered((ST > 0) ? 1 + ST : 2) for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i - ST]; -// expected-error@+3 2 {{argument to 'ordered' clause must be a strictly positive integer value}} +// expected-error@+3 {{argument to 'ordered' clause must be a strictly positive integer value}} // expected-error@+2 2 {{directive '#pragma omp target parallel for simd' cannot contain more than one 'ordered' clause}} // expected-error@+1 {{'ordered' clause with a parameter can not be specified in '#pragma omp target parallel for simd' directive}} #pragma omp target parallel for simd ordered(foobool(argc)), ordered(true), ordered(-5) @@ -105,7 +105,7 @@ int main(int argc, char **argv) { #endif // expected-error@+3 {{expression is not an integral constant expression}} // expected-error@+2 2 {{directive '#pragma omp target parallel for simd' cannot contain more than one 'ordered' clause}} -// expected-error@+1 2 {{argument to 'ordered' clause must be a strictly positive integer value}} +// expected-error@+1 {{argument to 'ordered' clause must be a strictly positive integer value}} #pragma omp target parallel for simd ordered(foobool(argc)), ordered(true), ordered(-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i - 4]; diff --git a/test/OpenMP/target_parallel_for_simd_private_messages.cpp b/test/OpenMP/target_parallel_for_simd_private_messages.cpp index 51f1d9b8be..6210323330 100644 --- a/test/OpenMP/target_parallel_for_simd_private_messages.cpp +++ b/test/OpenMP/target_parallel_for_simd_private_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -58,7 +68,7 @@ public: S6() : a(0) {} S6(T v) : a(v) { -#pragma omp target parallel for simd private(a) private(this->a) +#pragma omp target parallel for simd allocate(omp_thread_mem_alloc: a) private(a) private(this->a) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target parallel for simd' directive}} for (int k = 0; k < v; ++k) ++this->a; } @@ -116,7 +126,7 @@ int foomain(I argc, C **argv) { #pragma omp target parallel for simd private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp target parallel for simd private(argc) +#pragma omp target parallel for simd private(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target parallel for simd private(S1) // expected-error {{'S1' does not refer to a value}} @@ -166,7 +176,7 @@ using A::x; int main(int argc, char **argv) { S4 e(4); S5 g(5); - S6<float> s6(0.0) , s6_0(1.0); + S6<float> s6(0.0) , s6_0(1.0); // expected-note {{in instantiation of member function 'S6<float>::S6' requested here}} S7<S6<float> > s7(0.0) , s7_0(1.0); int i; int &j = i; diff --git a/test/OpenMP/target_parallel_for_simd_reduction_messages.cpp b/test/OpenMP/target_parallel_for_simd_reduction_messages.cpp index eb3d756dce..87be4f1c65 100644 --- a/test/OpenMP/target_parallel_for_simd_reduction_messages.cpp +++ b/test/OpenMP/target_parallel_for_simd_reduction_messages.cpp @@ -6,6 +6,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -14,7 +24,7 @@ bool foobool(int argc) { } void foobar(int &ref) { -#pragma omp target parallel for simd reduction(+:ref) +#pragma omp target parallel for simd reduction(+:ref) allocate(omp_thread_mem_alloc: ref) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target parallel for simd' directive}} for (int i = 0; i < 10; ++i) foo(); } @@ -124,7 +134,7 @@ T tmain(T argc) { #pragma omp target parallel for simd reduction(foo : argc) //expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'float'}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int'}} for (int i = 0; i < 10; ++i) foo(); -#pragma omp target parallel for simd reduction(&& : argc) +#pragma omp target parallel for simd reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int i = 0; i < 10; ++i) foo(); #pragma omp target parallel for simd reduction(^ : T) // expected-error {{'T' does not refer to a value}} diff --git a/test/OpenMP/target_parallel_for_simd_safelen_messages.cpp b/test/OpenMP/target_parallel_for_simd_safelen_messages.cpp index 74b1a7374f..1121593e5e 100644 --- a/test/OpenMP/target_parallel_for_simd_safelen_messages.cpp +++ b/test/OpenMP/target_parallel_for_simd_safelen_messages.cpp @@ -39,7 +39,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} #pragma omp target parallel for simd safelen ((ST > 0) ? 1 + ST : 2) for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; // expected-error@+6 2 {{directive '#pragma omp target parallel for simd' cannot contain more than one 'safelen' clause}} - // expected-error@+5 2 {{argument to 'safelen' clause must be a strictly positive integer value}} + // expected-error@+5 {{argument to 'safelen' clause must be a strictly positive integer value}} // expected-error@+4 2 {{expression is not an integral constant expression}} #if __cplusplus >= 201103L // expected-note@+2 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} @@ -84,7 +84,7 @@ int main(int argc, char **argv) { // expected-note@+4 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif // expected-error@+2 2 {{directive '#pragma omp target parallel for simd' cannot contain more than one 'safelen' clause}} - // expected-error@+1 2 {{argument to 'safelen' clause must be a strictly positive integer value}} + // expected-error@+1 {{argument to 'safelen' clause must be a strictly positive integer value}} #pragma omp target parallel for simd safelen (foobool(argc)), safelen (true), safelen (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; #pragma omp target parallel for simd safelen (S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/target_parallel_for_simd_simdlen_messages.cpp b/test/OpenMP/target_parallel_for_simd_simdlen_messages.cpp index f8b375ef1c..33a6642a8d 100644 --- a/test/OpenMP/target_parallel_for_simd_simdlen_messages.cpp +++ b/test/OpenMP/target_parallel_for_simd_simdlen_messages.cpp @@ -46,7 +46,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; // expected-error@+6 2 {{directive '#pragma omp target parallel for simd' cannot contain more than one 'simdlen' clause}} - // expected-error@+5 2 {{argument to 'simdlen' clause must be a strictly positive integer value}} + // expected-error@+5 {{argument to 'simdlen' clause must be a strictly positive integer value}} // expected-error@+4 2 {{expression is not an integral constant expression}} #if __cplusplus >= 201103L // expected-note@+2 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} @@ -111,7 +111,7 @@ int main(int argc, char **argv) { // expected-note@+4 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif // expected-error@+2 2 {{directive '#pragma omp target parallel for simd' cannot contain more than one 'simdlen' clause}} -// expected-error@+1 2 {{argument to 'simdlen' clause must be a strictly positive integer value}} +// expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}} #pragma omp target parallel for simd simdlen (foobool(argc)), simdlen (true), simdlen (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; diff --git a/test/OpenMP/target_parallel_if_codegen.cpp b/test/OpenMP/target_parallel_if_codegen.cpp index 03e8c34445..a4fdaa62f1 100644 --- a/test/OpenMP/target_parallel_if_codegen.cpp +++ b/test/OpenMP/target_parallel_if_codegen.cpp @@ -163,7 +163,8 @@ int bar(int n){ // CHECK: store i8 [[FB]], i8* [[CONV]], align // CHECK: [[ARG:%.+]] = load i[[SZ]], i[[SZ]]* [[CAPEC_ADDR]], align // -// CHECK-DAG: [[RET:%.+]] = call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 4, {{.*}}, i32 1, i32 0) +// CHECK-DAG: [[RET:%.+]] = call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 4, {{.*}}, i32 1, i32 [[NT:%.+]]) +// CHECK-DAG: [[NT]] = select i1 %{{.+}}, i32 0, i32 1 // CHECK: [[ERROR:%.+]] = icmp ne i32 [[RET]], 0 // CHECK: br i1 [[ERROR]], label %[[FAIL:.+]], label %[[END:[^,]+]] // @@ -189,7 +190,8 @@ int bar(int n){ // CHECK: br i1 [[CMP]], label {{%?}}[[IF_THEN:.+]], label {{%?}}[[IF_ELSE:.+]] // // CHECK: [[IF_THEN]] -// CHECK-DAG: [[RET:%.+]] = call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 3, {{.*}}, i32 1, i32 0) +// CHECK-DAG: [[RET:%.+]] = call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 3, {{.*}}, i32 1, i32 [[NT:%.+]]) +// CHECK-DAG: [[NT]] = select i1 %{{.+}}, i32 0, i32 1 // CHECK: [[ERROR:%.+]] = icmp ne i32 [[RET]], 0 // CHECK-NEXT: br i1 [[ERROR]], label %[[FAIL:.+]], label %[[END:[^,]+]] // CHECK: [[FAIL]] @@ -221,7 +223,8 @@ int bar(int n){ // CHECK: br i1 [[TB]], label {{%?}}[[IF_THEN:.+]], label {{%?}}[[IF_ELSE:.+]] // // CHECK: [[IF_THEN]] -// CHECK-DAG: [[RET:%.+]] = call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 1, {{.*}}, i32 1, i32 0) +// CHECK-DAG: [[RET:%.+]] = call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 1, {{.*}}, i32 1, i32 [[NT:%.+]]) +// CHECK-DAG: [[NT]] = select i1 %{{.+}}, i32 0, i32 1 // CHECK: [[ERROR:%.+]] = icmp ne i32 [[RET]], 0 // CHECK-NEXT: br i1 [[ERROR]], label %[[FAIL:.+]], label %[[END:[^,]+]] // CHECK: [[FAIL]] @@ -263,7 +266,7 @@ int bar(int n){ // // CHECK: define {{.*}}[[FTEMPLATE]] // -// CHECK-DAG: [[RET:%.+]] = call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 1, {{.*}}, i32 1, i32 0) +// CHECK-DAG: [[RET:%.+]] = call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 1, {{.*}}, i32 1, i32 1) // CHECK-NEXT: [[ERROR:%.+]] = icmp ne i32 [[RET]], 0 // CHECK-NEXT: br i1 [[ERROR]], label %[[FAIL:.+]], label %[[END:[^,]+]] // diff --git a/test/OpenMP/target_parallel_map_messages.cpp b/test/OpenMP/target_parallel_map_messages.cpp index 056fd501ac..52774aa741 100644 --- a/test/OpenMP/target_parallel_map_messages.cpp +++ b/test/OpenMP/target_parallel_map_messages.cpp @@ -86,6 +86,8 @@ T tmain(T argc) { foo(); #pragma omp target parallel map(l[:-1]) // expected-error 2 {{section length is evaluated to a negative value -1}} foo(); +#pragma omp target parallel map(l[true:true]) + foo(); #pragma omp target parallel map(x) foo(); #pragma omp target parallel map(tofrom: t[:I]) @@ -163,7 +165,7 @@ T tmain(T argc) { foo(); #pragma omp target parallel map(always: x) // expected-error {{missing map type}} foo(); -#pragma omp target parallel map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always' or 'close'}} expected-error {{missing map type}} +#pragma omp target parallel map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always', 'close', or 'mapper'}} expected-error {{missing map type}} foo(); #pragma omp target parallel map(always, tofrom: always, tofrom, x) foo(); @@ -205,6 +207,8 @@ int main(int argc, char **argv) { foo(); #pragma omp target parallel map(l[:-1]) // expected-error {{section length is evaluated to a negative value -1}} foo(); +#pragma omp target parallel map(l[true:true]) + foo(); #pragma omp target parallel map(x) foo(); #pragma omp target parallel map(to: x) @@ -270,7 +274,7 @@ int main(int argc, char **argv) { foo(); #pragma omp target parallel map(always: x) // expected-error {{missing map type}} foo(); -#pragma omp target parallel map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always' or 'close'}} expected-error {{missing map type}} +#pragma omp target parallel map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always', 'close', or 'mapper'}} expected-error {{missing map type}} foo(); #pragma omp target parallel map(always, tofrom: always, tofrom, x) foo(); diff --git a/test/OpenMP/target_parallel_num_threads_codegen.cpp b/test/OpenMP/target_parallel_num_threads_codegen.cpp index 7a39a3fd1c..41a779ced3 100644 --- a/test/OpenMP/target_parallel_num_threads_codegen.cpp +++ b/test/OpenMP/target_parallel_num_threads_codegen.cpp @@ -263,7 +263,7 @@ int bar(int n){ // CHECK: store i16 [[CEV]], i16* [[CONV]], align // CHECK: [[ARG:%.+]] = load i[[SZ]], i[[SZ]]* [[CAPEC_ADDR]], align // CHECK: [[T:%.+]] = load i16, i16* [[CAPE_ADDR]], align -// CHECK: [[THREADS:%.+]] = sext i16 [[T]] to i32 +// CHECK: [[THREADS:%.+]] = zext i16 [[T]] to i32 // // CHECK-DAG: [[RET:%.+]] = call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 3, {{.*}}, i32 1, i32 [[THREADS]]) // CHECK: [[ERROR:%.+]] = icmp ne i32 [[RET]], 0 diff --git a/test/OpenMP/target_parallel_private_messages.cpp b/test/OpenMP/target_parallel_private_messages.cpp index de71c03ad4..97ed1fc96a 100644 --- a/test/OpenMP/target_parallel_private_messages.cpp +++ b/test/OpenMP/target_parallel_private_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -76,7 +86,7 @@ int foomain(I argc, C **argv) { {} #pragma omp target parallel private(argc argv) // expected-error {{expected ',' or ')' in 'private' clause}} {} -#pragma omp target parallel private(argc) +#pragma omp target parallel private(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} {} #pragma omp target parallel private(S1) // expected-error {{'S1' does not refer to a value}} {} @@ -86,7 +96,7 @@ int foomain(I argc, C **argv) { {} #pragma omp target parallel private(argv[1]) // expected-error {{expected variable name}} {} -#pragma omp target parallel private(ba) +#pragma omp target parallel allocate(omp_thread_mem_alloc: ba) private(ba) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target parallel' directive}} {} #pragma omp target parallel private(ca) // expected-error {{const-qualified variable without mutable fields cannot be private}} {} diff --git a/test/OpenMP/target_parallel_reduction_messages.cpp b/test/OpenMP/target_parallel_reduction_messages.cpp index 63a00caf92..eca57a8cce 100644 --- a/test/OpenMP/target_parallel_reduction_messages.cpp +++ b/test/OpenMP/target_parallel_reduction_messages.cpp @@ -6,6 +6,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -112,7 +122,7 @@ T tmain(T argc) { foo(); #pragma omp target parallel reduction(foo : argc) //expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'float'}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int'}} foo(); -#pragma omp target parallel reduction(&& : argc) +#pragma omp target parallel reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} foo(); #pragma omp target parallel reduction(^ : T) // expected-error {{'T' does not refer to a value}} foo(); @@ -156,7 +166,7 @@ T tmain(T argc) { #pragma omp for private(fl) for (int i = 0; i < 10; ++i) {} -#pragma omp target parallel reduction(+ : fl) +#pragma omp target parallel reduction(+ : fl) allocate(omp_thread_mem_alloc: fl) // expected-warning 2 {{allocator with the 'thread' trait access has unspecified behavior on 'target parallel' directive}} foo(); #pragma omp target parallel #pragma omp for reduction(- : fl) diff --git a/test/OpenMP/target_private_messages.cpp b/test/OpenMP/target_private_messages.cpp index 49ee3fed3e..245a0ea2b0 100644 --- a/test/OpenMP/target_private_messages.cpp +++ b/test/OpenMP/target_private_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + struct S1; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}} extern S1 a; class S2 { @@ -51,7 +61,7 @@ public: S6() : a(0) {} S6(T v) : a(v) { -#pragma omp target private(a) private(this->a) +#pragma omp target private(a) private(this->a) allocate(omp_thread_mem_alloc: a) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target' directive}} for (int k = 0; k < v; ++k) ++this->a; } @@ -103,7 +113,7 @@ int foomain(I argc, C **argv) { {} #pragma omp target private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} {} -#pragma omp target private(argc) +#pragma omp target private(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} {} #pragma omp target private(S1) // expected-error {{'S1' does not refer to a value}} {} @@ -147,7 +157,7 @@ using A::x; int main(int argc, char **argv) { S4 e(4); S5 g(5); - S6<float> s6(0.0) , s6_0(1.0); + S6<float> s6(0.0) , s6_0(1.0); // expected-note {{in instantiation of member function 'S6<float>::S6' requested here}} S7<S6<float> > s7(0.0) , s7_0(1.0); int i; int &j = i; diff --git a/test/OpenMP/target_reduction_messages.cpp b/test/OpenMP/target_reduction_messages.cpp index 29a12aba85..b9b744f455 100644 --- a/test/OpenMP/target_reduction_messages.cpp +++ b/test/OpenMP/target_reduction_messages.cpp @@ -6,6 +6,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -154,7 +164,7 @@ T tmain(T argc) { #pragma omp parallel #pragma omp for private(fl) for (int i = 0; i < 10; ++i) -#pragma omp target reduction(+ : fl) +#pragma omp target reduction(+ : fl) allocate(omp_thread_mem_alloc: fl) // expected-warning 2 {{allocator with the 'thread' trait access has unspecified behavior on 'target' directive}} foo(); #pragma omp parallel #pragma omp for reduction(- : fl) @@ -207,7 +217,7 @@ int main(int argc, char **argv) { foo(); #pragma omp target reduction(~ : argc) // expected-error {{expected unqualified-id}} foo(); -#pragma omp target reduction(&& : argc) +#pragma omp target reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} foo(); #pragma omp target reduction(^ : S1) // expected-error {{'S1' does not refer to a value}} foo(); diff --git a/test/OpenMP/target_simd_ast_print.cpp b/test/OpenMP/target_simd_ast_print.cpp index 7d3daa36f3..a68dd34f0b 100644 --- a/test/OpenMP/target_simd_ast_print.cpp +++ b/test/OpenMP/target_simd_ast_print.cpp @@ -76,20 +76,20 @@ T tmain(T argc, T *argv) { // CHECK: T clen = 5; T *p; #pragma omp threadprivate(g) -#pragma omp target simd linear(a) - // CHECK: #pragma omp target simd linear(a) +#pragma omp target simd linear(a) allocate(a) + // CHECK: #pragma omp target simd linear(a) allocate(a) for (T i = 0; i < 2; ++i) a = 2; // CHECK-NEXT: for (T i = 0; i < 2; ++i) // CHECK-NEXT: a = 2; -#pragma omp target simd private(argc, b), firstprivate(c, d), lastprivate(d, f) collapse(N) if (target :argc) reduction(+ : h) +#pragma omp target simd allocate(f) private(argc, b), firstprivate(c, d), lastprivate(d, f) collapse(N) if (target :argc) reduction(+ : h) for (int i = 0; i < 2; ++i) for (int j = 0; j < 2; ++j) for (int j = 0; j < 2; ++j) for (int j = 0; j < 2; ++j) for (int j = 0; j < 2; ++j) foo(); - // CHECK-NEXT: #pragma omp target simd private(argc,b) firstprivate(c,d) lastprivate(d,f) collapse(N) if(target: argc) reduction(+: h) + // CHECK-NEXT: #pragma omp target simd allocate(f) private(argc,b) firstprivate(c,d) lastprivate(d,f) collapse(N) if(target: argc) reduction(+: h) // CHECK-NEXT: for (int i = 0; i < 2; ++i) // CHECK-NEXT: for (int j = 0; j < 2; ++j) // CHECK-NEXT: for (int j = 0; j < 2; ++j) diff --git a/test/OpenMP/target_simd_codegen.cpp b/test/OpenMP/target_simd_codegen.cpp index 13504213c5..6a9ac90fe7 100644 --- a/test/OpenMP/target_simd_codegen.cpp +++ b/test/OpenMP/target_simd_codegen.cpp @@ -110,7 +110,7 @@ int foo(int n) { double cn[5][n]; TT<long long, char> d; - // CHECK: [[RET:%.+]] = call i32 @__tgt_target_nowait(i64 -1, i8* @{{[^,]+}}, i32 0, i8** null, i8** null, i[[SZ]]* null, i64* null) + // CHECK: [[RET:%.+]] = call i32 @__tgt_target_teams_nowait(i64 -1, i8* @{{[^,]+}}, i32 0, i8** null, i8** null, i[[SZ]]* null, i64* null, i32 1, i32 1) // CHECK-NEXT: [[ERROR:%.+]] = icmp ne i32 [[RET]], 0 // CHECK-NEXT: br i1 [[ERROR]], label %[[FAIL:[^,]+]], label %[[END:[^,]+]] // CHECK: [[FAIL]] @@ -128,7 +128,7 @@ int foo(int n) { a += 1; } - // CHECK-DAG: [[RET:%.+]] = call i32 @__tgt_target(i64 -1, i8* @{{[^,]+}}, i32 3, i8** [[BP:%[^,]+]], i8** [[P:%[^,]+]], i[[SZ]]* getelementptr inbounds ([3 x i[[SZ]]], [3 x i[[SZ]]]* [[SIZET2]], i32 0, i32 0), i64* getelementptr inbounds ([3 x i64], [3 x i64]* [[MAPT2]], i32 0, i32 0)) + // CHECK-DAG: [[RET:%.+]] = call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 3, i8** [[BP:%[^,]+]], i8** [[P:%[^,]+]], i[[SZ]]* getelementptr inbounds ([3 x i[[SZ]]], [3 x i[[SZ]]]* [[SIZET2]], i32 0, i32 0), i64* getelementptr inbounds ([3 x i64], [3 x i64]* [[MAPT2]], i32 0, i32 0), i32 1, i32 1) // CHECK-DAG: [[BP]] = getelementptr inbounds [3 x i8*], [3 x i8*]* [[BPR:%[^,]+]], i32 0, i32 0 // CHECK-DAG: [[P]] = getelementptr inbounds [3 x i8*], [3 x i8*]* [[PR:%[^,]+]], i32 0, i32 0 // CHECK-DAG: [[BPADDR0:%.+]] = getelementptr inbounds [3 x i8*], [3 x i8*]* [[BPR]], i32 0, i32 0 @@ -165,7 +165,7 @@ int foo(int n) { // CHECK: [[IF:%.+]] = icmp sgt i32 {{[^,]+}}, 10 // CHECK: br i1 [[IF]], label %[[IFTHEN:[^,]+]], label %[[IFELSE:[^,]+]] // CHECK: [[IFTHEN]] - // CHECK-DAG: [[RET:%.+]] = call i32 @__tgt_target(i64 -1, i8* @{{[^,]+}}, i32 2, i8** [[BPR:%[^,]+]], i8** [[PR:%[^,]+]], i[[SZ]]* getelementptr inbounds ([2 x i[[SZ]]], [2 x i[[SZ]]]* [[SIZET3]], i32 0, i32 0), i64* getelementptr inbounds ([2 x i64], [2 x i64]* [[MAPT3]], i32 0, i32 0)) + // CHECK-DAG: [[RET:%.+]] = call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 2, i8** [[BPR:%[^,]+]], i8** [[PR:%[^,]+]], i[[SZ]]* getelementptr inbounds ([2 x i[[SZ]]], [2 x i[[SZ]]]* [[SIZET3]], i32 0, i32 0), i64* getelementptr inbounds ([2 x i64], [2 x i64]* [[MAPT3]], i32 0, i32 0), i32 1, i32 1) // CHECK-DAG: [[BPR]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[BP:%[^,]+]], i32 0, i32 0 // CHECK-DAG: [[PR]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[P:%[^,]+]], i32 0, i32 0 @@ -217,7 +217,7 @@ int foo(int n) { // CHECK: [[CNELEMSIZE2:%.+]] = mul nuw i[[SZ]] 5, [[VLA1:%.+]] // CHECK: [[CNSIZE:%.+]] = mul nuw i[[SZ]] [[CNELEMSIZE2]], 8 - // CHECK-DAG: [[RET:%.+]] = call i32 @__tgt_target(i64 -1, i8* @{{[^,]+}}, i32 9, i8** [[BPR:%[^,]+]], i8** [[PR:%[^,]+]], i[[SZ]]* [[SR:%[^,]+]], i64* getelementptr inbounds ([9 x i64], [9 x i64]* [[MAPT4]], i32 0, i32 0)) + // CHECK-DAG: [[RET:%.+]] = call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 9, i8** [[BPR:%[^,]+]], i8** [[PR:%[^,]+]], i[[SZ]]* [[SR:%[^,]+]], i64* getelementptr inbounds ([9 x i64], [9 x i64]* [[MAPT4]], i32 0, i32 0), i32 1, i32 1) // CHECK-DAG: [[BPR]] = getelementptr inbounds [9 x i8*], [9 x i8*]* [[BP:%[^,]+]], i32 0, i32 0 // CHECK-DAG: [[PR]] = getelementptr inbounds [9 x i8*], [9 x i8*]* [[P:%[^,]+]], i32 0, i32 0 // CHECK-DAG: [[SR]] = getelementptr inbounds [9 x i[[SZ]]], [9 x i[[SZ]]]* [[S:%[^,]+]], i32 0, i32 0 @@ -489,7 +489,7 @@ int bar(int n){ // CHECK: [[CELEMSIZE2:%.+]] = mul nuw i[[SZ]] 2, [[VLA0:%.+]] // CHECK: [[CSIZE:%.+]] = mul nuw i[[SZ]] [[CELEMSIZE2]], 2 -// CHECK-DAG: [[RET:%.+]] = call i32 @__tgt_target(i64 -1, i8* @{{[^,]+}}, i32 6, i8** [[BPR:%[^,]+]], i8** [[PR:%[^,]+]], i[[SZ]]* [[SR:%[^,]+]], i64* getelementptr inbounds ([6 x i64], [6 x i64]* [[MAPT7]], i32 0, i32 0)) +// CHECK-DAG: [[RET:%.+]] = call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 6, i8** [[BPR:%[^,]+]], i8** [[PR:%[^,]+]], i[[SZ]]* [[SR:%[^,]+]], i64* getelementptr inbounds ([6 x i64], [6 x i64]* [[MAPT7]], i32 0, i32 0), i32 1, i32 1) // CHECK-DAG: [[BPR]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[BP:%.+]], i32 0, i32 0 // CHECK-DAG: [[PR]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[P:%.+]], i32 0, i32 0 // CHECK-DAG: [[SR]] = getelementptr inbounds [6 x i[[SZ]]], [6 x i[[SZ]]]* [[S:%.+]], i32 0, i32 0 @@ -564,7 +564,7 @@ int bar(int n){ // CHECK: [[IF:%.+]] = icmp sgt i32 {{[^,]+}}, 50 // CHECK: br i1 [[IF]], label %[[IFTHEN:[^,]+]], label %[[IFELSE:[^,]+]] // CHECK: [[IFTHEN]] -// CHECK-DAG: [[RET:%.+]] = call i32 @__tgt_target(i64 -1, i8* @{{[^,]+}}, i32 4, i8** [[BPR:%[^,]+]], i8** [[PR:%[^,]+]], i[[SZ]]* getelementptr inbounds ([4 x i[[SZ]]], [4 x i[[SZ]]]* [[SIZET6]], i32 0, i32 0), i64* getelementptr inbounds ([4 x i64], [4 x i64]* [[MAPT6]], i32 0, i32 0)) +// CHECK-DAG: [[RET:%.+]] = call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 4, i8** [[BPR:%[^,]+]], i8** [[PR:%[^,]+]], i[[SZ]]* getelementptr inbounds ([4 x i[[SZ]]], [4 x i[[SZ]]]* [[SIZET6]], i32 0, i32 0), i64* getelementptr inbounds ([4 x i64], [4 x i64]* [[MAPT6]], i32 0, i32 0), i32 1, i32 1) // CHECK-DAG: [[BPR]] = getelementptr inbounds [4 x i8*], [4 x i8*]* [[BP:%.+]], i32 0, i32 0 // CHECK-DAG: [[PR]] = getelementptr inbounds [4 x i8*], [4 x i8*]* [[P:%.+]], i32 0, i32 0 @@ -614,7 +614,7 @@ int bar(int n){ // CHECK: [[IF:%.+]] = icmp sgt i32 {{[^,]+}}, 40 // CHECK: br i1 [[IF]], label %[[IFTHEN:[^,]+]], label %[[IFELSE:[^,]+]] // CHECK: [[IFTHEN]] -// CHECK-DAG: [[RET:%.+]] = call i32 @__tgt_target(i64 -1, i8* @{{[^,]+}}, i32 3, i8** [[BPR:%[^,]+]], i8** [[PR:%[^,]+]], i[[SZ]]* getelementptr inbounds ([3 x i[[SZ]]], [3 x i[[SZ]]]* [[SIZET5]], i32 0, i32 0), i64* getelementptr inbounds ([3 x i64], [3 x i64]* [[MAPT5]], i32 0, i32 0)) +// CHECK-DAG: [[RET:%.+]] = call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 3, i8** [[BPR:%[^,]+]], i8** [[PR:%[^,]+]], i[[SZ]]* getelementptr inbounds ([3 x i[[SZ]]], [3 x i[[SZ]]]* [[SIZET5]], i32 0, i32 0), i64* getelementptr inbounds ([3 x i64], [3 x i64]* [[MAPT5]], i32 0, i32 0), i32 1, i32 1) // CHECK-DAG: [[BPR]] = getelementptr inbounds [3 x i8*], [3 x i8*]* [[BP:%.+]], i32 0, i32 0 // CHECK-DAG: [[PR]] = getelementptr inbounds [3 x i8*], [3 x i8*]* [[P:%.+]], i32 0, i32 0 diff --git a/test/OpenMP/target_simd_collapse_messages.cpp b/test/OpenMP/target_simd_collapse_messages.cpp index 400844152b..8bf2c3bbf7 100644 --- a/test/OpenMP/target_simd_collapse_messages.cpp +++ b/test/OpenMP/target_simd_collapse_messages.cpp @@ -41,7 +41,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} // expected-note@+5 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif // expected-error@+3 2 {{directive '#pragma omp target simd' cannot contain more than one 'collapse' clause}} - // expected-error@+2 2 {{argument to 'collapse' clause must be a strictly positive integer value}} + // expected-error@+2 {{argument to 'collapse' clause must be a strictly positive integer value}} // expected-error@+1 2 {{expression is not an integral constant expression}} #pragma omp target simd collapse (foobool(argc)), collapse (true), collapse (-5) for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; @@ -82,7 +82,7 @@ int main(int argc, char **argv) { #endif // expected-error@+3 {{expression is not an integral constant expression}} // expected-error@+2 2 {{directive '#pragma omp target simd' cannot contain more than one 'collapse' clause}} - // expected-error@+1 2 {{argument to 'collapse' clause must be a strictly positive integer value}} + // expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}} #pragma omp target simd collapse (foobool(argc)), collapse (true), collapse (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; #pragma omp target simd collapse (S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/target_simd_depend_codegen.cpp b/test/OpenMP/target_simd_depend_codegen.cpp index e87b4fc8c3..8a9ed02b50 100644 --- a/test/OpenMP/target_simd_depend_codegen.cpp +++ b/test/OpenMP/target_simd_depend_codegen.cpp @@ -98,7 +98,7 @@ int foo(int n) { // CHECK: getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 1 // CHECK: getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 2 // CHECK: getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 3 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call void @__kmpc_omp_wait_deps(%struct.ident_t* @0, i32 [[GTID]], i32 4, i8* [[DEP]], i32 0, i8* null) // CHECK: call void @__kmpc_omp_task_begin_if0(%struct.ident_t* @0, i32 [[GTID]], i8* [[TASK]]) @@ -138,7 +138,7 @@ int foo(int n) { // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 1 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 2 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call i32 @__kmpc_omp_task_with_deps(%struct.ident_t* @0, i32 [[GTID]], i8* [[TASK]], i32 3, i8* [[DEP]], i32 0, i8* null) // CHECK: br label %[[EXIT:.+]] @@ -154,7 +154,7 @@ int foo(int n) { // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 1 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 2 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call i32 @__kmpc_omp_task_with_deps(%struct.ident_t* @0, i32 [[GTID]], i8* [[TASK]], i32 3, i8* [[DEP]], i32 0, i8* null) // CHECK: br label %[[EXIT:.+]] @@ -170,7 +170,7 @@ int foo(int n) { // CHECK: [[TASK:%.+]] = call i8* @__kmpc_omp_task_alloc(%struct.ident_t* @0, i32 [[GTID]], i32 1, i[[SZ]] {{48|24}}, i[[SZ]] 4, i32 (i32, i8*)* bitcast (i32 (i32, %{{.+}}*)* [[TASK_ENTRY2:@.+]] to i32 (i32, i8*)*)) // CHECK: [[BC_TASK:%.+]] = bitcast i8* [[TASK]] to [[TASK_TY2:%.+]]* // CHECK: getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call void @__kmpc_omp_wait_deps(%struct.ident_t* @0, i32 [[GTID]], i32 1, i8* [[DEP]], i32 0, i8* null) // CHECK: call void @__kmpc_omp_task_begin_if0(%struct.ident_t* @0, i32 [[GTID]], i8* [[TASK]]) @@ -194,7 +194,7 @@ int foo(int n) { // CHECK: [[DEVICE_CAP:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* %{{.+}}, i32 0, i32 0 // CHECK: [[DEV:%.+]] = load i32, i32* [[DEVICE_CAP]], // CHECK: [[DEVICE:%.+]] = sext i32 [[DEV]] to i64 -// CHECK: [[RET:%.+]] = call i32 @__tgt_target(i64 [[DEVICE]], i8* @{{[^,]+}}, i32 0, i8** null, i8** null, i[[SZ]]* null, i64* null) +// CHECK: [[RET:%.+]] = call i32 @__tgt_target_teams(i64 [[DEVICE]], i8* @{{[^,]+}}, i32 0, i8** null, i8** null, i[[SZ]]* null, i64* null, i32 1, i32 1) // CHECK-NEXT: [[ERROR:%.+]] = icmp ne i32 [[RET]], 0 // CHECK-NEXT: br i1 [[ERROR]], label %[[FAIL:[^,]+]], label %[[END:[^,]+]] // CHECK: [[FAIL]] @@ -211,7 +211,7 @@ int foo(int n) { // CHECK: [[DEVICE_CAP:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* %{{.+}}, i32 0, i32 2 // CHECK: [[DEV:%.+]] = load i32, i32* [[DEVICE_CAP]], // CHECK: [[DEVICE:%.+]] = sext i32 [[DEV]] to i64 -// CHECK: [[RET:%.+]] = call i32 @__tgt_target_nowait(i64 [[DEVICE]], i8* @{{[^,]+}}, i32 2, i8** [[BPR:%[^,]+]], i8** [[PR:%[^,]+]], i[[SZ]]* [[SZT]], i64* getelementptr inbounds ([2 x i64], [2 x i64]* [[MAPT]], i32 0, i32 0) +// CHECK: [[RET:%.+]] = call i32 @__tgt_target_teams_nowait(i64 [[DEVICE]], i8* @{{[^,]+}}, i32 2, i8** [[BPR:%[^,]+]], i8** [[PR:%[^,]+]], i[[SZ]]* [[SZT]], i64* getelementptr inbounds ([2 x i64], [2 x i64]* [[MAPT]], i32 0, i32 0), i32 1, i32 1) // CHECK: [[ERROR:%.+]] = icmp ne i32 [[RET]], 0 // CHECK-NEXT: br i1 [[ERROR]], label %[[FAIL:[^,]+]], label %[[END:[^,]+]] diff --git a/test/OpenMP/target_simd_depend_messages.cpp b/test/OpenMP/target_simd_depend_messages.cpp index 80f988d7a0..69594db71c 100644 --- a/test/OpenMP/target_simd_depend_messages.cpp +++ b/test/OpenMP/target_simd_depend_messages.cpp @@ -25,13 +25,13 @@ int main(int argc, char **argv, char *env[]) { #pragma omp target simd depend // expected-error {{expected '(' after 'depend'}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target simd 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 target simd depend ( // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after dependency type - ignoring}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target simd depend () // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} + #pragma omp target simd depend () // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target simd 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 target simd depend (argc // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}} for (i = 0; i < argc; ++i) foo(); - #pragma omp target simd depend (source : argc) // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} + #pragma omp target simd depend (source : argc) // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} for (i = 0; i < argc; ++i) foo(); #pragma omp target simd depend (source) // expected-error {{expected expression}} expected-warning {{missing ':' after dependency type - ignoring}} for (i = 0; i < argc; ++i) foo(); diff --git a/test/OpenMP/target_simd_firstprivate_messages.cpp b/test/OpenMP/target_simd_firstprivate_messages.cpp index 85b216b4cb..eac95ade6f 100644 --- a/test/OpenMP/target_simd_firstprivate_messages.cpp +++ b/test/OpenMP/target_simd_firstprivate_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -86,7 +96,7 @@ int foomain(int argc, char **argv) { #pragma omp target simd firstprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp target simd firstprivate(argc) +#pragma omp target simd firstprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target simd firstprivate(S1) // expected-error {{'S1' does not refer to a value}} @@ -108,7 +118,7 @@ int foomain(int argc, char **argv) { { int v = 0; int i; -#pragma omp target simd firstprivate(i) +#pragma omp target simd allocate(omp_thread_mem_alloc: i) firstprivate(i) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target simd' directive}} for (int k = 0; k < argc; ++k) { i = k; v += i; diff --git a/test/OpenMP/target_simd_lastprivate_messages.cpp b/test/OpenMP/target_simd_lastprivate_messages.cpp index 70a452f6a5..8b485840ce 100644 --- a/test/OpenMP/target_simd_lastprivate_messages.cpp +++ b/test/OpenMP/target_simd_lastprivate_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -88,7 +98,7 @@ int foomain(int argc, char **argv) { #pragma omp target simd lastprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp target simd lastprivate(argc) +#pragma omp target simd lastprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target simd lastprivate(S1) // expected-error {{'S1' does not refer to a value}} @@ -110,7 +120,7 @@ int foomain(int argc, char **argv) { { int v = 0; int i; -#pragma omp target simd lastprivate(i) +#pragma omp target simd lastprivate(i) allocate(omp_thread_mem_alloc: i) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target simd' directive}} for (int k = 0; k < argc; ++k) { i = k; v += i; diff --git a/test/OpenMP/target_simd_linear_messages.cpp b/test/OpenMP/target_simd_linear_messages.cpp index d19409f280..86e3cc43fb 100644 --- a/test/OpenMP/target_simd_linear_messages.cpp +++ b/test/OpenMP/target_simd_linear_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + namespace X { int x; }; @@ -139,7 +149,7 @@ int foomain(I argc, C **argv) { #pragma omp target simd linear(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp target simd linear(argc : 5) +#pragma omp target simd linear(argc : 5) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target simd linear(S1) // expected-error {{'S1' does not refer to a value}} @@ -153,7 +163,7 @@ int foomain(I argc, C **argv) { #pragma omp target simd linear(argv[1]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp target simd linear(e, g) +#pragma omp target simd allocate(omp_thread_mem_alloc: e) linear(e, g) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target simd' directive}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target simd linear(h) // expected-error {{threadprivate or thread local variable cannot be linear}} diff --git a/test/OpenMP/target_simd_map_messages.cpp b/test/OpenMP/target_simd_map_messages.cpp index acd6298808..4b76042e45 100644 --- a/test/OpenMP/target_simd_map_messages.cpp +++ b/test/OpenMP/target_simd_map_messages.cpp @@ -159,7 +159,7 @@ T tmain(T argc) { for (i = 0; i < argc; ++i) foo(); #pragma omp target simd map(always: x) // expected-error {{missing map type}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target simd map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always' or 'close'}} expected-error {{missing map type}} +#pragma omp target simd map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always', 'close', or 'mapper'}} expected-error {{missing map type}} for (i = 0; i < argc; ++i) foo(); #pragma omp target simd map(always, tofrom: always, tofrom, x) for (i = 0; i < argc; ++i) foo(); @@ -263,7 +263,7 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); #pragma omp target simd map(always: x) // expected-error {{missing map type}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target simd map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always' or 'close'}} expected-error {{missing map type}} +#pragma omp target simd map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always', 'close', or 'mapper'}} expected-error {{missing map type}} for (i = 0; i < argc; ++i) foo(); #pragma omp target simd map(always, tofrom: always, tofrom, x) for (i = 0; i < argc; ++i) foo(); diff --git a/test/OpenMP/target_simd_private_messages.cpp b/test/OpenMP/target_simd_private_messages.cpp index 1b7d864c7c..f95d77c302 100644 --- a/test/OpenMP/target_simd_private_messages.cpp +++ b/test/OpenMP/target_simd_private_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -58,7 +68,7 @@ public: S6() : a(0) {} S6(T v) : a(v) { -#pragma omp target simd private(a) private(this->a) +#pragma omp target simd private(a) private(this->a) allocate(omp_thread_mem_alloc: a) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target simd' directive}} for (int k = 0; k < v; ++k) ++this->a; } @@ -116,7 +126,7 @@ int foomain(I argc, C **argv) { #pragma omp target simd private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp target simd private(argc) +#pragma omp target simd private(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target simd private(S1) // expected-error {{'S1' does not refer to a value}} @@ -166,7 +176,7 @@ using A::x; int main(int argc, char **argv) { S4 e(4); S5 g(5); - S6<float> s6(0.0) , s6_0(1.0); + S6<float> s6(0.0) , s6_0(1.0); // expected-note {{in instantiation of member function 'S6<float>::S6' requested here}} S7<S6<float> > s7(0.0) , s7_0(1.0); int i; int &j = i; diff --git a/test/OpenMP/target_simd_reduction_messages.cpp b/test/OpenMP/target_simd_reduction_messages.cpp index cf6c9f6295..e50159462c 100644 --- a/test/OpenMP/target_simd_reduction_messages.cpp +++ b/test/OpenMP/target_simd_reduction_messages.cpp @@ -6,6 +6,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 %s // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -14,7 +24,7 @@ bool foobool(int argc) { } void foobar(int &ref) { -#pragma omp target simd reduction(+:ref) +#pragma omp target simd allocate(omp_thread_mem_alloc: ref) reduction(+:ref) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target simd' directive}} for (int i = 0; i < 10; ++i) foo(); } @@ -124,7 +134,7 @@ T tmain(T argc) { #pragma omp target simd reduction(foo : argc) //expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'float'}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int'}} for (int i = 0; i < 10; ++i) foo(); -#pragma omp target simd reduction(&& : argc) +#pragma omp target simd reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int i = 0; i < 10; ++i) foo(); #pragma omp target simd reduction(^ : T) // expected-error {{'T' does not refer to a value}} diff --git a/test/OpenMP/target_simd_safelen_messages.cpp b/test/OpenMP/target_simd_safelen_messages.cpp index 69ceab1a68..993d707114 100644 --- a/test/OpenMP/target_simd_safelen_messages.cpp +++ b/test/OpenMP/target_simd_safelen_messages.cpp @@ -39,7 +39,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} #pragma omp target simd safelen ((ST > 0) ? 1 + ST : 2) for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; // expected-error@+6 2 {{directive '#pragma omp target simd' cannot contain more than one 'safelen' clause}} - // expected-error@+5 2 {{argument to 'safelen' clause must be a strictly positive integer value}} + // expected-error@+5 {{argument to 'safelen' clause must be a strictly positive integer value}} // expected-error@+4 2 {{expression is not an integral constant expression}} #if __cplusplus >= 201103L // expected-note@+2 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} @@ -84,7 +84,7 @@ int main(int argc, char **argv) { // expected-note@+4 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif // expected-error@+2 2 {{directive '#pragma omp target simd' cannot contain more than one 'safelen' clause}} - // expected-error@+1 2 {{argument to 'safelen' clause must be a strictly positive integer value}} + // expected-error@+1 {{argument to 'safelen' clause must be a strictly positive integer value}} #pragma omp target simd safelen (foobool(argc)), safelen (true), safelen (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; #pragma omp target simd safelen (S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/target_simd_simdlen_messages.cpp b/test/OpenMP/target_simd_simdlen_messages.cpp index c65fe20d3a..3a6e477886 100644 --- a/test/OpenMP/target_simd_simdlen_messages.cpp +++ b/test/OpenMP/target_simd_simdlen_messages.cpp @@ -46,7 +46,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; // expected-error@+6 2 {{directive '#pragma omp target simd' cannot contain more than one 'simdlen' clause}} - // expected-error@+5 2 {{argument to 'simdlen' clause must be a strictly positive integer value}} + // expected-error@+5 {{argument to 'simdlen' clause must be a strictly positive integer value}} // expected-error@+4 2 {{expression is not an integral constant expression}} #if __cplusplus >= 201103L // expected-note@+2 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} @@ -111,7 +111,7 @@ int main(int argc, char **argv) { // expected-note@+4 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif // expected-error@+2 2 {{directive '#pragma omp target simd' cannot contain more than one 'simdlen' clause}} -// expected-error@+1 2 {{argument to 'simdlen' clause must be a strictly positive integer value}} +// expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}} #pragma omp target simd simdlen (foobool(argc)), simdlen (true), simdlen (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; diff --git a/test/OpenMP/target_teams_ast_print.cpp b/test/OpenMP/target_teams_ast_print.cpp index a0cb63535d..9bf037e0db 100644 --- a/test/OpenMP/target_teams_ast_print.cpp +++ b/test/OpenMP/target_teams_ast_print.cpp @@ -39,9 +39,9 @@ T tmain(T argc, T *argv) { S<T> s; #pragma omp target teams a=2; -#pragma omp target teams default(none), private(argc,b) firstprivate(argv) shared (d) reduction(+:c) reduction(max:e) num_teams(C) thread_limit(d*C) +#pragma omp target teams default(none), private(argc,b) firstprivate(argv) shared (d) reduction(+:c) reduction(max:e) num_teams(C) thread_limit(d*C) allocate(argv) foo(); -#pragma omp target teams reduction(^:e, f) reduction(&& : g) +#pragma omp target teams allocate(f) reduction(^:e, f) reduction(&& : g) foo(); return 0; } @@ -52,9 +52,9 @@ T tmain(T argc, T *argv) { // CHECK-NEXT: S<T> s; // CHECK-NEXT: #pragma omp target teams{{$}} // CHECK-NEXT: a = 2; -// CHECK-NEXT: #pragma omp target teams default(none) private(argc,b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(C) thread_limit(d * C) +// CHECK-NEXT: #pragma omp target teams default(none) private(argc,b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(C) thread_limit(d * C) allocate(argv) // CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target teams reduction(^: e,f) reduction(&&: g) +// CHECK-NEXT: #pragma omp target teams allocate(f) reduction(^: e,f) reduction(&&: g) // CHECK-NEXT: foo() // CHECK: template<> int tmain<int, 5>(int argc, int *argv) { // CHECK-NEXT: int b = argc, c, d, e, f, g; @@ -62,9 +62,9 @@ T tmain(T argc, T *argv) { // CHECK-NEXT: S<int> s; // CHECK-NEXT: #pragma omp target teams // CHECK-NEXT: a = 2; -// CHECK-NEXT: #pragma omp target teams default(none) private(argc,b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(5) thread_limit(d * 5) +// CHECK-NEXT: #pragma omp target teams default(none) private(argc,b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(5) thread_limit(d * 5) allocate(argv) // CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target teams reduction(^: e,f) reduction(&&: g) +// CHECK-NEXT: #pragma omp target teams allocate(f) reduction(^: e,f) reduction(&&: g) // CHECK-NEXT: foo() // CHECK: template<> long tmain<long, 1>(long argc, long *argv) { // CHECK-NEXT: long b = argc, c, d, e, f, g; @@ -72,9 +72,9 @@ T tmain(T argc, T *argv) { // CHECK-NEXT: S<long> s; // CHECK-NEXT: #pragma omp target teams // CHECK-NEXT: a = 2; -// CHECK-NEXT: #pragma omp target teams default(none) private(argc,b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(1) thread_limit(d * 1) +// CHECK-NEXT: #pragma omp target teams default(none) private(argc,b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(1) thread_limit(d * 1) allocate(argv) // CHECK-NEXT: foo() -// CHECK-NEXT: #pragma omp target teams reduction(^: e,f) reduction(&&: g) +// CHECK-NEXT: #pragma omp target teams allocate(f) reduction(^: e,f) reduction(&&: g) // CHECK-NEXT: foo() enum Enum { }; diff --git a/test/OpenMP/target_teams_default_messages.cpp b/test/OpenMP/target_teams_default_messages.cpp index 18520d9e8d..a144fa05f1 100644 --- a/test/OpenMP/target_teams_default_messages.cpp +++ b/test/OpenMP/target_teams_default_messages.cpp @@ -18,10 +18,10 @@ int main(int argc, char **argv) { #pragma omp target teams default (x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} foo(); -#pragma omp target teams default(none) +#pragma omp target teams default(none) // expected-note {{explicit data sharing attribute requested here}} ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} -#pragma omp target teams default(none) +#pragma omp target teams default(none) // expected-note {{explicit data sharing attribute requested here}} #pragma omp parallel default(shared) ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} return 0; diff --git a/test/OpenMP/target_teams_depend_codegen.cpp b/test/OpenMP/target_teams_depend_codegen.cpp index 9f9c7656ea..3c783fa178 100644 --- a/test/OpenMP/target_teams_depend_codegen.cpp +++ b/test/OpenMP/target_teams_depend_codegen.cpp @@ -98,7 +98,7 @@ int foo(int n) { // CHECK: getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 1 // CHECK: getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 2 // CHECK: getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 3 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call void @__kmpc_omp_wait_deps(%struct.ident_t* @0, i32 [[GTID]], i32 4, i8* [[DEP]], i32 0, i8* null) // CHECK: call void @__kmpc_omp_task_begin_if0(%struct.ident_t* @0, i32 [[GTID]], i8* [[TASK]]) @@ -138,7 +138,7 @@ int foo(int n) { // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 1 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 2 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call i32 @__kmpc_omp_task_with_deps(%struct.ident_t* @0, i32 [[GTID]], i8* [[TASK]], i32 3, i8* [[DEP]], i32 0, i8* null) // CHECK: br label %[[EXIT:.+]] @@ -154,7 +154,7 @@ int foo(int n) { // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 1 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 2 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call i32 @__kmpc_omp_task_with_deps(%struct.ident_t* @0, i32 [[GTID]], i8* [[TASK]], i32 3, i8* [[DEP]], i32 0, i8* null) // CHECK: br label %[[EXIT:.+]] @@ -170,7 +170,7 @@ int foo(int n) { // CHECK: [[TASK:%.+]] = call i8* @__kmpc_omp_task_alloc(%struct.ident_t* @0, i32 [[GTID]], i32 1, i[[SZ]] {{48|24}}, i[[SZ]] 4, i32 (i32, i8*)* bitcast (i32 (i32, %{{.+}}*)* [[TASK_ENTRY2:@.+]] to i32 (i32, i8*)*)) // CHECK: [[BC_TASK:%.+]] = bitcast i8* [[TASK]] to [[TASK_TY2:%.+]]* // CHECK: getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call void @__kmpc_omp_wait_deps(%struct.ident_t* @0, i32 [[GTID]], i32 1, i8* [[DEP]], i32 0, i8* null) // CHECK: call void @__kmpc_omp_task_begin_if0(%struct.ident_t* @0, i32 [[GTID]], i8* [[TASK]]) diff --git a/test/OpenMP/target_teams_depend_messages.cpp b/test/OpenMP/target_teams_depend_messages.cpp index 235ce98ee9..79aef0d35a 100644 --- a/test/OpenMP/target_teams_depend_messages.cpp +++ b/test/OpenMP/target_teams_depend_messages.cpp @@ -24,13 +24,13 @@ int main(int argc, char **argv, char *env[]) { #pragma omp target teams depend // expected-error {{expected '(' after 'depend'}} foo(); -#pragma omp target teams 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 target teams depend ( // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after dependency type - ignoring}} foo(); -#pragma omp target teams depend () // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} +#pragma omp target teams depend () // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} foo(); -#pragma omp target teams 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 target teams depend (argc // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}} foo(); -#pragma omp target teams depend (source : argc) // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} +#pragma omp target teams depend (source : argc) // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} foo(); #pragma omp target teams depend (source) // expected-error {{expected expression}} expected-warning {{missing ':' after dependency type - ignoring}} foo(); diff --git a/test/OpenMP/target_teams_distribute_ast_print.cpp b/test/OpenMP/target_teams_distribute_ast_print.cpp index 4484451c49..616bbebefb 100644 --- a/test/OpenMP/target_teams_distribute_ast_print.cpp +++ b/test/OpenMP/target_teams_distribute_ast_print.cpp @@ -55,7 +55,7 @@ class S8 : public S7<S> { public: S8(int v) : S7<S>(v){ -#pragma omp target teams distribute private(a) private(this->a) private(S7<S>::a) +#pragma omp target teams distribute private(a) private(this->a) private(S7<S>::a) for (int k = 0; k < a.a; ++k) ++this->a.a; } @@ -68,14 +68,14 @@ public: void bar() { int b, argv, d, c, e, f; -#pragma omp target teams distribute default(none), private(b) firstprivate(argv) shared(d) reduction(+:c) reduction(max:e) num_teams(f) thread_limit(d) +#pragma omp target teams distribute allocate(argv) default(none), private(b) firstprivate(argv) shared(d) reduction(+:c) reduction(max:e) num_teams(f) thread_limit(d) allocate(e) for (int k = 0; k < a.a; ++k) ++a.a; } }; // CHECK: #pragma omp target teams distribute private(this->a) private(this->a) private(this->S7<S>::a) // CHECK: #pragma omp target teams distribute private(this->a) private(this->a) -// CHECK: #pragma omp target teams distribute default(none) private(b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(f) thread_limit(d) +// CHECK: #pragma omp target teams distribute allocate(argv) default(none) private(b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(f) thread_limit(d) allocate(e) template <class T, int N> T tmain(T argc) { diff --git a/test/OpenMP/target_teams_distribute_collapse_messages.cpp b/test/OpenMP/target_teams_distribute_collapse_messages.cpp index 4010c5a9a9..7495a18443 100644 --- a/test/OpenMP/target_teams_distribute_collapse_messages.cpp +++ b/test/OpenMP/target_teams_distribute_collapse_messages.cpp @@ -56,7 +56,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} // expected-note@+5 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif // expected-error@+3 2 {{directive '#pragma omp target teams distribute' cannot contain more than one 'collapse' clause}} -// expected-error@+2 2 {{argument to 'collapse' clause must be a strictly positive integer value}} +// expected-error@+2 {{argument to 'collapse' clause must be a strictly positive integer value}} // expected-error@+1 2 {{expression is not an integral constant expression}} #pragma omp target teams distribute collapse (foobool(argc)), collapse (true), collapse (-5) for (int i = ST; i < N; i++) @@ -122,7 +122,7 @@ int main(int argc, char **argv) { #endif // expected-error@+3 {{expression is not an integral constant expression}} // expected-error@+2 2 {{directive '#pragma omp target teams distribute' cannot contain more than one 'collapse' clause}} -// expected-error@+1 2 {{argument to 'collapse' clause must be a strictly positive integer value}} +// expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}} #pragma omp target teams distribute collapse (foobool(argc)), collapse (true), collapse (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; diff --git a/test/OpenMP/target_teams_distribute_default_messages.cpp b/test/OpenMP/target_teams_distribute_default_messages.cpp index 2a3229dde5..539a296f26 100644 --- a/test/OpenMP/target_teams_distribute_default_messages.cpp +++ b/test/OpenMP/target_teams_distribute_default_messages.cpp @@ -18,7 +18,7 @@ int main(int argc, char **argv) { #pragma omp target teams distribute default (x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} for (int i=0; i<200; i++) foo(); - #pragma omp target teams distribute default(none) + #pragma omp target teams distribute default(none) // expected-note {{explicit data sharing attribute requested here}} for (int i=0; i<200; i++) ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} return 0; diff --git a/test/OpenMP/target_teams_distribute_depend_codegen.cpp b/test/OpenMP/target_teams_distribute_depend_codegen.cpp index 99b7f2c2e9..c5d54da976 100644 --- a/test/OpenMP/target_teams_distribute_depend_codegen.cpp +++ b/test/OpenMP/target_teams_distribute_depend_codegen.cpp @@ -98,7 +98,7 @@ int foo(int n) { // CHECK: getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 1 // CHECK: getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 2 // CHECK: getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 3 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call void @__kmpc_omp_wait_deps(%struct.ident_t* [[ID]], i32 [[GTID]], i32 4, i8* [[DEP]], i32 0, i8* null) // CHECK: call void @__kmpc_omp_task_begin_if0(%struct.ident_t* [[ID]], i32 [[GTID]], i8* [[TASK]]) @@ -138,7 +138,7 @@ int foo(int n) { // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 1 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 2 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call i32 @__kmpc_omp_task_with_deps(%struct.ident_t* [[ID]], i32 [[GTID]], i8* [[TASK]], i32 3, i8* [[DEP]], i32 0, i8* null) // CHECK: br label %[[EXIT:.+]] @@ -154,7 +154,7 @@ int foo(int n) { // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 1 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 2 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call i32 @__kmpc_omp_task_with_deps(%struct.ident_t* [[ID]], i32 [[GTID]], i8* [[TASK]], i32 3, i8* [[DEP]], i32 0, i8* null) // CHECK: br label %[[EXIT:.+]] @@ -170,7 +170,7 @@ int foo(int n) { // CHECK: [[TASK:%.+]] = call i8* @__kmpc_omp_task_alloc(%struct.ident_t* [[ID]], i32 [[GTID]], i32 1, i[[SZ]] {{48|24}}, i[[SZ]] 4, i32 (i32, i8*)* bitcast (i32 (i32, %{{.+}}*)* [[TASK_ENTRY2:@.+]] to i32 (i32, i8*)*)) // CHECK: [[BC_TASK:%.+]] = bitcast i8* [[TASK]] to [[TASK_TY2:%.+]]* // CHECK: getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call void @__kmpc_omp_wait_deps(%struct.ident_t* [[ID]], i32 [[GTID]], i32 1, i8* [[DEP]], i32 0, i8* null) // CHECK: call void @__kmpc_omp_task_begin_if0(%struct.ident_t* [[ID]], i32 [[GTID]], i8* [[TASK]]) diff --git a/test/OpenMP/target_teams_distribute_depend_messages.cpp b/test/OpenMP/target_teams_distribute_depend_messages.cpp index 9daba67020..14c7745155 100644 --- a/test/OpenMP/target_teams_distribute_depend_messages.cpp +++ b/test/OpenMP/target_teams_distribute_depend_messages.cpp @@ -25,13 +25,13 @@ int main(int argc, char **argv, char *env[]) { #pragma omp target teams distribute depend // expected-error {{expected '(' after 'depend'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute 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 target teams distribute depend ( // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after dependency type - ignoring}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute depend () // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} +#pragma omp target teams distribute depend () // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute 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 target teams distribute depend (argc // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute depend (source : argc) // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} +#pragma omp target teams distribute depend (source : argc) // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute depend (source) // expected-error {{expected expression}} expected-warning {{missing ':' after dependency type - ignoring}} for (i = 0; i < argc; ++i) foo(); diff --git a/test/OpenMP/target_teams_distribute_firstprivate_messages.cpp b/test/OpenMP/target_teams_distribute_firstprivate_messages.cpp index 01c1a2818f..833f951b78 100644 --- a/test/OpenMP/target_teams_distribute_firstprivate_messages.cpp +++ b/test/OpenMP/target_teams_distribute_firstprivate_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -84,7 +94,7 @@ int main(int argc, char **argv) { #pragma omp target teams distribute firstprivate (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute firstprivate (argc) +#pragma omp target teams distribute firstprivate (argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute firstprivate (S1) // expected-error {{'S1' does not refer to a value}} @@ -96,7 +106,7 @@ int main(int argc, char **argv) { #pragma omp target teams distribute firstprivate (argv[1]) // expected-error {{expected variable name}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute firstprivate(ba) +#pragma omp target teams distribute firstprivate(ba) allocate(omp_thread_mem_alloc: ba) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target teams distribute' directive}} for (i = 0; i < argc; ++i) foo(); #pragma omp target diff --git a/test/OpenMP/target_teams_distribute_lastprivate_messages.cpp b/test/OpenMP/target_teams_distribute_lastprivate_messages.cpp index 0a2f5448ba..a7e33d0e78 100644 --- a/test/OpenMP/target_teams_distribute_lastprivate_messages.cpp +++ b/test/OpenMP/target_teams_distribute_lastprivate_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -88,7 +98,7 @@ int foomain(int argc, char **argv) { #pragma omp target teams distribute lastprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp target teams distribute lastprivate(argc) +#pragma omp target teams distribute allocate(omp_thread_mem_alloc: argc) lastprivate(argc) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target teams distribute' directive}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target teams distribute lastprivate(S1) // expected-error {{'S1' does not refer to a value}} @@ -162,7 +172,7 @@ int main(int argc, char **argv) { #pragma omp target teams distribute lastprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute lastprivate(argc) +#pragma omp target teams distribute lastprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute lastprivate(S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/target_teams_distribute_map_messages.cpp b/test/OpenMP/target_teams_distribute_map_messages.cpp index bbfa7cde9a..0de429736e 100644 --- a/test/OpenMP/target_teams_distribute_map_messages.cpp +++ b/test/OpenMP/target_teams_distribute_map_messages.cpp @@ -86,6 +86,8 @@ T tmain(T argc) { for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute map(l[:-1]) // expected-error 2 {{section length is evaluated to a negative value -1}} for (i = 0; i < argc; ++i) foo(); +#pragma omp target teams distribute map(l[true:true]) + for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute map(x) for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute map(tofrom: t[:I]) @@ -163,7 +165,7 @@ T tmain(T argc) { for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute map(always: x) // expected-error {{missing map type}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always' or 'close'}} expected-error {{missing map type}} +#pragma omp target teams distribute map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always', 'close', or 'mapper'}} expected-error {{missing map type}} for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute map(always, tofrom: always, tofrom, x) for (i = 0; i < argc; ++i) foo(); @@ -206,6 +208,8 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute map(l[:-1]) // expected-error {{section length is evaluated to a negative value -1}} for (i = 0; i < argc; ++i) foo(); +#pragma omp target teams distribute map(l[true:true]) + for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute map(x) for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute map(to: x) @@ -271,7 +275,7 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute map(always: x) // expected-error {{missing map type}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always' or 'close'}} expected-error {{missing map type}} +#pragma omp target teams distribute map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always', 'close', or 'mapper'}} expected-error {{missing map type}} for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute map(always, tofrom: always, tofrom, x) for (i = 0; i < argc; ++i) foo(); diff --git a/test/OpenMP/target_teams_distribute_messages.cpp b/test/OpenMP/target_teams_distribute_messages.cpp index d3be0f632b..7b2080ae2b 100644 --- a/test/OpenMP/target_teams_distribute_messages.cpp +++ b/test/OpenMP/target_teams_distribute_messages.cpp @@ -61,7 +61,7 @@ L1: break; } } -#pragma omp target teams distribute default(none) +#pragma omp target teams distribute default(none) // expected-note {{explicit data sharing attribute requested here}} for (int i = 0; i < 10; ++i) ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} diff --git a/test/OpenMP/target_teams_distribute_parallel_for_ast_print.cpp b/test/OpenMP/target_teams_distribute_parallel_for_ast_print.cpp index a22b561320..c02f1b9bf9 100644 --- a/test/OpenMP/target_teams_distribute_parallel_for_ast_print.cpp +++ b/test/OpenMP/target_teams_distribute_parallel_for_ast_print.cpp @@ -72,7 +72,7 @@ public: } void bar() { int b, argv, d, c, e, f8; -#pragma omp target teams distribute parallel for default(none), private(b) firstprivate(argv) shared(d) reduction(+:c) reduction(max:e) num_teams(f8) thread_limit(d) +#pragma omp target teams distribute parallel for allocate(b) default(none), private(b) firstprivate(argv) shared(d) reduction(+:c) reduction(max:e) num_teams(f8) thread_limit(d) allocate(e) for (int k = 0; k < a.a; ++k) ++a.a; } @@ -80,7 +80,7 @@ public: // CHECK: #pragma omp target teams distribute parallel for private(this->a) private(this->a) private(this->S::a) // CHECK: #pragma omp target teams distribute parallel for private(this->a) private(this->a) private(this->S7<S>::a) // CHECK: #pragma omp target teams distribute parallel for private(this->a) private(this->a) -// CHECK: #pragma omp target teams distribute parallel for default(none) private(b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(f8) thread_limit(d) +// CHECK: #pragma omp target teams distribute parallel for allocate(b) default(none) private(b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(f8) thread_limit(d) allocate(e) template <class T, int N> T tmain(T argc) { diff --git a/test/OpenMP/target_teams_distribute_parallel_for_codegen.cpp b/test/OpenMP/target_teams_distribute_parallel_for_codegen.cpp index e439431a05..4c7ac2441c 100644 --- a/test/OpenMP/target_teams_distribute_parallel_for_codegen.cpp +++ b/test/OpenMP/target_teams_distribute_parallel_for_codegen.cpp @@ -2,6 +2,7 @@ #ifndef HEADER #define HEADER // Test host codegen. +// RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s --check-prefix HCK_NO_TGT // RUN: %clang_cc1 -DCK1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-64 --check-prefix HCK1 --check-prefix HCK1-64 // RUN: %clang_cc1 -DCK1 -fopenmp -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -emit-pch -o %t %s // RUN: %clang_cc1 -DCK1 -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=powerpc64le-ibm-linux-gnu -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s --check-prefix CK1 --check-prefix CK1-64 --check-prefix HCK1 --check-prefix HCK1-64 @@ -38,6 +39,8 @@ #ifdef CK1 +// HCK_NO_TGT-NOT: @__kmpc_push_target_tripcount + // HCK1: define{{.*}} i32 @{{.+}}target_teams_fun{{.*}}( int target_teams_fun(int *g){ int n = 1000; diff --git a/test/OpenMP/target_teams_distribute_parallel_for_collapse_messages.cpp b/test/OpenMP/target_teams_distribute_parallel_for_collapse_messages.cpp index 61e76cde02..a866b79764 100644 --- a/test/OpenMP/target_teams_distribute_parallel_for_collapse_messages.cpp +++ b/test/OpenMP/target_teams_distribute_parallel_for_collapse_messages.cpp @@ -56,7 +56,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} // expected-note@+5 2 {{non-constexpr function 'foobool' cannot be used}} #endif // expected-error@+3 2 {{directive '#pragma omp target teams distribute parallel for' cannot contain more than one 'collapse' clause}} -// expected-error@+2 2 {{argument to 'collapse' clause must be a strictly positive integer value}} +// expected-error@+2 {{argument to 'collapse' clause must be a strictly positive integer value}} // expected-error@+1 2 {{expression is not an integral constant expression}} #pragma omp target teams distribute parallel for collapse (foobool(argc)), collapse (true), collapse (-5) for (int i = ST; i < N; i++) @@ -121,7 +121,7 @@ int main(int argc, char **argv) { #endif // expected-error@+3 {{expression is not an integral constant expression}} // expected-error@+2 2 {{directive '#pragma omp target teams distribute parallel for' cannot contain more than one 'collapse' clause}} -// expected-error@+1 2 {{argument to 'collapse' clause must be a strictly positive integer value}} +// expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}} #pragma omp target teams distribute parallel for collapse (foobool(argc)), collapse (true), collapse (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; diff --git a/test/OpenMP/target_teams_distribute_parallel_for_default_messages.cpp b/test/OpenMP/target_teams_distribute_parallel_for_default_messages.cpp index d7c3fbaa9c..d5ea823858 100644 --- a/test/OpenMP/target_teams_distribute_parallel_for_default_messages.cpp +++ b/test/OpenMP/target_teams_distribute_parallel_for_default_messages.cpp @@ -18,7 +18,7 @@ int main(int argc, char **argv) { #pragma omp target teams distribute parallel for default (x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} for (int i=0; i<200; i++) foo(); -#pragma omp target teams distribute parallel for default(none) +#pragma omp target teams distribute parallel for default(none) // expected-note {{explicit data sharing attribute requested here}} for (int i=0; i<200; i++) ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} return 0; diff --git a/test/OpenMP/target_teams_distribute_parallel_for_depend_codegen.cpp b/test/OpenMP/target_teams_distribute_parallel_for_depend_codegen.cpp index f573c04547..884c3642fb 100644 --- a/test/OpenMP/target_teams_distribute_parallel_for_depend_codegen.cpp +++ b/test/OpenMP/target_teams_distribute_parallel_for_depend_codegen.cpp @@ -98,7 +98,7 @@ int foo(int n) { // CHECK: getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 1 // CHECK: getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 2 // CHECK: getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 3 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call void @__kmpc_omp_wait_deps(%struct.ident_t* [[ID]], i32 [[GTID]], i32 4, i8* [[DEP]], i32 0, i8* null) // CHECK: call void @__kmpc_omp_task_begin_if0(%struct.ident_t* [[ID]], i32 [[GTID]], i8* [[TASK]]) @@ -138,7 +138,7 @@ int foo(int n) { // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 1 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 2 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call i32 @__kmpc_omp_task_with_deps(%struct.ident_t* [[ID]], i32 [[GTID]], i8* [[TASK]], i32 3, i8* [[DEP]], i32 0, i8* null) // CHECK: br label %[[EXIT:.+]] @@ -154,7 +154,7 @@ int foo(int n) { // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 1 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 2 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call i32 @__kmpc_omp_task_with_deps(%struct.ident_t* [[ID]], i32 [[GTID]], i8* [[TASK]], i32 3, i8* [[DEP]], i32 0, i8* null) // CHECK: br label %[[EXIT:.+]] @@ -170,7 +170,7 @@ int foo(int n) { // CHECK: [[TASK:%.+]] = call i8* @__kmpc_omp_task_alloc(%struct.ident_t* [[ID]], i32 [[GTID]], i32 1, i[[SZ]] {{48|24}}, i[[SZ]] 4, i32 (i32, i8*)* bitcast (i32 (i32, %{{.+}}*)* [[TASK_ENTRY2:@.+]] to i32 (i32, i8*)*)) // CHECK: [[BC_TASK:%.+]] = bitcast i8* [[TASK]] to [[TASK_TY2:%.+]]* // CHECK: getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call void @__kmpc_omp_wait_deps(%struct.ident_t* [[ID]], i32 [[GTID]], i32 1, i8* [[DEP]], i32 0, i8* null) // CHECK: call void @__kmpc_omp_task_begin_if0(%struct.ident_t* [[ID]], i32 [[GTID]], i8* [[TASK]]) diff --git a/test/OpenMP/target_teams_distribute_parallel_for_depend_messages.cpp b/test/OpenMP/target_teams_distribute_parallel_for_depend_messages.cpp index 253e139b82..d853771c0d 100644 --- a/test/OpenMP/target_teams_distribute_parallel_for_depend_messages.cpp +++ b/test/OpenMP/target_teams_distribute_parallel_for_depend_messages.cpp @@ -25,13 +25,13 @@ int main(int argc, char **argv, char *env[]) { #pragma omp target teams distribute parallel for depend // expected-error {{expected '(' after 'depend'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for 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 target teams distribute parallel for depend ( // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after dependency type - ignoring}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for depend () // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} +#pragma omp target teams distribute parallel for depend () // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for 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 target teams distribute parallel for depend (argc // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for depend (source : argc) // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} +#pragma omp target teams distribute parallel for depend (source : argc) // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute parallel for depend (source) // expected-error {{expected expression}} expected-warning {{missing ':' after dependency type - ignoring}} for (i = 0; i < argc; ++i) foo(); diff --git a/test/OpenMP/target_teams_distribute_parallel_for_firstprivate_messages.cpp b/test/OpenMP/target_teams_distribute_parallel_for_firstprivate_messages.cpp index a278e9f89a..d7be6062eb 100644 --- a/test/OpenMP/target_teams_distribute_parallel_for_firstprivate_messages.cpp +++ b/test/OpenMP/target_teams_distribute_parallel_for_firstprivate_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -84,7 +94,7 @@ int main(int argc, char **argv) { #pragma omp target teams distribute parallel for firstprivate (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for firstprivate (argc) +#pragma omp target teams distribute parallel for firstprivate (argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute parallel for firstprivate (S1) // expected-error {{'S1' does not refer to a value}} @@ -96,7 +106,7 @@ int main(int argc, char **argv) { #pragma omp target teams distribute parallel for firstprivate (argv[1]) // expected-error {{expected variable name}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for firstprivate(ba) +#pragma omp target teams distribute parallel for firstprivate(ba) allocate(omp_thread_mem_alloc: ba) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target teams distribute parallel for' directive}} for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute parallel for firstprivate(ca) // expected-error {{no matching constructor for initialization of 'S3'}} diff --git a/test/OpenMP/target_teams_distribute_parallel_for_if_codegen.cpp b/test/OpenMP/target_teams_distribute_parallel_for_if_codegen.cpp index af6ed9744a..8f1e88f980 100644 --- a/test/OpenMP/target_teams_distribute_parallel_for_if_codegen.cpp +++ b/test/OpenMP/target_teams_distribute_parallel_for_if_codegen.cpp @@ -83,7 +83,7 @@ int main() { // CHECK: call void @__kmpc_push_target_tripcount(i64 -1, i64 100) // CHECK: call i{{[0-9]+}} @__tgt_target_teams( // CHECK: call void [[OFFLOADING_FUN_0:@.+]]( -// CHECK: call void @__kmpc_push_target_tripcount(i64 -1, i64 100) +// CHECK-NOT: call void @__kmpc_push_target_tripcount(i64 -1, i64 100) // CHECK: call void [[OFFLOADING_FUN_1:@.+]]( // CHECK: call void @__kmpc_push_target_tripcount(i64 -1, i64 100) // CHECK: call i{{[0-9]+}} @__tgt_target_teams( diff --git a/test/OpenMP/target_teams_distribute_parallel_for_if_messages.cpp b/test/OpenMP/target_teams_distribute_parallel_for_if_messages.cpp index 6f990f7bd2..328e191ed3 100644 --- a/test/OpenMP/target_teams_distribute_parallel_for_if_messages.cpp +++ b/test/OpenMP/target_teams_distribute_parallel_for_if_messages.cpp @@ -106,6 +106,8 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute parallel for if(distribute : argc) // expected-error {{directive name modifier 'distribute' is not allowed for '#pragma omp target teams distribute parallel for'}} for (i = 0; i < argc; ++i) foo(); +#pragma omp target teams distribute parallel for default(none) if(argc+argv[0][0]) // expected-error {{variable 'argv' must have explicitly specified data sharing attributes}} expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} expected-note 2 {{explicit data sharing attribute requested here}} + for (i = 0; i < argc; ++i) foo(); return tmain(argc, argv); } diff --git a/test/OpenMP/target_teams_distribute_parallel_for_lastprivate_messages.cpp b/test/OpenMP/target_teams_distribute_parallel_for_lastprivate_messages.cpp index 3c5e815217..d06628fef8 100644 --- a/test/OpenMP/target_teams_distribute_parallel_for_lastprivate_messages.cpp +++ b/test/OpenMP/target_teams_distribute_parallel_for_lastprivate_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -88,7 +98,7 @@ int foomain(int argc, char **argv) { #pragma omp target teams distribute parallel for lastprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp target teams distribute parallel for lastprivate(argc) +#pragma omp target teams distribute parallel for lastprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target teams distribute parallel for lastprivate(S1) // expected-error {{'S1' does not refer to a value}} @@ -107,7 +117,7 @@ int foomain(int argc, char **argv) { for (int k = 0; k < argc; ++k) ++k; int v = 0; -#pragma omp target teams distribute parallel for lastprivate(i) +#pragma omp target teams distribute parallel for allocate(omp_thread_mem_alloc: i) lastprivate(i) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target teams distribute parallel for' directive}} for (int k = 0; k < argc; ++k) { i = k; v += i; diff --git a/test/OpenMP/target_teams_distribute_parallel_for_map_messages.cpp b/test/OpenMP/target_teams_distribute_parallel_for_map_messages.cpp index f585d0a1ee..f47655d686 100644 --- a/test/OpenMP/target_teams_distribute_parallel_for_map_messages.cpp +++ b/test/OpenMP/target_teams_distribute_parallel_for_map_messages.cpp @@ -86,6 +86,8 @@ T tmain(T argc) { for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute parallel for map(l[:-1]) // expected-error 2 {{section length is evaluated to a negative value -1}} for (i = 0; i < argc; ++i) foo(); +#pragma omp target teams distribute parallel for map(l[true:true]) + for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute parallel for map(x) for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute parallel for map(tofrom: t[:I]) @@ -163,7 +165,7 @@ T tmain(T argc) { for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute parallel for map(always: x) // expected-error {{missing map type}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always' or 'close'}} expected-error {{missing map type}} +#pragma omp target teams distribute parallel for map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always', 'close', or 'mapper'}} expected-error {{missing map type}} for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute parallel for map(always, tofrom: always, tofrom, x) for (i = 0; i < argc; ++i) foo(); @@ -206,6 +208,8 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute parallel for map(l[:-1]) // expected-error {{section length is evaluated to a negative value -1}} for (i = 0; i < argc; ++i) foo(); +#pragma omp target teams distribute parallel for map(l[true:true]) + for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute parallel for map(x) for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute parallel for map(to: x) @@ -271,7 +275,7 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute parallel for map(always: x) // expected-error {{missing map type}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always' or 'close'}} expected-error {{missing map type}} +#pragma omp target teams distribute parallel for map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always', 'close', or 'mapper'}} expected-error {{missing map type}} for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute parallel for map(always, tofrom: always, tofrom, x) for (i = 0; i < argc; ++i) foo(); diff --git a/test/OpenMP/target_teams_distribute_parallel_for_messages.cpp b/test/OpenMP/target_teams_distribute_parallel_for_messages.cpp index 551acd2e8f..e70c5df389 100644 --- a/test/OpenMP/target_teams_distribute_parallel_for_messages.cpp +++ b/test/OpenMP/target_teams_distribute_parallel_for_messages.cpp @@ -61,7 +61,7 @@ L1: break; } } -#pragma omp target teams distribute parallel for default(none) +#pragma omp target teams distribute parallel for default(none) // expected-note {{explicit data sharing attribute requested here}} for (int i = 0; i < 10; ++i) ++argc; // expected-error {{ariable 'argc' must have explicitly specified data sharing attributes}} diff --git a/test/OpenMP/target_teams_distribute_parallel_for_private_messages.cpp b/test/OpenMP/target_teams_distribute_parallel_for_private_messages.cpp index 43b0304bb9..86410b3faf 100644 --- a/test/OpenMP/target_teams_distribute_parallel_for_private_messages.cpp +++ b/test/OpenMP/target_teams_distribute_parallel_for_private_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -70,7 +80,7 @@ int main(int argc, char **argv) { #pragma omp target teams distribute parallel for private (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp target teams distribute parallel for private (argc) +#pragma omp target teams distribute parallel for private (argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target teams distribute parallel for private (S1) // expected-error {{'S1' does not refer to a value}} @@ -106,7 +116,7 @@ int main(int argc, char **argv) { #pragma omp target teams distribute parallel for firstprivate(i), private(i) // expected-error {{firstprivate variable cannot be private}} expected-note {{defined as firstprivate}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp target teams distribute parallel for private(j) +#pragma omp target teams distribute parallel for allocate(omp_thread_mem_alloc: j) private(j) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target teams distribute parallel for' directive}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target teams distribute parallel for reduction(+:i) diff --git a/test/OpenMP/target_teams_distribute_parallel_for_reduction_messages.cpp b/test/OpenMP/target_teams_distribute_parallel_for_reduction_messages.cpp index 33a0e37b86..01175deeca 100644 --- a/test/OpenMP/target_teams_distribute_parallel_for_reduction_messages.cpp +++ b/test/OpenMP/target_teams_distribute_parallel_for_reduction_messages.cpp @@ -6,6 +6,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 %s // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -107,7 +117,7 @@ T tmain(T argc) { for (int j=0; j<100; j++) foo(); #pragma omp target teams distribute parallel for reduction(foo : argc) //expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'float'}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int'}} for (int j=0; j<100; j++) foo(); -#pragma omp target teams distribute parallel for reduction(&& : argc) +#pragma omp target teams distribute parallel for reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int j=0; j<100; j++) foo(); #pragma omp target teams distribute parallel for reduction(^ : T) // expected-error {{'T' does not refer to a value}} for (int j=0; j<100; j++) foo(); @@ -146,7 +156,7 @@ T tmain(T argc) { #pragma omp parallel reduction(min : i) #pragma omp target teams distribute parallel for reduction(max : j) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}} for (int j=0; j<100; j++) foo(); -#pragma omp target teams distribute parallel for reduction(+ : fl) +#pragma omp target teams distribute parallel for reduction(+ : fl) allocate(omp_thread_mem_alloc: fl) // expected-warning 2 {{allocator with the 'thread' trait access has unspecified behavior on 'target teams distribute parallel for' directive}} for (int j=0; j<100; j++) foo(); return T(); diff --git a/test/OpenMP/target_teams_distribute_parallel_for_simd_ast_print.cpp b/test/OpenMP/target_teams_distribute_parallel_for_simd_ast_print.cpp index 5de2d4b195..86f243ee4d 100644 --- a/test/OpenMP/target_teams_distribute_parallel_for_simd_ast_print.cpp +++ b/test/OpenMP/target_teams_distribute_parallel_for_simd_ast_print.cpp @@ -33,7 +33,7 @@ public: } S7 &operator=(S7 &s) { int k; -#pragma omp target teams distribute parallel for simd private(a) private(this->a) linear(k) +#pragma omp target teams distribute parallel for simd allocate(a) private(a) private(this->a) linear(k) allocate(k) for (k = 0; k < s.a.a; ++k) ++s.a.a; @@ -58,7 +58,7 @@ public: } }; // CHECK: #pragma omp target teams distribute parallel for simd private(this->a) private(this->a) private(T::a) -// CHECK: #pragma omp target teams distribute parallel for simd private(this->a) private(this->a) linear(k) +// CHECK: #pragma omp target teams distribute parallel for simd allocate(this->a) private(this->a) private(this->a) linear(k) allocate(k) // CHECK: #pragma omp target teams distribute parallel for simd default(none) private(b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(f) thread_limit(d) // CHECK: #pragma omp target teams distribute parallel for simd simdlen(slen1) safelen(slen2) aligned(arr: alen) diff --git a/test/OpenMP/target_teams_distribute_parallel_for_simd_codegen.cpp b/test/OpenMP/target_teams_distribute_parallel_for_simd_codegen.cpp index 7a1ea81091..6846aaf434 100644 --- a/test/OpenMP/target_teams_distribute_parallel_for_simd_codegen.cpp +++ b/test/OpenMP/target_teams_distribute_parallel_for_simd_codegen.cpp @@ -104,7 +104,7 @@ int target_teams_fun(int *g){ // CK1: ret void // CK1: define internal void @[[OUTL1]]({{.+}}) - // CK1: [[ARRDECAY:%.+]] = getelementptr inbounds [1000 x i32], [1000 x i32]* %{{.+}}, i32 0, i32 0 + // CK1: [[ARRDECAY:%.+]] = getelementptr inbounds [1000 x i32], [1000 x i32]* %{{.+}}, i{{32|64}} 0, i{{32|64}} 0 // CK1: [[ARR_CAST:%.+]] = ptrtoint i32* [[ARRDECAY]] to i{{32|64}} // CK1: [[MASKED_PTR:%.+]] = and i{{32|64}} [[ARR_CAST]], 7 // CK1: [[COND:%.+]] = icmp eq i{{32|64}} [[MASKED_PTR]], 0 diff --git a/test/OpenMP/target_teams_distribute_parallel_for_simd_collapse_messages.cpp b/test/OpenMP/target_teams_distribute_parallel_for_simd_collapse_messages.cpp index 069ea65ad2..4ca7a8ca9a 100644 --- a/test/OpenMP/target_teams_distribute_parallel_for_simd_collapse_messages.cpp +++ b/test/OpenMP/target_teams_distribute_parallel_for_simd_collapse_messages.cpp @@ -56,7 +56,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} // expected-note@+5 2 {{non-constexpr function 'foobool' cannot be used}} #endif // expected-error@+3 2 {{directive '#pragma omp target teams distribute parallel for simd' cannot contain more than one 'collapse' clause}} -// expected-error@+2 2 {{argument to 'collapse' clause must be a strictly positive integer value}} +// expected-error@+2 {{argument to 'collapse' clause must be a strictly positive integer value}} // expected-error@+1 2 {{expression is not an integral constant expression}} #pragma omp target teams distribute parallel for simd collapse (foobool(argc)), collapse (true), collapse (-5) for (int i = ST; i < N; i++) @@ -121,7 +121,7 @@ int main(int argc, char **argv) { #endif // expected-error@+3 {{expression is not an integral constant expression}} // expected-error@+2 2 {{directive '#pragma omp target teams distribute parallel for simd' cannot contain more than one 'collapse' clause}} -// expected-error@+1 2 {{argument to 'collapse' clause must be a strictly positive integer value}} +// expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}} #pragma omp target teams distribute parallel for simd collapse (foobool(argc)), collapse (true), collapse (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; diff --git a/test/OpenMP/target_teams_distribute_parallel_for_simd_default_messages.cpp b/test/OpenMP/target_teams_distribute_parallel_for_simd_default_messages.cpp index a81aacea4a..d832d8cf16 100644 --- a/test/OpenMP/target_teams_distribute_parallel_for_simd_default_messages.cpp +++ b/test/OpenMP/target_teams_distribute_parallel_for_simd_default_messages.cpp @@ -23,7 +23,7 @@ int main(int argc, char **argv) { #pragma omp target teams distribute parallel for simd default (x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} for (int i=0; i<200; i++) foo(); -#pragma omp target teams distribute parallel for simd default(none) +#pragma omp target teams distribute parallel for simd default(none) // expected-note {{explicit data sharing attribute requested here}} for (int i=0; i<200; i++) ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} return 0; diff --git a/test/OpenMP/target_teams_distribute_parallel_for_simd_depend_codegen.cpp b/test/OpenMP/target_teams_distribute_parallel_for_simd_depend_codegen.cpp index 1258e685ea..8a02da4c62 100644 --- a/test/OpenMP/target_teams_distribute_parallel_for_simd_depend_codegen.cpp +++ b/test/OpenMP/target_teams_distribute_parallel_for_simd_depend_codegen.cpp @@ -98,7 +98,7 @@ int foo(int n) { // CHECK: getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 1 // CHECK: getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 2 // CHECK: getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 3 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call void @__kmpc_omp_wait_deps(%struct.ident_t* [[ID]], i32 [[GTID]], i32 4, i8* [[DEP]], i32 0, i8* null) // CHECK: call void @__kmpc_omp_task_begin_if0(%struct.ident_t* [[ID]], i32 [[GTID]], i8* [[TASK]]) @@ -138,7 +138,7 @@ int foo(int n) { // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 1 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 2 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call i32 @__kmpc_omp_task_with_deps(%struct.ident_t* [[ID]], i32 [[GTID]], i8* [[TASK]], i32 3, i8* [[DEP]], i32 0, i8* null) // CHECK: br label %[[EXIT:.+]] @@ -154,7 +154,7 @@ int foo(int n) { // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 1 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 2 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call i32 @__kmpc_omp_task_with_deps(%struct.ident_t* [[ID]], i32 [[GTID]], i8* [[TASK]], i32 3, i8* [[DEP]], i32 0, i8* null) // CHECK: br label %[[EXIT:.+]] @@ -170,7 +170,7 @@ int foo(int n) { // CHECK: [[TASK:%.+]] = call i8* @__kmpc_omp_task_alloc(%struct.ident_t* [[ID]], i32 [[GTID]], i32 1, i[[SZ]] {{48|24}}, i[[SZ]] 4, i32 (i32, i8*)* bitcast (i32 (i32, %{{.+}}*)* [[TASK_ENTRY2:@.+]] to i32 (i32, i8*)*)) // CHECK: [[BC_TASK:%.+]] = bitcast i8* [[TASK]] to [[TASK_TY2:%.+]]* // CHECK: getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call void @__kmpc_omp_wait_deps(%struct.ident_t* [[ID]], i32 [[GTID]], i32 1, i8* [[DEP]], i32 0, i8* null) // CHECK: call void @__kmpc_omp_task_begin_if0(%struct.ident_t* [[ID]], i32 [[GTID]], i8* [[TASK]]) diff --git a/test/OpenMP/target_teams_distribute_parallel_for_simd_depend_messages.cpp b/test/OpenMP/target_teams_distribute_parallel_for_simd_depend_messages.cpp index 7cc0d41234..2690b01e22 100644 --- a/test/OpenMP/target_teams_distribute_parallel_for_simd_depend_messages.cpp +++ b/test/OpenMP/target_teams_distribute_parallel_for_simd_depend_messages.cpp @@ -25,13 +25,13 @@ int main(int argc, char **argv, char *env[]) { #pragma omp target teams distribute parallel for simd depend // expected-error {{expected '(' after 'depend'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for simd 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 target teams distribute parallel for simd depend ( // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after dependency type - ignoring}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for simd depend () // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} +#pragma omp target teams distribute parallel for simd depend () // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for simd 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 target teams distribute parallel for simd depend (argc // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for simd depend (source : argc) // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} +#pragma omp target teams distribute parallel for simd depend (source : argc) // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute parallel for simd depend (source) // expected-error {{expected expression}} expected-warning {{missing ':' after dependency type - ignoring}} for (i = 0; i < argc; ++i) foo(); diff --git a/test/OpenMP/target_teams_distribute_parallel_for_simd_firstprivate_messages.cpp b/test/OpenMP/target_teams_distribute_parallel_for_simd_firstprivate_messages.cpp index 69292a7c61..46a91c953b 100644 --- a/test/OpenMP/target_teams_distribute_parallel_for_simd_firstprivate_messages.cpp +++ b/test/OpenMP/target_teams_distribute_parallel_for_simd_firstprivate_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -84,7 +94,7 @@ int main(int argc, char **argv) { #pragma omp target teams distribute parallel for simd firstprivate (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for simd firstprivate (argc) +#pragma omp target teams distribute parallel for simd firstprivate (argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute parallel for simd firstprivate (S1) // expected-error {{'S1' does not refer to a value}} @@ -96,7 +106,7 @@ int main(int argc, char **argv) { #pragma omp target teams distribute parallel for simd firstprivate (argv[1]) // expected-error {{expected variable name}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for simd firstprivate(ba) +#pragma omp target teams distribute parallel for simd allocate(omp_thread_mem_alloc: ba) firstprivate(ba) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target teams distribute parallel for simd' directive}} for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute parallel for simd firstprivate(ca) // expected-error {{no matching constructor for initialization of 'S3'}} diff --git a/test/OpenMP/target_teams_distribute_parallel_for_simd_if_codegen.cpp b/test/OpenMP/target_teams_distribute_parallel_for_simd_if_codegen.cpp index b6778417be..79ae4fe29a 100644 --- a/test/OpenMP/target_teams_distribute_parallel_for_simd_if_codegen.cpp +++ b/test/OpenMP/target_teams_distribute_parallel_for_simd_if_codegen.cpp @@ -83,7 +83,7 @@ int main() { // CHECK: call void @__kmpc_push_target_tripcount(i64 -1, i64 100) // CHECK: call i{{[0-9]+}} @__tgt_target_teams( // CHECK: call void [[OFFLOADING_FUN_0:@.+]]( -// CHECK: call void @__kmpc_push_target_tripcount(i64 -1, i64 100) +// CHECK-NOT: call void @__kmpc_push_target_tripcount(i64 -1, i64 100) // CHECK: call void [[OFFLOADING_FUN_1:@.+]]( // CHECK: call void @__kmpc_push_target_tripcount(i64 -1, i64 100) // CHECK: call i{{[0-9]+}} @__tgt_target_teams( diff --git a/test/OpenMP/target_teams_distribute_parallel_for_simd_lastprivate_messages.cpp b/test/OpenMP/target_teams_distribute_parallel_for_simd_lastprivate_messages.cpp index d1adbd0d39..2652079514 100644 --- a/test/OpenMP/target_teams_distribute_parallel_for_simd_lastprivate_messages.cpp +++ b/test/OpenMP/target_teams_distribute_parallel_for_simd_lastprivate_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -88,7 +98,7 @@ int foomain(int argc, char **argv) { #pragma omp target teams distribute parallel for simd lastprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp target teams distribute parallel for simd lastprivate(argc) +#pragma omp target teams distribute parallel for simd lastprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target teams distribute parallel for simd lastprivate(S1) // expected-error {{'S1' does not refer to a value}} @@ -107,7 +117,7 @@ int foomain(int argc, char **argv) { for (int k = 0; k < argc; ++k) ++k; int v = 0; -#pragma omp target teams distribute parallel for simd lastprivate(i) +#pragma omp target teams distribute parallel for simd lastprivate(i) allocate(omp_thread_mem_alloc: i) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target teams distribute parallel for simd' directive}} for (int k = 0; k < argc; ++k) { i = k; v += i; diff --git a/test/OpenMP/target_teams_distribute_parallel_for_simd_linear_messages.cpp b/test/OpenMP/target_teams_distribute_parallel_for_simd_linear_messages.cpp index 372a976087..029401a64c 100644 --- a/test/OpenMP/target_teams_distribute_parallel_for_simd_linear_messages.cpp +++ b/test/OpenMP/target_teams_distribute_parallel_for_simd_linear_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + namespace X { int x; }; @@ -142,7 +152,7 @@ template<class I, class C> int foomain(I argc, C **argv) { for (int k = 0; k < argc; ++k) ++k; // expected-error@+1 {{only loop iteration variables are allowed in 'linear' clause in distribute directives}} -#pragma omp target teams distribute parallel for simd linear (argc : 5) +#pragma omp target teams distribute parallel for simd linear (argc : 5) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target teams distribute parallel for simd linear (S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/target_teams_distribute_parallel_for_simd_map_messages.cpp b/test/OpenMP/target_teams_distribute_parallel_for_simd_map_messages.cpp index 5cf0327895..64fe5f6e09 100644 --- a/test/OpenMP/target_teams_distribute_parallel_for_simd_map_messages.cpp +++ b/test/OpenMP/target_teams_distribute_parallel_for_simd_map_messages.cpp @@ -86,6 +86,8 @@ T tmain(T argc) { for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute parallel for simd map(l[:-1]) // expected-error 2 {{section length is evaluated to a negative value -1}} for (i = 0; i < argc; ++i) foo(); +#pragma omp target teams distribute parallel for simd map(l[true:true]) + for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute parallel for simd map(x) for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute parallel for simd map(tofrom: t[:I]) @@ -163,7 +165,7 @@ T tmain(T argc) { for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute parallel for simd map(always: x) // expected-error {{missing map type}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for simd map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always' or 'close'}} expected-error {{missing map type}} +#pragma omp target teams distribute parallel for simd map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always', 'close', or 'mapper'}} expected-error {{missing map type}} for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute parallel for simd map(always, tofrom: always, tofrom, x) for (i = 0; i < argc; ++i) foo(); @@ -206,6 +208,8 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute parallel for simd map(l[:-1]) // expected-error {{section length is evaluated to a negative value -1}} for (i = 0; i < argc; ++i) foo(); +#pragma omp target teams distribute parallel for simd map(l[true:true]) + for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute parallel for simd map(x) for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute parallel for simd map(to: x) @@ -271,7 +275,7 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute parallel for simd map(always: x) // expected-error {{missing map type}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute parallel for simd map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always' or 'close'}} expected-error {{missing map type}} +#pragma omp target teams distribute parallel for simd map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always', 'close', or 'mapper'}} expected-error {{missing map type}} for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute parallel for simd map(always, tofrom: always, tofrom, x) for (i = 0; i < argc; ++i) foo(); diff --git a/test/OpenMP/target_teams_distribute_parallel_for_simd_messages.cpp b/test/OpenMP/target_teams_distribute_parallel_for_simd_messages.cpp index 58e8862347..a98f7d83ec 100644 --- a/test/OpenMP/target_teams_distribute_parallel_for_simd_messages.cpp +++ b/test/OpenMP/target_teams_distribute_parallel_for_simd_messages.cpp @@ -62,7 +62,7 @@ L1: break; } } -#pragma omp target teams distribute parallel for simd default(none) +#pragma omp target teams distribute parallel for simd default(none) // expected-note {{explicit data sharing attribute requested here}} for (int i = 0; i < 10; ++i) ++argc; // expected-error {{ariable 'argc' must have explicitly specified data sharing attributes}} diff --git a/test/OpenMP/target_teams_distribute_parallel_for_simd_private_messages.cpp b/test/OpenMP/target_teams_distribute_parallel_for_simd_private_messages.cpp index 9cf810a9e9..1f3a131326 100644 --- a/test/OpenMP/target_teams_distribute_parallel_for_simd_private_messages.cpp +++ b/test/OpenMP/target_teams_distribute_parallel_for_simd_private_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -70,7 +80,7 @@ int main(int argc, char **argv) { #pragma omp target teams distribute parallel for simd private (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; - #pragma omp target teams distribute parallel for simd private (argc) + #pragma omp target teams distribute parallel for simd private (argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target teams distribute parallel for simd private (S1) // expected-error {{'S1' does not refer to a value}} @@ -82,7 +92,7 @@ int main(int argc, char **argv) { #pragma omp target teams distribute parallel for simd private (argv[1]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; - #pragma omp target teams distribute parallel for simd private(ba) + #pragma omp target teams distribute parallel for simd private(ba) allocate(omp_thread_mem_alloc: ba) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target teams distribute parallel for simd' directive}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target teams distribute parallel for simd private(ca) // expected-error {{const-qualified variable without mutable fields cannot be private}} diff --git a/test/OpenMP/target_teams_distribute_parallel_for_simd_reduction_messages.cpp b/test/OpenMP/target_teams_distribute_parallel_for_simd_reduction_messages.cpp index d3d9c60091..6e298a7e6b 100644 --- a/test/OpenMP/target_teams_distribute_parallel_for_simd_reduction_messages.cpp +++ b/test/OpenMP/target_teams_distribute_parallel_for_simd_reduction_messages.cpp @@ -6,6 +6,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 %s // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -107,7 +117,7 @@ T tmain(T argc) { for (int j=0; j<100; j++) foo(); #pragma omp target teams distribute parallel for simd reduction(foo : argc) //expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'float'}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int'}} for (int j=0; j<100; j++) foo(); -#pragma omp target teams distribute parallel for simd reduction(&& : argc) +#pragma omp target teams distribute parallel for simd reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int j=0; j<100; j++) foo(); #pragma omp target teams distribute parallel for simd reduction(^ : T) // expected-error {{'T' does not refer to a value}} for (int j=0; j<100; j++) foo(); @@ -235,7 +245,7 @@ int main(int argc, char **argv) { #pragma omp parallel reduction(min : i) #pragma omp target teams distribute parallel for simd reduction(max : j) // expected-error {{argument of OpenMP clause 'reduction' must reference the same object in all threads}} for (int j=0; j<100; j++) foo(); -#pragma omp target teams distribute parallel for simd reduction(+ : fl) +#pragma omp target teams distribute parallel for simd allocate(omp_thread_mem_alloc: fl) reduction(+ : fl) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target teams distribute parallel for simd' directive}} for (int j=0; j<100; j++) foo(); static int m; #pragma omp target teams distribute parallel for simd reduction(+ : m) // OK diff --git a/test/OpenMP/target_teams_distribute_parallel_for_simd_safelen_messages.cpp b/test/OpenMP/target_teams_distribute_parallel_for_simd_safelen_messages.cpp index f068e6b2e4..d05f071e91 100644 --- a/test/OpenMP/target_teams_distribute_parallel_for_simd_safelen_messages.cpp +++ b/test/OpenMP/target_teams_distribute_parallel_for_simd_safelen_messages.cpp @@ -49,9 +49,12 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} argv[0][i] = argv[0][i] - argv[0][i-ST]; #if __cplusplus >= 201103L - // expected-note@+2 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} + // expected-note@+5 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif -#pragma omp target teams distribute parallel for simd safelen (foobool(argc)), safelen (true), safelen (-5) // expected-error 2 {{directive '#pragma omp target teams distribute parallel for simd' cannot contain more than one 'safelen' clause}} expected-error 2 {{argument to 'safelen' clause must be a strictly positive integer value}} expected-error 2 {{expression is not an integral constant expression}} +// expected-error@+3 2 {{directive '#pragma omp target teams distribute parallel for simd' cannot contain more than one 'safelen' clause}} +// expected-error@+2 {{argument to 'safelen' clause must be a strictly positive integer value}} +// expected-error@+1 2 {{expression is not an integral constant expression}} +#pragma omp target teams distribute parallel for simd safelen (foobool(argc)), safelen (true), safelen (-5) for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; @@ -108,9 +111,12 @@ int main(int argc, char **argv) { argv[0][i] = argv[0][i] - argv[0][i-4]; #if __cplusplus >= 201103L - // expected-note@+2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} + // expected-note@+5 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif -#pragma omp target teams distribute parallel for simd safelen (foobool(argc)), safelen (true), safelen (-5) // expected-error 2 {{argument to 'safelen' clause must be a strictly positive integer value}} expected-error 2 {{directive '#pragma omp target teams distribute parallel for simd' cannot contain more than one 'safelen' clause}} expected-error {{expression is not an integral constant expression}} +// expected-error@+3 {{argument to 'safelen' clause must be a strictly positive integer value}} +// expected-error@+2 2 {{directive '#pragma omp target teams distribute parallel for simd' cannot contain more than one 'safelen' clause}} +// expected-error@+1 {{expression is not an integral constant expression}} +#pragma omp target teams distribute parallel for simd safelen (foobool(argc)), safelen (true), safelen (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; diff --git a/test/OpenMP/target_teams_distribute_parallel_for_simd_simdlen_messages.cpp b/test/OpenMP/target_teams_distribute_parallel_for_simd_simdlen_messages.cpp index d5f714c9c3..1c490582fd 100644 --- a/test/OpenMP/target_teams_distribute_parallel_for_simd_simdlen_messages.cpp +++ b/test/OpenMP/target_teams_distribute_parallel_for_simd_simdlen_messages.cpp @@ -49,9 +49,12 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} argv[0][i] = argv[0][i] - argv[0][i-ST]; #if __cplusplus >= 201103L - // expected-note@+2 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} + // expected-note@+5 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif -#pragma omp target teams distribute parallel for simd safelen (foobool(argc)), safelen (true), safelen (-5) // expected-error 2 {{directive '#pragma omp target teams distribute parallel for simd' cannot contain more than one 'safelen' clause}} expected-error 2 {{argument to 'safelen' clause must be a strictly positive integer value}} expected-error 2 {{expression is not an integral constant expression}} +// expected-error@+3 2 {{directive '#pragma omp target teams distribute parallel for simd' cannot contain more than one 'safelen' clause}} +// expected-error@+2 {{argument to 'safelen' clause must be a strictly positive integer value}} +// expected-error@+1 2 {{expression is not an integral constant expression}} +#pragma omp target teams distribute parallel for simd safelen (foobool(argc)), safelen (true), safelen (-5) for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; @@ -108,9 +111,12 @@ int main(int argc, char **argv) { argv[0][i] = argv[0][i] - argv[0][i-4]; #if __cplusplus >= 201103L - // expected-note@+2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} + // expected-note@+5 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif -#pragma omp target teams distribute parallel for simd safelen (foobool(argc)), safelen (true), safelen (-5) // expected-error 2 {{argument to 'safelen' clause must be a strictly positive integer value}} expected-error 2 {{directive '#pragma omp target teams distribute parallel for simd' cannot contain more than one 'safelen' clause}} expected-error {{expression is not an integral constant expression}} +// expected-error@+3 {{argument to 'safelen' clause must be a strictly positive integer value}} +// expected-error@+2 2 {{directive '#pragma omp target teams distribute parallel for simd' cannot contain more than one 'safelen' clause}} +// expected-error@+1 {{expression is not an integral constant expression}} +#pragma omp target teams distribute parallel for simd safelen (foobool(argc)), safelen (true), safelen (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; diff --git a/test/OpenMP/target_teams_distribute_private_messages.cpp b/test/OpenMP/target_teams_distribute_private_messages.cpp index 3d692a3f26..93989a5840 100644 --- a/test/OpenMP/target_teams_distribute_private_messages.cpp +++ b/test/OpenMP/target_teams_distribute_private_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -70,7 +80,7 @@ int main(int argc, char **argv) { #pragma omp target teams distribute private (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp target teams distribute private (argc) +#pragma omp target teams distribute private (argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target teams distribute private (S1) // expected-error {{'S1' does not refer to a value}} @@ -82,7 +92,7 @@ int main(int argc, char **argv) { #pragma omp target teams distribute private (argv[1]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp target teams distribute private(ba) +#pragma omp target teams distribute private(ba) allocate(omp_thread_mem_alloc: ba) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target teams distribute' directive}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target teams distribute private(ca) // expected-error {{const-qualified variable without mutable fields cannot be private}} diff --git a/test/OpenMP/target_teams_distribute_reduction_messages.cpp b/test/OpenMP/target_teams_distribute_reduction_messages.cpp index 6a9e6782f6..bdde93bd93 100644 --- a/test/OpenMP/target_teams_distribute_reduction_messages.cpp +++ b/test/OpenMP/target_teams_distribute_reduction_messages.cpp @@ -6,6 +6,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 %s // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -112,7 +122,7 @@ T tmain(T argc) { for (int j=0; j<100; j++) foo(); #pragma omp target teams distribute reduction(foo : argc) //expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'float'}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int'}} for (int j=0; j<100; j++) foo(); -#pragma omp target teams distribute reduction(&& : argc) +#pragma omp target teams distribute reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int j=0; j<100; j++) foo(); #pragma omp target teams distribute reduction(^ : T) // expected-error {{'T' does not refer to a value}} for (int j=0; j<100; j++) foo(); @@ -151,7 +161,7 @@ T tmain(T argc) { #pragma omp parallel reduction(min : i) #pragma omp target teams distribute reduction(max : j) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}} for (int j=0; j<100; j++) foo(); -#pragma omp target teams distribute reduction(+ : fl) +#pragma omp target teams distribute allocate(omp_thread_mem_alloc: fl) reduction(+ : fl) // expected-warning 2 {{allocator with the 'thread' trait access has unspecified behavior on 'target teams distribute' directive}} for (int j=0; j<100; j++) foo(); return T(); diff --git a/test/OpenMP/target_teams_distribute_simd_ast_print.cpp b/test/OpenMP/target_teams_distribute_simd_ast_print.cpp index a96863572a..cf3e8fed67 100644 --- a/test/OpenMP/target_teams_distribute_simd_ast_print.cpp +++ b/test/OpenMP/target_teams_distribute_simd_ast_print.cpp @@ -33,7 +33,7 @@ public: } S7 &operator=(S7 &s) { int k; -#pragma omp target teams distribute simd private(a) private(this->a) linear(k) +#pragma omp target teams distribute simd allocate(a) private(a) private(this->a) linear(k) allocate(k) for (k = 0; k < s.a.a; ++k) ++s.a.a; return *this; @@ -55,7 +55,7 @@ public: } }; // CHECK: #pragma omp target teams distribute simd private(this->a) private(this->a) private(T::a) -// CHECK: #pragma omp target teams distribute simd private(this->a) private(this->a) linear(k) +// CHECK: #pragma omp target teams distribute simd allocate(this->a) private(this->a) private(this->a) linear(k) allocate(k) // CHECK: #pragma omp target teams distribute simd private(b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(f) thread_limit(d) // CHECK: #pragma omp target teams distribute simd simdlen(slen1) safelen(slen2) aligned(arr: alen) // CHECK: #pragma omp target teams distribute simd private(this->a) private(this->a) private(this->S::a) diff --git a/test/OpenMP/target_teams_distribute_simd_codegen.cpp b/test/OpenMP/target_teams_distribute_simd_codegen.cpp index 0a5482e9b1..4e7d7d3c8d 100644 --- a/test/OpenMP/target_teams_distribute_simd_codegen.cpp +++ b/test/OpenMP/target_teams_distribute_simd_codegen.cpp @@ -152,7 +152,7 @@ int foo(int n) { a += 1; } - // CHECK-DAG: [[RET:%.+]] = call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 1, i8** [[BP:%[^,]+]], i8** [[P:%[^,]+]], i[[SZ]]* getelementptr inbounds ([1 x i[[SZ]]], [1 x i[[SZ]]]* [[SIZET2]], i32 0, i32 0), i64* getelementptr inbounds ([1 x i64], [1 x i64]* [[MAPT2]], i32 0, i32 0), i32 0, i32 0) + // CHECK-DAG: [[RET:%.+]] = call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 1, i8** [[BP:%[^,]+]], i8** [[P:%[^,]+]], i[[SZ]]* getelementptr inbounds ([1 x i[[SZ]]], [1 x i[[SZ]]]* [[SIZET2]], i32 0, i32 0), i64* getelementptr inbounds ([1 x i64], [1 x i64]* [[MAPT2]], i32 0, i32 0), i32 0, i32 1) // CHECK-DAG: [[BP]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BPR:%[^,]+]], i32 0, i32 0 // CHECK-DAG: [[P]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[PR:%[^,]+]], i32 0, i32 0 // CHECK-DAG: [[BPADDR0:%.+]] = getelementptr inbounds [1 x i8*], [1 x i8*]* [[BPR]], i32 0, i32 [[IDX0:[0-9]+]] @@ -176,7 +176,7 @@ int foo(int n) { // CHECK: [[IF:%.+]] = icmp sgt i32 {{[^,]+}}, 10 // CHECK: br i1 [[IF]], label %[[IFTHEN:[^,]+]], label %[[IFELSE:[^,]+]] // CHECK: [[IFTHEN]] - // CHECK-DAG: [[RET:%.+]] = call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 2, i8** [[BPR:%[^,]+]], i8** [[PR:%[^,]+]], i[[SZ]]* getelementptr inbounds ([2 x i[[SZ]]], [2 x i[[SZ]]]* [[SIZET3]], i32 0, i32 0), i64* getelementptr inbounds ([2 x i64], [2 x i64]* [[MAPT3]], i32 0, i32 0), i32 0, i32 0) + // CHECK-DAG: [[RET:%.+]] = call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 2, i8** [[BPR:%[^,]+]], i8** [[PR:%[^,]+]], i[[SZ]]* getelementptr inbounds ([2 x i[[SZ]]], [2 x i[[SZ]]]* [[SIZET3]], i32 0, i32 0), i64* getelementptr inbounds ([2 x i64], [2 x i64]* [[MAPT3]], i32 0, i32 0), i32 0, i32 1) // CHECK-DAG: [[BPR]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[BP:%[^,]+]], i32 0, i32 0 // CHECK-DAG: [[PR]] = getelementptr inbounds [2 x i8*], [2 x i8*]* [[P:%[^,]+]], i32 0, i32 0 @@ -227,7 +227,7 @@ int foo(int n) { // CHECK: [[CNELEMSIZE2:%.+]] = mul nuw i[[SZ]] 5, [[VLA1:%.+]] // CHECK: [[CNSIZE:%.+]] = mul nuw i[[SZ]] [[CNELEMSIZE2]], 8 - // CHECK-DAG: [[RET:%.+]] = call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 9, i8** [[BPR:%[^,]+]], i8** [[PR:%[^,]+]], i[[SZ]]* [[SR:%[^,]+]], i64* getelementptr inbounds ([9 x i64], [9 x i64]* [[MAPT4]], i32 0, i32 0), i32 0, i32 0) + // CHECK-DAG: [[RET:%.+]] = call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 9, i8** [[BPR:%[^,]+]], i8** [[PR:%[^,]+]], i[[SZ]]* [[SR:%[^,]+]], i64* getelementptr inbounds ([9 x i64], [9 x i64]* [[MAPT4]], i32 0, i32 0), i32 0, i32 1) // CHECK-DAG: [[BPR]] = getelementptr inbounds [9 x i8*], [9 x i8*]* [[BP:%[^,]+]], i32 0, i32 0 // CHECK-DAG: [[PR]] = getelementptr inbounds [9 x i8*], [9 x i8*]* [[P:%[^,]+]], i32 0, i32 0 // CHECK-DAG: [[SR]] = getelementptr inbounds [9 x i[[SZ]]], [9 x i[[SZ]]]* [[S:%[^,]+]], i32 0, i32 0 @@ -564,7 +564,7 @@ int bar(int n){ // CHECK: [[CELEMSIZE2:%.+]] = mul nuw i[[SZ]] 2, [[VLA0:%.+]] // CHECK: [[CSIZE:%.+]] = mul nuw i[[SZ]] [[CELEMSIZE2]], 2 -// CHECK-DAG: [[RET:%.+]] = call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 6, i8** [[BPR:%[^,]+]], i8** [[PR:%[^,]+]], i[[SZ]]* [[SR:%[^,]+]], i64* getelementptr inbounds ([6 x i64], [6 x i64]* [[MAPT5]], i32 0, i32 0), i32 0, i32 0) +// CHECK-DAG: [[RET:%.+]] = call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 6, i8** [[BPR:%[^,]+]], i8** [[PR:%[^,]+]], i[[SZ]]* [[SR:%[^,]+]], i64* getelementptr inbounds ([6 x i64], [6 x i64]* [[MAPT5]], i32 0, i32 0), i32 0, i32 1) // CHECK-DAG: [[BPR]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[BP:%.+]], i32 0, i32 0 // CHECK-DAG: [[PR]] = getelementptr inbounds [6 x i8*], [6 x i8*]* [[P:%.+]], i32 0, i32 0 // CHECK-DAG: [[SR]] = getelementptr inbounds [6 x i[[SZ]]], [6 x i[[SZ]]]* [[S:%.+]], i32 0, i32 0 @@ -639,7 +639,7 @@ int bar(int n){ // CHECK: [[IF:%.+]] = icmp sgt i32 {{[^,]+}}, 50 // CHECK: br i1 [[IF]], label %[[IFTHEN:[^,]+]], label %[[IFELSE:[^,]+]] // CHECK: [[IFTHEN]] -// CHECK-DAG: [[RET:%.+]] = call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 5, i8** [[BPR:%[^,]+]], i8** [[PR:%[^,]+]], i[[SZ]]* getelementptr inbounds ([5 x i[[SZ]]], [5 x i[[SZ]]]* [[SIZET6]], i32 0, i32 0), i64* getelementptr inbounds ([5 x i64], [5 x i64]* [[MAPT6]], i32 0, i32 0), i32 0, i32 0) +// CHECK-DAG: [[RET:%.+]] = call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 5, i8** [[BPR:%[^,]+]], i8** [[PR:%[^,]+]], i[[SZ]]* getelementptr inbounds ([5 x i[[SZ]]], [5 x i[[SZ]]]* [[SIZET6]], i32 0, i32 0), i64* getelementptr inbounds ([5 x i64], [5 x i64]* [[MAPT6]], i32 0, i32 0), i32 0, i32 1) // CHECK-DAG: [[BPR]] = getelementptr inbounds [5 x i8*], [5 x i8*]* [[BP:%.+]], i32 0, i32 0 // CHECK-DAG: [[PR]] = getelementptr inbounds [5 x i8*], [5 x i8*]* [[P:%.+]], i32 0, i32 0 @@ -696,7 +696,7 @@ int bar(int n){ // CHECK: [[IF:%.+]] = icmp sgt i32 {{[^,]+}}, 40 // CHECK: br i1 [[IF]], label %[[IFTHEN:[^,]+]], label %[[IFELSE:[^,]+]] // CHECK: [[IFTHEN]] -// CHECK-DAG: [[RET:%.+]] = call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 3, i8** [[BPR:%[^,]+]], i8** [[PR:%[^,]+]], i[[SZ]]* getelementptr inbounds ([3 x i[[SZ]]], [3 x i[[SZ]]]* [[SIZET7]], i32 0, i32 0), i64* getelementptr inbounds ([3 x i64], [3 x i64]* [[MAPT7]], i32 0, i32 0), i32 0, i32 0) +// CHECK-DAG: [[RET:%.+]] = call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 3, i8** [[BPR:%[^,]+]], i8** [[PR:%[^,]+]], i[[SZ]]* getelementptr inbounds ([3 x i[[SZ]]], [3 x i[[SZ]]]* [[SIZET7]], i32 0, i32 0), i64* getelementptr inbounds ([3 x i64], [3 x i64]* [[MAPT7]], i32 0, i32 0), i32 0, i32 1) // CHECK-DAG: [[BPR]] = getelementptr inbounds [3 x i8*], [3 x i8*]* [[BP:%.+]], i32 0, i32 0 // CHECK-DAG: [[PR]] = getelementptr inbounds [3 x i8*], [3 x i8*]* [[P:%.+]], i32 0, i32 0 diff --git a/test/OpenMP/target_teams_distribute_simd_collapse_messages.cpp b/test/OpenMP/target_teams_distribute_simd_collapse_messages.cpp index a2d3bde44a..6561091ec8 100644 --- a/test/OpenMP/target_teams_distribute_simd_collapse_messages.cpp +++ b/test/OpenMP/target_teams_distribute_simd_collapse_messages.cpp @@ -53,7 +53,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} argv[0][i] = argv[0][i] - argv[0][i-ST]; // expected-error 2 {{expected 2 for loops after '#pragma omp target teams distribute simd', but found only 1}} // expected-error@+6 2 {{directive '#pragma omp target teams distribute simd' cannot contain more than one 'collapse' clause}} -// expected-error@+5 2 {{argument to 'collapse' clause must be a strictly positive integer value}} +// expected-error@+5 {{argument to 'collapse' clause must be a strictly positive integer value}} // expected-error@+4 2 {{expression is not an integral constant expression}} #if __cplusplus >= 201103L // expected-note@+2 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} @@ -118,7 +118,7 @@ int main(int argc, char **argv) { // expected-error@+6 {{expression is not an integral constant expression}} // expected-error@+5 2 {{directive '#pragma omp target teams distribute simd' cannot contain more than one 'collapse' clause}} -// expected-error@+4 2 {{argument to 'collapse' clause must be a strictly positive integer value}} +// expected-error@+4 {{argument to 'collapse' clause must be a strictly positive integer value}} #if __cplusplus >= 201103L // expected-note@+2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif diff --git a/test/OpenMP/target_teams_distribute_simd_depend_codegen.cpp b/test/OpenMP/target_teams_distribute_simd_depend_codegen.cpp index 1eb732322c..21055ea4b1 100644 --- a/test/OpenMP/target_teams_distribute_simd_depend_codegen.cpp +++ b/test/OpenMP/target_teams_distribute_simd_depend_codegen.cpp @@ -98,7 +98,7 @@ int foo(int n) { // CHECK: getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 1 // CHECK: getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 2 // CHECK: getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 3 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call void @__kmpc_omp_wait_deps(%struct.ident_t* [[ID]], i32 [[GTID]], i32 4, i8* [[DEP]], i32 0, i8* null) // CHECK: call void @__kmpc_omp_task_begin_if0(%struct.ident_t* [[ID]], i32 [[GTID]], i8* [[TASK]]) @@ -138,7 +138,7 @@ int foo(int n) { // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 1 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 2 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call i32 @__kmpc_omp_task_with_deps(%struct.ident_t* [[ID]], i32 [[GTID]], i8* [[TASK]], i32 3, i8* [[DEP]], i32 0, i8* null) // CHECK: br label %[[EXIT:.+]] @@ -154,7 +154,7 @@ int foo(int n) { // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 1 // CHECK: getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 2 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call i32 @__kmpc_omp_task_with_deps(%struct.ident_t* [[ID]], i32 [[GTID]], i8* [[TASK]], i32 3, i8* [[DEP]], i32 0, i8* null) // CHECK: br label %[[EXIT:.+]] @@ -170,7 +170,7 @@ int foo(int n) { // CHECK: [[TASK:%.+]] = call i8* @__kmpc_omp_task_alloc(%struct.ident_t* [[ID]], i32 [[GTID]], i32 1, i[[SZ]] {{48|24}}, i[[SZ]] 4, i32 (i32, i8*)* bitcast (i32 (i32, %{{.+}}*)* [[TASK_ENTRY2:@.+]] to i32 (i32, i8*)*)) // CHECK: [[BC_TASK:%.+]] = bitcast i8* [[TASK]] to [[TASK_TY2:%.+]]* // CHECK: getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 - // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* %{{.+}}, i32 0, i32 0 + // CHECK: [[DEP_START:%.+]] = getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* %{{.+}}, i[[SZ]] 0, i[[SZ]] 0 // CHECK: [[DEP:%.+]] = bitcast %struct.kmp_depend_info* [[DEP_START]] to i8* // CHECK: call void @__kmpc_omp_wait_deps(%struct.ident_t* [[ID]], i32 [[GTID]], i32 1, i8* [[DEP]], i32 0, i8* null) // CHECK: call void @__kmpc_omp_task_begin_if0(%struct.ident_t* [[ID]], i32 [[GTID]], i8* [[TASK]]) @@ -194,7 +194,7 @@ int foo(int n) { // CHECK: [[DEVICE_CAP:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* %{{.+}}, i32 0, i32 0 // CHECK: [[DEV:%.+]] = load i32, i32* [[DEVICE_CAP]], // CHECK: [[DEVICE:%.+]] = sext i32 [[DEV]] to i64 -// CHECK: [[RET:%.+]] = call i32 @__tgt_target_teams(i64 [[DEVICE]], i8* @{{[^,]+}}, i32 0, i8** null, i8** null, i[[SZ]]* null, i64* null, i32 0, i32 0) +// CHECK: [[RET:%.+]] = call i32 @__tgt_target_teams(i64 [[DEVICE]], i8* @{{[^,]+}}, i32 0, i8** null, i8** null, i[[SZ]]* null, i64* null, i32 0, i32 1) // CHECK-NEXT: [[ERROR:%.+]] = icmp ne i32 [[RET]], 0 // CHECK-NEXT: br i1 [[ERROR]], label %[[FAIL:[^,]+]], label %[[END:[^,]+]] // CHECK: [[FAIL]] @@ -211,7 +211,7 @@ int foo(int n) { // CHECK: [[DEVICE_CAP:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* %{{.+}}, i32 0, i32 2 // CHECK: [[DEV:%.+]] = load i32, i32* [[DEVICE_CAP]], // CHECK: [[DEVICE:%.+]] = sext i32 [[DEV]] to i64 -// CHECK: [[RET:%.+]] = call i32 @__tgt_target_teams_nowait(i64 [[DEVICE]], i8* @{{[^,]+}}, i32 2, i8** [[BPR:%[^,]+]], i8** [[PR:%[^,]+]], i[[SZ]]* [[SZT]], i64* getelementptr inbounds ([2 x i64], [2 x i64]* [[MAPT]], i32 0, i32 0), i32 0, i32 0) +// CHECK: [[RET:%.+]] = call i32 @__tgt_target_teams_nowait(i64 [[DEVICE]], i8* @{{[^,]+}}, i32 2, i8** [[BPR:%[^,]+]], i8** [[PR:%[^,]+]], i[[SZ]]* [[SZT]], i64* getelementptr inbounds ([2 x i64], [2 x i64]* [[MAPT]], i32 0, i32 0), i32 0, i32 1) // CHECK: [[ERROR:%.+]] = icmp ne i32 [[RET]], 0 // CHECK-NEXT: br i1 [[ERROR]], label %[[FAIL:[^,]+]], label %[[END:[^,]+]] diff --git a/test/OpenMP/target_teams_distribute_simd_depend_messages.cpp b/test/OpenMP/target_teams_distribute_simd_depend_messages.cpp index 9c70d051d7..7e2012ace3 100644 --- a/test/OpenMP/target_teams_distribute_simd_depend_messages.cpp +++ b/test/OpenMP/target_teams_distribute_simd_depend_messages.cpp @@ -25,13 +25,13 @@ int main(int argc, char **argv, char *env[]) { #pragma omp target teams distribute simd depend // expected-error {{expected '(' after 'depend'}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute simd 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 target teams distribute simd depend ( // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after dependency type - ignoring}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute simd depend () // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} +#pragma omp target teams distribute simd depend () // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute simd 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 target teams distribute simd depend (argc // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute simd depend (source : argc) // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} +#pragma omp target teams distribute simd depend (source : argc) // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute simd depend (source) // expected-error {{expected expression}} expected-warning {{missing ':' after dependency type - ignoring}} for (i = 0; i < argc; ++i) foo(); diff --git a/test/OpenMP/target_teams_distribute_simd_firstprivate_codegen.cpp b/test/OpenMP/target_teams_distribute_simd_firstprivate_codegen.cpp index b2b911e888..463a6afd2d 100644 --- a/test/OpenMP/target_teams_distribute_simd_firstprivate_codegen.cpp +++ b/test/OpenMP/target_teams_distribute_simd_firstprivate_codegen.cpp @@ -85,7 +85,7 @@ int main() { // LAMBDA: call void [[OUTER_LAMBDA:@.+]]( [&]() { // LAMBDA: define{{.*}} internal{{.*}} void [[OUTER_LAMBDA]]( - // LAMBDA: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 3, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 0, i32 0) + // LAMBDA: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 3, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 0, i32 1) // LAMBDA: call void @[[LOFFL1:.+]](i{{64|32}} %{{.+}}) // LAMBDA: ret #pragma omp target teams distribute simd firstprivate(g, g1, sivar) @@ -164,7 +164,7 @@ int main() { } // CHECK: define {{.*}}i{{[0-9]+}} @main() -// CHECK: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 5, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 0, i32 0) +// CHECK: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 5, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 0, i32 1) // CHECK: call void @[[OFFL1:.+]]({{[^,]+}}, {{[^,]+}}, {{[^,]+}}, {{[^,]+}}, {{[^,]+}}) // CHECK: {{%.+}} = call{{.*}} i32 @[[TMAIN_INT:.+]]() // CHECK: ret @@ -225,8 +225,8 @@ int main() { // CHECK-DAG: [[VAR_ADDR_REF:%.+]] = load{{.+}} [[VAR_ADDR]], // firstprivate vec(vec): copy from *_addr into priv1 and then from priv1 into priv2 -// CHECK-DAG: [[VEC_DEST_PRIV:%.+]] = bitcast [2 x i{{[0-9]+}}]* [[VEC_PRIV]] to i8* -// CHECK-DAG: [[VEC_SRC:%.+]] = bitcast [2 x i{{[0-9]+}}]* [[VEC_ADDR_VAL]] to i8* +// CHECK-DAG: [[VEC_DEST_PRIV:%.+]] = bitcast [2 x i{{[0-9]+}}]* [[VEC_PRIV]] to i8* +// CHECK-DAG: [[VEC_SRC:%.+]] = bitcast [2 x i{{[0-9]+}}]* [[VEC_ADDR_VAL]] to i8* // CHECK: call void @llvm.memcpy.{{.+}}(i8* align {{[0-9]+}} [[VEC_DEST_PRIV]], i8* align {{[0-9]+}} [[VEC_SRC]], {{.+}}) // firstprivate(s_arr) @@ -258,7 +258,7 @@ int main() { // CHECK: ret void // CHECK: define{{.*}} i{{[0-9]+}} @[[TMAIN_INT]]() -// CHECK: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 4, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 0, i32 0) +// CHECK: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 4, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 0, i32 1) // CHECK: call void @[[TOFFL1:.+]]({{[^,]+}}, {{[^,]+}}, {{[^,]+}}, {{[^,]+}}) // CHECK: ret @@ -311,8 +311,8 @@ int main() { // CHECK: [[S_ARR_ADDR_REF:%.+]] = load [2 x [[S_INT_TY]]]*, [2 x [[S_INT_TY]]]** [[S_ARR_ADDR]], // firstprivate vec(vec): copy from *_addr into priv1 and then from priv1 into priv2 -// CHECK-DAG: [[VEC_DEST_PRIV:%.+]] = bitcast [2 x i{{[0-9]+}}]* [[VEC_PRIV]] to i8* -// CHECK-DAG: [[VEC_SRC:%.+]] = bitcast [2 x i{{[0-9]+}}]* [[VEC_ADDR_VAL]] to i8* +// CHECK-DAG: [[VEC_DEST_PRIV:%.+]] = bitcast [2 x i{{[0-9]+}}]* [[VEC_PRIV]] to i8* +// CHECK-DAG: [[VEC_SRC:%.+]] = bitcast [2 x i{{[0-9]+}}]* [[VEC_ADDR_VAL]] to i8* // CHECK: call void @llvm.memcpy.{{.+}}(i8* align {{[0-9]+}} [[VEC_DEST_PRIV]], i8* align {{[0-9]+}} [[VEC_SRC]], {{.+}}) // firstprivate(s_arr) diff --git a/test/OpenMP/target_teams_distribute_simd_firstprivate_messages.cpp b/test/OpenMP/target_teams_distribute_simd_firstprivate_messages.cpp index a4aaba7f83..1ce3adc74d 100644 --- a/test/OpenMP/target_teams_distribute_simd_firstprivate_messages.cpp +++ b/test/OpenMP/target_teams_distribute_simd_firstprivate_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -84,7 +94,7 @@ int main(int argc, char **argv) { #pragma omp target teams distribute simd firstprivate (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute simd firstprivate (argc) +#pragma omp target teams distribute simd firstprivate (argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute simd firstprivate (S1) // expected-error {{'S1' does not refer to a value}} @@ -96,7 +106,7 @@ int main(int argc, char **argv) { #pragma omp target teams distribute simd firstprivate (argv[1]) // expected-error {{expected variable name}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute simd firstprivate(ba) +#pragma omp target teams distribute simd firstprivate(ba) allocate(omp_thread_mem_alloc: ba) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target teams distribute simd' directive}} for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute simd firstprivate(ca) // expected-error {{no matching constructor for initialization of 'S3'}} diff --git a/test/OpenMP/target_teams_distribute_simd_lastprivate_messages.cpp b/test/OpenMP/target_teams_distribute_simd_lastprivate_messages.cpp index 4dcc9ea754..1235f81a21 100644 --- a/test/OpenMP/target_teams_distribute_simd_lastprivate_messages.cpp +++ b/test/OpenMP/target_teams_distribute_simd_lastprivate_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -88,7 +98,7 @@ int foomain(int argc, char **argv) { #pragma omp target teams distribute simd lastprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp target teams distribute simd lastprivate(argc) +#pragma omp target teams distribute simd lastprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target teams distribute simd lastprivate(S1) // expected-error {{'S1' does not refer to a value}} @@ -107,7 +117,7 @@ int foomain(int argc, char **argv) { for (int k = 0; k < argc; ++k) ++k; int v = 0; -#pragma omp target teams distribute simd lastprivate(i) +#pragma omp target teams distribute simd allocate(omp_thread_mem_alloc: i) lastprivate(i) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target teams distribute simd' directive}} for (int k = 0; k < argc; ++k) { i = k; v += i; diff --git a/test/OpenMP/target_teams_distribute_simd_linear_messages.cpp b/test/OpenMP/target_teams_distribute_simd_linear_messages.cpp index c353242bc1..f4131ed7ae 100644 --- a/test/OpenMP/target_teams_distribute_simd_linear_messages.cpp +++ b/test/OpenMP/target_teams_distribute_simd_linear_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + namespace X { int x; }; @@ -209,7 +219,7 @@ int main(int argc, char **argv) { for (int k = 0; k < argc; ++k) ++k; // expected-error@+1 {{only loop iteration variables are allowed in 'linear' clause in distribute directives}} -#pragma omp target teams distribute simd linear (argc) +#pragma omp target teams distribute simd linear (argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target teams distribute simd linear (S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/target_teams_distribute_simd_map_messages.cpp b/test/OpenMP/target_teams_distribute_simd_map_messages.cpp index 99c633a45d..3806c4ecf5 100644 --- a/test/OpenMP/target_teams_distribute_simd_map_messages.cpp +++ b/test/OpenMP/target_teams_distribute_simd_map_messages.cpp @@ -86,6 +86,8 @@ T tmain(T argc) { for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute simd map(l[:-1]) // expected-error 2 {{section length is evaluated to a negative value -1}} for (i = 0; i < argc; ++i) foo(); +#pragma omp target teams distribute simd map(l[true:true]) + for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute simd map(x) for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute simd map(tofrom: t[:I]) @@ -163,7 +165,7 @@ T tmain(T argc) { for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute simd map(always: x) // expected-error {{missing map type}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute simd map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always' or 'close'}} expected-error {{missing map type}} +#pragma omp target teams distribute simd map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always', 'close', or 'mapper'}} expected-error {{missing map type}} for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute simd map(always, tofrom: always, tofrom, x) for (i = 0; i < argc; ++i) foo(); @@ -206,6 +208,8 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute simd map(l[:-1]) // expected-error {{section length is evaluated to a negative value -1}} for (i = 0; i < argc; ++i) foo(); +#pragma omp target teams distribute simd map(l[true:true]) + for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute simd map(x) for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute simd map(to: x) @@ -271,7 +275,7 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute simd map(always: x) // expected-error {{missing map type}} for (i = 0; i < argc; ++i) foo(); -#pragma omp target teams distribute simd map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always' or 'close'}} expected-error {{missing map type}} +#pragma omp target teams distribute simd map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always', 'close', or 'mapper'}} expected-error {{missing map type}} for (i = 0; i < argc; ++i) foo(); #pragma omp target teams distribute simd map(always, tofrom: always, tofrom, x) for (i = 0; i < argc; ++i) foo(); diff --git a/test/OpenMP/target_teams_distribute_simd_private_codegen.cpp b/test/OpenMP/target_teams_distribute_simd_private_codegen.cpp index 4fa4d04c70..402c83921d 100644 --- a/test/OpenMP/target_teams_distribute_simd_private_codegen.cpp +++ b/test/OpenMP/target_teams_distribute_simd_private_codegen.cpp @@ -84,7 +84,7 @@ int main() { // LAMBDA: call void [[OUTER_LAMBDA:@.+]]( [&]() { // LAMBDA: define{{.*}} internal{{.*}} void [[OUTER_LAMBDA]]( - // LAMBDA: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 0, i8** null, i8** null, i{{64|32}}* null, i64* null, i32 0, i32 0) + // LAMBDA: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 0, i8** null, i8** null, i{{64|32}}* null, i64* null, i32 0, i32 1) // LAMBDA: call void @[[LOFFL1:.+]]() // LAMBDA: ret #pragma omp target teams distribute simd private(g, g1, sivar) @@ -151,7 +151,7 @@ int main() { } // CHECK: define {{.*}}i{{[0-9]+}} @main() -// CHECK: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 0, i8** null, i8** null, i{{64|32}}* null, i64* null, i32 0, i32 0) +// CHECK: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 0, i8** null, i8** null, i{{64|32}}* null, i64* null, i32 0, i32 1) // CHECK: call void @[[OFFL1:.+]]() // CHECK: {{%.+}} = call{{.*}} i32 @[[TMAIN_INT:.+]]() // CHECK: ret diff --git a/test/OpenMP/target_teams_distribute_simd_private_messages.cpp b/test/OpenMP/target_teams_distribute_simd_private_messages.cpp index eef86d229d..7edcaf19a3 100644 --- a/test/OpenMP/target_teams_distribute_simd_private_messages.cpp +++ b/test/OpenMP/target_teams_distribute_simd_private_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -70,7 +80,7 @@ int main(int argc, char **argv) { #pragma omp target teams distribute simd private (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp target teams distribute simd private (argc) +#pragma omp target teams distribute simd private (argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target teams distribute simd private (S1) // expected-error {{'S1' does not refer to a value}} @@ -82,7 +92,7 @@ int main(int argc, char **argv) { #pragma omp target teams distribute simd private (argv[1]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp target teams distribute simd private(ba) +#pragma omp target teams distribute simd private(ba) allocate(omp_thread_mem_alloc: ba) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target teams distribute simd' directive}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target teams distribute simd private(ca) // expected-error {{const-qualified variable without mutable fields cannot be private}} diff --git a/test/OpenMP/target_teams_distribute_simd_reduction_codegen.cpp b/test/OpenMP/target_teams_distribute_simd_reduction_codegen.cpp index c533bb30f8..a850238af5 100644 --- a/test/OpenMP/target_teams_distribute_simd_reduction_codegen.cpp +++ b/test/OpenMP/target_teams_distribute_simd_reduction_codegen.cpp @@ -46,7 +46,7 @@ int main() { // LAMBDA: call void [[OUTER_LAMBDA:@.+]]( [&]() { // LAMBDA: define{{.*}} internal{{.*}} void [[OUTER_LAMBDA]]( - // LAMBDA: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 1, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 0, i32 0) + // LAMBDA: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 1, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 0, i32 1) // LAMBDA: call void @[[LOFFL1:.+]]( // LAMBDA: ret #pragma omp target teams distribute simd reduction(+: sivar) @@ -124,7 +124,7 @@ int main() { // CHECK: [[RED_VAR:@.+]] = common global [8 x {{.+}}] zeroinitializer // CHECK: define {{.*}}i{{[0-9]+}} @main() -// CHECK: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 1, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 0, i32 0) +// CHECK: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 1, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 0, i32 1) // CHECK: call void @[[OFFL1:.+]](i32* {{.+}}) // CHECK: [[RES:%.+]] = call{{.*}} i32 @[[TMAIN_INT:[^(]+]]() // CHECK: ret i32 [[RES]] diff --git a/test/OpenMP/target_teams_distribute_simd_reduction_messages.cpp b/test/OpenMP/target_teams_distribute_simd_reduction_messages.cpp index 1b4b3ed88c..c033c05802 100644 --- a/test/OpenMP/target_teams_distribute_simd_reduction_messages.cpp +++ b/test/OpenMP/target_teams_distribute_simd_reduction_messages.cpp @@ -6,6 +6,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 %s // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -107,7 +117,7 @@ T tmain(T argc) { for (int j=0; j<100; j++) foo(); #pragma omp target teams distribute simd reduction(foo : argc) //expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'float'}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int'}} for (int j=0; j<100; j++) foo(); -#pragma omp target teams distribute simd reduction(&& : argc) +#pragma omp target teams distribute simd reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int j=0; j<100; j++) foo(); #pragma omp target teams distribute simd reduction(^ : T) // expected-error {{'T' does not refer to a value}} for (int j=0; j<100; j++) foo(); @@ -146,7 +156,7 @@ T tmain(T argc) { #pragma omp parallel reduction(min : i) #pragma omp target teams distribute simd reduction(max : j) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}} for (int j=0; j<100; j++) foo(); -#pragma omp target teams distribute simd reduction(+ : fl) +#pragma omp target teams distribute simd reduction(+ : fl) allocate(omp_thread_mem_alloc: fl) // expected-warning 2 {{allocator with the 'thread' trait access has unspecified behavior on 'target teams distribute simd' directive}} for (int j=0; j<100; j++) foo(); return T(); diff --git a/test/OpenMP/target_teams_distribute_simd_safelen_messages.cpp b/test/OpenMP/target_teams_distribute_simd_safelen_messages.cpp index 67b22216b9..da5c8eb75d 100644 --- a/test/OpenMP/target_teams_distribute_simd_safelen_messages.cpp +++ b/test/OpenMP/target_teams_distribute_simd_safelen_messages.cpp @@ -49,9 +49,12 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} argv[0][i] = argv[0][i] - argv[0][i-ST]; #if __cplusplus >= 201103L - // expected-note@+2 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} + // expected-note@+5 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif -#pragma omp target teams distribute simd safelen (foobool(argc)), safelen (true), safelen (-5) // expected-error 2 {{directive '#pragma omp target teams distribute simd' cannot contain more than one 'safelen' clause}} expected-error 2 {{argument to 'safelen' clause must be a strictly positive integer value}} expected-error 2 {{expression is not an integral constant expression}} +// expected-error@+3 2 {{directive '#pragma omp target teams distribute simd' cannot contain more than one 'safelen' clause}} +// expected-error@+2 {{argument to 'safelen' clause must be a strictly positive integer value}} +// expected-error@+1 2 {{expression is not an integral constant expression}} +#pragma omp target teams distribute simd safelen (foobool(argc)), safelen (true), safelen (-5) for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; @@ -108,9 +111,12 @@ int main(int argc, char **argv) { argv[0][i] = argv[0][i] - argv[0][i-4]; #if __cplusplus >= 201103L - // expected-note@+2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} + // expected-note@+5 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif -#pragma omp target teams distribute simd safelen (foobool(argc)), safelen (true), safelen (-5) // expected-error 2 {{argument to 'safelen' clause must be a strictly positive integer value}} expected-error 2 {{directive '#pragma omp target teams distribute simd' cannot contain more than one 'safelen' clause}} expected-error {{expression is not an integral constant expression}} +// expected-error@+3 {{argument to 'safelen' clause must be a strictly positive integer value}} +// expected-error@+2 2 {{directive '#pragma omp target teams distribute simd' cannot contain more than one 'safelen' clause}} +// expected-error@+1 {{expression is not an integral constant expression}} +#pragma omp target teams distribute simd safelen (foobool(argc)), safelen (true), safelen (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; diff --git a/test/OpenMP/target_teams_distribute_simd_simdlen_messages.cpp b/test/OpenMP/target_teams_distribute_simd_simdlen_messages.cpp index 6fea25a57a..851fff36f2 100644 --- a/test/OpenMP/target_teams_distribute_simd_simdlen_messages.cpp +++ b/test/OpenMP/target_teams_distribute_simd_simdlen_messages.cpp @@ -49,9 +49,12 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} argv[0][i] = argv[0][i] - argv[0][i-ST]; #if __cplusplus >= 201103L - // expected-note@+2 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} + // expected-note@+5 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif -#pragma omp target teams distribute simd safelen (foobool(argc)), safelen (true), safelen (-5) // expected-error 2 {{directive '#pragma omp target teams distribute simd' cannot contain more than one 'safelen' clause}} expected-error 2 {{argument to 'safelen' clause must be a strictly positive integer value}} expected-error 2 {{expression is not an integral constant expression}} +// expected-error@+3 2 {{directive '#pragma omp target teams distribute simd' cannot contain more than one 'safelen' clause}} +// expected-error@+2 {{argument to 'safelen' clause must be a strictly positive integer value}} +// expected-error@+1 2 {{expression is not an integral constant expression}} +#pragma omp target teams distribute simd safelen (foobool(argc)), safelen (true), safelen (-5) for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; @@ -108,9 +111,12 @@ int main(int argc, char **argv) { argv[0][i] = argv[0][i] - argv[0][i-4]; #if __cplusplus >= 201103L - // expected-note@+2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} + // expected-note@+5 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif -#pragma omp target teams distribute simd safelen (foobool(argc)), safelen (true), safelen (-5) // expected-error 2 {{argument to 'safelen' clause must be a strictly positive integer value}} expected-error 2 {{directive '#pragma omp target teams distribute simd' cannot contain more than one 'safelen' clause}} expected-error {{expression is not an integral constant expression}} +// expected-error@+3 {{argument to 'safelen' clause must be a strictly positive integer value}} +// expected-error@+2 2 {{directive '#pragma omp target teams distribute simd' cannot contain more than one 'safelen' clause}} +// expected-error@+1 {{expression is not an integral constant expression}} +#pragma omp target teams distribute simd safelen (foobool(argc)), safelen (true), safelen (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; diff --git a/test/OpenMP/target_teams_firstprivate_messages.cpp b/test/OpenMP/target_teams_firstprivate_messages.cpp index 492796981a..9f6eb8ad81 100644 --- a/test/OpenMP/target_teams_firstprivate_messages.cpp +++ b/test/OpenMP/target_teams_firstprivate_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -78,7 +88,7 @@ int main(int argc, char **argv) { foo(); #pragma omp target teams firstprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} foo(); -#pragma omp target teams firstprivate(argc) +#pragma omp target teams firstprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} foo(); #pragma omp target teams firstprivate(S1) // expected-error {{'S1' does not refer to a value}} foo(); @@ -86,7 +96,7 @@ int main(int argc, char **argv) { foo(); #pragma omp target teams firstprivate(argv[1]) // expected-error {{expected variable name}} foo(); -#pragma omp target teams firstprivate(ba) +#pragma omp target teams allocate(omp_thread_mem_alloc: ba) firstprivate(ba) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target teams' directive}} foo(); #pragma omp target teams firstprivate(ca) foo(); diff --git a/test/OpenMP/target_teams_map_messages.cpp b/test/OpenMP/target_teams_map_messages.cpp index 4b2629ee33..8608756bd4 100644 --- a/test/OpenMP/target_teams_map_messages.cpp +++ b/test/OpenMP/target_teams_map_messages.cpp @@ -57,6 +57,8 @@ struct SA { {} #pragma omp target teams map(b[:-1]) // expected-error {{section length is evaluated to a negative value -1}} {} + #pragma omp target teams map(b[true:true]) + {} #pragma omp target teams map(always, tofrom: c,f) {} @@ -454,7 +456,7 @@ T tmain(T argc) { #pragma omp target data map(always, tofrom: x) #pragma omp target data map(always: x) // expected-error {{missing map type}} -#pragma omp target data map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always' or 'close'}} expected-error {{missing map type}} +#pragma omp target data map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always', 'close', or 'mapper'}} expected-error {{missing map type}} #pragma omp target data map(always, tofrom: always, tofrom, x) #pragma omp target teams map(tofrom j) // expected-error {{expected ',' or ')' in 'map' clause}} foo(); @@ -529,7 +531,7 @@ int main(int argc, char **argv) { #pragma omp target data map(always, tofrom: x) #pragma omp target data map(always: x) // expected-error {{missing map type}} -#pragma omp target data map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always' or 'close'}} expected-error {{missing map type}} +#pragma omp target data map(tofrom, always: x) // expected-error {{incorrect map type modifier, expected 'always', 'close', or 'mapper'}} expected-error {{missing map type}} #pragma omp target data map(always, tofrom: always, tofrom, x) #pragma omp target teams map(tofrom j) // expected-error {{expected ',' or ')' in 'map' clause}} foo(); diff --git a/test/OpenMP/target_teams_messages.cpp b/test/OpenMP/target_teams_messages.cpp index bc068f87b6..362767ef1d 100644 --- a/test/OpenMP/target_teams_messages.cpp +++ b/test/OpenMP/target_teams_messages.cpp @@ -47,14 +47,14 @@ int main(int argc, char **argv) { break; } } -#pragma omp target teams default(none) +#pragma omp target teams default(none) // expected-note {{explicit data sharing attribute requested here}} ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} -#pragma omp target teams default(none) +#pragma omp target teams default(none) // expected-note {{explicit data sharing attribute requested here}} #pragma omp parallel num_threads(argc) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} ; -#pragma omp target teams default(none) +#pragma omp target teams default(none) // expected-note {{explicit data sharing attribute requested here}} { #pragma omp parallel num_threads(argc) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} ; diff --git a/test/OpenMP/target_teams_private_messages.cpp b/test/OpenMP/target_teams_private_messages.cpp index ceb268f40a..7714113af7 100644 --- a/test/OpenMP/target_teams_private_messages.cpp +++ b/test/OpenMP/target_teams_private_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -78,7 +88,7 @@ int main(int argc, char **argv) { foo(); #pragma omp target teams private (argv[1]) // expected-error {{expected variable name}} foo(); -#pragma omp target teams private(ba) +#pragma omp target teams private(ba) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} foo(); #pragma omp target teams private(ca) // expected-error {{const-qualified variable without mutable fields cannot be private}} foo(); @@ -98,7 +108,7 @@ int main(int argc, char **argv) { foo(); #pragma omp target teams private(j) foo(); -#pragma omp target teams firstprivate(i) +#pragma omp target teams firstprivate(i) allocate(omp_thread_mem_alloc: i) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target teams' directive}} for (int k = 0; k < 10; ++k) { #pragma omp parallel private(i) foo(); diff --git a/test/OpenMP/target_teams_reduction_messages.cpp b/test/OpenMP/target_teams_reduction_messages.cpp index 1c3eacfef4..2d8a47b7f8 100644 --- a/test/OpenMP/target_teams_reduction_messages.cpp +++ b/test/OpenMP/target_teams_reduction_messages.cpp @@ -6,6 +6,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -o - %s // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -o - %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -112,7 +122,7 @@ T tmain(T argc) { foo(); #pragma omp target teams reduction(foo : argc) //expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'float'}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int'}} foo(); -#pragma omp target teams reduction(&& : argc) +#pragma omp target teams reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} foo(); #pragma omp target teams reduction(^ : T) // expected-error {{'T' does not refer to a value}} foo(); @@ -155,7 +165,7 @@ T tmain(T argc) { #pragma omp parallel for private(fl) for (int i = 0; i < 10; ++i) {} -#pragma omp target teams reduction(+ : fl) +#pragma omp target teams reduction(+ : fl) allocate(omp_thread_mem_alloc: fl) // expected-warning 2 {{allocator with the 'thread' trait access has unspecified behavior on 'target teams' directive}} foo(); #pragma omp target teams #pragma omp parallel for reduction(- : fl) diff --git a/test/OpenMP/target_update_depend_codegen.cpp b/test/OpenMP/target_update_depend_codegen.cpp index ee1b0bfcee..96c51f8cf4 100644 --- a/test/OpenMP/target_update_depend_codegen.cpp +++ b/test/OpenMP/target_update_depend_codegen.cpp @@ -90,7 +90,7 @@ void foo(int arg) { // CK1: store i[[sz]] 4, i[[sz]]* [[DEP_SIZE]], // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2 // CK1: store i8 1, i8* [[DEP_ATTRS]] - // CK1: [[DEP:%.+]] = getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* [[MAIN_DEP]], i32 0, i32 0 + // CK1: [[DEP:%.+]] = getelementptr inbounds [1 x %struct.kmp_depend_info], [1 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 0 // CK1: [[BC:%.+]] = bitcast %struct.kmp_depend_info* [[DEP]] to i8* // CK1: = call i32 @__kmpc_omp_task_with_deps(%struct.ident_t* @{{.+}}, i32 %{{.+}}, i8* [[RES]], i32 1, i8* [[BC]], i32 0, i8* null) @@ -161,7 +161,7 @@ void foo(int arg) { // CK1: store i[[sz]] 800, i[[sz]]* [[DEP_SIZE]], // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2 // CK1: store i8 3, i8* [[DEP_ATTRS]] - // CK1: [[DEP:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* [[MAIN_DEP]], i32 0, i32 0 + // CK1: [[DEP:%.+]] = getelementptr inbounds [3 x %struct.kmp_depend_info], [3 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 0 // CK1: [[BC:%.+]] = bitcast %struct.kmp_depend_info* [[DEP]] to i8* // CK1: call void @__kmpc_omp_wait_deps(%struct.ident_t* @{{.+}}, i32 %{{.+}}, i32 3, i8* [[BC]], i32 0, i8* null) // CK1: call void @__kmpc_omp_task_begin_if0(%struct.ident_t* @{{.+}}, i32 %{{.+}}, i8* [[RES]]) @@ -239,7 +239,7 @@ void foo(int arg) { // CK1: store i[[sz]] 800, i[[sz]]* [[DEP_SIZE]], // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2 // CK1: store i8 3, i8* [[DEP_ATTRS]] - // CK1: [[DEP:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* [[MAIN_DEP]], i32 0, i32 0 + // CK1: [[DEP:%.+]] = getelementptr inbounds [4 x %struct.kmp_depend_info], [4 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 0 // CK1: [[BC:%.+]] = bitcast %struct.kmp_depend_info* [[DEP]] to i8* // CK1: call void @__kmpc_omp_wait_deps(%struct.ident_t* @{{.+}}, i32 %{{.+}}, i32 4, i8* [[BC]], i32 0, i8* null) // CK1: call void @__kmpc_omp_task_begin_if0(%struct.ident_t* @{{.+}}, i32 %{{.+}}, i8* [[RES]]) @@ -320,7 +320,7 @@ void foo(int arg) { // CK1: store i[[sz]] 4, i[[sz]]* [[DEP_SIZE]], // CK1: [[DEP_ATTRS:%.+]] = getelementptr inbounds %struct.kmp_depend_info, %struct.kmp_depend_info* [[DEP]], i32 0, i32 2 // CK1: store i8 1, i8* [[DEP_ATTRS]] - // CK1: [[DEP:%.+]] = getelementptr inbounds [5 x %struct.kmp_depend_info], [5 x %struct.kmp_depend_info]* [[MAIN_DEP]], i32 0, i32 0 + // CK1: [[DEP:%.+]] = getelementptr inbounds [5 x %struct.kmp_depend_info], [5 x %struct.kmp_depend_info]* [[MAIN_DEP]], i[[sz]] 0, i[[sz]] 0 // CK1: [[BC:%.+]] = bitcast %struct.kmp_depend_info* [[DEP]] to i8* // CK1: call void @__kmpc_omp_wait_deps(%struct.ident_t* @{{.+}}, i32 %{{.+}}, i32 5, i8* [[BC]], i32 0, i8* null) // CK1: call void @__kmpc_omp_task_begin_if0(%struct.ident_t* @{{.+}}, i32 %{{.+}}, i8* [[RES]]) diff --git a/test/OpenMP/target_update_depend_messages.cpp b/test/OpenMP/target_update_depend_messages.cpp index d52f566844..016219c073 100644 --- a/test/OpenMP/target_update_depend_messages.cpp +++ b/test/OpenMP/target_update_depend_messages.cpp @@ -30,10 +30,10 @@ int tmain(T argc, S **argv, R *env[]) { {} #pragma omp target update to(z) depend // expected-error {{expected '(' after 'depend'}} - #pragma omp target update to(z) 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 target update to(z) depend() // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} - #pragma omp target update to(z) 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 target update to(z) depend(source : argc) // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} + #pragma omp target update to(z) depend( // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after dependency type - ignoring}} + #pragma omp target update to(z) depend() // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} + #pragma omp target update to(z) depend(argc // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}} + #pragma omp target update to(z) depend(source : argc) // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} #pragma omp target update to(z) depend(source) // expected-error {{expected expression}} expected-warning {{missing ':' after dependency type - ignoring}} #pragma omp target update to(z) depend(in : argc)) // expected-warning {{extra tokens at the end of '#pragma omp target update' are ignored}} #pragma omp target update to(z) depend(out: ) // expected-error {{expected expression}} @@ -78,10 +78,10 @@ int main(int argc, char **argv, char *env[]) { {} #pragma omp target update to(z) depend // expected-error {{expected '(' after 'depend'}} - #pragma omp target update to(z) 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 target update to(z) depend() // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} - #pragma omp target update to(z) 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 target update to(z) depend(source : argc) // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} + #pragma omp target update to(z) depend( // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-warning {{missing ':' after dependency type - ignoring}} + #pragma omp target update to(z) depend() // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} + #pragma omp target update to(z) depend(argc // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}} + #pragma omp target update to(z) depend(source : argc) // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} #pragma omp target update to(z) depend(source) // expected-error {{expected expression}} expected-warning {{missing ':' after dependency type - ignoring}} #pragma omp target update to(z) depend(in : argc)) // expected-warning {{extra tokens at the end of '#pragma omp target update' are ignored}} #pragma omp target update to(z) depend(out: ) // expected-error {{expected expression}} diff --git a/test/OpenMP/target_update_messages.cpp b/test/OpenMP/target_update_messages.cpp index da71ff6a5a..68b76344b9 100644 --- a/test/OpenMP/target_update_messages.cpp +++ b/test/OpenMP/target_update_messages.cpp @@ -26,7 +26,7 @@ int main(int argc, char **argv) { #pragma omp target update to(m) ] // expected-warning {{extra tokens at the end of '#pragma omp target update' are ignored}} #pragma omp target update to(m) ) // expected-warning {{extra tokens at the end of '#pragma omp target update' are ignored}} - #pragma omp target update from(m) // OK + #pragma omp target update from(m) allocate(m) // expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp target update'}} { foo(); } diff --git a/test/OpenMP/target_vla_messages.cpp b/test/OpenMP/target_vla_messages.cpp index b744081e98..30a2751724 100644 --- a/test/OpenMP/target_vla_messages.cpp +++ b/test/OpenMP/target_vla_messages.cpp @@ -47,7 +47,7 @@ void target_template(int arg) { #pragma omp target { #ifdef NO_VLA - // expected-error@+2 {{variable length arrays are not supported for the current target}} + // expected-error@+2 2 {{variable length arrays are not supported for the current target}} #endif T vla[arg]; } @@ -73,6 +73,9 @@ void target(int arg) { } } +#ifdef NO_VLA + // expected-note@+2 {{in instantiation of function template specialization 'target_template<long>' requested here}} +#endif target_template<long>(arg); } diff --git a/test/OpenMP/task_ast_print.cpp b/test/OpenMP/task_ast_print.cpp index 01ffda9f87..527f47072b 100644 --- a/test/OpenMP/task_ast_print.cpp +++ b/test/OpenMP/task_ast_print.cpp @@ -28,8 +28,8 @@ protected: public: S7(typename T::type v) : a(v) { -#pragma omp taskgroup task_reduction(+:b) -#pragma omp task private(a) private(this->a) private(T::a) in_reduction(+:this->b) +#pragma omp taskgroup allocate(b) task_reduction(+:b) +#pragma omp task private(a) private(this->a) private(T::a) in_reduction(+:this->b) allocate(b) for (int k = 0; k < a.a; ++k) ++this->a.a; } @@ -41,8 +41,8 @@ public: } }; -// CHECK: #pragma omp taskgroup task_reduction(+: this->b) -// CHECK: #pragma omp task private(this->a) private(this->a) private(T::a) in_reduction(+: this->b){{$}} +// CHECK: #pragma omp taskgroup allocate(this->b) task_reduction(+: this->b) +// CHECK: #pragma omp task private(this->a) private(this->a) private(T::a) in_reduction(+: this->b) allocate(this->b){{$}} // CHECK: #pragma omp task private(this->a) private(this->a) // CHECK: #pragma omp task private(this->a) private(this->a) private(this->S1::a) diff --git a/test/OpenMP/task_codegen.cpp b/test/OpenMP/task_codegen.cpp index b034bb29c8..2c4eb682d8 100644 --- a/test/OpenMP/task_codegen.cpp +++ b/test/OpenMP/task_codegen.cpp @@ -95,7 +95,7 @@ int main() { // CHECK: store i64 [[SIZEOF]], i64* [[T0]] // CHECK: [[T0:%.*]] = getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 2 // CHECK: store i8 1, i8* [[T0]] -// CHECK: [[DEPS:%.*]] = getelementptr inbounds [4 x [[KMP_DEPEND_INFO]]], [4 x [[KMP_DEPEND_INFO]]]* [[DEPENDENCIES]], i32 0, i32 0 +// CHECK: [[DEPS:%.*]] = getelementptr inbounds [4 x [[KMP_DEPEND_INFO]]], [4 x [[KMP_DEPEND_INFO]]]* [[DEPENDENCIES]], i{{32|64}} 0, i{{32|64}} 0 // CHECK: bitcast [[KMP_DEPEND_INFO]]* [[DEPS]] to i8* // CHECK: call i32 @__kmpc_omp_task_with_deps([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i8* [[ORIG_TASK_PTR]], i32 4, i8* %{{[^,]+}}, i32 0, i8* null) #pragma omp task shared(a, s) depend(in : a, b, s, arr[:]) @@ -142,13 +142,52 @@ int main() { // CHECK: store i64 [[SIZEOF]], 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: getelementptr inbounds [2 x [[KMP_DEPEND_INFO]]], [2 x [[KMP_DEPEND_INFO]]]* %{{[^,]+}}, i{{32|64}} 0, i{{32|64}} 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 untied depend(out : s[0], arr[4:][b]) { a = 1; } +// CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i32 0, i64 40, i64 1, +// CHECK: getelementptr inbounds [2 x [[STRUCT_S]]], [2 x [[STRUCT_S]]]* [[S]], i64 0, i64 0 +// CHECK: getelementptr inbounds [2 x [[KMP_DEPEND_INFO]]], [2 x [[KMP_DEPEND_INFO]]]* %{{[^,]+}}, i64 0, i64 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 4, i8* +// CHECK: [[B_VAL:%.+]] = load i8, i8* [[B]] +// CHECK: [[IDX2:%.+]] = sext i8 [[B_VAL]] to i64 +// CHECK: [[IDX1:%.+]] = mul nsw i64 4, [[A_VAL]] +// CHECK: [[START:%.+]] = getelementptr inbounds i32, i32* %{{.+}}, i64 [[IDX1]] +// CHECK: [[START1:%.+]] = getelementptr inbounds i32, i32* [[START]], i64 [[IDX2]] +// CHECK: [[B_VAL:%.+]] = load i8, i8* [[B]] +// CHECK: [[IDX2:%.+]] = sext i8 [[B_VAL]] to i64 +// CHECK: [[IDX1:%.+]] = mul nsw i64 9, [[A_VAL]] +// CHECK: [[END:%.+]] = getelementptr inbounds i32, i32* %{{.+}}, i64 [[IDX1]] +// CHECK: [[END1:%.+]] = getelementptr inbounds i32, i32* [[END]], i64 [[IDX2]] +// CHECK: [[END2:%.+]] = getelementptr i32, i32* [[END1]], i32 1 +// CHECK: [[START_INT:%.+]] = ptrtoint i32* [[START1]] to i64 +// CHECK: [[END_INT:%.+]] = ptrtoint i32* [[END2]] to i64 +// CHECK: [[SIZEOF:%.+]] = sub nuw i64 [[END_INT]], [[START_INT]] +// CHECK: getelementptr inbounds [2 x [[KMP_DEPEND_INFO]]], [2 x [[KMP_DEPEND_INFO]]]* %{{[^,]+}}, i64 0, i64 1 +// CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 0 +// CHECK: ptrtoint i32* [[START1]] to i64 +// CHECK: store i64 %{{[^,]+}}, i64* +// CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 1 +// CHECK: store i64 [[SIZEOF]], i64* +// CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 2 +// CHECK: store i8 4, i8* +// CHECK: getelementptr inbounds [2 x [[KMP_DEPEND_INFO]]], [2 x [[KMP_DEPEND_INFO]]]* %{{[^,]+}}, i{{32|64}} 0, i{{32|64}} 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 untied depend(mutexinoutset: s[0], arr[4:][b]) + { + a = 1; + } // CHECK: [[ORIG_TASK_PTR:%.+]] = call i8* @__kmpc_omp_task_alloc([[IDENT_T]]* @{{.+}}, i32 [[GTID]], i32 3, i64 40, i64 1, // CHECK: getelementptr inbounds [3 x [[KMP_DEPEND_INFO]]], [3 x [[KMP_DEPEND_INFO]]]* %{{[^,]+}}, i64 0, i64 0 // CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 0 @@ -190,7 +229,7 @@ int main() { // CHECK: store i64 [[SIZEOF]], i64* // CHECK: getelementptr inbounds [[KMP_DEPEND_INFO]], [[KMP_DEPEND_INFO]]* %{{[^,]+}}, i32 0, i32 2 // CHECK: store i8 3, i8* -// CHECK: getelementptr inbounds [3 x [[KMP_DEPEND_INFO]]], [3 x [[KMP_DEPEND_INFO]]]* %{{[^,]+}}, i32 0, i32 0 +// CHECK: getelementptr inbounds [3 x [[KMP_DEPEND_INFO]]], [3 x [[KMP_DEPEND_INFO]]]* %{{[^,]+}}, i{{32|64}} 0, i{{32|64}} 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 final(true) depend(inout: a, s[1], arr[:a][3:]) @@ -293,4 +332,3 @@ struct S1 { // CHECK: call i8* @__kmpc_omp_task_alloc( #endif - diff --git a/test/OpenMP/task_default_messages.cpp b/test/OpenMP/task_default_messages.cpp index 046e388c14..0eb26856e7 100644 --- a/test/OpenMP/task_default_messages.cpp +++ b/test/OpenMP/task_default_messages.cpp @@ -13,10 +13,10 @@ int main(int argc, char **argv) { #pragma omp task default(x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} foo(); -#pragma omp task default(none) +#pragma omp task default(none) // expected-note {{explicit data sharing attribute requested here}} ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} -#pragma omp task default(none) +#pragma omp task default(none) // expected-note {{explicit data sharing attribute requested here}} #pragma omp task default(shared) ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} return 0; diff --git a/test/OpenMP/task_depend_messages.cpp b/test/OpenMP/task_depend_messages.cpp index 469785e97c..12d1d1a684 100644 --- a/test/OpenMP/task_depend_messages.cpp +++ b/test/OpenMP/task_depend_messages.cpp @@ -23,10 +23,10 @@ int main(int argc, char **argv, char *env[]) { auto arr = x; // expected-error {{use of undeclared identifier 'x'}} #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 (source : argc) // expected-error {{expected 'in', 'out' or 'inout' in OpenMP clause 'depend'}} + #pragma omp task depend ( // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' 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', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} + #pragma omp task depend (argc // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} expected-warning {{missing ':' after dependency type - ignoring}} expected-error {{expected ')'}} expected-note {{to match this '('}} + #pragma omp task depend (source : argc) // expected-error {{expected 'in', 'out', 'inout' or 'mutexinoutset' in OpenMP clause 'depend'}} #pragma omp task depend (source) // expected-error {{expected expression}} expected-warning {{missing ':' after dependency type - ignoring}} #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}} diff --git a/test/OpenMP/task_firstprivate_codegen.cpp b/test/OpenMP/task_firstprivate_codegen.cpp index 09b1deabde..dc0ba8ac67 100644 --- a/test/OpenMP/task_firstprivate_codegen.cpp +++ b/test/OpenMP/task_firstprivate_codegen.cpp @@ -473,12 +473,13 @@ struct St { ~St() {} }; -void array_func(int n, float a[n], St s[2]) { +void array_func(int n, float a[n], St s[2], int(& p)[1]) { // ARRAY: call i8* @__kmpc_omp_task_alloc( // ARRAY: call i32 @__kmpc_omp_task( // ARRAY: store float** %{{.+}}, float*** %{{.+}}, // ARRAY: store %struct.St** %{{.+}}, %struct.St*** %{{.+}}, -#pragma omp task firstprivate(a, s) +// ARRAY: store [1 x i32]* %{{.+}}, [1 x i32]** %{{.+}}, +#pragma omp task firstprivate(a, s, p) ; } #endif diff --git a/test/OpenMP/task_firstprivate_messages.cpp b/test/OpenMP/task_firstprivate_messages.cpp index d970f097a5..f299c75518 100644 --- a/test/OpenMP/task_firstprivate_messages.cpp +++ b/test/OpenMP/task_firstprivate_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -13,7 +23,7 @@ template <typename T> struct S { T b; S(T a, T c) { -#pragma omp task default(none) firstprivate(a, b) +#pragma omp task default(none) firstprivate(a, b) // expected-note {{explicit data sharing attribute requested here}} a = b = c; // expected-error {{variable 'c' must have explicitly specified data sharing attributes}} } }; @@ -91,11 +101,11 @@ int main(int argc, char **argv) { #pragma omp task firstprivate(argc // expected-error {{expected ')'}} expected-note {{to match this '('}} #pragma omp task firstprivate(argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} #pragma omp task firstprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} -#pragma omp task firstprivate(argc) +#pragma omp task firstprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} #pragma omp task firstprivate(S1) // expected-error {{'S1' does not refer to a value}} #pragma omp task firstprivate(a, b, c, d, f) // expected-error {{firstprivate variable with incomplete type 'S1'}} #pragma omp task firstprivate(argv[1]) // expected-error {{expected variable name}} -#pragma omp task firstprivate(ba) +#pragma omp task allocate(omp_thread_mem_alloc: ba) firstprivate(ba) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'task' directive}} #pragma omp task firstprivate(ca) #pragma omp task firstprivate(da) #pragma omp task firstprivate(S2::S2s) diff --git a/test/OpenMP/task_in_reduction_codegen.cpp b/test/OpenMP/task_in_reduction_codegen.cpp index e96d12689f..2370b2bc41 100644 --- a/test/OpenMP/task_in_reduction_codegen.cpp +++ b/test/OpenMP/task_in_reduction_codegen.cpp @@ -10,6 +10,16 @@ #ifndef HEADER #define HEADER +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + // CHECK: [[PRIVATES:%.+]] = type { i8*, i8* } struct S { @@ -31,7 +41,7 @@ int main(int argc, char **argv) { { #pragma omp taskgroup task_reduction(-:c, d) #pragma omp parallel -#pragma omp task in_reduction(+:a) in_reduction(-:d) +#pragma omp task in_reduction(+:a) in_reduction(-:d) allocate(omp_high_bw_mem_alloc: d) a += d[a]; } return 0; diff --git a/test/OpenMP/task_in_reduction_message.cpp b/test/OpenMP/task_in_reduction_message.cpp index e9bde31ec9..d064a5f625 100644 --- a/test/OpenMP/task_in_reduction_message.cpp +++ b/test/OpenMP/task_in_reduction_message.cpp @@ -7,6 +7,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s // SIMD-ONLY0-NOT: {{__kmpc|__tgt}} +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -16,7 +26,7 @@ bool foobool(int argc) { void foobar(int &ref) { #pragma omp taskgroup task_reduction(+:ref) -#pragma omp task in_reduction(+:ref) +#pragma omp task in_reduction(+:ref) allocate(omp_thread_mem_alloc: ref) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'task' directive}} foo(); } @@ -245,7 +255,7 @@ int main(int argc, char **argv) { #pragma omp task in_reduction(| : argc, // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{in_reduction variable must have the same reduction operation as in a task_reduction clause}} foo(); } -#pragma omp task in_reduction(| : argc) +#pragma omp task in_reduction(| : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} foo(); } #pragma omp task in_reduction(|| : argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name, array element or array section}} diff --git a/test/OpenMP/task_messages.cpp b/test/OpenMP/task_messages.cpp index d490c7f8ea..92bb14983b 100644 --- a/test/OpenMP/task_messages.cpp +++ b/test/OpenMP/task_messages.cpp @@ -38,10 +38,10 @@ int foo() { #pragma omp task // expected-note@+1 2 {{predetermined as a firstprivate in a task construct here}} ++s1; -#pragma omp task default(none) +#pragma omp task default(none) // expected-note 2 {{explicit data sharing attribute requested here}} #pragma omp task default(shared) ++a; // expected-error 2 {{variable 'a' must have explicitly specified data sharing attributes}} -#pragma omp task default(none) +#pragma omp task default(none) // expected-note 2 {{explicit data sharing attribute requested here}} #pragma omp task // expected-error@+1 {{calling a private constructor of class 'S'}} ++a; // expected-error 2 {{variable 'a' must have explicitly specified data sharing attributes}} @@ -167,7 +167,7 @@ L1: break; } } -#pragma omp task default(none) +#pragma omp task default(none) // expected-note {{explicit data sharing attribute requested here}} ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} goto L2; // expected-error {{use of undeclared label 'L2'}} @@ -184,10 +184,10 @@ L2: for (int n = 0; n < 100; ++n) { } -#pragma omp task default(none) +#pragma omp task default(none) // expected-note {{explicit data sharing attribute requested here}} #pragma omp task default(shared) ++a; // expected-error {{variable 'a' must have explicitly specified data sharing attributes}} -#pragma omp task default(none) +#pragma omp task default(none) // expected-note {{explicit data sharing attribute requested here}} #pragma omp task ++a; // expected-error {{variable 'a' must have explicitly specified data sharing attributes}} #pragma omp task default(shared) @@ -201,10 +201,10 @@ L2: #pragma omp task #pragma omp parallel shared(a, b) ++a, ++b; -#pragma omp task default(none) +#pragma omp task default(none) // expected-note {{explicit data sharing attribute requested here}} #pragma omp task default(shared) ++sa; // expected-error {{variable 'sa' must have explicitly specified data sharing attributes}} -#pragma omp task default(none) +#pragma omp task default(none) // expected-note {{explicit data sharing attribute requested here}} #pragma omp task // expected-error@+1 {{calling a private constructor of class 'S'}} ++sa; // expected-error {{variable 'sa' must have explicitly specified data sharing attributes}} diff --git a/test/OpenMP/task_private_messages.cpp b/test/OpenMP/task_private_messages.cpp index 2a3df509c2..934f5aad8c 100644 --- a/test/OpenMP/task_private_messages.cpp +++ b/test/OpenMP/task_private_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -77,7 +87,7 @@ int main(int argc, char **argv) { #pragma omp task private(S1) // expected-error {{'S1' does not refer to a value}} #pragma omp task private(a, b, c, d, f) // expected-error {{a private variable with incomplete type 'S1'}} expected-error 1 {{const-qualified variable without mutable fields cannot be private}} expected-error 2 {{const-qualified variable cannot be private}} #pragma omp task private(argv[1]) // expected-error {{expected variable name}} -#pragma omp task private(ba) +#pragma omp task private(ba) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} #pragma omp task private(ca) // expected-error {{const-qualified variable without mutable fields cannot be private}} #pragma omp task private(da) // expected-error {{const-qualified variable cannot be private}} #pragma omp task private(S2::S2s) // expected-error {{shared variable cannot be private}} @@ -92,7 +102,7 @@ int main(int argc, char **argv) { foo(); #pragma omp task firstprivate(i) for (int k = 0; k < 10; ++k) { -#pragma omp task private(i) +#pragma omp task private(i) allocate(omp_thread_mem_alloc: i) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'task' directive}} foo(); } static int m; diff --git a/test/OpenMP/taskgroup_task_reduction_codegen.cpp b/test/OpenMP/taskgroup_task_reduction_codegen.cpp index 02a5ba664e..686bb6ff57 100644 --- a/test/OpenMP/taskgroup_task_reduction_codegen.cpp +++ b/test/OpenMP/taskgroup_task_reduction_codegen.cpp @@ -12,6 +12,16 @@ #ifndef HEADER #define HEADER +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + // CHECK-DAG: @reduction_size.[[ID:.+]]_[[CID:[0-9]+]].artificial. // CHECK-DAG: @reduction_size.[[ID]]_[[CID]].artificial..cache. @@ -29,7 +39,7 @@ int main(int argc, char **argv) { float b; S c[5]; short d[argc]; -#pragma omp taskgroup task_reduction(+: a, b, argc) +#pragma omp taskgroup allocate(omp_pteam_mem_alloc: a) task_reduction(+: a, b, argc) { #pragma omp taskgroup task_reduction(-:c, d) ; diff --git a/test/OpenMP/taskgroup_task_reduction_messages.cpp b/test/OpenMP/taskgroup_task_reduction_messages.cpp index 56abe2abe6..64d7c6c3ca 100644 --- a/test/OpenMP/taskgroup_task_reduction_messages.cpp +++ b/test/OpenMP/taskgroup_task_reduction_messages.cpp @@ -6,6 +6,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s +extern int omp_default_mem_alloc; void foo() { } @@ -112,7 +113,7 @@ T tmain(T argc) { foo(); #pragma omp taskgroup task_reduction(foo : argc) //expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'float'}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int'}} foo(); -#pragma omp taskgroup task_reduction(&& : argc) +#pragma omp taskgroup task_reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} foo(); #pragma omp taskgroup task_reduction(^ : T) // expected-error {{'T' does not refer to a value}} foo(); diff --git a/test/OpenMP/taskloop_ast_print.cpp b/test/OpenMP/taskloop_ast_print.cpp index 97f797b7c9..d32ebb5a34 100644 --- a/test/OpenMP/taskloop_ast_print.cpp +++ b/test/OpenMP/taskloop_ast_print.cpp @@ -17,10 +17,10 @@ T tmain(T argc) { T b = argc, c, d, e, f, g; static T a; // CHECK: static T a; -#pragma omp taskgroup task_reduction(+: d) -#pragma omp taskloop if(taskloop: argc > N) default(shared) untied priority(N) grainsize(N) reduction(+:g) in_reduction(+: d) - // CHECK-NEXT: #pragma omp taskgroup task_reduction(+: d) - // CHECK-NEXT: #pragma omp taskloop if(taskloop: argc > N) default(shared) untied priority(N) grainsize(N) reduction(+: g) in_reduction(+: d){{$}} +#pragma omp taskgroup allocate(d) task_reduction(+: d) +#pragma omp taskloop if(taskloop: argc > N) default(shared) untied priority(N) grainsize(N) reduction(+:g) in_reduction(+: d) allocate(d) + // CHECK-NEXT: #pragma omp taskgroup allocate(d) task_reduction(+: d) + // CHECK-NEXT: #pragma omp taskloop if(taskloop: argc > N) default(shared) untied priority(N) grainsize(N) reduction(+: g) in_reduction(+: d) allocate(d){{$}} for (int i = 0; i < 2; ++i) a = 2; // CHECK-NEXT: for (int i = 0; i < 2; ++i) diff --git a/test/OpenMP/taskloop_collapse_messages.cpp b/test/OpenMP/taskloop_collapse_messages.cpp index 4de0f38dae..091b8b8321 100644 --- a/test/OpenMP/taskloop_collapse_messages.cpp +++ b/test/OpenMP/taskloop_collapse_messages.cpp @@ -39,7 +39,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} #pragma omp taskloop collapse ((ST > 0) ? 1 + ST : 2) // expected-note 2 {{as specified in 'collapse' clause}} for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; // expected-error 2 {{expected 2 for loops after '#pragma omp taskloop', but found only 1}} // expected-error@+6 2 {{directive '#pragma omp taskloop' cannot contain more than one 'collapse' clause}} - // expected-error@+5 2 {{argument to 'collapse' clause must be a strictly positive integer value}} + // expected-error@+5 {{argument to 'collapse' clause must be a strictly positive integer value}} // expected-error@+4 2 {{expression is not an integral constant expression}} #if __cplusplus >= 201103L // expected-note@+2 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} @@ -86,7 +86,7 @@ int main(int argc, char **argv) { // expected-note@+4 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif // expected-error@+2 2 {{directive '#pragma omp taskloop' cannot contain more than one 'collapse' clause}} - // expected-error@+1 2 {{argument to 'collapse' clause must be a strictly positive integer value}} + // expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}} #pragma omp taskloop collapse (foobool(argc)), collapse (true), collapse (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; #pragma omp taskloop collapse (S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/taskloop_firstprivate_messages.cpp b/test/OpenMP/taskloop_firstprivate_messages.cpp index a34d9bcd82..fde767da94 100644 --- a/test/OpenMP/taskloop_firstprivate_messages.cpp +++ b/test/OpenMP/taskloop_firstprivate_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -93,7 +103,7 @@ int foomain(int argc, char **argv) { for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel -#pragma omp taskloop firstprivate(argc) +#pragma omp taskloop allocate(omp_thread_mem_alloc: argc) firstprivate(argc) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'taskloop' directive}} for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel @@ -199,7 +209,7 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); #pragma omp parallel -#pragma omp taskloop firstprivate(argc) +#pragma omp taskloop firstprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (i = 0; i < argc; ++i) foo(); #pragma omp parallel diff --git a/test/OpenMP/taskloop_in_reduction_messages.cpp b/test/OpenMP/taskloop_in_reduction_messages.cpp index 177217888e..00c17d0a19 100644 --- a/test/OpenMP/taskloop_in_reduction_messages.cpp +++ b/test/OpenMP/taskloop_in_reduction_messages.cpp @@ -6,6 +6,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -164,7 +174,7 @@ T tmain(T argc) { for (int i = 0; i < 10; ++i) foo(); #pragma omp taskgroup task_reduction(&&:argc) -#pragma omp taskloop in_reduction(&& : argc) +#pragma omp taskloop in_reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int i = 0; i < 10; ++i) foo(); #pragma omp taskloop in_reduction(^ : T) // expected-error {{'T' does not refer to a value}} @@ -223,7 +233,7 @@ T tmain(T argc) { foo(); #pragma omp taskgroup task_reduction(+:fl) { -#pragma omp taskloop in_reduction(+ : fl) +#pragma omp taskloop in_reduction(+ : fl) allocate(omp_thread_mem_alloc: fl) // expected-warning 2 {{allocator with the 'thread' trait access has unspecified behavior on 'taskloop' directive}} for (int i = 0; i < 10; ++i) foo(); #pragma omp taskgroup task_reduction(*:fl) // expected-note 2 {{previously marked as task_reduction with different reduction operation}} diff --git a/test/OpenMP/taskloop_lastprivate_codegen.cpp b/test/OpenMP/taskloop_lastprivate_codegen.cpp index fa1549d7fc..000ca8f02f 100644 --- a/test/OpenMP/taskloop_lastprivate_codegen.cpp +++ b/test/OpenMP/taskloop_lastprivate_codegen.cpp @@ -4,6 +4,7 @@ // RUN: %clang_cc1 -verify -fopenmp -x c++ -std=c++11 -DLAMBDA -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck -check-prefix=LAMBDA %s // RUN: %clang_cc1 -verify -fopenmp -x c++ -fblocks -DBLOCKS -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck -check-prefix=BLOCKS %s // RUN: %clang_cc1 -verify -fopenmp -x c++ -std=c++11 -DARRAY -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck -check-prefix=ARRAY %s +// RUN: %clang_cc1 -verify -fopenmp -x c++ -std=c++11 -DLOOP -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck -check-prefix=LOOP %s // RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -triple x86_64-apple-darwin10 -emit-pch -o %t %s @@ -11,11 +12,12 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -std=c++11 -DLAMBDA -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s // RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -fblocks -DBLOCKS -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s // RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -std=c++11 -DARRAY -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s +// RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -std=c++11 -DLOOP -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck -check-prefix=SIMD-ONLY0 %s // SIMD-ONLY0-NOT: {{__kmpc|__tgt}} // expected-no-diagnostics // It doesn't pass on win32. // REQUIRES: shell -#ifndef ARRAY +#if !defined(ARRAY) && !defined(LOOP) #ifndef HEADER #define HEADER @@ -501,7 +503,7 @@ int main() { // CHECK: ret i32 #endif -#else +#elif defined(ARRAY) // ARRAY-LABEL: array_func struct St { int a, b; @@ -522,5 +524,16 @@ void array_func(int n, float a[n], St s[2]) { for (int i = 0; i < 10; ++i) ; } +#else + +// LOOP-LABEL: loop +void loop() { +// LOOP: call i8* @__kmpc_omp_task_alloc( +// LOOP: call void @__kmpc_taskloop( + int i; +#pragma omp taskloop lastprivate(i) + for (i = 0; i < 10; ++i) + ; +} #endif diff --git a/test/OpenMP/taskloop_lastprivate_messages.cpp b/test/OpenMP/taskloop_lastprivate_messages.cpp index c46a1f0c4c..929d2b801c 100644 --- a/test/OpenMP/taskloop_lastprivate_messages.cpp +++ b/test/OpenMP/taskloop_lastprivate_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -95,7 +105,7 @@ int foomain(int argc, char **argv) { for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel -#pragma omp taskloop lastprivate(argc) +#pragma omp taskloop lastprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel @@ -122,7 +132,7 @@ int foomain(int argc, char **argv) { { int v = 0; int i; -#pragma omp taskloop lastprivate(i) +#pragma omp taskloop allocate(omp_thread_mem_alloc: i) lastprivate(i) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'taskloop' directive}} for (int k = 0; k < argc; ++k) { i = k; v += i; diff --git a/test/OpenMP/taskloop_private_messages.cpp b/test/OpenMP/taskloop_private_messages.cpp index ffe731d2c7..107a2f4b76 100644 --- a/test/OpenMP/taskloop_private_messages.cpp +++ b/test/OpenMP/taskloop_private_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -58,7 +68,7 @@ public: S6() : a(0) {} S6(T v) : a(v) { -#pragma omp taskloop private(a) private(this->a) +#pragma omp taskloop private(a) private(this->a) allocate(omp_thread_mem_alloc: a) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'taskloop' directive}} for (int k = 0; k < v; ++k) ++this->a; } @@ -116,7 +126,7 @@ int foomain(I argc, C **argv) { #pragma omp taskloop private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp taskloop private(argc) +#pragma omp taskloop private(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp taskloop private(S1) // expected-error {{'S1' does not refer to a value}} @@ -176,7 +186,7 @@ using A::x; int main(int argc, char **argv) { S4 e(4); S5 g(5); - S6<float> s6(0.0) , s6_0(1.0); + S6<float> s6(0.0) , s6_0(1.0); // expected-note {{in instantiation of member function 'S6<float>::S6' requested here}} S7<S6<float> > s7(0.0) , s7_0(1.0); int i; int &j = i; diff --git a/test/OpenMP/taskloop_reduction_messages.cpp b/test/OpenMP/taskloop_reduction_messages.cpp index 4794c7a2d0..a1c533cfe0 100644 --- a/test/OpenMP/taskloop_reduction_messages.cpp +++ b/test/OpenMP/taskloop_reduction_messages.cpp @@ -6,6 +6,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -133,7 +143,7 @@ T tmain(T argc) { #pragma omp taskloop reduction(foo : argc) //expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'float'}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int'}} for (int i = 0; i < 10; ++i) foo(); -#pragma omp taskloop reduction(&& : argc) +#pragma omp taskloop reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int i = 0; i < 10; ++i) foo(); #pragma omp taskloop reduction(^ : T) // expected-error {{'T' does not refer to a value}} @@ -191,7 +201,7 @@ T tmain(T argc) { for (int i = 0; i < 10; ++i) foo(); #pragma omp parallel private(fl) -#pragma omp taskloop reduction(+ : fl) +#pragma omp taskloop reduction(+ : fl) allocate(omp_thread_mem_alloc: fl) // expected-warning 2 {{allocator with the 'thread' trait access has unspecified behavior on 'taskloop' directive}} for (int i = 0; i < 10; ++i) foo(); #pragma omp parallel reduction(* : fl) diff --git a/test/OpenMP/taskloop_simd_ast_print.cpp b/test/OpenMP/taskloop_simd_ast_print.cpp index 0a847f8fad..d5403ed06d 100644 --- a/test/OpenMP/taskloop_simd_ast_print.cpp +++ b/test/OpenMP/taskloop_simd_ast_print.cpp @@ -18,10 +18,10 @@ T tmain(T argc) { T *ptr; static T a; // CHECK: static T a; -#pragma omp taskgroup task_reduction(+: d) -#pragma omp taskloop simd if(taskloop: argc > N) default(shared) untied priority(N) safelen(N) linear(c) aligned(ptr) grainsize(N) reduction(+:g) in_reduction(+: d) - // CHECK-NEXT: #pragma omp taskgroup task_reduction(+: d) - // CHECK-NEXT: #pragma omp taskloop simd if(taskloop: argc > N) default(shared) untied priority(N) safelen(N) linear(c) aligned(ptr) grainsize(N) reduction(+: g) in_reduction(+: d){{$}} +#pragma omp taskgroup task_reduction(+: d) allocate(d) +#pragma omp taskloop simd allocate(d) if(taskloop: argc > N) default(shared) untied priority(N) safelen(N) linear(c) aligned(ptr) grainsize(N) reduction(+:g) in_reduction(+: d) + // CHECK-NEXT: #pragma omp taskgroup task_reduction(+: d) allocate(d) + // CHECK-NEXT: #pragma omp taskloop simd allocate(d) if(taskloop: argc > N) default(shared) untied priority(N) safelen(N) linear(c) aligned(ptr) grainsize(N) reduction(+: g) in_reduction(+: d){{$}} for (int i = 0; i < 2; ++i) a = 2; // CHECK-NEXT: for (int i = 0; i < 2; ++i) diff --git a/test/OpenMP/taskloop_simd_collapse_messages.cpp b/test/OpenMP/taskloop_simd_collapse_messages.cpp index 3f7e66a277..fd620c8fc1 100644 --- a/test/OpenMP/taskloop_simd_collapse_messages.cpp +++ b/test/OpenMP/taskloop_simd_collapse_messages.cpp @@ -39,7 +39,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} #pragma omp taskloop simd collapse ((ST > 0) ? 1 + ST : 2) // expected-note 2 {{as specified in 'collapse' clause}} for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; // expected-error 2 {{expected 2 for loops after '#pragma omp taskloop simd', but found only 1}} // expected-error@+6 2 {{directive '#pragma omp taskloop simd' cannot contain more than one 'collapse' clause}} - // expected-error@+5 2 {{argument to 'collapse' clause must be a strictly positive integer value}} + // expected-error@+5 {{argument to 'collapse' clause must be a strictly positive integer value}} // expected-error@+4 2 {{expression is not an integral constant expression}} #if __cplusplus >= 201103L // expected-note@+2 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} @@ -86,7 +86,7 @@ int main(int argc, char **argv) { // expected-note@+4 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif // expected-error@+2 2 {{directive '#pragma omp taskloop simd' cannot contain more than one 'collapse' clause}} - // expected-error@+1 2 {{argument to 'collapse' clause must be a strictly positive integer value}} + // expected-error@+1 {{argument to 'collapse' clause must be a strictly positive integer value}} #pragma omp taskloop simd collapse (foobool(argc)), collapse (true), collapse (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; #pragma omp taskloop simd collapse (S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/taskloop_simd_firstprivate_messages.cpp b/test/OpenMP/taskloop_simd_firstprivate_messages.cpp index 3fb5ad1706..7553bd2fec 100644 --- a/test/OpenMP/taskloop_simd_firstprivate_messages.cpp +++ b/test/OpenMP/taskloop_simd_firstprivate_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -93,7 +103,7 @@ int foomain(int argc, char **argv) { for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel -#pragma omp taskloop simd firstprivate(argc) +#pragma omp taskloop simd firstprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel @@ -120,7 +130,7 @@ int foomain(int argc, char **argv) { { int v = 0; int i; -#pragma omp taskloop simd firstprivate(i) +#pragma omp taskloop simd allocate(omp_thread_mem_alloc: i) firstprivate(i) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'taskloop simd' directive}} for (int k = 0; k < argc; ++k) { i = k; v += i; diff --git a/test/OpenMP/taskloop_simd_in_reduction_messages.cpp b/test/OpenMP/taskloop_simd_in_reduction_messages.cpp index 5fa976b229..6ad8bad2a3 100644 --- a/test/OpenMP/taskloop_simd_in_reduction_messages.cpp +++ b/test/OpenMP/taskloop_simd_in_reduction_messages.cpp @@ -6,6 +6,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -164,7 +174,7 @@ T tmain(T argc) { for (int i = 0; i < 10; ++i) foo(); #pragma omp taskgroup task_reduction(&&:argc) -#pragma omp taskloop simd in_reduction(&& : argc) +#pragma omp taskloop simd in_reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int i = 0; i < 10; ++i) foo(); #pragma omp taskloop simd in_reduction(^ : T) // expected-error {{'T' does not refer to a value}} @@ -223,7 +233,7 @@ T tmain(T argc) { foo(); #pragma omp taskgroup task_reduction(+:fl) { -#pragma omp taskloop simd in_reduction(+ : fl) +#pragma omp taskloop simd allocate(omp_thread_mem_alloc: fl) in_reduction(+ : fl) // expected-warning 2 {{allocator with the 'thread' trait access has unspecified behavior on 'taskloop simd' directive}} for (int i = 0; i < 10; ++i) foo(); #pragma omp taskgroup task_reduction(*:fl) // expected-note 2 {{previously marked as task_reduction with different reduction operation}} diff --git a/test/OpenMP/taskloop_simd_lastprivate_messages.cpp b/test/OpenMP/taskloop_simd_lastprivate_messages.cpp index 3ed65de247..ec0d071a1d 100644 --- a/test/OpenMP/taskloop_simd_lastprivate_messages.cpp +++ b/test/OpenMP/taskloop_simd_lastprivate_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -95,7 +105,7 @@ int foomain(int argc, char **argv) { for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel -#pragma omp taskloop simd lastprivate(argc) +#pragma omp taskloop simd lastprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp parallel @@ -122,7 +132,7 @@ int foomain(int argc, char **argv) { { int v = 0; int i; -#pragma omp taskloop simd lastprivate(i) +#pragma omp taskloop simd lastprivate(i) allocate(omp_thread_mem_alloc: i) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'taskloop simd' directive}} for (int k = 0; k < argc; ++k) { i = k; v += i; diff --git a/test/OpenMP/taskloop_simd_linear_messages.cpp b/test/OpenMP/taskloop_simd_linear_messages.cpp index 645026c9fa..05b08d6d75 100644 --- a/test/OpenMP/taskloop_simd_linear_messages.cpp +++ b/test/OpenMP/taskloop_simd_linear_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + namespace X { int x; }; @@ -127,7 +137,7 @@ template<class I, class C> int foomain(I argc, C **argv) { for (int k = 0; k < argc; ++k) ++k; #pragma omp taskloop simd linear (argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; - #pragma omp taskloop simd linear (argc : 5) + #pragma omp taskloop simd linear (argc : 5) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp taskloop simd linear (S1) // expected-error {{'S1' does not refer to a value}} for (int k = 0; k < argc; ++k) ++k; @@ -147,7 +157,7 @@ template<class I, class C> int foomain(I argc, C **argv) { { int v = 0; int i; - #pragma omp taskloop simd linear(v:i) + #pragma omp taskloop simd allocate(omp_thread_mem_alloc: v) linear(v:i) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'taskloop simd' directive}} for (int k = 0; k < argc; ++k) { i = k; v += i; } } #pragma omp taskloop simd linear(ref(j)) diff --git a/test/OpenMP/taskloop_simd_private_messages.cpp b/test/OpenMP/taskloop_simd_private_messages.cpp index 68e5365251..4198c891c2 100644 --- a/test/OpenMP/taskloop_simd_private_messages.cpp +++ b/test/OpenMP/taskloop_simd_private_messages.cpp @@ -2,6 +2,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -58,7 +68,7 @@ public: S6() : a(0) {} S6(T v) : a(v) { -#pragma omp taskloop simd private(a) private(this->a) +#pragma omp taskloop simd allocate(omp_thread_mem_alloc: a) private(a) private(this->a) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'taskloop simd' directive}} for (int k = 0; k < v; ++k) ++this->a; } @@ -116,7 +126,7 @@ int foomain(I argc, C **argv) { #pragma omp taskloop simd private(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} for (int k = 0; k < argc; ++k) ++k; -#pragma omp taskloop simd private(argc) +#pragma omp taskloop simd private(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp taskloop simd private(S1) // expected-error {{'S1' does not refer to a value}} @@ -176,7 +186,7 @@ using A::x; int main(int argc, char **argv) { S4 e(4); S5 g(5); - S6<float> s6(0.0) , s6_0(1.0); + S6<float> s6(0.0) , s6_0(1.0); // expected-note {{in instantiation of member function 'S6<float>::S6' requested here}} S7<S6<float> > s7(0.0) , s7_0(1.0); int i; int &j = i; diff --git a/test/OpenMP/taskloop_simd_reduction_messages.cpp b/test/OpenMP/taskloop_simd_reduction_messages.cpp index fb279e28b8..dc3a389fc0 100644 --- a/test/OpenMP/taskloop_simd_reduction_messages.cpp +++ b/test/OpenMP/taskloop_simd_reduction_messages.cpp @@ -6,6 +6,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() { } @@ -133,7 +143,7 @@ T tmain(T argc) { #pragma omp taskloop simd reduction(foo : argc) //expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'float'}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int'}} for (int i = 0; i < 10; ++i) foo(); -#pragma omp taskloop simd reduction(&& : argc) +#pragma omp taskloop simd reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int i = 0; i < 10; ++i) foo(); #pragma omp taskloop simd reduction(^ : T) // expected-error {{'T' does not refer to a value}} @@ -191,7 +201,7 @@ T tmain(T argc) { for (int i = 0; i < 10; ++i) foo(); #pragma omp parallel private(fl) -#pragma omp taskloop simd reduction(+ : fl) +#pragma omp taskloop simd reduction(+ : fl) allocate(omp_thread_mem_alloc: fl) // expected-warning 2 {{allocator with the 'thread' trait access has unspecified behavior on 'taskloop simd' directive}} for (int i = 0; i < 10; ++i) foo(); #pragma omp parallel reduction(* : fl) diff --git a/test/OpenMP/taskloop_simd_safelen_messages.cpp b/test/OpenMP/taskloop_simd_safelen_messages.cpp index 87c4fe07ab..b926689c3b 100644 --- a/test/OpenMP/taskloop_simd_safelen_messages.cpp +++ b/test/OpenMP/taskloop_simd_safelen_messages.cpp @@ -39,7 +39,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} #pragma omp taskloop simd safelen ((ST > 0) ? 1 + ST : 2) for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; // expected-error@+6 2 {{directive '#pragma omp taskloop simd' cannot contain more than one 'safelen' clause}} - // expected-error@+5 2 {{argument to 'safelen' clause must be a strictly positive integer value}} + // expected-error@+5 {{argument to 'safelen' clause must be a strictly positive integer value}} // expected-error@+4 2 {{expression is not an integral constant expression}} #if __cplusplus >= 201103L // expected-note@+2 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} @@ -84,7 +84,7 @@ int main(int argc, char **argv) { // expected-note@+4 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif // expected-error@+2 2 {{directive '#pragma omp taskloop simd' cannot contain more than one 'safelen' clause}} - // expected-error@+1 2 {{argument to 'safelen' clause must be a strictly positive integer value}} + // expected-error@+1 {{argument to 'safelen' clause must be a strictly positive integer value}} #pragma omp taskloop simd safelen (foobool(argc)), safelen (true), safelen (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; #pragma omp taskloop simd safelen (S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/taskloop_simd_simdlen_messages.cpp b/test/OpenMP/taskloop_simd_simdlen_messages.cpp index 4170d012dd..75d9a1d360 100644 --- a/test/OpenMP/taskloop_simd_simdlen_messages.cpp +++ b/test/OpenMP/taskloop_simd_simdlen_messages.cpp @@ -39,7 +39,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} #pragma omp taskloop simd simdlen ((ST > 0) ? 1 + ST : 2) for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; // expected-error@+6 2 {{directive '#pragma omp taskloop simd' cannot contain more than one 'simdlen' clause}} - // expected-error@+5 2 {{argument to 'simdlen' clause must be a strictly positive integer value}} + // expected-error@+5 {{argument to 'simdlen' clause must be a strictly positive integer value}} // expected-error@+4 2 {{expression is not an integral constant expression}} #if __cplusplus >= 201103L // expected-note@+2 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} @@ -84,7 +84,7 @@ int main(int argc, char **argv) { // expected-note@+4 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif // expected-error@+2 2 {{directive '#pragma omp taskloop simd' cannot contain more than one 'simdlen' clause}} - // expected-error@+1 2 {{argument to 'simdlen' clause must be a strictly positive integer value}} + // expected-error@+1 {{argument to 'simdlen' clause must be a strictly positive integer value}} #pragma omp taskloop simd simdlen (foobool(argc)), simdlen (true), simdlen (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; #pragma omp taskloop simd simdlen (S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/taskwait_messages.cpp b/test/OpenMP/taskwait_messages.cpp index 46efff5972..ed7c53b070 100644 --- a/test/OpenMP/taskwait_messages.cpp +++ b/test/OpenMP/taskwait_messages.cpp @@ -4,7 +4,7 @@ template <class T> T tmain(T argc) { -#pragma omp taskwait +#pragma omp taskwait allocate(argc) // expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp taskwait'}} ; #pragma omp taskwait untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp taskwait'}} #pragma omp taskwait unknown // expected-warning {{extra tokens at the end of '#pragma omp taskwait' are ignored}} @@ -29,7 +29,7 @@ T tmain(T argc) { #pragma omp taskwait // expected-error {{'#pragma omp taskwait' cannot be an immediate substatement}} switch (argc) case 1: -#pragma omp taskwait +#pragma omp taskwait // expected-error {{'#pragma omp taskwait' cannot be an immediate substatement}} switch (argc) case 1: { #pragma omp taskwait @@ -49,7 +49,7 @@ T tmain(T argc) { #pragma omp taskwait } label: -#pragma omp taskwait // expected-error {{'#pragma omp taskwait' cannot be an immediate substatement}} +#pragma omp taskwait label1 : { #pragma omp taskwait } @@ -83,7 +83,7 @@ int main(int argc, char **argv) { #pragma omp taskwait // expected-error {{'#pragma omp taskwait' cannot be an immediate substatement}} switch (argc) case 1: -#pragma omp taskwait +#pragma omp taskwait // expected-error {{'#pragma omp taskwait' cannot be an immediate substatement}} switch (argc) case 1: { #pragma omp taskwait @@ -103,7 +103,7 @@ int main(int argc, char **argv) { #pragma omp taskwait } label: -#pragma omp taskwait // expected-error {{'#pragma omp taskwait' cannot be an immediate substatement}} +#pragma omp taskwait label1 : { #pragma omp taskwait } diff --git a/test/OpenMP/taskyield_messages.cpp b/test/OpenMP/taskyield_messages.cpp index fd98a8786f..cb66ccddf3 100644 --- a/test/OpenMP/taskyield_messages.cpp +++ b/test/OpenMP/taskyield_messages.cpp @@ -4,7 +4,7 @@ template <class T> T tmain(T argc) { -#pragma omp taskyield +#pragma omp taskyield allocate(argc) // expected-error {{unexpected OpenMP clause 'allocate' in directive '#pragma omp taskyield'}} ; #pragma omp taskyield untied // expected-error {{unexpected OpenMP clause 'untied' in directive '#pragma omp taskyield'}} #pragma omp taskyield unknown // expected-warning {{extra tokens at the end of '#pragma omp taskyield' are ignored}} @@ -29,7 +29,7 @@ T tmain(T argc) { #pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}} switch (argc) case 1: -#pragma omp taskyield +#pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}} switch (argc) case 1: { #pragma omp taskyield @@ -49,10 +49,13 @@ T tmain(T argc) { #pragma omp taskyield } label: -#pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}} +#pragma omp taskyield label1 : { #pragma omp taskyield } +if (1) + label2: +#pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}} return T(); } @@ -83,7 +86,7 @@ int main(int argc, char **argv) { #pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}} switch (argc) case 1: -#pragma omp taskyield +#pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}} switch (argc) case 1: { #pragma omp taskyield @@ -103,10 +106,13 @@ int main(int argc, char **argv) { #pragma omp taskyield } label: -#pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}} +#pragma omp taskyield label1 : { #pragma omp taskyield } +if (1) + label2: +#pragma omp taskyield // expected-error {{'#pragma omp taskyield' cannot be an immediate substatement}} return tmain(argc); } diff --git a/test/OpenMP/teams_default_messages.cpp b/test/OpenMP/teams_default_messages.cpp index c032f5e482..28a5e2902c 100644 --- a/test/OpenMP/teams_default_messages.cpp +++ b/test/OpenMP/teams_default_messages.cpp @@ -25,11 +25,11 @@ int main(int argc, char **argv) { foo(); #pragma omp target - #pragma omp teams default(none) + #pragma omp teams default(none) // expected-note {{explicit data sharing attribute requested here}} ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} #pragma omp target - #pragma omp teams default(none) + #pragma omp teams default(none) // expected-note {{explicit data sharing attribute requested here}} #pragma omp parallel default(shared) ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} return 0; diff --git a/test/OpenMP/teams_distribute_ast_print.cpp b/test/OpenMP/teams_distribute_ast_print.cpp index 8868802bbc..8673b453ea 100644 --- a/test/OpenMP/teams_distribute_ast_print.cpp +++ b/test/OpenMP/teams_distribute_ast_print.cpp @@ -10,6 +10,16 @@ #ifndef HEADER #define HEADER +typedef void **omp_allocator_handle_t; +extern const omp_allocator_handle_t omp_default_mem_alloc; +extern const omp_allocator_handle_t omp_large_cap_mem_alloc; +extern const omp_allocator_handle_t omp_const_mem_alloc; +extern const omp_allocator_handle_t omp_high_bw_mem_alloc; +extern const omp_allocator_handle_t omp_low_lat_mem_alloc; +extern const omp_allocator_handle_t omp_cgroup_mem_alloc; +extern const omp_allocator_handle_t omp_pteam_mem_alloc; +extern const omp_allocator_handle_t omp_thread_mem_alloc; + void foo() {} struct S { @@ -78,7 +88,7 @@ public: void bar() { int b, argv, d, c, e, f; #pragma omp target -#pragma omp teams distribute default(none), private(b) firstprivate(argv) shared(d) reduction(+:c) reduction(max:e) num_teams(f) thread_limit(d) +#pragma omp teams distribute allocate(omp_thread_mem_alloc:argv) default(none), private(b) firstprivate(argv) shared(d) reduction(+:c) reduction(max:e) num_teams(f) thread_limit(d) allocate(omp_default_mem_alloc:c) for (int k = 0; k < a.a; ++k) ++a.a; } @@ -88,7 +98,7 @@ public: // CHECK: #pragma omp target // CHECK-NEXT: #pragma omp teams distribute private(this->a) private(this->a) // CHECK: #pragma omp target -// CHECK-NEXT: #pragma omp teams distribute default(none) private(b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(f) thread_limit(d) +// CHECK-NEXT: #pragma omp teams distribute allocate(omp_thread_mem_alloc: argv) default(none) private(b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(f) thread_limit(d) allocate(omp_default_mem_alloc: c) template <class T, int N> T tmain(T argc) { diff --git a/test/OpenMP/teams_distribute_collapse_messages.cpp b/test/OpenMP/teams_distribute_collapse_messages.cpp index bcbd774e8e..d95109c3dc 100644 --- a/test/OpenMP/teams_distribute_collapse_messages.cpp +++ b/test/OpenMP/teams_distribute_collapse_messages.cpp @@ -63,7 +63,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} // expected-note@+6 2 {{non-constexpr function 'foobool' cannot be used}} #endif // expected-error@+4 2 {{directive '#pragma omp teams distribute' cannot contain more than one 'collapse' clause}} -// expected-error@+3 2 {{argument to 'collapse' clause must be a strictly positive integer value}} +// expected-error@+3 {{argument to 'collapse' clause must be a strictly positive integer value}} // expected-error@+2 2 {{expression is not an integral constant expression}} #pragma omp target #pragma omp teams distribute collapse (foobool(argc)), collapse (true), collapse (-5) @@ -140,7 +140,7 @@ int main(int argc, char **argv) { #endif // expected-error@+4 {{expression is not an integral constant expression}} // expected-error@+3 2 {{directive '#pragma omp teams distribute' cannot contain more than one 'collapse' clause}} -// expected-error@+2 2 {{argument to 'collapse' clause must be a strictly positive integer value}} +// expected-error@+2 {{argument to 'collapse' clause must be a strictly positive integer value}} #pragma omp target #pragma omp teams distribute collapse (foobool(argc)), collapse (true), collapse (-5) for (int i = 4; i < 12; i++) diff --git a/test/OpenMP/teams_distribute_default_messages.cpp b/test/OpenMP/teams_distribute_default_messages.cpp index 5e8702a99d..9ebce9aea0 100644 --- a/test/OpenMP/teams_distribute_default_messages.cpp +++ b/test/OpenMP/teams_distribute_default_messages.cpp @@ -25,7 +25,7 @@ int main(int argc, char **argv) { for (int i=0; i<200; i++) foo(); #pragma omp target - #pragma omp teams distribute default(none) + #pragma omp teams distribute default(none) // expected-note {{explicit data sharing attribute requested here}} for (int i=0; i<200; i++) ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} return 0; diff --git a/test/OpenMP/teams_distribute_firstprivate_messages.cpp b/test/OpenMP/teams_distribute_firstprivate_messages.cpp index e373a3a870..2bbe8d78dc 100644 --- a/test/OpenMP/teams_distribute_firstprivate_messages.cpp +++ b/test/OpenMP/teams_distribute_firstprivate_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wno-openmp-target +extern int omp_default_mem_alloc; void foo() { } @@ -91,7 +92,7 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); #pragma omp target -#pragma omp teams distribute firstprivate (argc) +#pragma omp teams distribute firstprivate (argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (i = 0; i < argc; ++i) foo(); #pragma omp target diff --git a/test/OpenMP/teams_distribute_lastprivate_messages.cpp b/test/OpenMP/teams_distribute_lastprivate_messages.cpp index a6440b7b6d..76f7139870 100644 --- a/test/OpenMP/teams_distribute_lastprivate_messages.cpp +++ b/test/OpenMP/teams_distribute_lastprivate_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wno-openmp-target +extern int omp_default_mem_alloc; void foo() { } @@ -95,7 +96,7 @@ int foomain(int argc, char **argv) { for (int k = 0; k < argc; ++k) ++k; #pragma omp target -#pragma omp teams distribute lastprivate(argc) +#pragma omp teams distribute lastprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target diff --git a/test/OpenMP/teams_distribute_parallel_for_ast_print.cpp b/test/OpenMP/teams_distribute_parallel_for_ast_print.cpp index 50d7b59fd9..c414a210a1 100644 --- a/test/OpenMP/teams_distribute_parallel_for_ast_print.cpp +++ b/test/OpenMP/teams_distribute_parallel_for_ast_print.cpp @@ -81,7 +81,7 @@ public: void bar() { int b, argv, d, c, e, f8; #pragma omp target -#pragma omp teams distribute parallel for default(none), private(b) firstprivate(argv) shared(d) reduction(+:c) reduction(max:e) num_teams(f8) thread_limit(d) copyin(x) +#pragma omp teams distribute parallel for allocate(b) default(none), private(b) firstprivate(argv) shared(d) reduction(+:c) reduction(max:e) num_teams(f8) thread_limit(d) copyin(x) allocate(argv) for (int k = 0; k < a.a; ++k) ++a.a; } @@ -93,7 +93,7 @@ public: // CHECK: #pragma omp target // CHECK-NEXT: #pragma omp teams distribute parallel for private(this->a) private(this->a) // CHECK: #pragma omp target -// CHECK-NEXT: #pragma omp teams distribute parallel for default(none) private(b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(f8) thread_limit(d) copyin(x) +// CHECK-NEXT: #pragma omp teams distribute parallel for allocate(b) default(none) private(b) firstprivate(argv) shared(d) reduction(+: c) reduction(max: e) num_teams(f8) thread_limit(d) copyin(x) allocate(argv) template <class T, int N> T tmain(T argc) { diff --git a/test/OpenMP/teams_distribute_parallel_for_collapse_messages.cpp b/test/OpenMP/teams_distribute_parallel_for_collapse_messages.cpp index 2e83a37bc9..1171807fdb 100644 --- a/test/OpenMP/teams_distribute_parallel_for_collapse_messages.cpp +++ b/test/OpenMP/teams_distribute_parallel_for_collapse_messages.cpp @@ -63,7 +63,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} // expected-note@+6 2 {{non-constexpr function 'foobool' cannot be used}} #endif // expected-error@+4 2 {{directive '#pragma omp teams distribute parallel for' cannot contain more than one 'collapse' clause}} -// expected-error@+3 2 {{argument to 'collapse' clause must be a strictly positive integer value}} +// expected-error@+3 {{argument to 'collapse' clause must be a strictly positive integer value}} // expected-error@+2 2 {{expression is not an integral constant expression}} #pragma omp target #pragma omp teams distribute parallel for collapse (foobool(argc)), collapse (true), collapse (-5) @@ -139,7 +139,7 @@ int main(int argc, char **argv) { #endif // expected-error@+4 {{expression is not an integral constant expression}} // expected-error@+3 2 {{directive '#pragma omp teams distribute parallel for' cannot contain more than one 'collapse' clause}} -// expected-error@+2 2 {{argument to 'collapse' clause must be a strictly positive integer value}} +// expected-error@+2 {{argument to 'collapse' clause must be a strictly positive integer value}} #pragma omp target #pragma omp teams distribute parallel for collapse (foobool(argc)), collapse (true), collapse (-5) for (int i = 4; i < 12; i++) diff --git a/test/OpenMP/teams_distribute_parallel_for_default_messages.cpp b/test/OpenMP/teams_distribute_parallel_for_default_messages.cpp index e5b3331520..efc139d84a 100644 --- a/test/OpenMP/teams_distribute_parallel_for_default_messages.cpp +++ b/test/OpenMP/teams_distribute_parallel_for_default_messages.cpp @@ -25,7 +25,7 @@ int main(int argc, char **argv) { for (int i=0; i<200; i++) foo(); #pragma omp target - #pragma omp teams distribute parallel for default(none) + #pragma omp teams distribute parallel for default(none) // expected-note {{explicit data sharing attribute requested here}} for (int i=0; i<200; i++) ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} return 0; diff --git a/test/OpenMP/teams_distribute_parallel_for_firstprivate_messages.cpp b/test/OpenMP/teams_distribute_parallel_for_firstprivate_messages.cpp index f495588754..35ef9792c4 100644 --- a/test/OpenMP/teams_distribute_parallel_for_firstprivate_messages.cpp +++ b/test/OpenMP/teams_distribute_parallel_for_firstprivate_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wno-openmp-target +extern int omp_default_mem_alloc; void foo() { } @@ -91,7 +92,7 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); #pragma omp target -#pragma omp teams distribute parallel for firstprivate (argc) +#pragma omp teams distribute parallel for firstprivate (argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (i = 0; i < argc; ++i) foo(); #pragma omp target diff --git a/test/OpenMP/teams_distribute_parallel_for_lastprivate_messages.cpp b/test/OpenMP/teams_distribute_parallel_for_lastprivate_messages.cpp index 14b7e8be2a..6207efadb1 100644 --- a/test/OpenMP/teams_distribute_parallel_for_lastprivate_messages.cpp +++ b/test/OpenMP/teams_distribute_parallel_for_lastprivate_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wno-openmp-target +extern int omp_default_mem_alloc; void foo() { } @@ -95,7 +96,7 @@ int foomain(int argc, char **argv) { for (int k = 0; k < argc; ++k) ++k; #pragma omp target -#pragma omp teams distribute parallel for lastprivate(argc) +#pragma omp teams distribute parallel for lastprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target diff --git a/test/OpenMP/teams_distribute_parallel_for_messages.cpp b/test/OpenMP/teams_distribute_parallel_for_messages.cpp index 57ad666380..b861783842 100644 --- a/test/OpenMP/teams_distribute_parallel_for_messages.cpp +++ b/test/OpenMP/teams_distribute_parallel_for_messages.cpp @@ -76,7 +76,7 @@ L1: } } #pragma omp target -#pragma omp teams distribute parallel for default(none) +#pragma omp teams distribute parallel for default(none) // expected-note {{explicit data sharing attribute requested here}} for (int i = 0; i < 10; ++i) ++argc; // expected-error {{ariable 'argc' must have explicitly specified data sharing attributes}} diff --git a/test/OpenMP/teams_distribute_parallel_for_private_messages.cpp b/test/OpenMP/teams_distribute_parallel_for_private_messages.cpp index ba9e077437..5b22861f8e 100644 --- a/test/OpenMP/teams_distribute_parallel_for_private_messages.cpp +++ b/test/OpenMP/teams_distribute_parallel_for_private_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; void foo() { } @@ -77,7 +78,7 @@ int main(int argc, char **argv) { for (int k = 0; k < argc; ++k) ++k; #pragma omp target - #pragma omp teams distribute parallel for private (argc) + #pragma omp teams distribute parallel for private (argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target diff --git a/test/OpenMP/teams_distribute_parallel_for_reduction_messages.cpp b/test/OpenMP/teams_distribute_parallel_for_reduction_messages.cpp index 5eb69fd00b..5c982462c5 100644 --- a/test/OpenMP/teams_distribute_parallel_for_reduction_messages.cpp +++ b/test/OpenMP/teams_distribute_parallel_for_reduction_messages.cpp @@ -6,6 +6,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 %s -Wno-openmp-target // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 %s -Wno-openmp-target +extern int omp_default_mem_alloc; void foo() { } @@ -119,7 +120,7 @@ T tmain(T argc) { #pragma omp teams distribute parallel for reduction(foo : argc) //expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'float'}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int'}} for (int j=0; j<100; j++) foo(); #pragma omp target -#pragma omp teams distribute parallel for reduction(&& : argc) +#pragma omp teams distribute parallel for reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int j=0; j<100; j++) foo(); #pragma omp target #pragma omp teams distribute parallel for reduction(^ : T) // expected-error {{'T' does not refer to a value}} diff --git a/test/OpenMP/teams_distribute_parallel_for_simd_ast_print.cpp b/test/OpenMP/teams_distribute_parallel_for_simd_ast_print.cpp index bce89b7498..31a2e7e035 100644 --- a/test/OpenMP/teams_distribute_parallel_for_simd_ast_print.cpp +++ b/test/OpenMP/teams_distribute_parallel_for_simd_ast_print.cpp @@ -136,12 +136,12 @@ T tmain(T argc) { // CHECK-NEXT: for (int i = 0; i < 2; ++i) // CHECK-NEXT: a = 2; #pragma omp target -#pragma omp teams distribute parallel for simd private(argc, b), firstprivate(c, d), collapse(2) +#pragma omp teams distribute parallel for simd allocate(b) private(argc, b), firstprivate(c, d), collapse(2) allocate(d) for (int i = 0; i < 10; ++i) for (int j = 0; j < 10; ++j) foo(); // CHECK: #pragma omp target -// CHECK-NEXT: #pragma omp teams distribute parallel for simd private(argc,b) firstprivate(c,d) collapse(2) +// CHECK-NEXT: #pragma omp teams distribute parallel for simd allocate(b) private(argc,b) firstprivate(c,d) collapse(2) allocate(d) // CHECK-NEXT: for (int i = 0; i < 10; ++i) // CHECK-NEXT: for (int j = 0; j < 10; ++j) // CHECK-NEXT: foo(); diff --git a/test/OpenMP/teams_distribute_parallel_for_simd_collapse_messages.cpp b/test/OpenMP/teams_distribute_parallel_for_simd_collapse_messages.cpp index a287da7a36..31611c7ff0 100644 --- a/test/OpenMP/teams_distribute_parallel_for_simd_collapse_messages.cpp +++ b/test/OpenMP/teams_distribute_parallel_for_simd_collapse_messages.cpp @@ -63,7 +63,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} // expected-note@+6 2 {{non-constexpr function 'foobool' cannot be used}} #endif // expected-error@+4 2 {{directive '#pragma omp teams distribute parallel for simd' cannot contain more than one 'collapse' clause}} -// expected-error@+3 2 {{argument to 'collapse' clause must be a strictly positive integer value}} +// expected-error@+3 {{argument to 'collapse' clause must be a strictly positive integer value}} // expected-error@+2 2 {{expression is not an integral constant expression}} #pragma omp target #pragma omp teams distribute parallel for simd collapse (foobool(argc)), collapse (true), collapse (-5) @@ -139,7 +139,7 @@ int main(int argc, char **argv) { #endif // expected-error@+4 {{expression is not an integral constant expression}} // expected-error@+3 2 {{directive '#pragma omp teams distribute parallel for simd' cannot contain more than one 'collapse' clause}} -// expected-error@+2 2 {{argument to 'collapse' clause must be a strictly positive integer value}} +// expected-error@+2 {{argument to 'collapse' clause must be a strictly positive integer value}} #pragma omp target #pragma omp teams distribute parallel for simd collapse (foobool(argc)), collapse (true), collapse (-5) for (int i = 4; i < 12; i++) diff --git a/test/OpenMP/teams_distribute_parallel_for_simd_default_messages.cpp b/test/OpenMP/teams_distribute_parallel_for_simd_default_messages.cpp index 8db9d668fd..4de844737a 100644 --- a/test/OpenMP/teams_distribute_parallel_for_simd_default_messages.cpp +++ b/test/OpenMP/teams_distribute_parallel_for_simd_default_messages.cpp @@ -25,7 +25,7 @@ int main(int argc, char **argv) { for (int i=0; i<200; i++) foo(); #pragma omp target - #pragma omp teams distribute parallel for simd default(none) + #pragma omp teams distribute parallel for simd default(none) // expected-note {{explicit data sharing attribute requested here}} for (int i=0; i<200; i++) ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} return 0; diff --git a/test/OpenMP/teams_distribute_parallel_for_simd_firstprivate_messages.cpp b/test/OpenMP/teams_distribute_parallel_for_simd_firstprivate_messages.cpp index 036f201230..611e9b808f 100644 --- a/test/OpenMP/teams_distribute_parallel_for_simd_firstprivate_messages.cpp +++ b/test/OpenMP/teams_distribute_parallel_for_simd_firstprivate_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wno-openmp-target +extern int omp_default_mem_alloc; void foo() { } @@ -91,7 +92,7 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); #pragma omp target -#pragma omp teams distribute parallel for simd firstprivate (argc) +#pragma omp teams distribute parallel for simd firstprivate (argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (i = 0; i < argc; ++i) foo(); #pragma omp target diff --git a/test/OpenMP/teams_distribute_parallel_for_simd_lastprivate_messages.cpp b/test/OpenMP/teams_distribute_parallel_for_simd_lastprivate_messages.cpp index 7e78d06e93..f123f90243 100644 --- a/test/OpenMP/teams_distribute_parallel_for_simd_lastprivate_messages.cpp +++ b/test/OpenMP/teams_distribute_parallel_for_simd_lastprivate_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wno-openmp-target +extern int omp_default_mem_alloc; void foo() { } @@ -95,7 +96,7 @@ int foomain(int argc, char **argv) { for (int k = 0; k < argc; ++k) ++k; #pragma omp target -#pragma omp teams distribute parallel for simd lastprivate(argc) +#pragma omp teams distribute parallel for simd lastprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target diff --git a/test/OpenMP/teams_distribute_parallel_for_simd_linear_messages.cpp b/test/OpenMP/teams_distribute_parallel_for_simd_linear_messages.cpp index c6fb77b496..798aa56559 100644 --- a/test/OpenMP/teams_distribute_parallel_for_simd_linear_messages.cpp +++ b/test/OpenMP/teams_distribute_parallel_for_simd_linear_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; namespace X { int x; }; @@ -161,7 +162,7 @@ template<class I, class C> int foomain(I argc, C **argv) { // expected-error@+2 {{only loop iteration variables are allowed in 'linear' clause in distribute directives}} #pragma omp target -#pragma omp teams distribute parallel for simd linear (argc : 5) +#pragma omp teams distribute parallel for simd linear (argc : 5) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target diff --git a/test/OpenMP/teams_distribute_parallel_for_simd_messages.cpp b/test/OpenMP/teams_distribute_parallel_for_simd_messages.cpp index d27e156161..e95ddfc669 100644 --- a/test/OpenMP/teams_distribute_parallel_for_simd_messages.cpp +++ b/test/OpenMP/teams_distribute_parallel_for_simd_messages.cpp @@ -76,7 +76,7 @@ L1: } } #pragma omp target -#pragma omp teams distribute parallel for simd default(none) +#pragma omp teams distribute parallel for simd default(none) // expected-note {{explicit data sharing attribute requested here}} for (int i = 0; i < 10; ++i) ++argc; // expected-error {{ariable 'argc' must have explicitly specified data sharing attributes}} diff --git a/test/OpenMP/teams_distribute_parallel_for_simd_private_messages.cpp b/test/OpenMP/teams_distribute_parallel_for_simd_private_messages.cpp index 7bbe4c2f23..9d4ca03f9e 100644 --- a/test/OpenMP/teams_distribute_parallel_for_simd_private_messages.cpp +++ b/test/OpenMP/teams_distribute_parallel_for_simd_private_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; void foo() { } @@ -77,7 +78,7 @@ int main(int argc, char **argv) { for (int k = 0; k < argc; ++k) ++k; #pragma omp target - #pragma omp teams distribute parallel for simd private (argc) + #pragma omp teams distribute parallel for simd private (argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target diff --git a/test/OpenMP/teams_distribute_parallel_for_simd_reduction_messages.cpp b/test/OpenMP/teams_distribute_parallel_for_simd_reduction_messages.cpp index 9f203063f1..1efd4b05ca 100644 --- a/test/OpenMP/teams_distribute_parallel_for_simd_reduction_messages.cpp +++ b/test/OpenMP/teams_distribute_parallel_for_simd_reduction_messages.cpp @@ -6,6 +6,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 %s -Wno-openmp-target // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 %s -Wno-openmp-target +extern int omp_default_mem_alloc; void foo() { } @@ -119,7 +120,7 @@ T tmain(T argc) { #pragma omp teams distribute parallel for simd reduction(foo : argc) //expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'float'}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int'}} for (int j=0; j<100; j++) foo(); #pragma omp target -#pragma omp teams distribute parallel for simd reduction(&& : argc) +#pragma omp teams distribute parallel for simd reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int j=0; j<100; j++) foo(); #pragma omp target #pragma omp teams distribute parallel for simd reduction(^ : T) // expected-error {{'T' does not refer to a value}} diff --git a/test/OpenMP/teams_distribute_parallel_for_simd_safelen_messages.cpp b/test/OpenMP/teams_distribute_parallel_for_simd_safelen_messages.cpp index e673bb382a..2b31c89634 100644 --- a/test/OpenMP/teams_distribute_parallel_for_simd_safelen_messages.cpp +++ b/test/OpenMP/teams_distribute_parallel_for_simd_safelen_messages.cpp @@ -56,10 +56,13 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} argv[0][i] = argv[0][i] - argv[0][i-ST]; #if __cplusplus >= 201103L - // expected-note@+3 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} + // expected-note@+6 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif #pragma omp target -#pragma omp teams distribute parallel for simd safelen (foobool(argc)), safelen (true), safelen (-5) // expected-error 2 {{directive '#pragma omp teams distribute parallel for simd' cannot contain more than one 'safelen' clause}} expected-error 2 {{argument to 'safelen' clause must be a strictly positive integer value}} expected-error 2 {{expression is not an integral constant expression}} +// expected-error@+3 2 {{directive '#pragma omp teams distribute parallel for simd' cannot contain more than one 'safelen' clause}} +// expected-error@+2 {{argument to 'safelen' clause must be a strictly positive integer value}} +// expected-error@+1 2 {{expression is not an integral constant expression}} +#pragma omp teams distribute parallel for simd safelen (foobool(argc)), safelen (true), safelen (-5) for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; @@ -126,10 +129,13 @@ int main(int argc, char **argv) { argv[0][i] = argv[0][i] - argv[0][i-4]; #if __cplusplus >= 201103L - // expected-note@+3 {{non-constexpr function 'foobool' cannot be used in a constant expression}} + // expected-note@+6 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif #pragma omp target -#pragma omp teams distribute parallel for simd safelen (foobool(argc)), safelen (true), safelen (-5) // expected-error 2 {{argument to 'safelen' clause must be a strictly positive integer value}} expected-error 2 {{directive '#pragma omp teams distribute parallel for simd' cannot contain more than one 'safelen' clause}} expected-error {{expression is not an integral constant expression}} +// expected-error@+3 {{argument to 'safelen' clause must be a strictly positive integer value}} +// expected-error@+2 2 {{directive '#pragma omp teams distribute parallel for simd' cannot contain more than one 'safelen' clause}} +// expected-error@+1 {{expression is not an integral constant expression}} +#pragma omp teams distribute parallel for simd safelen (foobool(argc)), safelen (true), safelen (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; diff --git a/test/OpenMP/teams_distribute_parallel_for_simd_simdlen_messages.cpp b/test/OpenMP/teams_distribute_parallel_for_simd_simdlen_messages.cpp index e673bb382a..2b31c89634 100644 --- a/test/OpenMP/teams_distribute_parallel_for_simd_simdlen_messages.cpp +++ b/test/OpenMP/teams_distribute_parallel_for_simd_simdlen_messages.cpp @@ -56,10 +56,13 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} argv[0][i] = argv[0][i] - argv[0][i-ST]; #if __cplusplus >= 201103L - // expected-note@+3 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} + // expected-note@+6 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif #pragma omp target -#pragma omp teams distribute parallel for simd safelen (foobool(argc)), safelen (true), safelen (-5) // expected-error 2 {{directive '#pragma omp teams distribute parallel for simd' cannot contain more than one 'safelen' clause}} expected-error 2 {{argument to 'safelen' clause must be a strictly positive integer value}} expected-error 2 {{expression is not an integral constant expression}} +// expected-error@+3 2 {{directive '#pragma omp teams distribute parallel for simd' cannot contain more than one 'safelen' clause}} +// expected-error@+2 {{argument to 'safelen' clause must be a strictly positive integer value}} +// expected-error@+1 2 {{expression is not an integral constant expression}} +#pragma omp teams distribute parallel for simd safelen (foobool(argc)), safelen (true), safelen (-5) for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; @@ -126,10 +129,13 @@ int main(int argc, char **argv) { argv[0][i] = argv[0][i] - argv[0][i-4]; #if __cplusplus >= 201103L - // expected-note@+3 {{non-constexpr function 'foobool' cannot be used in a constant expression}} + // expected-note@+6 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif #pragma omp target -#pragma omp teams distribute parallel for simd safelen (foobool(argc)), safelen (true), safelen (-5) // expected-error 2 {{argument to 'safelen' clause must be a strictly positive integer value}} expected-error 2 {{directive '#pragma omp teams distribute parallel for simd' cannot contain more than one 'safelen' clause}} expected-error {{expression is not an integral constant expression}} +// expected-error@+3 {{argument to 'safelen' clause must be a strictly positive integer value}} +// expected-error@+2 2 {{directive '#pragma omp teams distribute parallel for simd' cannot contain more than one 'safelen' clause}} +// expected-error@+1 {{expression is not an integral constant expression}} +#pragma omp teams distribute parallel for simd safelen (foobool(argc)), safelen (true), safelen (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; diff --git a/test/OpenMP/teams_distribute_private_messages.cpp b/test/OpenMP/teams_distribute_private_messages.cpp index c24504460e..130cbd5c57 100644 --- a/test/OpenMP/teams_distribute_private_messages.cpp +++ b/test/OpenMP/teams_distribute_private_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; void foo() { } @@ -77,7 +78,7 @@ int main(int argc, char **argv) { for (int k = 0; k < argc; ++k) ++k; #pragma omp target - #pragma omp teams distribute private (argc) + #pragma omp teams distribute private (argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target diff --git a/test/OpenMP/teams_distribute_reduction_messages.cpp b/test/OpenMP/teams_distribute_reduction_messages.cpp index f83dda6809..da86638ba0 100644 --- a/test/OpenMP/teams_distribute_reduction_messages.cpp +++ b/test/OpenMP/teams_distribute_reduction_messages.cpp @@ -6,6 +6,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 %s -Wno-openmp-target // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 %s -Wno-openmp-target +extern int omp_default_mem_alloc; void foo() { } @@ -125,7 +126,7 @@ T tmain(T argc) { #pragma omp teams distribute reduction(foo : argc) //expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'float'}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int'}} for (int j=0; j<100; j++) foo(); #pragma omp target -#pragma omp teams distribute reduction(&& : argc) +#pragma omp teams distribute reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int j=0; j<100; j++) foo(); #pragma omp target #pragma omp teams distribute reduction(^ : T) // expected-error {{'T' does not refer to a value}} diff --git a/test/OpenMP/teams_distribute_simd_ast_print.cpp b/test/OpenMP/teams_distribute_simd_ast_print.cpp index f811b0b7ac..aa11622217 100644 --- a/test/OpenMP/teams_distribute_simd_ast_print.cpp +++ b/test/OpenMP/teams_distribute_simd_ast_print.cpp @@ -130,12 +130,12 @@ T tmain(T argc) { // CHECK-NEXT: for (int i = 0; i < 2; ++i) // CHECK-NEXT: a = 2; #pragma omp target -#pragma omp teams distribute simd private(argc, b), firstprivate(c, d), collapse(2) +#pragma omp teams distribute simd allocate(b) private(argc, b), firstprivate(c, d), collapse(2) allocate(c) for (int i = 0; i < 10; ++i) for (int j = 0; j < 10; ++j) foo(); // CHECK: #pragma omp target -// CHECK-NEXT: #pragma omp teams distribute simd private(argc,b) firstprivate(c,d) collapse(2) +// CHECK-NEXT: #pragma omp teams distribute simd allocate(b) private(argc,b) firstprivate(c,d) collapse(2) allocate(c) // CHECK-NEXT: for (int i = 0; i < 10; ++i) // CHECK-NEXT: for (int j = 0; j < 10; ++j) // CHECK-NEXT: foo(); diff --git a/test/OpenMP/teams_distribute_simd_codegen.cpp b/test/OpenMP/teams_distribute_simd_codegen.cpp index c89a936b64..ab1482855e 100644 --- a/test/OpenMP/teams_distribute_simd_codegen.cpp +++ b/test/OpenMP/teams_distribute_simd_codegen.cpp @@ -39,7 +39,7 @@ int teams_argument_global(int n) { // CK1: [[TE_PAR:%.+]] = load{{.+}}, {{.+}} [[TE_CAST]], // CK1: [[TH_PAR:%.+]] = load{{.+}}, {{.+}} [[TH_CAST]], - // CK1: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 5, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 {{.+}}, i32 {{.+}}) + // CK1: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 5, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 {{.+}}, i32 1) // CK1: call void @[[OFFL1:.+]](i{{32|64}} [[TE_PAR]], i{{32|64}} [[TH_PAR]], #pragma omp target @@ -48,7 +48,7 @@ int teams_argument_global(int n) { a[i] = 0; } - // CK1: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 2, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 0, i32 0) + // CK1: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 2, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 0, i32 1) // CK1: call void @[[OFFL2:.+]](i{{64|32}} %{{.+}}) #pragma omp target {{{ @@ -119,7 +119,7 @@ int teams_local_arg(void) { int n = 100; int a[n]; - // CK2: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 3, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}, i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 0, i32 0) + // CK2: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 3, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}, i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 0, i32 1) // CK2: call void @[[OFFL1:.+]](i{{64|32}} %{{.+}}) #pragma omp target #pragma omp teams distribute simd @@ -135,7 +135,7 @@ int teams_local_arg(void) { // CK2: define internal void @[[OUTL1]]({{.+}}) // CK2: call void @__kmpc_for_static_init_4( // CK2: call void @__kmpc_for_static_fini( - // CK2: ret void + // CK2: ret void return a[0]; } @@ -168,7 +168,7 @@ struct SS{ // CK3: define {{.*}}i32 @{{.+}}foo{{.+}}( int foo(void) { - // CK3: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 1, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 0, i32 0) + // CK3: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 1, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 0, i32 1) // CK3: call void @[[OFFL1:.+]]([[SSI]]* %{{.+}}) #pragma omp target #pragma omp teams distribute simd @@ -184,7 +184,7 @@ struct SS{ // CK3: define internal void @[[OUTL1]]({{.+}}) // CK3: call void @__kmpc_for_static_init_4( // CK3: call void @__kmpc_for_static_fini( - // CK3: ret void + // CK3: ret void return a[0]; } @@ -241,7 +241,7 @@ int main (int argc, char **argv) { } // CK4: define {{.*}}i32 @{{[^,]+}}(i{{.+}}{{.+}} %[[ARGC:.+]], {{.+}}) -// CK4: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 3, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}, i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 0, i32 0) +// CK4: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 3, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}, i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 0, i32 1) // CK4: call void @[[OFFL1:.+]]({{.+}}) // CK4: {{%.+}} = call{{.*}} i32 @[[TMAIN:.+]]({{.+}}) // CK4: ret @@ -256,7 +256,7 @@ int main (int argc, char **argv) { // CK4: ret void // CK4: define {{.*}}i32 @[[TMAIN]]({{.+}}) -// CK4: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 3, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 {{.+}}, i32 {{.+}}) +// CK4: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 3, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 {{.+}}, i32 1) // CK4: call void @[[OFFLT:.+]]({{.+}}) // CK4: ret // CK4-NEXT: } diff --git a/test/OpenMP/teams_distribute_simd_collapse_messages.cpp b/test/OpenMP/teams_distribute_simd_collapse_messages.cpp index d0b2f814bf..a5eb6d20e0 100644 --- a/test/OpenMP/teams_distribute_simd_collapse_messages.cpp +++ b/test/OpenMP/teams_distribute_simd_collapse_messages.cpp @@ -60,7 +60,7 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} argv[0][i] = argv[0][i] - argv[0][i-ST]; // expected-error 2 {{expected 2 for loops after '#pragma omp teams distribute simd', but found only 1}} // expected-error@+7 2 {{directive '#pragma omp teams distribute simd' cannot contain more than one 'collapse' clause}} -// expected-error@+6 2 {{argument to 'collapse' clause must be a strictly positive integer value}} +// expected-error@+6 {{argument to 'collapse' clause must be a strictly positive integer value}} // expected-error@+5 2 {{expression is not an integral constant expression}} #if __cplusplus >= 201103L // expected-note@+3 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} @@ -136,7 +136,7 @@ int main(int argc, char **argv) { // expected-error@+7 {{expression is not an integral constant expression}} // expected-error@+6 2 {{directive '#pragma omp teams distribute simd' cannot contain more than one 'collapse' clause}} -// expected-error@+5 2 {{argument to 'collapse' clause must be a strictly positive integer value}} +// expected-error@+5 {{argument to 'collapse' clause must be a strictly positive integer value}} #if __cplusplus >= 201103L // expected-note@+3 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif diff --git a/test/OpenMP/teams_distribute_simd_default_messages.cpp b/test/OpenMP/teams_distribute_simd_default_messages.cpp index af176f46cb..8f6db01efb 100644 --- a/test/OpenMP/teams_distribute_simd_default_messages.cpp +++ b/test/OpenMP/teams_distribute_simd_default_messages.cpp @@ -25,7 +25,7 @@ int main(int argc, char **argv) { for (int i=0; i<200; i++) foo(); #pragma omp target - #pragma omp teams distribute simd default(none) + #pragma omp teams distribute simd default(none) // expected-note {{explicit data sharing attribute requested here}} for (int i=0; i<200; i++) ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} return 0; diff --git a/test/OpenMP/teams_distribute_simd_firstprivate_codegen.cpp b/test/OpenMP/teams_distribute_simd_firstprivate_codegen.cpp index 27320191fa..ec0b006a37 100644 --- a/test/OpenMP/teams_distribute_simd_firstprivate_codegen.cpp +++ b/test/OpenMP/teams_distribute_simd_firstprivate_codegen.cpp @@ -86,7 +86,7 @@ int main() { // LAMBDA: call void [[OUTER_LAMBDA:@.+]]( [&]() { // LAMBDA: define{{.*}} internal{{.*}} void [[OUTER_LAMBDA]]( - // LAMBDA: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 3, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 0, i32 0) + // LAMBDA: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 3, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 0, i32 1) // LAMBDA: call void @[[LOFFL1:.+]](i{{64|32}} %{{.+}}) // LAMBDA: ret #pragma omp target @@ -167,7 +167,7 @@ int main() { } // CHECK: define {{.*}}i{{[0-9]+}} @main() -// CHECK: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 5, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 0, i32 0) +// CHECK: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 5, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 0, i32 1) // CHECK: call void @[[OFFL1:.+]](i{{64|32}} %{{.+}}) // CHECK: {{%.+}} = call{{.*}} i32 @[[TMAIN_INT:.+]]() // CHECK: ret @@ -261,7 +261,7 @@ int main() { // CHECK: ret void // CHECK: define{{.*}} i{{[0-9]+}} @[[TMAIN_INT]]() -// CHECK: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 4, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 0, i32 0) +// CHECK: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 4, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 0, i32 1) // CHECK: call void @[[TOFFL1:.+]](i{{64|32}} %{{.+}}) // CHECK: ret diff --git a/test/OpenMP/teams_distribute_simd_firstprivate_messages.cpp b/test/OpenMP/teams_distribute_simd_firstprivate_messages.cpp index 5b074c4cda..08a461a467 100644 --- a/test/OpenMP/teams_distribute_simd_firstprivate_messages.cpp +++ b/test/OpenMP/teams_distribute_simd_firstprivate_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wno-openmp-target +extern int omp_default_mem_alloc; void foo() { } @@ -91,7 +92,7 @@ int main(int argc, char **argv) { for (i = 0; i < argc; ++i) foo(); #pragma omp target -#pragma omp teams distribute simd firstprivate (argc) +#pragma omp teams distribute simd firstprivate (argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (i = 0; i < argc; ++i) foo(); #pragma omp target diff --git a/test/OpenMP/teams_distribute_simd_lastprivate_messages.cpp b/test/OpenMP/teams_distribute_simd_lastprivate_messages.cpp index 5e0806b687..4feda4be2b 100644 --- a/test/OpenMP/teams_distribute_simd_lastprivate_messages.cpp +++ b/test/OpenMP/teams_distribute_simd_lastprivate_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wno-openmp-target +extern int omp_default_mem_alloc; void foo() { } @@ -95,7 +96,7 @@ int foomain(int argc, char **argv) { for (int k = 0; k < argc; ++k) ++k; #pragma omp target -#pragma omp teams distribute simd lastprivate(argc) +#pragma omp teams distribute simd lastprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target diff --git a/test/OpenMP/teams_distribute_simd_linear_messages.cpp b/test/OpenMP/teams_distribute_simd_linear_messages.cpp index 8548e3dcc0..43fe1a4239 100644 --- a/test/OpenMP/teams_distribute_simd_linear_messages.cpp +++ b/test/OpenMP/teams_distribute_simd_linear_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; namespace X { int x; }; @@ -161,7 +162,7 @@ template<class I, class C> int foomain(I argc, C **argv) { // expected-error@+2 {{only loop iteration variables are allowed in 'linear' clause in distribute directives}} #pragma omp target -#pragma omp teams distribute simd linear (argc : 5) +#pragma omp teams distribute simd linear (argc : 5) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target diff --git a/test/OpenMP/teams_distribute_simd_messages.cpp b/test/OpenMP/teams_distribute_simd_messages.cpp index 79128706bc..7a99e3f352 100644 --- a/test/OpenMP/teams_distribute_simd_messages.cpp +++ b/test/OpenMP/teams_distribute_simd_messages.cpp @@ -76,7 +76,7 @@ L1: } } #pragma omp target -#pragma omp teams distribute simd default(none) +#pragma omp teams distribute simd default(none) // expected-note {{explicit data sharing attribute requested here}} for (int i = 0; i < 10; ++i) ++argc; // expected-error {{ariable 'argc' must have explicitly specified data sharing attributes}} diff --git a/test/OpenMP/teams_distribute_simd_private_codegen.cpp b/test/OpenMP/teams_distribute_simd_private_codegen.cpp index fc7000a699..10ad66ad31 100644 --- a/test/OpenMP/teams_distribute_simd_private_codegen.cpp +++ b/test/OpenMP/teams_distribute_simd_private_codegen.cpp @@ -85,7 +85,7 @@ int main() { // LAMBDA: call void [[OUTER_LAMBDA:@.+]]( [&]() { // LAMBDA: define{{.*}} internal{{.*}} void [[OUTER_LAMBDA]]( - // LAMBDA: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 1, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 0, i32 0) + // LAMBDA: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 1, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 0, i32 1) // LAMBDA: call void @[[LOFFL1:.+]]( // LAMBDA: ret #pragma omp target @@ -155,7 +155,7 @@ int main() { } // CHECK: define {{.*}}i{{[0-9]+}} @main() -// CHECK: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 0, i8** null, i8** null, i{{64|32}}* null, i64* null, i32 0, i32 0) +// CHECK: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 0, i8** null, i8** null, i{{64|32}}* null, i64* null, i32 0, i32 1) // CHECK: call void @[[OFFL1:.+]]() // CHECK: {{%.+}} = call{{.*}} i32 @[[TMAIN_INT:.+]]() // CHECK: ret diff --git a/test/OpenMP/teams_distribute_simd_private_messages.cpp b/test/OpenMP/teams_distribute_simd_private_messages.cpp index f2485b36a0..7ffdf86e3c 100644 --- a/test/OpenMP/teams_distribute_simd_private_messages.cpp +++ b/test/OpenMP/teams_distribute_simd_private_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; void foo() { } @@ -77,7 +78,7 @@ int main(int argc, char **argv) { for (int k = 0; k < argc; ++k) ++k; #pragma omp target - #pragma omp teams distribute simd private (argc) + #pragma omp teams distribute simd private (argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int k = 0; k < argc; ++k) ++k; #pragma omp target diff --git a/test/OpenMP/teams_distribute_simd_reduction_codegen.cpp b/test/OpenMP/teams_distribute_simd_reduction_codegen.cpp index 10901dea12..2137913bcd 100644 --- a/test/OpenMP/teams_distribute_simd_reduction_codegen.cpp +++ b/test/OpenMP/teams_distribute_simd_reduction_codegen.cpp @@ -47,7 +47,7 @@ int main() { // LAMBDA: call void [[OUTER_LAMBDA:@.+]]( [&]() { // LAMBDA: define{{.*}} internal{{.*}} void [[OUTER_LAMBDA]]( - // LAMBDA: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 1, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 0, i32 0) + // LAMBDA: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 1, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 0, i32 1) // LAMBDA: call void @[[LOFFL1:.+]]( // LAMBDA: ret #pragma omp target @@ -128,7 +128,7 @@ int main() { // CHECK: [[RED_VAR:@.+]] = common global [8 x {{.+}}] zeroinitializer // CHECK: define {{.*}}i{{[0-9]+}} @main() -// CHECK: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 1, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 0, i32 0) +// CHECK: call i32 @__tgt_target_teams(i64 -1, i8* @{{[^,]+}}, i32 1, i8** %{{[^,]+}}, i8** %{{[^,]+}}, i{{64|32}}* {{.+}}@{{[^,]+}}, i32 0, i32 0), i64* {{.+}}@{{[^,]+}}, i32 0, i32 0), i32 0, i32 1) // CHECK: call void @[[OFFL1:.+]](i{{64|32}} %{{.+}}) // CHECK: {{%.+}} = call{{.*}} i32 @[[TMAIN_INT:.+]]() // CHECK: ret diff --git a/test/OpenMP/teams_distribute_simd_reduction_messages.cpp b/test/OpenMP/teams_distribute_simd_reduction_messages.cpp index e590d3616d..fbe73e1f1e 100644 --- a/test/OpenMP/teams_distribute_simd_reduction_messages.cpp +++ b/test/OpenMP/teams_distribute_simd_reduction_messages.cpp @@ -6,6 +6,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 %s -Wno-openmp-target // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 %s -Wno-openmp-target +extern int omp_default_mem_alloc; void foo() { } @@ -119,7 +120,7 @@ T tmain(T argc) { #pragma omp teams distribute simd reduction(foo : argc) //expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'float'}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int'}} for (int j=0; j<100; j++) foo(); #pragma omp target -#pragma omp teams distribute simd reduction(&& : argc) +#pragma omp teams distribute simd reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} for (int j=0; j<100; j++) foo(); #pragma omp target #pragma omp teams distribute simd reduction(^ : T) // expected-error {{'T' does not refer to a value}} diff --git a/test/OpenMP/teams_distribute_simd_safelen_messages.cpp b/test/OpenMP/teams_distribute_simd_safelen_messages.cpp index 7be581a96b..a3ea61e1da 100644 --- a/test/OpenMP/teams_distribute_simd_safelen_messages.cpp +++ b/test/OpenMP/teams_distribute_simd_safelen_messages.cpp @@ -56,10 +56,13 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} argv[0][i] = argv[0][i] - argv[0][i-ST]; #if __cplusplus >= 201103L - // expected-note@+3 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} + // expected-note@+6 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif #pragma omp target -#pragma omp teams distribute simd safelen (foobool(argc)), safelen (true), safelen (-5) // expected-error 2 {{directive '#pragma omp teams distribute simd' cannot contain more than one 'safelen' clause}} expected-error 2 {{argument to 'safelen' clause must be a strictly positive integer value}} expected-error 2 {{expression is not an integral constant expression}} +// expected-error@+3 2 {{directive '#pragma omp teams distribute simd' cannot contain more than one 'safelen' clause}} +// expected-error@+2 {{argument to 'safelen' clause must be a strictly positive integer value}} +// expected-error@+1 2 {{expression is not an integral constant expression}} +#pragma omp teams distribute simd safelen (foobool(argc)), safelen (true), safelen (-5) for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; @@ -126,10 +129,13 @@ int main(int argc, char **argv) { argv[0][i] = argv[0][i] - argv[0][i-4]; #if __cplusplus >= 201103L - // expected-note@+3 {{non-constexpr function 'foobool' cannot be used in a constant expression}} + // expected-note@+6 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif #pragma omp target -#pragma omp teams distribute simd safelen (foobool(argc)), safelen (true), safelen (-5) // expected-error 2 {{argument to 'safelen' clause must be a strictly positive integer value}} expected-error 2 {{directive '#pragma omp teams distribute simd' cannot contain more than one 'safelen' clause}} expected-error {{expression is not an integral constant expression}} +// expected-error@+3 {{argument to 'safelen' clause must be a strictly positive integer value}} +// expected-error@+2 2 {{directive '#pragma omp teams distribute simd' cannot contain more than one 'safelen' clause}} +// expected-error@+1 {{expression is not an integral constant expression}} +#pragma omp teams distribute simd safelen (foobool(argc)), safelen (true), safelen (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; diff --git a/test/OpenMP/teams_distribute_simd_simdlen_messages.cpp b/test/OpenMP/teams_distribute_simd_simdlen_messages.cpp index 7be581a96b..a3ea61e1da 100644 --- a/test/OpenMP/teams_distribute_simd_simdlen_messages.cpp +++ b/test/OpenMP/teams_distribute_simd_simdlen_messages.cpp @@ -56,10 +56,13 @@ T tmain(T argc, S **argv) { //expected-note 2 {{declared here}} argv[0][i] = argv[0][i] - argv[0][i-ST]; #if __cplusplus >= 201103L - // expected-note@+3 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} + // expected-note@+6 2 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif #pragma omp target -#pragma omp teams distribute simd safelen (foobool(argc)), safelen (true), safelen (-5) // expected-error 2 {{directive '#pragma omp teams distribute simd' cannot contain more than one 'safelen' clause}} expected-error 2 {{argument to 'safelen' clause must be a strictly positive integer value}} expected-error 2 {{expression is not an integral constant expression}} +// expected-error@+3 2 {{directive '#pragma omp teams distribute simd' cannot contain more than one 'safelen' clause}} +// expected-error@+2 {{argument to 'safelen' clause must be a strictly positive integer value}} +// expected-error@+1 2 {{expression is not an integral constant expression}} +#pragma omp teams distribute simd safelen (foobool(argc)), safelen (true), safelen (-5) for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; @@ -126,10 +129,13 @@ int main(int argc, char **argv) { argv[0][i] = argv[0][i] - argv[0][i-4]; #if __cplusplus >= 201103L - // expected-note@+3 {{non-constexpr function 'foobool' cannot be used in a constant expression}} + // expected-note@+6 {{non-constexpr function 'foobool' cannot be used in a constant expression}} #endif #pragma omp target -#pragma omp teams distribute simd safelen (foobool(argc)), safelen (true), safelen (-5) // expected-error 2 {{argument to 'safelen' clause must be a strictly positive integer value}} expected-error 2 {{directive '#pragma omp teams distribute simd' cannot contain more than one 'safelen' clause}} expected-error {{expression is not an integral constant expression}} +// expected-error@+3 {{argument to 'safelen' clause must be a strictly positive integer value}} +// expected-error@+2 2 {{directive '#pragma omp teams distribute simd' cannot contain more than one 'safelen' clause}} +// expected-error@+1 {{expression is not an integral constant expression}} +#pragma omp teams distribute simd safelen (foobool(argc)), safelen (true), safelen (-5) for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; diff --git a/test/OpenMP/teams_firstprivate_messages.cpp b/test/OpenMP/teams_firstprivate_messages.cpp index d29a2e3960..f04827708a 100644 --- a/test/OpenMP/teams_firstprivate_messages.cpp +++ b/test/OpenMP/teams_firstprivate_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wno-openmp-target +extern int omp_default_mem_alloc; void foo() { } @@ -85,7 +86,7 @@ int main(int argc, char **argv) { #pragma omp teams firstprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}} foo(); #pragma omp target -#pragma omp teams firstprivate(argc) +#pragma omp teams firstprivate(argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} foo(); #pragma omp target #pragma omp teams firstprivate(S1) // expected-error {{'S1' does not refer to a value}} diff --git a/test/OpenMP/teams_messages.cpp b/test/OpenMP/teams_messages.cpp index 6ed3be9da5..bba7da2e0e 100644 --- a/test/OpenMP/teams_messages.cpp +++ b/test/OpenMP/teams_messages.cpp @@ -63,7 +63,7 @@ int main(int argc, char **argv) { } } #pragma omp target - #pragma omp teams default(none) + #pragma omp teams default(none) // expected-note {{explicit data sharing attribute requested here}} ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} goto L2; // expected-error {{use of undeclared label 'L2'}} diff --git a/test/OpenMP/teams_private_messages.cpp b/test/OpenMP/teams_private_messages.cpp index 4ad7a0de29..5cc8a7a805 100644 --- a/test/OpenMP/teams_private_messages.cpp +++ b/test/OpenMP/teams_private_messages.cpp @@ -2,6 +2,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd %s +extern int omp_default_mem_alloc; void foo() { } @@ -89,7 +90,7 @@ int main(int argc, char **argv) { #pragma omp teams private (argv[1]) // expected-error {{expected variable name}} foo(); #pragma omp target - #pragma omp teams private(ba) + #pragma omp teams private(ba) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} foo(); #pragma omp target #pragma omp teams private(ca) // expected-error {{const-qualified variable without mutable fields cannot be private}} diff --git a/test/OpenMP/teams_reduction_messages.cpp b/test/OpenMP/teams_reduction_messages.cpp index 37f58f8b17..558d766e70 100644 --- a/test/OpenMP/teams_reduction_messages.cpp +++ b/test/OpenMP/teams_reduction_messages.cpp @@ -6,6 +6,7 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -o - %s -Wno-openmp-target // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -o - %s -Wno-openmp-target +extern int omp_default_mem_alloc; void foo() { } @@ -125,7 +126,7 @@ T tmain(T argc) { #pragma omp teams reduction(foo : argc) //expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'float'}} expected-error {{incorrect reduction identifier, expected one of '+', '-', '*', '&', '|', '^', '&&', '||', 'min' or 'max' or declare reduction for type 'int'}} foo(); #pragma omp target -#pragma omp teams reduction(&& : argc) +#pragma omp teams reduction(&& : argc) allocate , allocate(, allocate(omp_default , allocate(omp_default_mem_alloc, allocate(omp_default_mem_alloc:, allocate(omp_default_mem_alloc: argc, allocate(omp_default_mem_alloc: argv), allocate(argv) // expected-error {{expected '(' after 'allocate'}} expected-error 2 {{expected expression}} expected-error 2 {{expected ')'}} expected-error {{use of undeclared identifier 'omp_default'}} expected-note 2 {{to match this '('}} foo(); #pragma omp target #pragma omp teams reduction(^ : T) // expected-error {{'T' does not refer to a value}} diff --git a/test/OpenMP/threadprivate_messages.cpp b/test/OpenMP/threadprivate_messages.cpp index 62ddfd1e63..381314246b 100644 --- a/test/OpenMP/threadprivate_messages.cpp +++ b/test/OpenMP/threadprivate_messages.cpp @@ -19,7 +19,7 @@ struct CompleteSt1{ int a; // expected-note {{'a' defined here}} -#pragma omp threadprivate(a) +#pragma omp threadprivate(a) allocate(a) // expected-warning {{extra tokens at the end of '#pragma omp threadprivate' are ignored}} #pragma omp threadprivate(u) // expected-error {{use of undeclared identifier 'u'}} #pragma omp threadprivate(d, a) int foo() { // expected-note {{declared here}} |