1 // REQUIRES: amdgpu-registered-target
3 // Check bundle ID for code object v2.
5 // RUN: %clang -### --target=x86_64-linux-gnu \
6 // RUN: -mno-code-object-v3 \
7 // RUN: --offload-arch=gfx906 -nogpulib \
8 // RUN: %s 2>&1 | FileCheck -check-prefixes=V2,V2-WARN %s
10 // RUN: %clang -### --target=x86_64-linux-gnu \
11 // RUN: -mcode-object-version=2 \
12 // RUN: --offload-arch=gfx906 -nogpulib \
13 // RUN: %s 2>&1 | FileCheck -check-prefix=V2 %s
15 // V2-WARN: warning: argument '-mno-code-object-v3' is deprecated, use '-mcode-object-version=2' instead [-Wdeprecated]
16 // V2: "-mllvm" "--amdhsa-code-object-version=2"
17 // V2: "-targets=host-x86_64-unknown-linux,hip-amdgcn-amd-amdhsa--gfx906"
19 // Check bundle ID for code object v3.
21 // RUN: %clang -### --target=x86_64-linux-gnu \
22 // RUN: -mcode-object-v3 \
23 // RUN: --offload-arch=gfx906 -nogpulib \
24 // RUN: %s 2>&1 | FileCheck -check-prefixes=V3,V3-WARN %s
26 // RUN: %clang -### --target=x86_64-linux-gnu \
27 // RUN: -mcode-object-version=3 \
28 // RUN: --offload-arch=gfx906 -nogpulib \
29 // RUN: %s 2>&1 | FileCheck -check-prefix=V3 %s
31 // RUN: %clang -### --target=x86_64-linux-gnu \
32 // RUN: -mcode-object-version=4 -mcode-object-version=3 \
33 // RUN: --offload-arch=gfx906 -nogpulib \
34 // RUN: %s 2>&1 | FileCheck -check-prefix=V3 %s
36 // V3-WARN: warning: argument '-mcode-object-v3' is deprecated, use '-mcode-object-version=3' instead [-Wdeprecated]
37 // V3: "-mcode-object-version=3"
38 // V3: "-mllvm" "--amdhsa-code-object-version=3"
39 // V3: "-targets=host-x86_64-unknown-linux,hip-amdgcn-amd-amdhsa--gfx906"
41 // Check bundle ID for code object version 4.
43 // RUN: %clang -### --target=x86_64-linux-gnu \
44 // RUN: -mcode-object-version=4 \
45 // RUN: --offload-arch=gfx906 -nogpulib \
46 // RUN: %s 2>&1 | FileCheck -check-prefix=V4 %s
48 // V4: "-mcode-object-version=4"
49 // V4: "-mllvm" "--amdhsa-code-object-version=4"
50 // V4: "-targets=host-x86_64-unknown-linux,hipv4-amdgcn-amd-amdhsa--gfx906"
52 // Check bundle ID for code object version 5.
54 // RUN: %clang -### --target=x86_64-linux-gnu \
55 // RUN: -mcode-object-version=5 \
56 // RUN: --offload-arch=gfx906 -nogpulib \
57 // RUN: %s 2>&1 | FileCheck -check-prefix=V5 %s
59 // V5: "-mcode-object-version=5"
60 // V5: "-mllvm" "--amdhsa-code-object-version=5"
61 // V5: "-targets=host-x86_64-unknown-linux,hipv4-amdgcn-amd-amdhsa--gfx906"
63 // Check bundle ID for code object version default
65 // RUN: %clang -### --target=x86_64-linux-gnu \
66 // RUN: --offload-arch=gfx906 -nogpulib \
67 // RUN: %s 2>&1 | FileCheck -check-prefix=VD %s
69 // VD: "-targets=host-x86_64-unknown-linux,hipv4-amdgcn-amd-amdhsa--gfx906"
71 // Check invalid code object version option.
73 // RUN: %clang -### --target=x86_64-linux-gnu \
74 // RUN: -mcode-object-version=1 \
75 // RUN: --offload-arch=gfx906 -nogpulib \
76 // RUN: %s 2>&1 | FileCheck -check-prefix=INVALID %s
77 // INVALID: error: invalid integral value '1' in '-mcode-object-version=1'
78 // INVALID-NOT: error: invalid integral value
80 // Check LLVM code object version option --amdhsa-code-object-version
81 // is passed to -cc1 and -cc1as, and -mcode-object-version is passed
82 // to -cc1 but not -cc1as.
84 // RUN: %clang -### --target=x86_64-linux-gnu \
85 // RUN: -mcode-object-version=5 \
86 // RUN: --offload-arch=gfx906 -nogpulib -save-temps \
87 // RUN: %s 2>&1 | FileCheck -check-prefix=CC1 %s
89 // CC1: "-cc1" {{.*}}"-mcode-object-version=5" {{.*}}"-mllvm" "--amdhsa-code-object-version=5"
90 // CC1: "-cc1as" {{.*}}"-mllvm" "--amdhsa-code-object-version=5"
92 // RUN: %clang -### --target=x86_64-linux-gnu \
93 // RUN: -mcode-object-version=5 \
94 // RUN: --offload-arch=gfx906 -nogpulib -save-temps \
95 // RUN: %s 2>&1 | FileCheck -check-prefix=CC1NEG %s
97 // CC1NEG-NOT: "-cc1as" {{.*}}"-mcode-object-version=5"
99 // Check warnings are emitted for legacy options before -mcode-object-version options.
100 // Check warnings are emitted only once.
102 // RUN: %clang -### --target=x86_64-linux-gnu \
103 // RUN: -mno-code-object-v3 -mcode-object-v3 -mcode-object-version=4 \
104 // RUN: --offload-arch=gfx906 -nogpulib \
105 // RUN: %s 2>&1 | FileCheck -check-prefixes=WARN %s
106 // WARN: warning: argument '-mno-code-object-v3' is deprecated, use '-mcode-object-version=2' instead [-Wdeprecated]
107 // WARN: warning: argument '-mcode-object-v3' is deprecated, use '-mcode-object-version=3' instead [-Wdeprecated]
108 // WARN-NOT: warning: argument {{.*}} is deprecated