1 // REQUIRES: clang-driver
2 // REQUIRES: x86-registered-target
3 // REQUIRES: nvptx-registered-target
4 
5 // RUN: %clang -v -### --cuda-gpu-arch=sm_20 --sysroot=%S/Inputs/CUDA 2>&1 %s | \
6 // RUN:    FileCheck %s --check-prefix=OK
7 // RUN: %clang -v -### --cuda-gpu-arch=sm_20 --sysroot=%S/Inputs/CUDA_80 2>&1 %s | \
8 // RUN:    FileCheck %s --check-prefix=OK
9 // RUN: %clang -v -### --cuda-gpu-arch=sm_60 --sysroot=%S/Inputs/CUDA_80 2>&1 %s | \
10 // RUN:    FileCheck %s --check-prefix=OK
11 
12 // The installation at Inputs/CUDA is CUDA 7.0, which doesn't support sm_60.
13 // RUN: %clang -v -### --cuda-gpu-arch=sm_60 --sysroot=%S/Inputs/CUDA 2>&1 %s | \
14 // RUN:    FileCheck %s --check-prefix=ERR_SM60
15 
16 // This should only complain about sm_60, not sm_35.
17 // RUN: %clang -v -### --cuda-gpu-arch=sm_60 --cuda-gpu-arch=sm_35 \
18 // RUN:    --sysroot=%S/Inputs/CUDA 2>&1 %s | \
19 // RUN:    FileCheck %s --check-prefix=ERR_SM60 --check-prefix=OK_SM35
20 
21 // We should get two errors here, one for sm_60 and one for sm_61.
22 // RUN: %clang -v -### --cuda-gpu-arch=sm_60 --cuda-gpu-arch=sm_61 \
23 // RUN:    --sysroot=%S/Inputs/CUDA 2>&1 %s | \
24 // RUN:    FileCheck %s --check-prefix=ERR_SM60 --check-prefix=ERR_SM61
25 
26 // We should still get an error if we pass -nocudainc, because this compilation
27 // would invoke ptxas, and we do a version check on that, too.
28 // RUN: %clang -v -### --cuda-gpu-arch=sm_60 -nocudainc --sysroot=%S/Inputs/CUDA 2>&1 %s | \
29 // RUN:    FileCheck %s --check-prefix=ERR_SM60
30 
31 // If with -nocudainc and -E, we don't touch the CUDA install, so we
32 // shouldn't get an error.
33 // RUN: %clang -v -### -E --cuda-device-only --cuda-gpu-arch=sm_60 -nocudainc \
34 // RUN:    --sysroot=%S/Inputs/CUDA 2>&1 %s | \
35 // RUN:    FileCheck %s --check-prefix=OK
36 
37 // --no-cuda-version-check should suppress all of these errors.
38 // RUN: %clang -v -### --cuda-gpu-arch=sm_60 --sysroot=%S/Inputs/CUDA 2>&1 \
39 // RUN:    --no-cuda-version-check %s | \
40 // RUN:    FileCheck %s --check-prefix=OK
41 
42 // OK-NOT: error: GPU arch
43 
44 // OK_SM35-NOT: error: GPU arch sm_35
45 
46 // We should only get one error per architecture.
47 // ERR_SM60: error: GPU arch sm_60 {{.*}}
48 // ERR_SM60-NOT: error: GPU arch sm_60
49 
50 // ERR_SM61: error: GPU arch sm_61 {{.*}}
51 // ERR_SM61-NOT: error: GPU arch sm_61
52