blob: 9751bfd6d5b3874c0e55486e0fde78335e1389fa [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
Samuel Antaoe57ad2a2016-02-04 08:13:16 +000016// RUN: %clang -E -target x86_64-linux-gnu --cuda-gpu-arch=sm_20 -nocudainc %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
Samuel Antaoe57ad2a2016-02-04 08:13:16 +000022// RUN: %clang -E -target x86_64-linux-gnu --cuda-gpu-arch=sm_20 --cuda-device-only -nocudainc %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
Samuel Antaoe57ad2a2016-02-04 08:13:16 +000026// RUN: %clang -E -target x86_64-linux-gnu --cuda-gpu-arch=sm_30 --cuda-device-only -nocudainc %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 \
Samuel Antaoe57ad2a2016-02-04 08:13:16 +000031// RUN: --cuda-device-only -nocudainc %s 2>&1 \
Justin Lebar2b187c32016-01-14 21:41:18 +000032// RUN: | FileCheck -check-prefix SM20 -check-prefix SM30 %s