blob: 84a7bcf2a12f9b5e0f8a906fd880220630f8dc96 [file] [log] [blame]
Justin Lebar2b187c32016-01-14 21:41:18 +00001// Tests CUDA compilation with -E.
2
3// REQUIRES: clang-driver
4// REQUIRES: x86-registered-target
5// REQUIRES: nvptx-registered-target
6
7#ifndef __CUDA_ARCH__
8#define PREPROCESSED_AWAY
9clang_unittest_no_arch PREPROCESSED_AWAY
10#else
11clang_unittest_cuda_arch __CUDA_ARCH__
12#endif
13
14// CHECK-NOT: PREPROCESSED_AWAY
15
Artem Belevichc3ded372016-08-02 23:43:04 +000016// RUN: %clang -E -target x86_64-linux-gnu --cuda-gpu-arch=sm_20 -nocudainc -nocudalib %s 2>&1 \
Justin Lebar2b187c32016-01-14 21:41:18 +000017// RUN: | FileCheck -check-prefix NOARCH %s
Samuel Antaoe57ad2a2016-02-04 08:13:16 +000018// RUN: %clang -E -target x86_64-linux-gnu --cuda-gpu-arch=sm_20 --cuda-host-only -nocudainc %s 2>&1 \
Justin Lebar2b187c32016-01-14 21:41:18 +000019// RUN: | FileCheck -check-prefix NOARCH %s
20// NOARCH: clang_unittest_no_arch
21
Artem Belevichc3ded372016-08-02 23:43:04 +000022// RUN: %clang -E -target x86_64-linux-gnu --cuda-gpu-arch=sm_20 --cuda-device-only -nocudainc -nocudalib %s 2>&1 \
Justin Lebar2b187c32016-01-14 21:41:18 +000023// RUN: | FileCheck -check-prefix SM20 %s
24// SM20: clang_unittest_cuda_arch 200
25
Artem Belevichc3ded372016-08-02 23:43:04 +000026// RUN: %clang -E -target x86_64-linux-gnu --cuda-gpu-arch=sm_30 --cuda-device-only -nocudainc -nocudalib %s 2>&1 \
Justin Lebar2b187c32016-01-14 21:41:18 +000027// RUN: | FileCheck -check-prefix SM30 %s
28// SM30: clang_unittest_cuda_arch 300
29
30// RUN: %clang -E -target x86_64-linux-gnu --cuda-gpu-arch=sm_20 --cuda-gpu-arch=sm_30 \
Artem Belevichc3ded372016-08-02 23:43:04 +000031// RUN: --cuda-device-only -nocudainc -nocudalib %s 2>&1 \
Justin Lebar2b187c32016-01-14 21:41:18 +000032// RUN: | FileCheck -check-prefix SM20 -check-prefix SM30 %s