brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · d86bdb9 Raw
54 lines · c
1// RUN: %clang_cc1 -fopenmp -x c -triple i386-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda -emit-llvm-bc %s -o %t-x86-host.bc2// RUN: %clang_cc1 -verify -fopenmp -x c -triple nvptx-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-x86-host.bc -fsyntax-only3// RUN: %clang_cc1 -verify -DDIAGS -DIMMEDIATE -fopenmp -x c -triple nvptx-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-x86-host.bc -fsyntax-only4// RUN: %clang_cc1 -verify -DDIAGS -DDELAYED -fopenmp -x c -triple nvptx-unknown-unknown -fopenmp-targets=nvptx-nvidia-cuda %s -fopenmp-is-target-device -fopenmp-host-ir-file-path %t-x86-host.bc -fsyntax-only5// REQUIRES: x86-registered-target6// REQUIRES: nvptx-registered-target7 8#ifndef DIAGS9// expected-no-diagnostics10#endif // DIAGS11 12void foo(int r, ...) {13#ifdef IMMEDIATE14// expected-error@+4 {{CUDA device code does not support va_arg}}15#endif // IMMEDIATE16  __builtin_va_list list;17  __builtin_va_start(list, r);18  (void)__builtin_va_arg(list, int);19  __builtin_va_end(list);20}21#ifdef IMMEDIATE22#pragma omp declare target to(foo)23#endif //IMMEDIATE24 25#ifdef IMMEDIATE26#pragma omp declare target27#endif //IMMEDIATE28void t1(int r, ...) {29#ifdef DIAGS30// expected-error@+4 {{CUDA device code does not support va_arg}}31#endif // DIAGS32  __builtin_va_list list;33  __builtin_va_start(list, r);34  (void)__builtin_va_arg(list, int);35  __builtin_va_end(list);36}37 38#ifdef IMMEDIATE39#pragma omp end declare target40#endif //IMMEDIATE41 42int main() {43#ifdef DELAYED44#pragma omp target45#endif // DELAYED46  {47#ifdef DELAYED48// expected-note@+2 {{called by 'main'}}49#endif // DELAYED50    t1(0);51  }52  return 0;53}54