xref: /aosp_15_r20/external/clang/test/Driver/fopenmp.c (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang -target x86_64-linux-gnu -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP
2*67e74705SXin Li // RUN: %clang -target x86_64-linux-gnu -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP
3*67e74705SXin Li // RUN: %clang -target x86_64-linux-gnu -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP
4*67e74705SXin Li // RUN: %clang -target x86_64-apple-darwin -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP
5*67e74705SXin Li // RUN: %clang -target x86_64-apple-darwin -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP
6*67e74705SXin Li // RUN: %clang -target x86_64-apple-darwin -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP
7*67e74705SXin Li // RUN: %clang -target x86_64-freebsd -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP
8*67e74705SXin Li // RUN: %clang -target x86_64-freebsd -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP
9*67e74705SXin Li // RUN: %clang -target x86_64-freebsd -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP
10*67e74705SXin Li // RUN: %clang -target x86_64-netbsd -fopenmp=libomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP
11*67e74705SXin Li // RUN: %clang -target x86_64-netbsd -fopenmp=libgomp -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP
12*67e74705SXin Li // RUN: %clang -target x86_64-netbsd -fopenmp=libiomp5 -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CC1-OPENMP
13*67e74705SXin Li //
14*67e74705SXin Li // CHECK-CC1-OPENMP: "-cc1"
15*67e74705SXin Li // CHECK-CC1-OPENMP: "-fopenmp"
16*67e74705SXin Li //
17*67e74705SXin Li // CHECK-CC1-NO-OPENMP: "-cc1"
18*67e74705SXin Li // CHECK-CC1-NO-OPENMP-NOT: "-fopenmp"
19*67e74705SXin Li //
20*67e74705SXin Li // RUN: %clang -target x86_64-linux-gnu -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP
21*67e74705SXin Li // RUN: %clang -target x86_64-linux-gnu -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP
22*67e74705SXin Li // RUN: %clang -target x86_64-linux-gnu -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5
23*67e74705SXin Li //
24*67e74705SXin Li // RUN: %clang -nostdlib -target x86_64-linux-gnu -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP
25*67e74705SXin Li // RUN: %clang -nostdlib -target x86_64-linux-gnu -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP
26*67e74705SXin Li // RUN: %clang -nostdlib -target x86_64-linux-gnu -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5
27*67e74705SXin Li //
28*67e74705SXin Li // RUN: %clang -target x86_64-darwin -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP
29*67e74705SXin Li // RUN: %clang -target x86_64-darwin -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP
30*67e74705SXin Li // RUN: %clang -target x86_64-darwin -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5
31*67e74705SXin Li //
32*67e74705SXin Li // RUN: %clang -nostdlib -target x86_64-darwin -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP
33*67e74705SXin Li // RUN: %clang -nostdlib -target x86_64-darwin -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP
34*67e74705SXin Li // RUN: %clang -nostdlib -target x86_64-darwin -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5
35*67e74705SXin Li //
36*67e74705SXin Li // RUN: %clang -target x86_64-netbsd -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-OMP
37*67e74705SXin Li // RUN: %clang -target x86_64-netbsd -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-GOMP
38*67e74705SXin Li // RUN: %clang -target x86_64-netbsd -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-IOMP5
39*67e74705SXin Li //
40*67e74705SXin Li // RUN: %clang -nostdlib -target x86_64-freebsd -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP
41*67e74705SXin Li // RUN: %clang -nostdlib -target x86_64-freebsd -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP
42*67e74705SXin Li // RUN: %clang -nostdlib -target x86_64-freebsd -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5
43*67e74705SXin Li //
44*67e74705SXin Li // RUN: %clang -nostdlib -target x86_64-netbsd -fopenmp=libomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP
45*67e74705SXin Li // RUN: %clang -nostdlib -target x86_64-netbsd -fopenmp=libgomp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP
46*67e74705SXin Li // RUN: %clang -nostdlib -target x86_64-netbsd -fopenmp=libiomp5 %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5
47*67e74705SXin Li //
48*67e74705SXin Li // CHECK-LD-OMP: "{{.*}}ld{{(.exe)?}}"
49*67e74705SXin Li // CHECK-LD-OMP: "-lomp"
50*67e74705SXin Li //
51*67e74705SXin Li // CHECK-LD-GOMP: "{{.*}}ld{{(.exe)?}}"
52*67e74705SXin Li // CHECK-LD-GOMP: "-lgomp"
53*67e74705SXin Li //
54*67e74705SXin Li // CHECK-LD-IOMP5: "{{.*}}ld{{(.exe)?}}"
55*67e74705SXin Li // CHECK-LD-IOMP5: "-liomp5"
56*67e74705SXin Li //
57*67e74705SXin Li // CHECK-NO-OMP: "{{.*}}ld{{(.exe)?}}"
58*67e74705SXin Li // CHECK-NO-OMP-NOT: "-lomp"
59*67e74705SXin Li //
60*67e74705SXin Li // CHECK-NO-GOMP: "{{.*}}ld{{(.exe)?}}"
61*67e74705SXin Li // CHECK-NO-GOMP-NOT: "-lgomp"
62*67e74705SXin Li //
63*67e74705SXin Li // CHECK-NO-IOMP5: "{{.*}}ld{{(.exe)?}}"
64*67e74705SXin Li // CHECK-NO-IOMP5-NOT: "-liomp5"
65*67e74705SXin Li //
66*67e74705SXin Li // We'd like to check that the default is sane, but until we have the ability
67*67e74705SXin Li // to *always* semantically analyze OpenMP without always generating runtime
68*67e74705SXin Li // calls (in the event of an unsupported runtime), we don't have a good way to
69*67e74705SXin Li // test the CC1 invocation. Instead, just ensure we do eventually link *some*
70*67e74705SXin Li // OpenMP runtime.
71*67e74705SXin Li //
72*67e74705SXin Li // RUN: %clang -target x86_64-linux-gnu -fopenmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANY
73*67e74705SXin Li // RUN: %clang -target x86_64-darwin -fopenmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANY
74*67e74705SXin Li // RUN: %clang -target x86_64-freebsd -fopenmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANY
75*67e74705SXin Li // RUN: %clang -target x86_64-netbsd -fopenmp %s -o %t -### 2>&1 | FileCheck %s --check-prefix=CHECK-LD-ANY
76*67e74705SXin Li //
77*67e74705SXin Li // CHECK-LD-ANY: "{{.*}}ld{{(.exe)?}}"
78*67e74705SXin Li // CHECK-LD-ANY: "-l{{(omp|gomp|iomp5)}}"
79