xref: /llvm-project/clang/test/CodeGenCUDA/openmp-parallel.cu (revision d41445113bccaa037e5876659b4fd98d96af03e4)
1 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu \
2 // RUN:   -fopenmp -emit-llvm -o -  -x hip %s | FileCheck %s
3 
4 #include "Inputs/cuda.h"
5 
foo(double)6 void foo(double) {}
foo(int)7 __device__ void foo(int) {}
8 
9 // Check foo resolves to the host function.
10 // CHECK-LABEL: define {{.*}}@_Z5test1v
11 // CHECK: call void @_Z3food(double noundef 1.000000e+00)
test1()12 void test1() {
13   #pragma omp parallel
14   for (int i = 0; i < 100; i++)
15     foo(1);
16 }
17 
18 // Check foo resolves to the host function.
19 // CHECK-LABEL: define {{.*}}@_Z5test2v
20 // CHECK: call void @_Z3food(double noundef 1.000000e+00)
test2()21 void test2() {
22   auto Lambda = []() {
23     #pragma omp parallel
24     for (int i = 0; i < 100; i++)
25       foo(1);
26   };
27   Lambda();
28 }
29