1 // Test for offload registration code for two targets
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 // expected-no-diagnostics
4 
5 void foo() {
6 #pragma omp target
7   {}
8 }
9 
10 // CHECK-DAG: [[ENTTY:%.+]] = type { i8*, i8*, i[[SZ:32|64]], i32, i32 }
11 
12 // Check target registration is registered as a Ctor.
13 // CHECK: appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 0, void ()* @.omp_offloading.requires_reg, i8* null }]
14 
15 // Check presence of foo() and the outlined target region
16 // CHECK: define void [[FOO:@.+]]()
17 // CHECK: define internal void [[OUTLINEDTARGET:@.+]]()
18 
19 // Check registration and unregistration code.
20 
21 // CHECK:     define internal void @.omp_offloading.requires_reg()
22 // CHECK:     call void @__tgt_register_requires(i64 1)
23 // CHECK:     ret void
24