1 // REQUIRES: system-linux
2 // REQUIRES: x86-registered-target
3 // REQUIRES: nvptx-registered-target
7 // RUN: cp %S/Inputs/nvptx-arch/nvptx_arch_fail %t/
8 // RUN: cp %S/Inputs/nvptx-arch/nvptx_arch_sm_70 %t/
9 // RUN: echo '#!/bin/sh' > %t/nvptx_arch_empty
10 // RUN: chmod +x %t/nvptx_arch_fail
11 // RUN: chmod +x %t/nvptx_arch_sm_70
12 // RUN: chmod +x %t/nvptx_arch_empty
14 // case when nvptx-arch returns nothing or fails
15 // RUN: %clang -### --target=x86_64-unknown-linux-gnu -nogpulib --offload-arch=native --nvptx-arch-tool=%t/nvptx_arch_fail -x cuda %s 2>&1 \
16 // RUN: | FileCheck %s --check-prefix=NO-OUTPUT-ERROR
17 // RUN: %clang -### --target=x86_64-unknown-linux-gnu -nogpulib --offload-new-driver --offload-arch=native --nvptx-arch-tool=%t/nvptx_arch_fail -x cuda %s 2>&1 \
18 // RUN: | FileCheck %s --check-prefix=NO-OUTPUT-ERROR
19 // NO-OUTPUT-ERROR: error: cannot determine nvptx64 architecture{{.*}}; consider passing it via '--offload-arch'
21 // case when nvptx-arch does not return anything with successful execution
22 // RUN: %clang -### --target=x86_64-unknown-linux-gnu -nogpulib --offload-arch=native --nvptx-arch-tool=%t/nvptx_arch_empty -x cuda %s 2>&1 \
23 // RUN: | FileCheck %s --check-prefix=EMPTY-OUTPUT
24 // RUN: %clang -### --target=x86_64-unknown-linux-gnu -nogpulib --offload-new-driver --offload-arch=native --nvptx-arch-tool=%t/nvptx_arch_empty -x cuda %s 2>&1 \
25 // RUN: | FileCheck %s --check-prefix=EMPTY-OUTPUT
26 // EMPTY-OUTPUT: error: cannot determine nvptx64 architecture: No NVIDIA GPU detected in the system; consider passing it via '--offload-arch'
28 // case when nvptx-arch does not return anything with successful execution
29 // RUN: %clang -### --target=x86_64-unknown-linux-gnu -nogpulib --offload-arch=native --nvptx-arch-tool=%t/nvptx_arch_sm_70 -x cuda %s 2>&1 \
30 // RUN: | FileCheck %s --check-prefix=ARCH-sm_70
31 // RUN: %clang -### --target=x86_64-unknown-linux-gnu -nogpulib --offload-arch=native --offload-new-driver --nvptx-arch-tool=%t/nvptx_arch_sm_70 -x cuda %s 2>&1 \
32 // RUN: | FileCheck %s --check-prefix=ARCH-sm_70
33 // ARCH-sm_70: "-cc1" "-triple" "nvptx64-nvidia-cuda"{{.*}}"-target-cpu" "sm_70"