1 // UNSUPPORTED: system-windows
5 // Test HIP runtime lib args specified by --rocm-path.
6 // RUN: %clang -### --hip-link -target x86_64-linux-gnu \
7 // RUN: --rocm-path=%S/Inputs/rocm %t.o 2>&1 \
8 // RUN: | FileCheck -check-prefixes=ROCM-PATH %s
10 // Test HIP runtime lib args specified by environment variable ROCM_PATH.
11 // RUN: env ROCM_PATH=%S/Inputs/rocm %clang -### --hip-link \
12 // RUN: -target x86_64-linux-gnu %t.o 2>&1 \
13 // RUN: | FileCheck -check-prefixes=ROCM-PATH %s
15 // Test detecting latest /opt/rocm-{release} directory.
17 // RUN: mkdir -p %T/opt
18 // RUN: cp -r %S/Inputs/rocm %T/opt/rocm-3.9.0-1234
19 // RUN: cp -r %S/Inputs/rocm %T/opt/rocm-3.10.0
20 // RUN: %clang -### --hip-link -target x86_64-linux-gnu \
21 // RUN: --sysroot=%T %t.o 2>&1 \
22 // RUN: | FileCheck -check-prefixes=ROCM-REL %s
24 // Test HIP runtime lib is not linked without --hip-link.
25 // RUN: %clang -### -target x86_64-linux-gnu \
26 // RUN: --rocm-path=%S/Inputs/rocm %t.o 2>&1 \
27 // RUN: | FileCheck -check-prefixes=NOHIPRT %s
29 // Test HIP runtime lib is not linked with -nostdlib.
30 // RUN: %clang -### --hip-link -nostdlib -target x86_64-linux-gnu \
31 // RUN: --rocm-path=%S/Inputs/rocm %t.o 2>&1 \
32 // RUN: | FileCheck -check-prefixes=NOHIPRT %s
34 // Test HIP runtime lib is not linked with -no-hip-rt.
35 // RUN: %clang -### --hip-link -no-hip-rt -target x86_64-linux-gnu \
36 // RUN: --rocm-path=%S/Inputs/rocm %t.o 2>&1 \
37 // RUN: | FileCheck -check-prefixes=NOHIPRT %s
39 // ROCM-PATH: "-L[[HIPRT:.*/Inputs/rocm/lib]]" "-rpath" "[[HIPRT]]" "-lamdhip64"
40 // ROCM-REL: "-L[[HIPRT:.*/opt/rocm-3.10.0/lib]]" "-rpath" "[[HIPRT]]" "-lamdhip64"
41 // NOHIPRT-NOT: "-L{{.*/Inputs/rocm/lib}}"
42 // NOHIPRT-NOT: "-rpath" "{{.*/Inputs/rocm/lib}}"
43 // NOHIPRT-NOT: "-lamdhip64"