[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Driver / hip-toolchain-no-rdc.hip
blob4ae054b62fb7ffad958f2ff88cf06d477a892dc3
1 // REQUIRES: x86-registered-target
2 // REQUIRES: amdgpu-registered-target
4 // RUN: rm -rf %t && mkdir %t
5 // RUN: %clang -### --target=x86_64-linux-gnu -fno-gpu-rdc \
6 // RUN:   -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
7 // RUN:   --hip-device-lib=lib1.bc --hip-device-lib=lib2.bc \
8 // RUN:   --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib1 \
9 // RUN:   --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib2 \
10 // RUN:   -fuse-ld=lld -nogpuinc \
11 // RUN:   %S/Inputs/hip_multiple_inputs/a.cu \
12 // RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
13 // RUN: 2>&1 | FileCheck -check-prefixes=CHECK,LINK %s
15 // RUN: %clang -### --target=x86_64-linux-gnu -fno-gpu-rdc \
16 // RUN:   -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
17 // RUN:   --hip-device-lib=lib1.bc --hip-device-lib=lib2.bc \
18 // RUN:   --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib1 \
19 // RUN:   --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib2 \
20 // RUN:   -fuse-ld=lld -nogpuinc -c \
21 // RUN:   %S/Inputs/hip_multiple_inputs/a.cu \
22 // RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
23 // RUN: 2>&1 | FileCheck -check-prefixes=CHECK %s
25 // RUN: %clang -### --target=x86_64-linux-gnu -fno-gpu-rdc \
26 // RUN:   -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
27 // RUN:   --hip-device-lib=lib1.bc --hip-device-lib=lib2.bc \
28 // RUN:   --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib1 \
29 // RUN:   --hip-device-lib-path=%S/Inputs/hip_multiple_inputs/lib2 \
30 // RUN:   -fuse-ld=lld -nogpuinc --offload-new-driver -c \
31 // RUN:   %S/Inputs/hip_multiple_inputs/a.cu \
32 // RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
33 // RUN: 2>&1 | FileCheck -check-prefixes=CHECK %s
35 // RUN: touch %t/a.o %t/b.o
36 // RUN: %clang -### --target=x86_64-linux-gnu \
37 // RUN:   --hip-link --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
38 // RUN:   -fuse-ld=lld -nogpuinc \
39 // RUN:   %t/a.o %t/b.o \
40 // RUN: 2>&1 | FileCheck -check-prefixes=LKONLY %s
43 // Compile device code in a.cu to code object for gfx803.
46 // CHECK: [[CLANG:".*clang.*"]] "-cc1" "-triple" "amdgcn-amd-amdhsa"
47 // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
48 // CHECK-SAME: "-emit-obj"
49 // CHECK-SAME: {{.*}} "-main-file-name" "a.cu"
50 // CHECK-SAME: "-fcuda-is-device" "-mllvm" "-amdgpu-internalize-symbols"
51 // CHECK-SAME: "-fcuda-allow-variadic-functions" "-fvisibility=hidden"
52 // CHECK-SAME: "-fapply-global-visibility-to-externs"
53 // CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
54 // CHECK-SAME: "-target-cpu" "gfx803"
55 // CHECK-SAME: {{.*}} "-o" [[OBJ_DEV_A_803:".*o"]] "-x" "hip"
56 // CHECK-SAME: {{.*}} [[A_SRC:".*a.cu"]]
58 // CHECK-NOT: {{".*llvm-link"}}
59 // CHECK-NOT: {{".*opt"}}
60 // CHECK-NOT: {{".*llc"}}
62 // CHECK: [[LLD: ".*lld.*"]] "-flavor" "gnu" "-m" "elf64_amdgpu" "--no-undefined" "-shared"
63 // CHECK-SAME: "-o" "[[IMG_DEV_A_803:.*out]]" [[OBJ_DEV_A_803]]
66 // Compile device code in a.cu to code object for gfx900.
69 // CHECK: [[CLANG:".*clang.*"]] "-cc1" "-triple" "amdgcn-amd-amdhsa"
70 // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
71 // CHECK-SAME: "-emit-obj"
72 // CHECK-SAME: {{.*}} "-main-file-name" "a.cu"
73 // CHECK-SAME: "-fcuda-is-device" "-mllvm" "-amdgpu-internalize-symbols"
74 // CHECK-SAME: "-fcuda-allow-variadic-functions" "-fvisibility=hidden"
75 // CHECK-SAME: "-fapply-global-visibility-to-externs"
76 // CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
77 // CHECK-SAME: "-target-cpu" "gfx900"
78 // CHECK-SAME: {{.*}} "-o" [[OBJ_DEV_A_900:".*o"]] "-x" "hip"
79 // CHECK-SAME: {{.*}} [[A_SRC]]
81 // CHECK-NOT: {{".*llvm-link"}}
82 // CHECK-NOT: {{".*opt"}}
83 // CHECK-NOT: {{".*llc"}}
85 // CHECK: [[LLD]] "-flavor" "gnu" "-m" "elf64_amdgpu" "--no-undefined" "-shared"
86 // CHECK-SAME: "-o" "[[IMG_DEV_A_900:.*out]]" [[OBJ_DEV_A_900]]
89 // Bundle and embed device code in host object for a.cu.
92 // CHECK: [[BUNDLER:".*clang-offload-bundler"]] "-type=o"
93 // CHECK-SAME: "-bundle-align=4096"
94 // CHECK-SAME: "-targets={{.*}},hipv4-amdgcn-amd-amdhsa--gfx803,hipv4-amdgcn-amd-amdhsa--gfx900"
95 // CHECK-SAME: "-input={{.*}}" "-input=[[IMG_DEV_A_803]]" "-input=[[IMG_DEV_A_900]]" "-output=[[BUNDLE_A:.*hipfb]]"
97 // CHECK: [[CLANG]] "-cc1" "-triple" "x86_64-unknown-linux-gnu"
98 // CHECK-SAME: "-aux-triple" "amdgcn-amd-amdhsa"
99 // CHECK-SAME: "-emit-obj"
100 // CHECK-SAME: {{.*}} "-main-file-name" "a.cu"
101 // CHECK-SAME: {{.*}} "-fcuda-include-gpubinary" "[[BUNDLE_A]]"
102 // CHECK-SAME: {{.*}} "-o" [[A_OBJ_HOST:".*o"]] "-x" "hip"
103 // CHECK-SAME: {{.*}} [[A_SRC]]
106 // Compile device code in b.hip to code object for gfx803.
109 // CHECK: [[CLANG:".*clang.*"]] "-cc1" "-triple" "amdgcn-amd-amdhsa"
110 // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
111 // CHECK-SAME: "-emit-obj"
112 // CHECK-SAME: {{.*}} "-main-file-name" "b.hip"
113 // CHECK-SAME: "-fcuda-is-device" "-mllvm" "-amdgpu-internalize-symbols"
114 // CHECK-SAME: "-fcuda-allow-variadic-functions" "-fvisibility=hidden"
115 // CHECK-SAME: "-fapply-global-visibility-to-externs"
116 // CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
117 // CHECK-SAME: "-target-cpu" "gfx803"
118 // CHECK-SAME: {{.*}} "-o" [[OBJ_DEV_B_803:".*o"]] "-x" "hip"
119 // CHECK-SAME: {{.*}} [[B_SRC:".*b.hip"]]
121 // CHECK-NOT: {{".*llvm-link"}}
122 // CHECK-NOT: {{".*opt"}}
123 // CHECK-NOT: {{".*llc"}}
125 // CHECK: [[LLD]] "-flavor" "gnu" "-m" "elf64_amdgpu" "--no-undefined" "-shared"
126 // CHECK-SAME: "-o" "[[IMG_DEV_B_803:.*out]]" [[OBJ_DEV_B_803]]
129 // Compile device code in b.hip to code object for gfx900.
132 // CHECK: [[CLANG:".*clang.*"]] "-cc1" "-triple" "amdgcn-amd-amdhsa"
133 // CHECK-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
134 // CHECK-SAME: "-emit-obj"
135 // CHECK-SAME: {{.*}} "-main-file-name" "b.hip"
136 // CHECK-SAME: "-fcuda-is-device" "-mllvm" "-amdgpu-internalize-symbols"
137 // CHECK-SAME: "-fcuda-allow-variadic-functions" "-fvisibility=hidden"
138 // CHECK-SAME: "-fapply-global-visibility-to-externs"
139 // CHECK-SAME: "{{.*}}lib1.bc" "{{.*}}lib2.bc"
140 // CHECK-SAME: "-target-cpu" "gfx900"
141 // CHECK-SAME: {{.*}} "-o" [[OBJ_DEV_B_900:".*o"]] "-x" "hip"
142 // CHECK-SAME: {{.*}} [[B_SRC]]
144 // CHECK-NOT: {{".*llvm-link"}}
145 // CHECK-NOT: {{".*opt"}}
146 // CHECK-NOT: {{".*llc"}}
148 // CHECK: [[LLD]] "-flavor" "gnu" "-m" "elf64_amdgpu" "--no-undefined" "-shared"
149 // CHECK-SAME: "-o" "[[IMG_DEV_B_900:.*out]]" [[OBJ_DEV_B_900]]
152 // Bundle and embed device code in host object for b.hip.
155 // CHECK: [[BUNDLER:".*clang-offload-bundler"]] "-type=o"
156 // CHECK-SAME: "-bundle-align=4096"
157 // CHECK-SAME: "-targets={{.*}},hipv4-amdgcn-amd-amdhsa--gfx803,hipv4-amdgcn-amd-amdhsa--gfx900"
158 // CHECK-SAME: "-input={{.*}}" "-input=[[IMG_DEV_B_803]]" "-input=[[IMG_DEV_B_900]]" "-output=[[BUNDLE_A:.*hipfb]]"
160 // CHECK: [[CLANG]] "-cc1" "-triple" "x86_64-unknown-linux-gnu"
161 // CHECK-SAME: "-aux-triple" "amdgcn-amd-amdhsa"
162 // CHECK-SAME: "-emit-obj"
163 // CHECK-SAME: {{.*}} "-main-file-name" "b.hip"
164 // CHECK-SAME: {{.*}} "-fcuda-include-gpubinary" "[[BUNDLE_A]]"
165 // CHECK-SAME: {{.*}} "-o" [[B_OBJ_HOST:".*o"]] "-x" "hip"
166 // CHECK-SAME: {{.*}} [[B_SRC]]
169 // Link host objects.
172 // LINK-NOT: {{".*/llvm-link"}}
173 // LINK-NOT: {{".*/opt"}}
174 // LINK-NOT: {{".*/llc"}}
175 // LINK: [[LD:".*ld.*"]] {{.*}} [[A_OBJ_HOST]] [[B_OBJ_HOST]]
176 // LINK-NOT: "-T" "{{.*}}.lk"
178 // LKONLY-NOT: {{".*/llvm-link"}}
179 // LKONLY-NOT: {{".*/opt"}}
180 // LKONLY-NOT: {{".*/llc"}}
181 // LKONLY: [[LD:".*ld.*"]] {{.*}} "{{.*/a.o}}" "{{.*/b.o}}"
182 // LKONLY-NOT: "-T" "{{.*}}.lk"