• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// REQUIRES: clang-driver
2// REQUIRES: x86-registered-target
3// REQUIRES: amdgpu-registered-target
4
5// RUN: %clang -### -target x86_64-linux-gnu \
6// RUN:   -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
7// RUN:   -c -nogpuinc -nogpulib --cuda-device-only -fgpu-rdc \
8// RUN:   %S/Inputs/hip_multiple_inputs/a.cu \
9// RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
10// RUN: 2>&1 | FileCheck -check-prefixes=COMMON,EMITBC %s
11
12// With `-emit-llvm`, the output should be the same as the aforementioned line
13// as `-fgpu-rdc` in HIP implies `-emit-llvm`.
14
15// RUN: %clang -### -target x86_64-linux-gnu \
16// RUN:   -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
17// RUN:   -c -emit-llvm -nogpuinc -nogpulib --cuda-device-only -fgpu-rdc \
18// RUN:   %S/Inputs/hip_multiple_inputs/a.cu \
19// RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
20// RUN: 2>&1 | FileCheck -check-prefixes=COMMON,EMITBC %s
21
22// RUN: %clang -### -target x86_64-linux-gnu \
23// RUN:   -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
24// RUN:   -S -nogpuinc -nogpulib --cuda-device-only -fgpu-rdc \
25// RUN:   %S/Inputs/hip_multiple_inputs/a.cu \
26// RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
27// RUN: 2>&1 | FileCheck -check-prefixes=COMMON,EMITLL %s
28
29// With `-emit-llvm`, the output should be the same as the aforementioned line
30// as `-fgpu-rdc` in HIP implies `-emit-llvm`.
31
32// RUN: %clang -### -target x86_64-linux-gnu \
33// RUN:   -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
34// RUN:   -S -emit-llvm -nogpuinc -nogpulib --cuda-device-only -fgpu-rdc \
35// RUN:   %S/Inputs/hip_multiple_inputs/a.cu \
36// RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
37// RUN: 2>&1 | FileCheck -check-prefixes=COMMON,EMITLL %s
38
39// With `-save-temps`, commane lines for each steps are dumped. For assembly
40// output, there should 3 steps (preprocessor, compile, and backend) per source
41// and per target, totally 12 steps.
42
43// RUN: %clang -### -save-temps -target x86_64-linux-gnu \
44// RUN:   -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \
45// RUN:   -S -nogpuinc -nogpulib --cuda-device-only -fgpu-rdc \
46// RUN:   %S/Inputs/hip_multiple_inputs/a.cu \
47// RUN:   %S/Inputs/hip_multiple_inputs/b.hip \
48// RUN: 2>&1 | FileCheck -check-prefix=SAVETEMP %s
49
50// COMMON: [[CLANG:".*clang.*"]] "-cc1" "-mllvm" "--amdhsa-code-object-version=4" "-triple" "amdgcn-amd-amdhsa"
51// COMMON-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
52// EMITBC-SAME: "-emit-llvm-bc"
53// EMITLL-SAME: "-emit-llvm"
54// COMMON-SAME: {{.*}} "-main-file-name" "a.cu"
55// COMMON-SAME: "-fcuda-is-device" "-fgpu-rdc" "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
56// COMMON-SAME: "-fapply-global-visibility-to-externs"
57// COMMON-SAME: "-target-cpu" "gfx803"
58// EMITBC-SAME: {{.*}} "-o" {{"a.*bc"}} "-x" "hip"
59// EMITLL-SAME: {{.*}} "-o" {{"a.*ll"}} "-x" "hip"
60// CHECK-SAME: {{.*}} {{".*a.cu"}}
61
62// COMMON: [[CLANG]] "-cc1" "-mllvm" "--amdhsa-code-object-version=4" "-triple" "amdgcn-amd-amdhsa"
63// COMMON-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
64// EMITBC-SAME: "-emit-llvm-bc"
65// EMITLL-SAME: "-emit-llvm"
66// COMMON-SAME: {{.*}} "-main-file-name" "a.cu"
67// COMMON-SAME: "-fcuda-is-device" "-fgpu-rdc" "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
68// COMMON-SAME: "-fapply-global-visibility-to-externs"
69// COMMON-SAME: "-target-cpu" "gfx900"
70// EMITBC-SAME: {{.*}} "-o" {{"a.*bc"}} "-x" "hip"
71// EMITLL-SAME: {{.*}} "-o" {{"a.*ll"}} "-x" "hip"
72// COMMON-SAME: {{.*}} {{".*a.cu"}}
73
74// COMMON: [[CLANG]] "-cc1" "-mllvm" "--amdhsa-code-object-version=4" "-triple" "amdgcn-amd-amdhsa"
75// COMMON-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
76// EMITBC-SAME: "-emit-llvm-bc"
77// EMITLL-SAME: "-emit-llvm"
78// COMMON-SAME: {{.*}} "-main-file-name" "b.hip"
79// COMMON-SAME: "-fcuda-is-device" "-fgpu-rdc" "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
80// COMMON-SAME: "-fapply-global-visibility-to-externs"
81// COMMON-SAME: "-target-cpu" "gfx803"
82// EMITBC-SAME: {{.*}} "-o" {{"b.*bc"}} "-x" "hip"
83// EMITLL-SAME: {{.*}} "-o" {{"b.*ll"}} "-x" "hip"
84// COMMON-SAME: {{.*}} {{".*b.hip"}}
85
86// COMMON: [[CLANG]] "-cc1" "-mllvm" "--amdhsa-code-object-version=4" "-triple" "amdgcn-amd-amdhsa"
87// COMMON-SAME: "-aux-triple" "x86_64-unknown-linux-gnu"
88// EMITBC-SAME: "-emit-llvm-bc"
89// EMITLL-SAME: "-emit-llvm"
90// COMMON-SAME: {{.*}} "-main-file-name" "b.hip"
91// COMMON-SAME: "-fcuda-is-device" "-fgpu-rdc" "-fcuda-allow-variadic-functions" "-fvisibility" "hidden"
92// COMMON-SAME: "-fapply-global-visibility-to-externs"
93// COMMON-SAME: "-target-cpu" "gfx900"
94// EMITBC-SAME: {{.*}} "-o" {{"b.*bc"}} "-x" "hip"
95// EMITLL-SAME: {{.*}} "-o" {{"b.*ll"}} "-x" "hip"
96// COMMON-SAME: {{.*}} {{".*b.hip"}}
97
98// SAVETEMP: [[CLANG:".*clang.*"]] "-cc1" "-mllvm" "--amdhsa-code-object-version=4" "-triple" "amdgcn-amd-amdhsa" "-aux-triple" "x86_64-unknown-linux-gnu"
99// SAVETEMP-SAME: "-E"
100// SAVETEMP-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx803"
101// SAVETEMP-SAME: {{.*}} "-o" [[A_GFX803_CUI:"a.*cui"]] "-x" "hip" {{".*a.cu"}}
102// SAVETEMP-NEXT: [[CLANG]] "-cc1" "-mllvm" "--amdhsa-code-object-version=4" "-triple" "amdgcn-amd-amdhsa" "-aux-triple" "x86_64-unknown-linux-gnu"
103// SAVETEMP-SAME: "-emit-llvm-bc"
104// SAVETEMP-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx803"
105// SAVETEMP-SAME: {{.*}} "-o" [[A_GFX803_TMP_BC:"a.*tmp.bc"]] "-x" "hip-cpp-output" [[A_GFX803_CUI]]
106// SAVETEMP-NEXT: [[CLANG]] "-cc1" "-mllvm" "--amdhsa-code-object-version=4" "-triple" "amdgcn-amd-amdhsa" "-aux-triple" "x86_64-unknown-linux-gnu"
107// SAVETEMP-SAME: "-emit-llvm"
108// SAVETEMP-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx803"
109// SAVETEMP-SAME: {{.*}} "-o" {{"a.*.ll"}} "-x" "ir" [[A_GFX803_TMP_BC]]
110
111// SAVETEMP: [[CLANG]] "-cc1" "-mllvm" "--amdhsa-code-object-version=4" "-triple" "amdgcn-amd-amdhsa" "-aux-triple" "x86_64-unknown-linux-gnu"
112// SAVETEMP-SAME: "-E"
113// SAVETEMP-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx900"
114// SAVETEMP-SAME: {{.*}} "-o" [[A_GFX900_CUI:"a.*cui"]] "-x" "hip" {{".*a.cu"}}
115// SAVETEMP-NEXT: [[CLANG]] "-cc1" "-mllvm" "--amdhsa-code-object-version=4" "-triple" "amdgcn-amd-amdhsa" "-aux-triple" "x86_64-unknown-linux-gnu"
116// SAVETEMP-SAME: "-emit-llvm-bc"
117// SAVETEMP-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx900"
118// SAVETEMP-SAME: {{.*}} "-o" [[A_GFX900_TMP_BC:"a.*tmp.bc"]] "-x" "hip-cpp-output" [[A_GFX900_CUI]]
119// SAVETEMP-NEXT: [[CLANG]] "-cc1" "-mllvm" "--amdhsa-code-object-version=4" "-triple" "amdgcn-amd-amdhsa" "-aux-triple" "x86_64-unknown-linux-gnu"
120// SAVETEMP-SAME: "-emit-llvm"
121// SAVETEMP-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx900"
122// SAVETEMP-SAME: {{.*}} "-o" {{"a.*.ll"}} "-x" "ir" [[A_GFX900_TMP_BC]]
123
124// SAVETEMP: [[CLANG]] "-cc1" "-mllvm" "--amdhsa-code-object-version=4" "-triple" "amdgcn-amd-amdhsa" "-aux-triple" "x86_64-unknown-linux-gnu"
125// SAVETEMP-SAME: "-E"
126// SAVETEMP-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx803"
127// SAVETEMP-SAME: {{.*}} "-o" [[B_GFX803_CUI:"b.*cui"]] "-x" "hip" {{".*b.hip"}}
128// SAVETEMP-NEXT: [[CLANG]] "-cc1" "-mllvm" "--amdhsa-code-object-version=4" "-triple" "amdgcn-amd-amdhsa" "-aux-triple" "x86_64-unknown-linux-gnu"
129// SAVETEMP-SAME: "-emit-llvm-bc"
130// SAVETEMP-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx803"
131// SAVETEMP-SAME: {{.*}} "-o" [[B_GFX803_TMP_BC:"b.*tmp.bc"]] "-x" "hip-cpp-output" [[B_GFX803_CUI]]
132// SAVETEMP-NEXT: [[CLANG]] "-cc1" "-mllvm" "--amdhsa-code-object-version=4" "-triple" "amdgcn-amd-amdhsa" "-aux-triple" "x86_64-unknown-linux-gnu"
133// SAVETEMP-SAME: "-emit-llvm"
134// SAVETEMP-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx803"
135// SAVETEMP-SAME: {{.*}} "-o" {{"b.*.ll"}} "-x" "ir" [[B_GFX803_TMP_BC]]
136
137// SAVETEMP: [[CLANG]] "-cc1" "-mllvm" "--amdhsa-code-object-version=4" "-triple" "amdgcn-amd-amdhsa" "-aux-triple" "x86_64-unknown-linux-gnu"
138// SAVETEMP-SAME: "-E"
139// SAVETEMP-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx900"
140// SAVETEMP-SAME: {{.*}} "-o" [[B_GFX900_CUI:"b.*cui"]] "-x" "hip" {{".*b.hip"}}
141// SAVETEMP-NEXT: [[CLANG]] "-cc1" "-mllvm" "--amdhsa-code-object-version=4" "-triple" "amdgcn-amd-amdhsa" "-aux-triple" "x86_64-unknown-linux-gnu"
142// SAVETEMP-SAME: "-emit-llvm-bc"
143// SAVETEMP-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx900"
144// SAVETEMP-SAME: {{.*}} "-o" [[B_GFX900_TMP_BC:"b.*tmp.bc"]] "-x" "hip-cpp-output" [[B_GFX900_CUI]]
145// SAVETEMP-NEXT: [[CLANG]] "-cc1" "-mllvm" "--amdhsa-code-object-version=4" "-triple" "amdgcn-amd-amdhsa" "-aux-triple" "x86_64-unknown-linux-gnu"
146// SAVETEMP-SAME: "-emit-llvm"
147// SAVETEMP-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx900"
148// SAVETEMP-SAME: {{.*}} "-o" {{"b.*.ll"}} "-x" "ir" [[B_GFX900_TMP_BC]]
149