annotate clang/test/SemaCUDA/qualifiers.cu @ 222:81f6424ef0e3 llvm-original

LLVM original branch
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 18 Jul 2021 22:10:01 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -verify %s
anatofuz
parents:
diff changeset
2 // RUN: %clang_cc1 -triple nvptx-unknown-cuda -fsyntax-only -verify -fcuda-is-device %s
anatofuz
parents:
diff changeset
3 //
anatofuz
parents:
diff changeset
4 // We run clang_cc1 with 'not' because source file contains
anatofuz
parents:
diff changeset
5 // intentional errors. CC1 failure is expected and must be ignored
anatofuz
parents:
diff changeset
6 // here. We're interested in what ends up in AST and that's what
anatofuz
parents:
diff changeset
7 // FileCheck verifies.
anatofuz
parents:
diff changeset
8 // RUN: not %clang_cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -ast-dump %s \
anatofuz
parents:
diff changeset
9 // RUN: | FileCheck %s --check-prefix=CHECK-ALL --check-prefix=CHECK-HOST
anatofuz
parents:
diff changeset
10 // RUN: not %clang_cc1 -triple nvptx-unknown-cuda -fsyntax-only -ast-dump -fcuda-is-device %s \
anatofuz
parents:
diff changeset
11 // RUN: | FileCheck %s --check-prefix=CHECK-ALL --check-prefix=CHECK-DEVICE
anatofuz
parents:
diff changeset
12
anatofuz
parents:
diff changeset
13 #include "Inputs/cuda.h"
anatofuz
parents:
diff changeset
14
anatofuz
parents:
diff changeset
15 // Host (x86) supports TLS and device-side compilation should ignore
anatofuz
parents:
diff changeset
16 // host variables. No errors in either case.
anatofuz
parents:
diff changeset
17 int __thread host_tls_var;
anatofuz
parents:
diff changeset
18 // CHECK-ALL: host_tls_var 'int' tls
anatofuz
parents:
diff changeset
19
anatofuz
parents:
diff changeset
20 #if defined(__CUDA_ARCH__)
anatofuz
parents:
diff changeset
21 // NVPTX does not support TLS
anatofuz
parents:
diff changeset
22 __device__ int __thread device_tls_var; // expected-error {{thread-local storage is not supported for the current target}}
anatofuz
parents:
diff changeset
23 // CHECK-DEVICE: device_tls_var 'int' tls
anatofuz
parents:
diff changeset
24 __shared__ int __thread shared_tls_var; // expected-error {{thread-local storage is not supported for the current target}}
anatofuz
parents:
diff changeset
25 // CHECK-DEVICE: shared_tls_var 'int' tls
anatofuz
parents:
diff changeset
26 #else
anatofuz
parents:
diff changeset
27 // Device-side vars should not produce any errors during host-side
anatofuz
parents:
diff changeset
28 // compilation.
anatofuz
parents:
diff changeset
29 __device__ int __thread device_tls_var;
anatofuz
parents:
diff changeset
30 // CHECK-HOST: device_tls_var 'int' tls
anatofuz
parents:
diff changeset
31 __shared__ int __thread shared_tls_var;
anatofuz
parents:
diff changeset
32 // CHECK-HOST: shared_tls_var 'int' tls
anatofuz
parents:
diff changeset
33 #endif
anatofuz
parents:
diff changeset
34
anatofuz
parents:
diff changeset
35 __global__ void g1(int x) {}
anatofuz
parents:
diff changeset
36 __global__ int g2(int x) { // expected-error {{must have void return type}}
anatofuz
parents:
diff changeset
37 return 1;
anatofuz
parents:
diff changeset
38 }