1 // Test offload registration for two targets, and test offload target validation.
2 // RUN: %clang_cc1 -verify -fopenmp -x c -triple x86_64-unknown-linux-gnu -fopenmp-targets=x86_64-pc-linux-gnu,powerpc64le-ibm-linux-gnu -emit-llvm %s -o - | FileCheck %s
3 // RUN: %clang_cc1 -verify -fopenmp -x c -triple x86_64-unknown-linux-gnu -fopenmp-targets=aarch64-unknown-linux-gnu -emit-llvm %s -o - | FileCheck %s
4 // expected-no-diagnostics
5 
foo()6 void foo() {
7 #pragma omp target
8   {}
9 }
10 
11 // CHECK-DAG: [[ENTTY:%.+]] = type { i8*, i8*, i[[SZ:32|64]], i32, i32 }
12 
13 // Check target registration is registered as a Ctor.
14 // CHECK: appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @.omp_offloading.requires_reg, i8* null }]
15 
16 // Check presence of foo() and the outlined target region
17 // CHECK: define{{.*}} void [[FOO:@.+]]()
18 // CHECK: define internal void [[OUTLINEDTARGET:@.+]]()
19 
20 // Check registration and unregistration code.
21 
22 // CHECK:     define internal void @.omp_offloading.requires_reg()
23 // CHECK:     call void @__tgt_register_requires(i64 1)
24 // CHECK:     ret void
25