[Flang] remove whole-archive option for AIX linker (#76039)
[llvm-project.git] / clang / test / Driver / clang-offload-bundler-zstd.c
blob3b577d4d166a3f5e8b6162d67bcb3f981ad4f9ae
1 // REQUIRES: zstd
2 // REQUIRES: x86-registered-target
3 // UNSUPPORTED: target={{.*}}-darwin{{.*}}, target={{.*}}-aix{{.*}}
5 //
6 // Generate the host binary to be bundled.
7 //
8 // RUN: %clang -O0 -target %itanium_abi_triple %s -c -emit-llvm -o %t.bc
11 // Generate an empty file to help with the checks of empty files.
13 // RUN: touch %t.empty
16 // Generate device binaries to be bundled.
18 // RUN: echo 'Content of device file 1' > %t.tgt1
19 // RUN: echo 'Content of device file 2' > %t.tgt2
22 // Check compression/decompression of offload bundle.
24 // RUN: clang-offload-bundler -type=bc -targets=hip-amdgcn-amd-amdhsa--gfx900,hip-amdgcn-amd-amdhsa--gfx906 \
25 // RUN: -input=%t.tgt1 -input=%t.tgt2 -output=%t.hip.bundle.bc -compress -verbose 2>&1 | \
26 // RUN: FileCheck -check-prefix=COMPRESS %s
27 // RUN: clang-offload-bundler -type=bc -list -input=%t.hip.bundle.bc | FileCheck -check-prefix=NOHOST %s
28 // RUN: clang-offload-bundler -type=bc -targets=hip-amdgcn-amd-amdhsa--gfx900,hip-amdgcn-amd-amdhsa--gfx906 \
29 // RUN: -output=%t.res.tgt1 -output=%t.res.tgt2 -input=%t.hip.bundle.bc -unbundle -verbose 2>&1 | \
30 // RUN: FileCheck -check-prefix=DECOMPRESS %s
31 // RUN: diff %t.tgt1 %t.res.tgt1
32 // RUN: diff %t.tgt2 %t.res.tgt2
34 // COMPRESS: Compression method used
35 // DECOMPRESS: Decompression method
36 // NOHOST-NOT: host-
37 // NOHOST-DAG: hip-amdgcn-amd-amdhsa--gfx900
38 // NOHOST-DAG: hip-amdgcn-amd-amdhsa--gfx906
42 // Check -bundle-align option.
45 // 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 -compress
46 // 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
47 // RUN: diff %t.bc %t.res.bc
48 // RUN: diff %t.tgt1 %t.res.tgt1
49 // RUN: diff %t.tgt2 %t.res.tgt2
51 // Check unbundling archive.
53 // RUN: clang-offload-bundler -type=bc -targets=hip-amdgcn-amd-amdhsa--gfx900,hip-amdgcn-amd-amdhsa--gfx906 \
54 // RUN: -input=%t.tgt1 -input=%t.tgt2 -output=%t.hip_bundle1.bc -compress
55 // RUN: clang-offload-bundler -type=bc -targets=hip-amdgcn-amd-amdhsa--gfx900,hip-amdgcn-amd-amdhsa--gfx906 \
56 // RUN: -input=%t.tgt1 -input=%t.tgt2 -output=%t.hip_bundle2.bc -compress
57 // RUN: rm -f %t.hip_archive.a
58 // RUN: llvm-ar cr %t.hip_archive.a %t.hip_bundle1.bc %t.hip_bundle2.bc
59 // RUN: clang-offload-bundler -unbundle -type=a -targets=hip-amdgcn-amd-amdhsa--gfx900,hip-amdgcn-amd-amdhsa--gfx906 \
60 // RUN: -output=%t.hip_900.a -output=%t.hip_906.a -input=%t.hip_archive.a
61 // RUN: llvm-ar t %t.hip_900.a | FileCheck -check-prefix=HIP-AR-900 %s
62 // RUN: llvm-ar t %t.hip_906.a | FileCheck -check-prefix=HIP-AR-906 %s
63 // HIP-AR-900-DAG: hip_bundle1-hip-amdgcn-amd-amdhsa--gfx900
64 // HIP-AR-900-DAG: hip_bundle2-hip-amdgcn-amd-amdhsa--gfx900
65 // HIP-AR-906-DAG: hip_bundle1-hip-amdgcn-amd-amdhsa--gfx906
66 // HIP-AR-906-DAG: hip_bundle2-hip-amdgcn-amd-amdhsa--gfx906
68 // Some code so that we can create a binary out of this file.
69 int A = 0;
70 void test_func(void) {
71 ++A;