1// REQUIRES: clang-driver, amdgpu-registered-target
2
3// Check bundle ID for code object v3.
4
5// RUN: %clang -### -target x86_64-linux-gnu \
6// RUN:   -mcode-object-v3 \
7// RUN:   --offload-arch=gfx906 -nogpulib \
8// RUN:   %s 2>&1 | FileCheck -check-prefixes=V3,V3-WARN %s
9
10// RUN: %clang -### -target x86_64-linux-gnu \
11// RUN:   -mcode-object-version=3 \
12// RUN:   --offload-arch=gfx906 -nogpulib \
13// RUN:   %s 2>&1 | FileCheck -check-prefix=V3 %s
14
15// RUN: %clang -### -target x86_64-linux-gnu \
16// RUN:   -mcode-object-version=4 -mcode-object-version=3 \
17// RUN:   --offload-arch=gfx906 -nogpulib \
18// RUN:   %s 2>&1 | FileCheck -check-prefix=V3 %s
19
20// V3-WARN: warning: argument '-mcode-object-v3' is deprecated, use '-mcode-object-version=3' instead [-Wdeprecated]
21// V3: "-mllvm" "--amdhsa-code-object-version=3"
22// V3: "-targets=host-x86_64-unknown-linux,hip-amdgcn-amd-amdhsa--gfx906"
23
24// Check bundle ID for code object v2.
25
26// RUN: %clang -### -target x86_64-linux-gnu \
27// RUN:   -mno-code-object-v3 \
28// RUN:   --offload-arch=gfx906 -nogpulib \
29// RUN:   %s 2>&1 | FileCheck -check-prefixes=V2,V2-WARN %s
30
31// RUN: %clang -### -target x86_64-linux-gnu \
32// RUN:   -mcode-object-version=2 \
33// RUN:   --offload-arch=gfx906 -nogpulib \
34// RUN:   %s 2>&1 | FileCheck -check-prefix=V2 %s
35
36// V2-WARN: warning: argument '-mno-code-object-v3' is deprecated, use '-mcode-object-version=2' instead [-Wdeprecated]
37// V2: "-mllvm" "--amdhsa-code-object-version=2"
38// V2: "-targets=host-x86_64-unknown-linux,hip-amdgcn-amd-amdhsa--gfx906"
39
40// Check bundle ID for code object version 4.
41
42// RUN: %clang -### -target x86_64-linux-gnu \
43// RUN:   -mcode-object-version=4 \
44// RUN:   --offload-arch=gfx906 -nogpulib \
45// RUN:   %s 2>&1 | FileCheck -check-prefix=V4 %s
46
47// RUN: %clang -### -target x86_64-linux-gnu \
48// RUN:   --offload-arch=gfx906 -nogpulib \
49// RUN:   %s 2>&1 | FileCheck -check-prefix=V4 %s
50
51// V4: "-mllvm" "--amdhsa-code-object-version=4"
52// V4: "-targets=host-x86_64-unknown-linux,hip-amdgcn-amd-amdhsa--gfx906"
53
54// Check invalid code object version option.
55
56// RUN: %clang -### -target x86_64-linux-gnu \
57// RUN:   -mcode-object-version=1 \
58// RUN:   --offload-arch=gfx906 -nogpulib \
59// RUN:   %s 2>&1 | FileCheck -check-prefix=INVALID %s
60// INVALID: error: invalid integral value '1' in '-mcode-object-version=1'
61// INVALID-NOT: error: invalid integral value
62
63// Check warnings are emitted for legacy options before -mcode-object-version options.
64// Check warnings are emitted only once.
65
66// RUN: %clang -### -target x86_64-linux-gnu \
67// RUN:   -mno-code-object-v3 -mcode-object-v3 -mcode-object-version=4 \
68// RUN:   --offload-arch=gfx906 -nogpulib \
69// RUN:   %s 2>&1 | FileCheck -check-prefixes=WARN %s
70// WARN: warning: argument '-mno-code-object-v3' is deprecated, use '-mcode-object-version=2' instead [-Wdeprecated]
71// WARN: warning: argument '-mcode-object-v3' is deprecated, use '-mcode-object-version=3' instead [-Wdeprecated]
72// WARN-NOT: warning: argument {{.*}} is deprecated
73