1 // Tests CUDA compilation with -S and -emit-llvm.
3 // REQUIRES: x86-registered-target
4 // REQUIRES: nvptx-registered-target
6 // RUN: %clang -### -S -target x86_64-linux-gnu --cuda-gpu-arch=sm_20 %s 2>&1 \
7 // RUN: | FileCheck -check-prefix HOST -check-prefix SM20 %s
8 // RUN: %clang -### -S -target x86_64-linux-gnu --cuda-host-only -o foo.s %s 2>&1 \
9 // RUN: | FileCheck -check-prefix HOST %s
10 // RUN: %clang -### -S -target x86_64-linux-gnu --cuda-gpu-arch=sm_20 \
11 // RUN: --cuda-device-only -o foo.s %s 2>&1 \
12 // RUN: | FileCheck -check-prefix SM20 %s
13 // RUN: %clang -### -S -target x86_64-linux-gnu --cuda-gpu-arch=sm_20 \
14 // RUN: --cuda-gpu-arch=sm_30 --cuda-device-only %s 2>&1 \
15 // RUN: | FileCheck -check-prefix SM20 -check-prefix SM30 %s
17 // HOST-DAG: "-cc1" "-triple" "x86_64-unknown-linux-gnu"
18 // SM20-DAG: "-cc1" "-triple" "nvptx64-nvidia-cuda"
19 // SM20-same: "-target-cpu" "sm_20"
20 // SM30-DAG: "-cc1" "-triple" "nvptx64-nvidia-cuda"
21 // SM30-same: "-target-cpu" "sm_30"
23 // RUN: %clang -### -S -target x86_64-linux-gnu -o foo.s %s 2>&1 \
24 // RUN: | FileCheck -check-prefix MULTIPLE-OUTPUT-FILES %s
25 // RUN: %clang -### -S -target x86_64-linux-gnu --cuda-device-only \
26 // RUN: --cuda-gpu-arch=sm_20 --cuda-gpu-arch=sm_30 -o foo.s %s 2>&1 \
27 // RUN: | FileCheck -check-prefix MULTIPLE-OUTPUT-FILES %s
28 // RUN: %clang -### -emit-llvm -c -target x86_64-linux-gnu -o foo.s %s 2>&1 \
29 // RUN: | FileCheck -check-prefix MULTIPLE-OUTPUT-FILES %s
30 // MULTIPLE-OUTPUT-FILES: error: cannot specify -o when generating multiple output files
31 // Make sure we do not get duplicate diagnostics.
32 // MULTIPLE-OUTPUT-FILES-NOT: error: cannot specify -o when generating multiple output files