Clang Project

clang_source_code/test/Driver/cuda-output-asm.cu
1// Tests CUDA compilation with -S and -emit-llvm.
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-unknown-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// RUN: %clang -### -emit-llvm -c -target x86_64-linux-gnu -o foo.s %s 2>&1 \
30// RUN:   | FileCheck -check-prefix MULTIPLE-OUTPUT-FILES %s
31// MULTIPLE-OUTPUT-FILES: error: cannot specify -o when generating multiple output files
32// Make sure we do not get duplicate diagnostics.
33// MULTIPLE-OUTPUT-FILES-NOT: error: cannot specify -o when generating multiple output files
34