Samuel Antao | 5b1a89a | 2016-10-27 00:53:34 +0000 | [diff] [blame] | 1 | // Tests CUDA compilation with -S and -emit-llvm. |
Justin Lebar | e8c3609 | 2016-01-14 21:41:31 +0000 | [diff] [blame] | 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 | |
Petr Hosek | 7b27454 | 2018-08-08 22:23:57 +0000 | [diff] [blame] | 18 | // HOST-DAG: "-cc1" "-triple" "x86_64-unknown-linux-gnu" |
Justin Lebar | e8c3609 | 2016-01-14 21:41:31 +0000 | [diff] [blame] | 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 |
Samuel Antao | 5b1a89a | 2016-10-27 00:53:34 +0000 | [diff] [blame] | 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 |
Justin Lebar | e8c3609 | 2016-01-14 21:41:31 +0000 | [diff] [blame] | 31 | // MULTIPLE-OUTPUT-FILES: error: cannot specify -o when generating multiple output files |
Samuel Antao | 10e905c | 2016-10-27 01:08:58 +0000 | [diff] [blame] | 32 | // Make sure we do not get duplicate diagnostics. |
| 33 | // MULTIPLE-OUTPUT-FILES-NOT: error: cannot specify -o when generating multiple output files |