[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / Driver / hip-toolchain-rdc-static-lib.hip
blob55cd3bd592084625b00d84a507d4b8edc73dc9e5
1 // REQUIRES: x86-registered-target
2 // REQUIRES: amdgpu-registered-target
4 // RUN: %clang -### -target x86_64-linux-gnu \
5 // RUN:   -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
6 // RUN:   --emit-static-lib -nogpulib \
7 // RUN:   -fuse-ld=lld -fgpu-rdc -nogpuinc \
8 // RUN:   %S/Inputs/hip_multiple_inputs/a.cu \
9 // RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
10 // RUN: 2>&1 | FileCheck %s
12 // emit objects for host side path
13 // CHECK: [[CLANG:".*clang.*"]] "-cc1" "-triple" "x86_64-unknown-linux-gnu"
14 // CHECK-SAME: "-aux-triple" "amdgcn-amd-amdhsa"
15 // CHECK-SAME: "-emit-obj"
16 // CHECK-SAME: {{.*}} "-main-file-name" "a.cu"
17 // CHECK-SAME: "-fgpu-rdc"
18 // CHECK-SAME: {{.*}} "-o" [[A_OBJ_HOST:".*o"]] "-x" "hip"
19 // CHECK-SAME: {{.*}} [[A_SRC:".*a.cu"]]
21 // CHECK: [[CLANG]] "-cc1" "-triple" "x86_64-unknown-linux-gnu"
22 // CHECK-SAME: "-aux-triple" "amdgcn-amd-amdhsa"
23 // CHECK-SAME: "-emit-obj"
24 // CHECK-SAME: {{.*}} "-main-file-name" "b.hip"
25 // CHECK-SAME: "-fgpu-rdc"
26 // CHECK-SAME: {{.*}} "-o" [[B_OBJ_HOST:".*o"]] "-x" "hip"
27 // CHECK-SAME: {{.*}} [[B_SRC:".*b.hip"]]
29 // generate image for device side path on gfx803
30 // CHECK: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa"
31 // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
32 // CHECK-SAME: "-emit-llvm-bc"
33 // CHECK-SAME: {{.*}} "-main-file-name" "a.cu"
34 // CHECK-SAME: "-fcuda-is-device"
35 // CHECK-SAME: "-target-cpu" "gfx803"
36 // CHECK-SAME: "-fgpu-rdc"
37 // CHECK-SAME: {{.*}} "-o" [[A_BC1:".*bc"]] "-x" "hip"
38 // CHECK-SAME: {{.*}} [[A_SRC]]
40 // CHECK: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa"
41 // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
42 // CHECK-SAME: "-emit-llvm-bc"
43 // CHECK-SAME: {{.*}} "-main-file-name" "b.hip"
44 // CHECK-SAME: "-fcuda-is-device"
45 // CHECK-SAME: "-target-cpu" "gfx803"
46 // CHECK-SAME: "-fgpu-rdc"
47 // CHECK-SAME: {{.*}} "-o" [[B_BC1:".*bc"]] "-x" "hip"
48 // CHECK-SAME: {{.*}} [[B_SRC]]
50 // CHECK-NOT: "*.llvm-link"
51 // CHECK-NOT: ".*opt"
52 // CHECK-NOT: ".*llc"
53 // CHECK: [[LLD: ".*lld.*"]] {{.*}} "-plugin-opt=-amdgpu-internalize-symbols"
54 // CHECK-SAME: "-plugin-opt=mcpu=gfx803"
55 // CHECK-SAME: "-o" "[[IMG_DEV1:.*out]]" [[A_BC1]] [[B_BC1]]
57 // generate image for device side path on gfx900
58 // CHECK: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa"
59 // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
60 // CHECK-SAME: "-emit-llvm-bc"
61 // CHECK-SAME: {{.*}} "-main-file-name" "a.cu"
62 // CHECK-SAME: "-fcuda-is-device"
63 // CHECK-SAME: "-target-cpu" "gfx900"
64 // CHECK-SAME: "-fgpu-rdc"
65 // CHECK-SAME: {{.*}} "-o" [[A_BC2:".*bc"]] "-x" "hip"
66 // CHECK-SAME: {{.*}} [[A_SRC]]
68 // CHECK: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa"
69 // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
70 // CHECK-SAME: "-emit-llvm-bc"
71 // CHECK-SAME: {{.*}} "-main-file-name" "b.hip"
72 // CHECK-SAME: "-fcuda-is-device"
73 // CHECK-SAME: "-target-cpu" "gfx900"
74 // CHECK-SAME: "-fgpu-rdc"
75 // CHECK-SAME: {{.*}} "-o" [[B_BC2:".*bc"]] "-x" "hip"
76 // CHECK-SAME: {{.*}} [[B_SRC]]
78 // CHECK-NOT: "*.llvm-link"
79 // CHECK-NOT: ".*opt"
80 // CHECK-NOT: ".*llc"
81 // CHECK: [[LLD]] {{.*}} "-plugin-opt=-amdgpu-internalize-symbols"
82 // CHECK-SAME: "-plugin-opt=mcpu=gfx900"
83 // CHECK-SAME: "-o" "[[IMG_DEV2:.*out]]" [[A_BC2]] [[B_BC2]]
85 // combine images generated into hip fat binary object
86 // CHECK: [[BUNDLER:".*clang-offload-bundler"]] "-type=o"
87 // CHECK-SAME: "-targets={{.*}},hipv4-amdgcn-amd-amdhsa--gfx803,hipv4-amdgcn-amd-amdhsa--gfx900"
88 // CHECK-SAME: "-input=[[IMG_DEV1]]" "-input=[[IMG_DEV2]]" "-output=[[BUNDLE:.*hipfb]]"
90 // CHECK: [[MC:".*llvm-mc.*"]] "-o" [[OBJBUNDLE:".*o"]] "{{.*}}.mcin" "--filetype=obj"
92 // CHECK: [[AR:".*llvm-ar.*"]] "rcsD" "{{.*}}.out" [[A_OBJ_HOST]] [[B_OBJ_HOST]] [[OBJBUNDLE]]