xref: /llvm-project/flang/test/Lower/OpenMP/omp-is-gpu.f90 (revision be9fa9dee50138f0283a3354ce76069036b1330c)
1!REQUIRES: amdgpu-registered-target, nvptx-registered-target
2
3!RUN: %flang_fc1 -triple amdgcn-amd-amdhsa -emit-hlfir -fopenmp -fopenmp-is-target-device %s -o - | FileCheck %s
4!RUN: %flang_fc1 -triple nvptx64-nvidia-cuda -emit-hlfir -fopenmp -fopenmp-is-target-device %s -o - | FileCheck %s
5!RUN: bbc -fopenmp -fopenmp-is-target-device -fopenmp-is-gpu -emit-hlfir -o - %s | FileCheck %s
6
7!RUN: not %flang_fc1 -triple amdgcn-amd-amdhsa -emit-hlfir -fopenmp %s -o - 2>&1 | FileCheck %s --check-prefix=FLANG-ERROR
8!RUN: not %flang_fc1 -triple nvptx64-nvidia-cuda -emit-hlfir -fopenmp %s -o - 2>&1 | FileCheck %s --check-prefix=FLANG-ERROR
9!RUN: not bbc -fopenmp -fopenmp-is-gpu -emit-hlfir %s -o - 2>&1 | FileCheck %s --check-prefix=BBC-ERROR
10
11!CHECK: module attributes {{{.*}}omp.is_gpu = true
12subroutine omp_subroutine()
13end subroutine omp_subroutine
14
15!FLANG-ERROR: error: OpenMP AMDGPU/NVPTX is only prepared to deal with device code.
16!BBC-ERROR: FATAL: -fopenmp-is-gpu can only be set if -fopenmp-is-target-device is also set
17