Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / target_num_teams_num_threads_attributes.cpp
blob613b21ff7f75f6dbc69bf46484413b212084edd2
1 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm-bc %s -o %t-ppc-host.bc
2 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple amdgcn-amd-amdhsa -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s
3 // RUN: %clang_cc1 -target-cpu gfx900 -fopenmp -x c++ -std=c++11 -triple amdgcn-amd-amdhsa -fopenmp-targets=amdgcn-amd-amdhsa -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s
4 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -fopenmp-targets=nvptx64 -emit-llvm-bc %s -o %t-ppc-host.bc
5 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple nvptx64 -fopenmp-targets=nvptx64 -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s
6 // RUN: %clang_cc1 -target-cpu sm_80 -fopenmp -x c++ -std=c++11 -triple nvptx64 -fopenmp-targets=nvptx64 -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s
8 // expected-no-diagnostics
11 #ifndef HEADER
12 #define HEADER
15 void default_val_num_teams() {
16 #pragma omp target simd
17 for (int i = 0; i < 22; i++)
18 int a_var;
21 void foo1() {
22 #pragma omp target teams num_teams(22)
23 { int a_var; }
26 void foo2() {
27 #pragma omp target teams distribute num_teams(22)
28 for (int i = 0; i < 22; i++)
29 int a_var;
32 void foo3() {
33 #pragma omp target teams distribute parallel for num_teams(22)
34 for (int i = 0; i < 22; i++)
35 int a_var;
38 void bar1() {
39 #pragma omp target teams num_teams(22)
40 { int a_var; }
43 void bar2() {
44 #pragma omp target teams distribute num_teams(33)
45 for (int i = 0; i < 22; i++)
46 int a_var;
49 void bar3() {
50 #pragma omp target teams distribute parallel for num_teams(44)
51 for (int i = 0; i < 22; i++)
52 int a_var;
55 void const_int() {
56 const int NT = 22;
57 #pragma omp target teams num_teams(NT)
58 { int a_var; }
61 void thread_limit() {
62 #pragma omp target teams thread_limit(22)
63 { int a_var; }
66 void num_threads() {
67 #pragma omp target teams distribute parallel for thread_limit(22) num_threads(11)
68 for (int i = 0; i < 22; i++)
69 int a_var;
72 void threads_and_teams() {
73 #pragma omp target teams distribute parallel for thread_limit(22) num_teams(33)
74 for (int i = 0; i < 22; i++)
75 int a_var;
78 #endif
81 // CHECK: "omp_target_num_teams"="1"
82 // CHECK: "omp_target_num_teams"="22"
83 // CHECK: "omp_target_num_teams"="33"
84 // CHECK: "omp_target_num_teams"="44"
86 // CHECK: "omp_target_thread_limit"="22"
88 // CHECK: "omp_target_thread_limit"="11"
90 // CHECK: "omp_target_num_teams"="33"
91 // CHECK-SAME: "omp_target_thread_limit"="22"