xref: /llvm-project/clang/test/Driver/hip-code-object-version.hip (revision 0d352b2ea767e043b47d78bfdbd6820356628314)
1// Check bundle ID for code object version 4.
2
3// RUN: not %clang -### --target=x86_64-linux-gnu \
4// RUN:   -mcode-object-version=4 \
5// RUN:   --offload-arch=gfx906 --rocm-path=%S/Inputs/rocm \
6// RUN:   %s 2>&1 | FileCheck -check-prefix=V4 %s
7
8// V4: "-mcode-object-version=4"
9// V4: "-mllvm" "--amdhsa-code-object-version=4"
10// V4: "-targets=host-x86_64-unknown-linux-gnu,hipv4-amdgcn-amd-amdhsa--gfx906"
11
12// Check bundle ID for code object version 5.
13
14// RUN: not %clang -### --target=x86_64-linux-gnu \
15// RUN:   -mcode-object-version=5 \
16// RUN:   --offload-arch=gfx906 --rocm-path=%S/Inputs/rocm \
17// RUN:   %s 2>&1 | FileCheck -check-prefix=V5 %s
18
19// V5: "-mcode-object-version=5"
20// V5: "-mllvm" "--amdhsa-code-object-version=5"
21// V5: "-targets=host-x86_64-unknown-linux-gnu,hipv4-amdgcn-amd-amdhsa--gfx906"
22
23// Check bundle ID for code object version 6.
24
25// RUN: not %clang -### --target=x86_64-linux-gnu \
26// RUN:   -mcode-object-version=6 \
27// RUN:   --offload-arch=gfx906 --rocm-path=%S/Inputs/rocm \
28// RUN:   %s 2>&1 | FileCheck -check-prefix=V6 %s
29
30// V6: warning: code object v6 is still in development and not ready for production use yet; use at your own risk
31// V6: "-mcode-object-version=6"
32// V6: "-mllvm" "--amdhsa-code-object-version=6"
33// V6: "-targets=host-x86_64-unknown-linux-gnu,hipv4-amdgcn-amd-amdhsa--gfx906"
34
35
36// Check bundle ID for code object version default
37
38// RUN: %clang -### --target=x86_64-linux-gnu \
39// RUN:   --offload-arch=gfx906 -nogpuinc -nogpulib \
40// RUN:   %s 2>&1 | FileCheck -check-prefix=VD %s
41
42// VD: "-targets=host-x86_64-unknown-linux-gnu,hipv4-amdgcn-amd-amdhsa--gfx906"
43
44// Check invalid code object version option.
45
46// RUN: not %clang -### --target=x86_64-linux-gnu \
47// RUN:   -mcode-object-version=1 \
48// RUN:   --offload-arch=gfx906 --rocm-path=%S/Inputs/rocm \
49// RUN:   %s 2>&1 | FileCheck -check-prefix=INVALID_1 %s
50// INVALID_1: error: invalid integral value '1' in '-mcode-object-version=1'
51// INVALID_1-NOT: error: invalid integral value
52
53// RUN: not %clang -### --target=x86_64-linux-gnu \
54// RUN:   -mcode-object-version=2 \
55// RUN:   --offload-arch=gfx906 --rocm-path=%S/Inputs/rocm \
56// RUN:   %s 2>&1 | FileCheck -check-prefix=INVALID_2 %s
57// INVALID_2: error: invalid integral value '2' in '-mcode-object-version=2'
58// INVALID_2-NOT: error: invalid integral value
59
60// RUN: not %clang -### --target=x86_64-linux-gnu \
61// RUN:   -mcode-object-version=3 \
62// RUN:   --offload-arch=gfx906 --rocm-path=%S/Inputs/rocm \
63// RUN:   %s 2>&1 | FileCheck -check-prefix=INVALID_3 %s
64// INVALID_3: error: invalid integral value '3' in '-mcode-object-version=3'
65// INVALID_3-NOT: error: invalid integral value
66
67// Check LLVM code object version option --amdhsa-code-object-version
68// is passed to -cc1 and -cc1as, and -mcode-object-version is passed
69// to -cc1 but not -cc1as.
70
71// RUN: not %clang -### --target=x86_64-linux-gnu \
72// RUN:   -mcode-object-version=5 \
73// RUN:   --offload-arch=gfx906 --rocm-path=%S/Inputs/rocm -save-temps \
74// RUN:   %s 2>&1 | FileCheck -check-prefix=CC1 %s
75
76// CC1: "-cc1" {{.*}}"-mcode-object-version=5" {{.*}}"-mllvm" "--amdhsa-code-object-version=5"
77// CC1: "-cc1as" {{.*}}"-mllvm" "--amdhsa-code-object-version=5"
78
79// RUN: not %clang -### --target=x86_64-linux-gnu \
80// RUN:   -mcode-object-version=5 \
81// RUN:   --offload-arch=gfx906 --rocm-path=%S/Inputs/rocm -save-temps \
82// RUN:   %s 2>&1 | FileCheck -check-prefix=CC1NEG %s
83
84// CC1NEG-NOT: "-cc1as" {{.*}}"-mcode-object-version=5"
85