blob: af62478ac27e7a4f407fca4d2ade077d2197fa41 [file] [log] [blame]
Justin Lebare8c36092016-01-14 21:41:31 +00001// Tests CUDA compilation with -S.
2
3// REQUIRES: clang-driver
4// REQUIRES: x86-registered-target
5// REQUIRES: nvptx-registered-target
6
7// RUN: %clang -### -S -target x86_64-linux-gnu --cuda-gpu-arch=sm_20 %s 2>&1 \
8// RUN: | FileCheck -check-prefix HOST -check-prefix SM20 %s
9// RUN: %clang -### -S -target x86_64-linux-gnu --cuda-host-only -o foo.s %s 2>&1 \
10// RUN: | FileCheck -check-prefix HOST %s
11// RUN: %clang -### -S -target x86_64-linux-gnu --cuda-gpu-arch=sm_20 \
12// RUN: --cuda-device-only -o foo.s %s 2>&1 \
13// RUN: | FileCheck -check-prefix SM20 %s
14// RUN: %clang -### -S -target x86_64-linux-gnu --cuda-gpu-arch=sm_20 \
15// RUN: --cuda-gpu-arch=sm_30 --cuda-device-only %s 2>&1 \
16// RUN: | FileCheck -check-prefix SM20 -check-prefix SM30 %s
17
18// HOST-DAG: "-cc1" "-triple" "x86_64--linux-gnu"
19// SM20-DAG: "-cc1" "-triple" "nvptx64-nvidia-cuda"
20// SM20-same: "-target-cpu" "sm_20"
21// SM30-DAG: "-cc1" "-triple" "nvptx64-nvidia-cuda"
22// SM30-same: "-target-cpu" "sm_30"
23
24// RUN: %clang -### -S -target x86_64-linux-gnu -o foo.s %s 2>&1 \
25// RUN: | FileCheck -check-prefix MULTIPLE-OUTPUT-FILES %s
26// RUN: %clang -### -S -target x86_64-linux-gnu --cuda-device-only \
27// RUN: --cuda-gpu-arch=sm_20 --cuda-gpu-arch=sm_30 -o foo.s %s 2>&1 \
28// RUN: | FileCheck -check-prefix MULTIPLE-OUTPUT-FILES %s
29// MULTIPLE-OUTPUT-FILES: error: cannot specify -o when generating multiple output files