Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Driver / clang-offload-bundler-zstd.c
blobb2b588b72d4d6f282b376b5c734cba9ea1eeb614
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
52 // Check unbundling archive.
54 // RUN: clang-offload-bundler -type=bc -targets=hip-amdgcn-amd-amdhsa--gfx900,hip-amdgcn-amd-amdhsa--gfx906 \
55 // RUN: -input=%t.tgt1 -input=%t.tgt2 -output=%T/hip_bundle1.bc -compress
56 // RUN: clang-offload-bundler -type=bc -targets=hip-amdgcn-amd-amdhsa--gfx900,hip-amdgcn-amd-amdhsa--gfx906 \
57 // RUN: -input=%t.tgt1 -input=%t.tgt2 -output=%T/hip_bundle2.bc -compress
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;