brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · ffa6c45 Raw
36 lines · c
1// Test target codegen - host bc file has to be created first.2//3// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple i386-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm-bc %s -o %t-x86-host.bc4// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple nvptx-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-x86-host.bc -o - | FileCheck %s5// expected-no-diagnostics6#ifndef HEADER7#define HEADER8 9void foo(int N) {10// CHECK: define {{.*}}l11{{.*}} #[[ATTR0:[0-9]+]]11#pragma omp target teams distribute parallel for simd12  for (int i = 0; i < N; ++i)13    ;14// CHECK: define {{.*}}l15{{.*}} #[[ATTR1:[0-9]+]]15#pragma omp target teams distribute parallel for simd thread_limit(4)16  for (int i = 0; i < N; ++i)17    ;18 19// CHECK: define {{.*}}l20{{.*}} #[[ATTR2:[0-9]+]]20#pragma omp target teams distribute parallel for simd ompx_attribute(__attribute__((launch_bounds(42, 42))))21  for (int i = 0; i < N; ++i)22    ;23 24// CHECK: define {{.*}}l25{{.*}} #[[ATTR3:[0-9]+]]25#pragma omp target teams distribute parallel for simd ompx_attribute(__attribute__((launch_bounds(42, 42)))) num_threads(22)26  for (int i = 0; i < N; ++i)27    ;28}29 30#endif31 32// CHECK: attributes #[[ATTR0]] = {{{.*}} "nvvm.maxntid"="128" {{.*}}}33// CHECK: attributes #[[ATTR1]] = {{{.*}} "nvvm.maxntid"="4" {{.*}}}34// CHECK: attributes #[[ATTR2]] = {{{.*}} "nvvm.maxntid"="42" {{.*}}}35// CHECK: attributes #[[ATTR3]] = {{{.*}} "nvvm.maxntid"="22" {{.*}}}36