brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.1 KiB · bbbacea Raw
94 lines · cpp
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.bc2// 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 %s4// 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.bc5// 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 %s7// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -fopenmp-targets=spirv64 -emit-llvm-bc %s -o %t-ppc-host.bc8// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple spirv64 -fopenmp-targets=spirv64 -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s 9 10// expected-no-diagnostics11 12 13#ifndef HEADER14#define HEADER15 16 17void default_val_num_teams() {18    #pragma omp target simd19    for (int i = 0; i < 22; i++)20        int a_var;21}22 23void foo1() {24    #pragma omp target teams num_teams(22)25    { int a_var; }26}27 28void foo2() {29    #pragma omp target teams distribute num_teams(22)30    for (int i = 0; i < 22; i++)31        int a_var;32}33 34void foo3() {35    #pragma omp target teams distribute parallel for num_teams(22)36    for (int i = 0; i < 22; i++)37        int a_var;38}39 40void bar1() {41    #pragma omp target teams num_teams(22)42    { int a_var; }43}44 45void bar2() {46    #pragma omp target teams distribute num_teams(33)47    for (int i = 0; i < 22; i++)48        int a_var;49}50 51void bar3() {52    #pragma omp target teams distribute parallel for num_teams(44)53    for (int i = 0; i < 22; i++)54        int a_var;55}56 57void const_int() {58    const int NT = 22;59    #pragma omp target teams num_teams(NT)60    { int a_var; }61}62 63void thread_limit() {64    #pragma omp target teams thread_limit(22)65    { int a_var; }66}67 68void num_threads() {69    #pragma omp target teams distribute parallel for thread_limit(22) num_threads(11)70    for (int i = 0; i < 22; i++)71        int a_var;72}73 74void threads_and_teams() {75    #pragma omp target teams distribute parallel for thread_limit(22) num_teams(33)76    for (int i = 0; i < 22; i++)77        int a_var;78}79 80#endif81 82 83// CHECK:      "omp_target_num_teams"="1"84// CHECK:      "omp_target_num_teams"="22"85// CHECK:      "omp_target_num_teams"="33"86// CHECK:      "omp_target_num_teams"="44"87 88// CHECK:      "omp_target_thread_limit"="22"89 90// CHECK:      "omp_target_thread_limit"="11"91 92// CHECK:      "omp_target_num_teams"="33"93// CHECK-SAME: "omp_target_thread_limit"="22"94