[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / Driver / clang-offload-bundler.c
blob555029bd838ffafa659a70e797660d18198e1fa0
1 // REQUIRES: x86-registered-target
2 // REQUIRES: powerpc-registered-target
3 // UNSUPPORTED: darwin, aix
5 //
6 // Generate all the types of files we can bundle.
7 //
8 // RUN: %clang -O0 -target %itanium_abi_triple %s -E -o %t.i
9 // RUN: %clangxx -O0 -target %itanium_abi_triple -x c++ %s -E -o %t.ii
10 // RUN: %clang -O0 -target %itanium_abi_triple %s -S -emit-llvm -o %t.ll
11 // RUN: %clang -O0 -target %itanium_abi_triple %s -c -emit-llvm -o %t.bc
12 // RUN: %clang -O0 -target %itanium_abi_triple %s -S -o %t.s
13 // RUN: %clang -O0 -target %itanium_abi_triple %s -c -o %t.o
14 // RUN: %clang -O0 -target %itanium_abi_triple %s -emit-ast -o %t.ast
17 // Generate an empty file to help with the checks of empty files.
19 // RUN: touch %t.empty
22 // Generate a couple of files to bundle with.
24 // RUN: echo 'Content of device file 1' > %t.tgt1
25 // RUN: echo 'Content of device file 2' > %t.tgt2
28 // Check help message.
30 // RUN: clang-offload-bundler --help | FileCheck %s --check-prefix CK-HELP
31 // CK-HELP: {{.*}}OVERVIEW: A tool to bundle several input files of the specified type <type>
32 // CK-HELP: {{.*}}referring to the same source file but different targets into a single
33 // CK-HELP: {{.*}}one. The resulting file can also be unbundled into different files by
34 // CK-HELP: {{.*}}this tool if -unbundle is provided.
35 // CK-HELP: {{.*}}USAGE: clang-offload-bundler [options]
36 // CK-HELP: {{.*}}-### {{.*}}- Print any external commands that are to be executed instead of actually executing them - for testing purposes.
37 // CK-HELP: {{.*}}-allow-missing-bundles {{.*}}- Create empty files if bundles are missing when unbundling.
38 // CK-HELP: {{.*}}-bundle-align=<uint> {{.*}}- Alignment of bundle for binary files
39 // CK-HELP: {{.*}}-hip-openmp-compatible {{.*}}- Treat hip and hipv4 offload kinds as compatible with openmp kind, and vice versa.
40 // CK-HELP: {{.*}}-input=<string> - Input file. Can be specified multiple times for multiple input files.
41 // CK-HELP: {{.*}}-inputs=<string> - [<input file>,...] (deprecated)
42 // CK-HELP: {{.*}}-list {{.*}}- List bundle IDs in the bundled file.
43 // CK-HELP: {{.*}}-output=<string> - Output file. Can be specified multiple times for multiple output files.
44 // CK-HELP: {{.*}}-outputs=<string> - [<output file>,...] (deprecated)
45 // CK-HELP: {{.*}}-targets=<string> - [<offload kind>-<target triple>,...]
46 // CK-HELP: {{.*}}-type=<string> - Type of the files to be bundled/unbundled.
47 // CK-HELP: {{.*}}Current supported types are:
48 // CK-HELP: {{.*}}i {{.*}}- cpp-output
49 // CK-HELP: {{.*}}ii {{.*}}- c++-cpp-output
50 // CK-HELP: {{.*}}ll {{.*}}- llvm
51 // CK-HELP: {{.*}}bc {{.*}}- llvm-bc
52 // CK-HELP: {{.*}}s {{.*}}- assembler
53 // CK-HELP: {{.*}}o {{.*}}- object
54 // CK-HELP: {{.*}}a {{.*}}- archive of objects
55 // CK-HELP: {{.*}}gch {{.*}}- precompiled-header
56 // CK-HELP: {{.*}}ast {{.*}}- clang AST file
57 // CK-HELP: {{.*}}-unbundle {{.*}}- Unbundle bundled file into several output files.
60 // Check errors.
62 // RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -input=%t.i -input=%t.tgt1 -input=%t.tgt2 -output=%t.bundle.i -unbundle 2>&1 | FileCheck %s --check-prefix CK-ERR1
63 // CK-ERR1: error: only one input file supported in unbundling mode
65 // RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -input=%t.i -output=%t.bundle.i -unbundle 2>&1 | FileCheck %s --check-prefix CK-ERR1A
66 // CK-ERR1A: error: number of output files and targets should match in unbundling mode
68 // RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu -input=%t.i -input=%t.tgt1 -input=%t.tgt2 -output=%t.bundle.i 2>&1 | FileCheck %s --check-prefix CK-ERR2
69 // RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -input=%t.i -input=%t.tgt1 -output=%t.bundle.i 2>&1 | FileCheck %s --check-prefix CK-ERR2
70 // CK-ERR2: error: number of input files and targets should match in bundling mode
72 // RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -output=%t.i -output=%t.tgt1 -output=%t.tgt2 -input=%t.bundle.i 2>&1 | FileCheck %s --check-prefix CK-ERR3
73 // CK-ERR3: error: only one output file supported in bundling mode
75 // RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu -output=%t.i -output=%t.tgt1 -output=%t.tgt2 -input=%t.bundle.i -unbundle 2>&1 | FileCheck %s --check-prefix CK-ERR4
76 // RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -output=%t.i -output=%t.tgt1 -input=%t.bundle.i -unbundle 2>&1 | FileCheck %s --check-prefix CK-ERR4
77 // CK-ERR4: error: number of output files and targets should match in unbundling mode
79 // RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -input=%t.i -input=%t.tgt1 -input=%t.tgt2.notexist -output=%t.bundle.i 2>&1 | \
80 // RUN: FileCheck %s -DFILE=%t.tgt2.notexist -DMSG=%errc_ENOENT --check-prefix CK-ERR5
81 // RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -output=%t.i -output=%t.tgt1 -output=%t.tgt2 -input=%t.bundle.i.notexist -unbundle 2>&1 | \
82 // RUN: FileCheck %s -DFILE=%t.bundle.i.notexist -DMSG=%errc_ENOENT --check-prefix CK-ERR5
83 // CK-ERR5: error: '[[FILE]]': [[MSG]]
85 // RUN: not clang-offload-bundler -type=invalid -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -input=%t.i -input=%t.tgt1 -input=%t.tgt2 -output=%t.bundle.i 2>&1 | FileCheck %s -DTYPE=invalid --check-prefix CK-ERR6
86 // CK-ERR6: error: '[[TYPE]]': invalid file type specified
88 // RUN: not clang-offload-bundler 2>&1 | FileCheck %s --check-prefix CK-ERR7
89 // CK-ERR7: clang-offload-bundler: for the --type option: must be specified at least once!
91 // RUN: not clang-offload-bundler -type=i -input=%t.i -input=%t.tgt1 -input=%t.tgt2 2>&1 | FileCheck %s -check-prefix=CK-ERR7A
92 // CK-ERR7A: error: no output file specified!
94 // RUN: not clang-offload-bundler -type=i -input=%t.i -input=%t.tgt1 -input=%t.tgt2 -output=%t.bundle.i 2>&1 | FileCheck %s -check-prefix=CK-ERR7B
95 // CK-ERR7B: error: for the --targets option: must be specified at least once!
97 // RUN: not clang-offload-bundler -type=i -targets=hxst-powerpcxxle-ibm-linux-gnu,openxp-pxxerpc64le-ibm-linux-gnu,xpenmp-x86_xx-pc-linux-gnu -input=%t.i -input=%t.tgt1 -input=%t.tgt2 -output=%t.bundle.i 2>&1 | FileCheck %s --check-prefix CK-ERR8
98 // CK-ERR8: error: invalid target 'hxst-powerpcxxle-ibm-linux-gnu', unknown offloading kind 'hxst', unknown target triple 'powerpcxxle-ibm-linux-gnu'
100 // RUN: not clang-offload-bundler -type=i -targets=host-powerpc64le-ibm-linux-gnu,openxp-pxxerpc64le-ibm-linux-gnu,xpenmp-x86_xx-pc-linux-gnu -input=%t.i -input=%t.tgt1 -input=%t.tgt2 -output=%t.bundle.i 2>&1 | FileCheck %s --check-prefix CK-ERR8A
101 // CK-ERR8A: error: invalid target 'openxp-pxxerpc64le-ibm-linux-gnu', unknown offloading kind 'openxp', unknown target triple 'pxxerpc64le-ibm-linux-gnu'
103 // RUN: not clang-offload-bundler -type=i -targets=host-powerpc64le-ibm-linux-gnu,openmp-powerpc64le-ibm-linux-gnu,xpenmp-x86_xx-pc-linux-gnu -input=%t.i -input=%t.tgt1 -input=%t.tgt2 -output=%t.bundle.i 2>&1 | FileCheck %s --check-prefix CK-ERR8B
104 // CK-ERR8B: error: invalid target 'xpenmp-x86_xx-pc-linux-gnu', unknown offloading kind 'xpenmp', unknown target triple 'x86_xx-pc-linux-gnu'
106 // RUN: not clang-offload-bundler -type=i -targets=openmp-powerpc64le-linux,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -input=%t.i -input=%t.tgt1 -input=%t.tgt2 -output=%t.bundle.i 2>&1 | FileCheck %s --check-prefix CK-ERR9A
107 // CK-ERR9A: error: expecting exactly one host target but got 0
109 // RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,host-%itanium_abi_triple,openmp-x86_64-pc-linux-gnu -input=%t.i -input=%t.tgt1 -input=%t.tgt2 -output=%t.bundle.i 2>&1 | FileCheck %s --check-prefix CK-ERR9B
110 // CK-ERR9B: error: Duplicate targets are not allowed
112 // RUN: not clang-offload-bundler -type=a -targets=hxst-powerpcxxle-ibm-linux-gnu,openxp-pxxerpc64le-ibm-linux-gnu,xpenmp-x86_xx-pc-linux-gnu -input=%t.i -input=%t.tgt1 -input=%t.tgt2 -output=%t.bundle.i 2>&1 | FileCheck %s --check-prefix CK-ERR10A
113 // CK-ERR10A: error: Archive files are only supported for unbundling
115 // RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -input=%t.i -inputs=%t.tgt1,%t.tgt2 -output=%t.bundle.i -unbundle 2>&1 | FileCheck %s --check-prefix CK-ERR11A
116 // CK-ERR11A: error: -inputs and -input cannot be used together, use only -input instead
118 // RUN: not clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu -output=%t.i -outputs=%t.tgt1,%t.tgt2 -input=%t.bundle.i -unbundle 2>&1 | FileCheck %s --check-prefix CK-ERR11B
119 // CK-ERR11B: error: -outputs and -output cannot be used together, use only -output instead
122 // Check text bundle. This is a readable format, so we check for the format we expect to find.
124 // RUN: clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -input=%t.i -input=%t.tgt1 -input=%t.tgt2 -output=%t.bundle3.i
125 // RUN: clang-offload-bundler -type=ii -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -input=%t.ii -input=%t.tgt1 -input=%t.tgt2 -output=%t.bundle3.ii
126 // RUN: clang-offload-bundler -type=ll -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -input=%t.ll -input=%t.tgt1 -input=%t.tgt2 -output=%t.bundle3.ll
127 // RUN: clang-offload-bundler -type=s -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -input=%t.s -input=%t.tgt1 -input=%t.tgt2 -output=%t.bundle3.s
128 // RUN: clang-offload-bundler -type=s -targets=openmp-powerpc64le-ibm-linux-gnu,host-%itanium_abi_triple,openmp-x86_64-pc-linux-gnu -input=%t.tgt1 -input=%t.s -input=%t.tgt2 -output=%t.bundle3.unordered.s
129 // RUN: FileCheck %s --input-file %t.bundle3.i --check-prefix CK-TEXTI
130 // RUN: FileCheck %s --input-file %t.bundle3.ii --check-prefix CK-TEXTI
131 // RUN: FileCheck %s --input-file %t.bundle3.ll --check-prefix CK-TEXTLL
132 // RUN: FileCheck %s --input-file %t.bundle3.s --check-prefix CK-TEXTS
133 // RUN: FileCheck %s --input-file %t.bundle3.unordered.s --check-prefix CK-TEXTS-UNORDERED
135 // CK-TEXTI: // __CLANG_OFFLOAD_BUNDLE____START__ host-[[HOST:.+]]
136 // CK-TEXTI: int A = 0;
137 // CK-TEXTI: test_func(void)
138 // CK-TEXTI: // __CLANG_OFFLOAD_BUNDLE____END__ host-[[HOST]]
139 // CK-TEXTI: // __CLANG_OFFLOAD_BUNDLE____START__ openmp-powerpc64le-ibm-linux-gnu
140 // CK-TEXTI: Content of device file 1
141 // CK-TEXTI: // __CLANG_OFFLOAD_BUNDLE____END__ openmp-powerpc64le-ibm-linux-gnu
142 // CK-TEXTI: // __CLANG_OFFLOAD_BUNDLE____START__ openmp-x86_64-pc-linux-gnu
143 // CK-TEXTI: Content of device file 2
144 // CK-TEXTI: // __CLANG_OFFLOAD_BUNDLE____END__ openmp-x86_64-pc-linux-gnu
146 // CK-TEXTLL: ; __CLANG_OFFLOAD_BUNDLE____START__ host-[[HOST:.+]]
147 // CK-TEXTLL: @A = {{.*}}global i32 0
148 // CK-TEXTLL: define {{.*}}@test_func()
149 // CK-TEXTLL: ; __CLANG_OFFLOAD_BUNDLE____END__ host-[[HOST]]
150 // CK-TEXTLL: ; __CLANG_OFFLOAD_BUNDLE____START__ openmp-powerpc64le-ibm-linux-gnu
151 // CK-TEXTLL: Content of device file 1
152 // CK-TEXTLL: ; __CLANG_OFFLOAD_BUNDLE____END__ openmp-powerpc64le-ibm-linux-gnu
153 // CK-TEXTLL: ; __CLANG_OFFLOAD_BUNDLE____START__ openmp-x86_64-pc-linux-gnu
154 // CK-TEXTLL: Content of device file 2
155 // CK-TEXTLL: ; __CLANG_OFFLOAD_BUNDLE____END__ openmp-x86_64-pc-linux-gnu
157 // CK-TEXTS: # __CLANG_OFFLOAD_BUNDLE____START__ host-[[HOST:.+]]
158 // CK-TEXTS: .globl {{.*}}test_func
159 // CK-TEXTS: .globl {{.*}}A
160 // CK-TEXTS: # __CLANG_OFFLOAD_BUNDLE____END__ host-[[HOST]]
161 // CK-TEXTS: # __CLANG_OFFLOAD_BUNDLE____START__ openmp-powerpc64le-ibm-linux-gnu
162 // CK-TEXTS: Content of device file 1
163 // CK-TEXTS: # __CLANG_OFFLOAD_BUNDLE____END__ openmp-powerpc64le-ibm-linux-gnu
164 // CK-TEXTS: # __CLANG_OFFLOAD_BUNDLE____START__ openmp-x86_64-pc-linux-gnu
165 // CK-TEXTS: Content of device file 2
166 // CK-TEXTS: # __CLANG_OFFLOAD_BUNDLE____END__ openmp-x86_64-pc-linux-gnu
168 // CK-TEXTS-UNORDERED: # __CLANG_OFFLOAD_BUNDLE____START__ openmp-powerpc64le-ibm-linux-gnu
169 // CK-TEXTS-UNORDERED: Content of device file 1
170 // CK-TEXTS-UNORDERED: # __CLANG_OFFLOAD_BUNDLE____END__ openmp-powerpc64le-ibm-linux-gnu
171 // CK-TEXTS-UNORDERED: # __CLANG_OFFLOAD_BUNDLE____START__ host-[[HOST:.+]]
172 // CK-TEXTS-UNORDERED: .globl {{.*}}test_func
173 // CK-TEXTS-UNORDERED: .globl {{.*}}A
174 // CK-TEXTS-UNORDERED: # __CLANG_OFFLOAD_BUNDLE____END__ host-[[HOST]]
175 // CK-TEXTS-UNORDERED: # __CLANG_OFFLOAD_BUNDLE____START__ openmp-x86_64-pc-linux-gnu
176 // CK-TEXTS-UNORDERED: Content of device file 2
177 // CK-TEXTS-UNORDERED: # __CLANG_OFFLOAD_BUNDLE____END__ openmp-x86_64-pc-linux-gnu
180 // Check text unbundle. Check if we get the exact same content that we bundled before for each file.
182 // RUN: clang-offload-bundler -type=i -input=%t.bundle3.i -list | FileCheck -check-prefix=CKLST %s
183 // RUN: clang-offload-bundler -type=i -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -output=%t.res.i -output=%t.res.tgt1 -output=%t.res.tgt2 -input=%t.bundle3.i -unbundle
184 // RUN: diff %t.i %t.res.i
185 // RUN: diff %t.tgt1 %t.res.tgt1
186 // RUN: diff %t.tgt2 %t.res.tgt2
187 // RUN: clang-offload-bundler -type=i -targets=openmp-powerpc64le-ibm-linux-gnu -output=%t.res.tgt1 -input=%t.bundle3.i -unbundle
188 // RUN: diff %t.tgt1 %t.res.tgt1
189 // RUN: clang-offload-bundler -type=ii -input=%t.bundle3.ii -list | FileCheck -check-prefix=CKLST %s
190 // RUN: clang-offload-bundler -type=ii -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -output=%t.res.ii -output=%t.res.tgt1 -output=%t.res.tgt2 -input=%t.bundle3.ii -unbundle
191 // RUN: diff %t.ii %t.res.ii
192 // RUN: diff %t.tgt1 %t.res.tgt1
193 // RUN: diff %t.tgt2 %t.res.tgt2
194 // RUN: clang-offload-bundler -type=ii -targets=openmp-x86_64-pc-linux-gnu -output=%t.res.tgt2 -input=%t.bundle3.ii -unbundle
195 // RUN: diff %t.tgt2 %t.res.tgt2
196 // RUN: clang-offload-bundler -type=ll -input=%t.bundle3.ll -list | FileCheck -check-prefix=CKLST %s
197 // RUN: clang-offload-bundler -type=ll -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -output=%t.res.ll -output=%t.res.tgt1 -output=%t.res.tgt2 -input=%t.bundle3.ll -unbundle
198 // RUN: diff %t.ll %t.res.ll
199 // RUN: diff %t.tgt1 %t.res.tgt1
200 // RUN: diff %t.tgt2 %t.res.tgt2
201 // RUN: clang-offload-bundler -type=ll -targets=openmp-powerpc64le-ibm-linux-gnu -output=%t.res.tgt1 -input=%t.bundle3.ll -unbundle
202 // RUN: diff %t.tgt1 %t.res.tgt1
203 // RUN: clang-offload-bundler -type=s -input=%t.bundle3.s -list | FileCheck -check-prefix=CKLST %s
204 // RUN: clang-offload-bundler -type=s -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -output=%t.res.s -output=%t.res.tgt1 -output=%t.res.tgt2 -input=%t.bundle3.s -unbundle
205 // RUN: diff %t.s %t.res.s
206 // RUN: diff %t.tgt1 %t.res.tgt1
207 // RUN: diff %t.tgt2 %t.res.tgt2
208 // RUN: clang-offload-bundler -type=s -targets=openmp-powerpc64le-ibm-linux-gnu,host-%itanium_abi_triple,openmp-x86_64-pc-linux-gnu -output=%t.res.tgt1 -output=%t.res.s -output=%t.res.tgt2 -input=%t.bundle3.s -unbundle
209 // RUN: diff %t.s %t.res.s
210 // RUN: diff %t.tgt1 %t.res.tgt1
211 // RUN: diff %t.tgt2 %t.res.tgt2
212 // RUN: clang-offload-bundler -type=s -targets=openmp-x86_64-pc-linux-gnu -output=%t.res.tgt2 -input=%t.bundle3.s -unbundle
213 // RUN: diff %t.tgt2 %t.res.tgt2
215 // Check if we can unbundle a file with no magic strings.
216 // RUN: clang-offload-bundler -type=s -input=%t.s -list | FileCheck -check-prefix=CKLST2 --allow-empty %s
217 // RUN: clang-offload-bundler -type=s -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -output=%t.res.s -output=%t.res.tgt1 -output=%t.res.tgt2 -input=%t.s -unbundle -allow-missing-bundles
218 // RUN: diff %t.s %t.res.s
219 // RUN: diff %t.empty %t.res.tgt1
220 // RUN: diff %t.empty %t.res.tgt2
221 // RUN: clang-offload-bundler -type=s -targets=openmp-powerpc64le-ibm-linux-gnu,host-%itanium_abi_triple,openmp-x86_64-pc-linux-gnu -output=%t.res.tgt1 -output=%t.res.s -output=%t.res.tgt2 -input=%t.s -unbundle -allow-missing-bundles
222 // RUN: diff %t.s %t.res.s
223 // RUN: diff %t.empty %t.res.tgt1
224 // RUN: diff %t.empty %t.res.tgt2
226 // Check that bindler prints an error if given host bundle does not exist in the fat binary.
227 // RUN: not clang-offload-bundler -type=s -targets=host-x86_64-xxx-linux-gnu,openmp-powerpc64le-ibm-linux-gnu -output=%t.res.s -output=%t.res.tgt1 -input=%t.bundle3.s -unbundle -allow-missing-bundles 2>&1 | FileCheck %s --check-prefix CK-NO-HOST-BUNDLE
228 // CK-NO-HOST-BUNDLE: error: Can't find bundle for the host target
231 // Check binary bundle/unbundle. The content that we have before bundling must be the same we have after unbundling.
233 // RUN: clang-offload-bundler -type=bc -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -input=%t.bc -input=%t.tgt1 -input=%t.tgt2 -output=%t.bundle3.bc
234 // RUN: clang-offload-bundler -type=gch -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -input=%t.ast -input=%t.tgt1 -input=%t.tgt2 -output=%t.bundle3.gch
235 // RUN: clang-offload-bundler -type=ast -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -input=%t.ast -input=%t.tgt1 -input=%t.tgt2 -output=%t.bundle3.ast
236 // RUN: clang-offload-bundler -type=ast -targets=openmp-powerpc64le-ibm-linux-gnu,host-%itanium_abi_triple,openmp-x86_64-pc-linux-gnu -input=%t.tgt1 -input=%t.ast -input=%t.tgt2 -output=%t.bundle3.unordered.ast
237 // RUN: clang-offload-bundler -type=bc -input=%t.bundle3.bc -list | FileCheck -check-prefix=CKLST %s
238 // RUN: clang-offload-bundler -type=bc -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -output=%t.res.bc -output=%t.res.tgt1 -output=%t.res.tgt2 -input=%t.bundle3.bc -unbundle
239 // RUN: diff %t.bc %t.res.bc
240 // RUN: diff %t.tgt1 %t.res.tgt1
241 // RUN: diff %t.tgt2 %t.res.tgt2
242 // RUN: clang-offload-bundler -type=bc -targets=openmp-powerpc64le-ibm-linux-gnu -output=%t.res.tgt1 -input=%t.bundle3.bc -unbundle
243 // RUN: diff %t.tgt1 %t.res.tgt1
244 // RUN: clang-offload-bundler -type=gch -input=%t.bundle3.gch -list | FileCheck -check-prefix=CKLST %s
245 // RUN: clang-offload-bundler -type=gch -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -output=%t.res.gch -output=%t.res.tgt1 -output=%t.res.tgt2 -input=%t.bundle3.gch -unbundle
246 // RUN: diff %t.ast %t.res.gch
247 // RUN: diff %t.tgt1 %t.res.tgt1
248 // RUN: diff %t.tgt2 %t.res.tgt2
249 // RUN: clang-offload-bundler -type=gch -targets=openmp-x86_64-pc-linux-gnu -output=%t.res.tgt2 -input=%t.bundle3.gch -unbundle
250 // RUN: diff %t.tgt2 %t.res.tgt2
251 // RUN: clang-offload-bundler -type=ast -input=%t.bundle3.ast -list | FileCheck -check-prefix=CKLST %s
252 // RUN: clang-offload-bundler -type=ast -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -output=%t.res.ast -output=%t.res.tgt1 -output=%t.res.tgt2 -input=%t.bundle3.ast -unbundle
253 // RUN: diff %t.ast %t.res.ast
254 // RUN: diff %t.tgt1 %t.res.tgt1
255 // RUN: diff %t.tgt2 %t.res.tgt2
256 // RUN: clang-offload-bundler -type=ast -targets=openmp-powerpc64le-ibm-linux-gnu,host-%itanium_abi_triple,openmp-x86_64-pc-linux-gnu -output=%t.res.tgt1 -output=%t.res.ast -output=%t.res.tgt2 -input=%t.bundle3.ast -unbundle
257 // RUN: diff %t.ast %t.res.ast
258 // RUN: diff %t.tgt1 %t.res.tgt1
259 // RUN: diff %t.tgt2 %t.res.tgt2
260 // RUN: clang-offload-bundler -type=ast -targets=openmp-powerpc64le-ibm-linux-gnu,host-%itanium_abi_triple,openmp-x86_64-pc-linux-gnu -output=%t.res.tgt1 -output=%t.res.ast -output=%t.res.tgt2 -input=%t.bundle3.unordered.ast -unbundle
261 // RUN: diff %t.ast %t.res.ast
262 // RUN: diff %t.tgt1 %t.res.tgt1
263 // RUN: diff %t.tgt2 %t.res.tgt2
264 // RUN: clang-offload-bundler -type=ast -targets=openmp-powerpc64le-ibm-linux-gnu -output=%t.res.tgt1 -input=%t.bundle3.ast -unbundle
265 // RUN: diff %t.tgt1 %t.res.tgt1
267 // Check if we can unbundle a file with no magic strings.
268 // RUN: clang-offload-bundler -type=bc -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -output=%t.res.bc -output=%t.res.tgt1 -output=%t.res.tgt2 -input=%t.bc -unbundle -allow-missing-bundles
269 // RUN: diff %t.bc %t.res.bc
270 // RUN: diff %t.empty %t.res.tgt1
271 // RUN: diff %t.empty %t.res.tgt2
272 // RUN: clang-offload-bundler -type=bc -targets=openmp-powerpc64le-ibm-linux-gnu,host-%itanium_abi_triple,openmp-x86_64-pc-linux-gnu -output=%t.res.tgt1 -output=%t.res.bc -output=%t.res.tgt2 -input=%t.bc -unbundle -allow-missing-bundles
273 // RUN: diff %t.bc %t.res.bc
274 // RUN: diff %t.empty %t.res.tgt1
275 // RUN: diff %t.empty %t.res.tgt2
277 // Check that we do not have to unbundle all available bundles from the fat binary.
278 // RUN: clang-offload-bundler -type=ast -targets=host-%itanium_abi_triple,openmp-x86_64-pc-linux-gnu -output=%t.res.ast -output=%t.res.tgt2 -input=%t.bundle3.unordered.ast -unbundle
279 // RUN: diff %t.ast %t.res.ast
280 // RUN: diff %t.tgt2 %t.res.tgt2
282 // Check that we do not have to unbundle all available bundles from the fat binary.
283 // RUN: clang-offload-bundler -type=ast -targets=host-%itanium_abi_triple,openmp-x86_64-pc-linux-gnu -output=%t.res.ast -output=%t.res.tgt2 -input=%t.bundle3.unordered.ast -unbundle
284 // RUN: diff %t.ast %t.res.ast
285 // RUN: diff %t.tgt2 %t.res.tgt2
288 // Check object bundle/unbundle. The content should be bundled into an ELF
289 // section (we are using a PowerPC little-endian host which uses ELF). We
290 // have an already bundled file to check the unbundle and do a dry run on the
291 // bundling as it cannot be tested in all host platforms that will run these
292 // tests.
295 // RUN: clang-offload-bundler -type=o -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -input=%t.o -input=%t.tgt1 -input=%t.tgt2 -output=%t.bundle3.o -### 2>&1 \
296 // RUN: | FileCheck %s -DHOST=%itanium_abi_triple -DINOBJ1=%t.o -DINOBJ2=%t.tgt1 -DINOBJ3=%t.tgt2 -DOUTOBJ=%t.bundle3.o --check-prefix CK-OBJ-CMD
297 // CK-OBJ-CMD: llvm-objcopy{{(.exe)?}}" "--add-section=__CLANG_OFFLOAD_BUNDLE__host-[[HOST]]={{.*}}" "--set-section-flags=__CLANG_OFFLOAD_BUNDLE__host-[[HOST]]=readonly,exclude" "--add-section=__CLANG_OFFLOAD_BUNDLE__openmp-powerpc64le-ibm-linux-gnu=[[INOBJ2]]" "--set-section-flags=__CLANG_OFFLOAD_BUNDLE__openmp-powerpc64le-ibm-linux-gnu=readonly,exclude" "--add-section=__CLANG_OFFLOAD_BUNDLE__openmp-x86_64-pc-linux-gnu=[[INOBJ3]]" "--set-section-flags=__CLANG_OFFLOAD_BUNDLE__openmp-x86_64-pc-linux-gnu=readonly,exclude" "--" "[[INOBJ1]]" "[[OUTOBJ]]"
299 // RUN: clang-offload-bundler -type=o -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -input=%t.o -input=%t.tgt1 -input=%t.tgt2 -output=%t.bundle3.o -### 2>&1 \
300 // RUN: | FileCheck %s -DHOST=%itanium_abi_triple -DINOBJ1=%t.o -DINOBJ2=%t.tgt1 -DINOBJ3=%t.tgt2 -DOUTOBJ=%t.bundle3.o --check-prefix CK-OBJ-CMD-INPUTS
301 // CK-OBJ-CMD-INPUTS: llvm-objcopy{{(.exe)?}}" "--add-section=__CLANG_OFFLOAD_BUNDLE__host-[[HOST]]={{.*}}" "--set-section-flags=__CLANG_OFFLOAD_BUNDLE__host-[[HOST]]=readonly,exclude" "--add-section=__CLANG_OFFLOAD_BUNDLE__openmp-powerpc64le-ibm-linux-gnu=[[INOBJ2]]" "--set-section-flags=__CLANG_OFFLOAD_BUNDLE__openmp-powerpc64le-ibm-linux-gnu=readonly,exclude" "--add-section=__CLANG_OFFLOAD_BUNDLE__openmp-x86_64-pc-linux-gnu=[[INOBJ3]]" "--set-section-flags=__CLANG_OFFLOAD_BUNDLE__openmp-x86_64-pc-linux-gnu=readonly,exclude" "--" "[[INOBJ1]]" "[[OUTOBJ]]"
303 // RUN: clang-offload-bundler -type=o -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -input=%t.o -input=%t.tgt1 -input=%t.tgt2 -output=%t.bundle3.o
304 // RUN: clang-offload-bundler -type=o -input=%t.bundle3.o -list | FileCheck -check-prefix=CKLST %s
305 // RUN: clang-offload-bundler -type=o -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -output=%t.res.o -output=%t.res.tgt1 -output=%t.res.tgt2 -input=%t.bundle3.o -unbundle
306 // RUN: diff %t.bundle3.o %t.res.o
307 // RUN: diff %t.tgt1 %t.res.tgt1
308 // RUN: diff %t.tgt2 %t.res.tgt2
309 // RUN: clang-offload-bundler -type=o -targets=openmp-powerpc64le-ibm-linux-gnu,host-%itanium_abi_triple,openmp-x86_64-pc-linux-gnu -output=%t.res.tgt1 -output=%t.res.o -output=%t.res.tgt2 -input=%t.bundle3.o -unbundle
310 // RUN: diff %t.bundle3.o %t.res.o
311 // RUN: diff %t.tgt1 %t.res.tgt1
312 // RUN: diff %t.tgt2 %t.res.tgt2
313 // RUN: clang-offload-bundler -type=o -targets=openmp-powerpc64le-ibm-linux-gnu -output=%t.res.tgt1 -input=%t.bundle3.o -unbundle
314 // RUN: diff %t.tgt1 %t.res.tgt1
316 // Check if we can unbundle a file with no magic strings.
317 // RUN: clang-offload-bundler -type=o -input=%t.o -list | FileCheck -check-prefix=CKLST2 --allow-empty %s
318 // RUN: clang-offload-bundler -type=o -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -output=%t.res.o -output=%t.res.tgt1 -output=%t.res.tgt2 -input=%t.o -unbundle -allow-missing-bundles
319 // RUN: diff %t.o %t.res.o
320 // RUN: diff %t.empty %t.res.tgt1
321 // RUN: diff %t.empty %t.res.tgt2
322 // RUN: clang-offload-bundler -type=o -targets=openmp-powerpc64le-ibm-linux-gnu,host-%itanium_abi_triple,openmp-x86_64-pc-linux-gnu -output=%t.res.tgt1 -output=%t.res.o -output=%t.res.tgt2 -input=%t.o -unbundle -allow-missing-bundles
323 // RUN: diff %t.o %t.res.o
324 // RUN: diff %t.empty %t.res.tgt1
325 // RUN: diff %t.empty %t.res.tgt2
328 // Check -bundle-align option
331 // RUN: clang-offload-bundler -bundle-align=4096 -type=bc -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -input=%t.bc -input=%t.tgt1 -input=%t.tgt2 -output=%t.bundle3.bc
332 // RUN: clang-offload-bundler -type=bc -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -output=%t.res.bc -output=%t.res.tgt1 -output=%t.res.tgt2 -input=%t.bundle3.bc -unbundle
333 // RUN: diff %t.bc %t.res.bc
334 // RUN: diff %t.tgt1 %t.res.tgt1
335 // RUN: diff %t.tgt2 %t.res.tgt2
338 // Check error due to missing bundles
340 // RUN: clang-offload-bundler -type=bc -targets=host-%itanium_abi_triple,hip-amdgcn-amd-amdhsa--gfx900 -input=%t.bc -input=%t.tgt1 -output=%t.hip.bundle.bc
341 // RUN: not clang-offload-bundler -type=bc -input=%t.hip.bundle.bc -output=%t.tmp.bc -unbundle \
342 // RUN: -targets=hip-amdgcn-amd-amdhsa--gfx906 \
343 // RUN: 2>&1 | FileCheck -check-prefix=MISS1 %s
344 // RUN: not clang-offload-bundler -type=bc -input=%t.hip.bundle.bc -output=%t.tmp.bc -output=%t.tmp2.bc -unbundle \
345 // RUN: -targets=hip-amdgcn-amd-amdhsa--gfx906,hip-amdgcn-amd-amdhsa--gfx900 \
346 // RUN: 2>&1 | FileCheck -check-prefix=MISS1 %s
347 // MISS1: error: Can't find bundles for hip-amdgcn-amd-amdhsa--gfx906
348 // RUN: not clang-offload-bundler -type=bc -input=%t.hip.bundle.bc -output=%t.tmp.bc -output=%t.tmp2.bc -unbundle \
349 // RUN: -targets=hip-amdgcn-amd-amdhsa--gfx906,hip-amdgcn-amd-amdhsa--gfx803 \
350 // RUN: 2>&1 | FileCheck -check-prefix=MISS2 %s
351 // MISS2: error: Can't find bundles for hip-amdgcn-amd-amdhsa--gfx803 and hip-amdgcn-amd-amdhsa--gfx906
352 // RUN: not clang-offload-bundler -type=bc -input=%t.hip.bundle.bc -output=%t.tmp.bc -output=%t.tmp2.bc -output=%t.tmp3.bc -unbundle \
353 // RUN: -targets=hip-amdgcn-amd-amdhsa--gfx906,hip-amdgcn-amd-amdhsa--gfx803,hip-amdgcn-amd-amdhsa--gfx1010 \
354 // RUN: 2>&1 | FileCheck -check-prefix=MISS3 %s
355 // MISS3: error: Can't find bundles for hip-amdgcn-amd-amdhsa--gfx1010, hip-amdgcn-amd-amdhsa--gfx803, and hip-amdgcn-amd-amdhsa--gfx906
358 // Check error due to duplicate targets
360 // RUN: not clang-offload-bundler -type=bc -targets=host-%itanium_abi_triple,hip-amdgcn-amd-amdhsa--gfx900,hip-amdgcn-amd-amdhsa--gfx900 \
361 // RUN: -input=%t.bc -input=%t.tgt1 -input=%t.tgt1 -output=%t.hip.bundle.bc 2>&1 | FileCheck -check-prefix=DUP %s
362 // RUN: not clang-offload-bundler -type=bc -input=%t.hip.bundle.bc -output=%t.tmp.bc -output=%t.tmp2.bc -unbundle \
363 // RUN: -targets=hip-amdgcn-amd-amdhsa--gfx906,hip-amdgcn-amd-amdhsa--gfx906 \
364 // RUN: 2>&1 | FileCheck -check-prefix=DUP %s
365 // DUP: error: Duplicate targets are not allowed
367 // Check -list option
370 // RUN: clang-offload-bundler -bundle-align=4096 -type=bc -targets=host-%itanium_abi_triple,openmp-powerpc64le-ibm-linux-gnu,openmp-x86_64-pc-linux-gnu -input=%t.bc -input=%t.tgt1 -input=%t.tgt2 -output=%t.bundle3.bc
371 // RUN: not clang-offload-bundler -type=bc -input=%t.bundle3.bc -unbundle -list 2>&1 | FileCheck -check-prefix=CKLST-ERR %s
372 // CKLST-ERR: error: -unbundle and -list cannot be used together
373 // RUN: not clang-offload-bundler -type=bc -input=%t.bundle3.bc -targets=host-%itanium_abi_triple -list 2>&1 | FileCheck -check-prefix=CKLST-ERR2 %s
374 // CKLST-ERR2: error: -targets option is invalid for -list
375 // RUN: not clang-offload-bundler -type=bc -input=%t.bundle3.bc -output=out.txt -list 2>&1 | FileCheck -check-prefix=CKLST-ERR3 %s
376 // CKLST-ERR3: error: -outputs option is invalid for -list
377 // RUN: not clang-offload-bundler -type=bc -input=%t.bundle3.bc -input=%t.bc -list 2>&1 | FileCheck -check-prefix=CKLST-ERR4 %s
378 // CKLST-ERR4: error: only one input file supported for -list
380 // CKLST-DAG: host-
381 // CKLST-DAG: openmp-powerpc64le-ibm-linux-gnu
382 // CKLST-DAG: openmp-x86_64-pc-linux-gnu
384 // CKLST2-NOT: host-
385 // CKLST2-NOT: openmp-powerpc64le-ibm-linux-gnu
386 // CKLST2-NOT: openmp-x86_64-pc-linux-gnu
389 // Check unbundling archive for HIP.
391 // When the input to clang-offload-bundler is an archive of bundled bitcodes,
392 // for each target, clang-offload-bundler extracts the bitcode from each
393 // bundle and archives them. Therefore for each target, the output is an
394 // archive of unbundled bitcodes.
396 // RUN: clang-offload-bundler -type=bc -targets=hip-amdgcn-amd-amdhsa--gfx900,hip-amdgcn-amd-amdhsa--gfx906 \
397 // RUN: -input=%t.tgt1 -input=%t.tgt2 -output=%T/hip_bundle1.bc
398 // RUN: clang-offload-bundler -type=bc -targets=hip-amdgcn-amd-amdhsa--gfx900,hip-amdgcn-amd-amdhsa--gfx906 \
399 // RUN: -input=%t.tgt1 -input=%t.tgt2 -output=%T/hip_bundle2.bc
400 // RUN: llvm-ar cr %T/hip_archive.a %T/hip_bundle1.bc %T/hip_bundle2.bc
401 // RUN: clang-offload-bundler -unbundle -type=a -targets=hip-amdgcn-amd-amdhsa--gfx900,hip-amdgcn-amd-amdhsa--gfx906 \
402 // RUN: -output=%T/hip_900.a -output=%T/hip_906.a -input=%T/hip_archive.a
403 // RUN: llvm-ar t %T/hip_900.a | FileCheck -check-prefix=HIP-AR-900 %s
404 // RUN: llvm-ar t %T/hip_906.a | FileCheck -check-prefix=HIP-AR-906 %s
405 // HIP-AR-900-DAG: hip_bundle1-hip-amdgcn-amd-amdhsa--gfx900
406 // HIP-AR-900-DAG: hip_bundle2-hip-amdgcn-amd-amdhsa--gfx900
407 // HIP-AR-906-DAG: hip_bundle1-hip-amdgcn-amd-amdhsa--gfx906
408 // HIP-AR-906-DAG: hip_bundle2-hip-amdgcn-amd-amdhsa--gfx906
411 // Check bundling without host target is allowed for HIP.
413 // RUN: clang-offload-bundler -type=bc -targets=hip-amdgcn-amd-amdhsa--gfx900,hip-amdgcn-amd-amdhsa--gfx906 \
414 // RUN: -input=%t.tgt1 -input=%t.tgt2 -output=%t.hip.bundle.bc
415 // RUN: clang-offload-bundler -type=bc -list -input=%t.hip.bundle.bc | FileCheck -check-prefix=NOHOST %s
416 // RUN: clang-offload-bundler -type=bc -targets=hip-amdgcn-amd-amdhsa--gfx900,hip-amdgcn-amd-amdhsa--gfx906 \
417 // RUN: -output=%t.res.tgt1 -output=%t.res.tgt2 -input=%t.hip.bundle.bc -unbundle
418 // RUN: diff %t.tgt1 %t.res.tgt1
419 // RUN: diff %t.tgt2 %t.res.tgt2
421 // NOHOST-NOT: host-
422 // NOHOST-DAG: hip-amdgcn-amd-amdhsa--gfx900
423 // NOHOST-DAG: hip-amdgcn-amd-amdhsa--gfx906
424 // Check archive unbundling
426 // Create few code object bundles and archive them to create an input archive
427 // RUN: clang-offload-bundler -type=o -targets=host-%itanium_abi_triple,openmp-amdgcn-amd-amdhsa-gfx906,openmp-amdgcn-amd-amdhsa--gfx908 -input=%t.o -input=%t.tgt1 -input=%t.tgt2 -output=%t.simple.bundle
428 // RUN: clang-offload-bundler -type=o -targets=host-%itanium_abi_triple,openmp-amdgcn-amd-amdhsa--gfx903 -input=%t.o -input=%t.tgt1 -output=%t.simple1.bundle
429 // RUN: clang-offload-bundler -type=o -targets=host-%itanium_abi_triple,hip-amdgcn-amd-amdhsa--gfx906 -input=%t.o -input=%t.tgt1 -output=%t.simple2.bundle
430 // RUN: llvm-ar cr %t.input-archive.a %t.simple.bundle %t.simple1.bundle %t.simple2.bundle
432 // RUN: clang-offload-bundler -unbundle -type=a -targets=openmp-amdgcn-amd-amdhsa-gfx906,openmp-amdgcn-amd-amdhsa-gfx908 -input=%t.input-archive.a -output=%t-archive-gfx906-simple.a -output=%t-archive-gfx908-simple.a
433 // RUN: llvm-ar t %t-archive-gfx906-simple.a | FileCheck %s -check-prefix=GFX906
434 // GFX906: simple-openmp-amdgcn-amd-amdhsa-gfx906
435 // RUN: llvm-ar t %t-archive-gfx908-simple.a | FileCheck %s -check-prefix=GFX908
436 // GFX908-NOT: {{gfx906}}
438 // Check for error if no compatible code object is found in the heterogeneous archive library
439 // RUN: not clang-offload-bundler -unbundle -type=a -targets=openmp-amdgcn-amd-amdhsa-gfx803 -input=%t.input-archive.a -output=%t-archive-gfx803-incompatible.a 2>&1 | FileCheck %s -check-prefix=INCOMPATIBLEARCHIVE
440 // INCOMPATIBLEARCHIVE: error: no compatible code object found for the target 'openmp-amdgcn-amd-amdhsa-gfx803' in heterogeneous archive library
442 // Check creation of empty archive if allow-missing-bundles is present and no compatible code object is found in the heterogeneous archive library
443 // RUN: clang-offload-bundler -unbundle -type=a -targets=openmp-amdgcn-amd-amdhsa-gfx803 -input=%t.input-archive.a -output=%t-archive-gfx803-empty.a -allow-missing-bundles
444 // RUN: cat %t-archive-gfx803-empty.a | FileCheck %s -check-prefix=EMPTYARCHIVE
445 // EMPTYARCHIVE: !<arch>
447 // Check compatibility of OpenMP code objects found in the heterogeneous archive library with HIP code objects of the target
448 // RUN: clang-offload-bundler -unbundle -type=a -targets=hip-amdgcn-amd-amdhsa-gfx906,hipv4-amdgcn-amd-amdhsa-gfx908 -input=%t.input-archive.a -output=%t-hip-archive-gfx906-simple.a -output=%t-hipv4-archive-gfx908-simple.a -hip-openmp-compatible
449 // RUN: llvm-ar t %t-hip-archive-gfx906-simple.a | FileCheck %s -check-prefix=HIPOPENMPCOMPAT
450 // HIPOPENMPCOMPAT: simple-openmp-amdgcn-amd-amdhsa-gfx906
451 // RUN: llvm-ar t %t-hipv4-archive-gfx908-simple.a | FileCheck %s -check-prefix=HIPv4OPENMPCOMPAT
452 // HIPv4OPENMPCOMPAT: simple-openmp-amdgcn-amd-amdhsa--gfx908
454 // Check compatibility of HIP code objects found in the heterogeneous archive library with OpenMP code objects of the target
455 // RUN: clang-offload-bundler -unbundle -type=a -targets=openmp-amdgcn-amd-amdhsa--gfx906 \
456 // RUN: -output=%T/hip-openmp_906.a -input=%T/hip_archive.a -hip-openmp-compatible
457 // RUN: llvm-ar t %T/hip-openmp_906.a | FileCheck -check-prefix=OPENMPHIPCOMPAT %s
458 // OPENMPHIPCOMPAT: hip_bundle1-hip-amdgcn-amd-amdhsa--gfx906
460 // Some code so that we can create a binary out of this file.
461 int A = 0;
462 void test_func(void) {
463 ++A;