41 lines · cpp
1// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --check-globals --prefix-filecheck-ir-name _ --global-value-regex "llvm.compiler.used" "_[0-9a-zA-Z]+A[0-9a-zA-Z]+pi[0-9a-zA-Z]+" "_[0-9a-zA-Z]+anotherPi" --version 22// REQUIRES: amdgpu-registered-target3 4 5// Test target codegen - host bc file has to be created first.6// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm-bc %s -o %t-ppc-host.bc7// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple nvptx64-unknown-unknown -fopenmp-targets=nvptx64-nvidia-cuda -emit-llvm %s -fopenmp-target-debug -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-ppc-host.bc -o - | FileCheck %s --check-prefix=CHECK8 9// expected-no-diagnostics10 11#ifndef HEADER12#define HEADER13 14#pragma omp declare target15class A {16public:17 static constexpr double pi = 3.141592653589793116;18//.19// CHECK: @_ZN1A2piE = linkonce_odr constant double 0x400921FB54442D18, comdat, align 820// CHECK: @_ZL9anotherPi = internal constant double 3.140000e+00, align 821// CHECK: @llvm.compiler.used = appending global [2 x ptr] [ptr @"__ZN1A2piE$ref", ptr @"__ZL9anotherPi$ref"], section "llvm.metadata"22//.23 A() { ; }24 ~A() { ; }25};26#pragma omp end declare target27 28void F(const double &);29void Test() { F(A::pi); }30 31#pragma omp declare target32constexpr static double anotherPi = 3.14;33#pragma omp end declare target34 35#endif36 37 38//39//// NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:40// CHECK: {{.*}}41