| 1 |
// RUN: %clang -### --target=x86_64-linux-gnu --no-offload-new-driver \ |
| 2 |
// RUN: -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \ |
| 3 |
// RUN: -c -nogpuinc -nogpulib --cuda-device-only -fgpu-rdc \ |
| 4 |
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \ |
| 5 |
// RUN: %S/Inputs/hip_multiple_inputs/b.hip --gpu-bundle-output \ |
| 6 |
// RUN: 2>&1 | FileCheck -check-prefixes=COMMON,EMITBC %s |
| 7 |
|
| 8 |
// With `-emit-llvm`, the output should be the same as the aforementioned line |
| 9 |
// as `-fgpu-rdc` in HIP implies `-emit-llvm`. |
| 10 |
|
| 11 |
// RUN: %clang -### --target=x86_64-linux-gnu --no-offload-new-driver \ |
| 12 |
// RUN: -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \ |
| 13 |
// RUN: -c -emit-llvm -nogpuinc -nogpulib --cuda-device-only -fgpu-rdc \ |
| 14 |
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \ |
| 15 |
// RUN: %S/Inputs/hip_multiple_inputs/b.hip --gpu-bundle-output \ |
| 16 |
// RUN: 2>&1 | FileCheck -check-prefixes=COMMON,EMITBC %s |
| 17 |
|
| 18 |
// With `-fno-hip-emit-relocatable`, the output should be the same as the aforementioned line |
| 19 |
// as `-fgpu-rdc` in HIP implies `-fno-hip-emit-relocatable`. |
| 20 |
|
| 21 |
// RUN: %clang -### --target=x86_64-linux-gnu --no-offload-new-driver \ |
| 22 |
// RUN: -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \ |
| 23 |
// RUN: -c -fno-hip-emit-relocatable -nogpuinc -nogpulib --cuda-device-only -fgpu-rdc \ |
| 24 |
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \ |
| 25 |
// RUN: %S/Inputs/hip_multiple_inputs/b.hip --gpu-bundle-output \ |
| 26 |
// RUN: 2>&1 | FileCheck -check-prefixes=COMMON,EMITBC %s |
| 27 |
|
| 28 |
// RUN: %clang -### --target=x86_64-linux-gnu --no-offload-new-driver \ |
| 29 |
// RUN: -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \ |
| 30 |
// RUN: -S -nogpuinc -nogpulib --cuda-device-only -fgpu-rdc \ |
| 31 |
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \ |
| 32 |
// RUN: %S/Inputs/hip_multiple_inputs/b.hip --gpu-bundle-output \ |
| 33 |
// RUN: 2>&1 | FileCheck -check-prefixes=COMMON,EMITLL %s |
| 34 |
|
| 35 |
// With `-emit-llvm`, the output should be the same as the aforementioned line |
| 36 |
// as `-fgpu-rdc` in HIP implies `-emit-llvm`. |
| 37 |
|
| 38 |
// RUN: %clang -### --target=x86_64-linux-gnu --no-offload-new-driver \ |
| 39 |
// RUN: -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \ |
| 40 |
// RUN: -S -emit-llvm -nogpuinc -nogpulib --cuda-device-only -fgpu-rdc \ |
| 41 |
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \ |
| 42 |
// RUN: %S/Inputs/hip_multiple_inputs/b.hip --gpu-bundle-output \ |
| 43 |
// RUN: 2>&1 | FileCheck -check-prefixes=COMMON,EMITLL %s |
| 44 |
|
| 45 |
// With `-save-temps`, commane lines for each steps are dumped. For assembly |
| 46 |
// output, there should 3 steps (preprocessor, compile, and backend) per source |
| 47 |
// and per target, totally 12 steps. |
| 48 |
|
| 49 |
// RUN: %clang -### -save-temps --target=x86_64-linux-gnu --no-offload-new-driver \ |
| 50 |
// RUN: -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \ |
| 51 |
// RUN: -S -nogpuinc -nogpulib --cuda-device-only -fgpu-rdc \ |
| 52 |
// RUN: %S/Inputs/hip_multiple_inputs/a.cu \ |
| 53 |
// RUN: %S/Inputs/hip_multiple_inputs/b.hip --gpu-bundle-output \ |
| 54 |
// RUN: 2>&1 | FileCheck -check-prefix=SAVETEMP %s |
| 55 |
|
| 56 |
// Check output one file without bundling cause error. |
| 57 |
|
| 58 |
// RUN: not %clang -### --target=x86_64-linux-gnu --no-offload-new-driver \ |
| 59 |
// RUN: -x hip --cuda-gpu-arch=gfx803 --cuda-gpu-arch=gfx900 \ |
| 60 |
// RUN: -S -nogpuinc -nogpulib --cuda-device-only -fgpu-rdc \ |
| 61 |
// RUN: %S/Inputs/hip_multiple_inputs/a.cu -o %t.s --no-gpu-bundle-output \ |
| 62 |
// RUN: 2>&1 | FileCheck -check-prefix=FAIL %s |
| 63 |
|
| 64 |
// COMMON: [[CLANG:".*clang.*"]] "-cc1" "-triple" "amdgcn-amd-amdhsa" |
| 65 |
// COMMON-SAME: "-aux-triple" "x86_64-unknown-linux-gnu" |
| 66 |
// EMITBC-SAME: "-emit-llvm-bc" |
| 67 |
// EMITLL-SAME: "-emit-llvm" |
| 68 |
// COMMON-SAME: {{.*}} "-main-file-name" "a.cu" |
| 69 |
// COMMON-SAME: "-fcuda-is-device" "-fno-threadsafe-statics" "-fcuda-allow-variadic-functions" "-fvisibility=hidden" |
| 70 |
// COMMON-SAME: "-fapply-global-visibility-to-externs" |
| 71 |
// COMMON-SAME: "-target-cpu" "gfx803" |
| 72 |
// COMMON-SAME: "-fgpu-rdc" |
| 73 |
// EMITBC-SAME: {{.*}} "-o" {{".*a.*bc"}} "-x" "hip" |
| 74 |
// EMITLL-SAME: {{.*}} "-o" {{".*a.*ll"}} "-x" "hip" |
| 75 |
// CHECK-SAME: {{.*}} {{".*a.cu"}} |
| 76 |
|
| 77 |
// COMMON: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa" |
| 78 |
// COMMON-SAME: "-aux-triple" "x86_64-unknown-linux-gnu" |
| 79 |
// EMITBC-SAME: "-emit-llvm-bc" |
| 80 |
// EMITLL-SAME: "-emit-llvm" |
| 81 |
// COMMON-SAME: {{.*}} "-main-file-name" "a.cu" |
| 82 |
// COMMON-SAME: "-fcuda-is-device" "-fno-threadsafe-statics" "-fcuda-allow-variadic-functions" "-fvisibility=hidden" |
| 83 |
// COMMON-SAME: "-fapply-global-visibility-to-externs" |
| 84 |
// COMMON-SAME: "-target-cpu" "gfx900" |
| 85 |
// COMMON-SAME: "-fgpu-rdc" |
| 86 |
// EMITBC-SAME: {{.*}} "-o" {{".*a.*bc"}} "-x" "hip" |
| 87 |
// EMITLL-SAME: {{.*}} "-o" {{".*a.*ll"}} "-x" "hip" |
| 88 |
// COMMON-SAME: {{.*}} {{".*a.cu"}} |
| 89 |
|
| 90 |
// COMMON: "{{.*}}clang-offload-bundler" "-type={{(bc|ll)}}" |
| 91 |
// COMMON-SAME: "-targets=hip-amdgcn-amd-amdhsa-unknown-gfx803,hip-amdgcn-amd-amdhsa-unknown-gfx900" |
| 92 |
// COMMON-SAME: "-output=a-hip-amdgcn-amd-amdhsa.{{(bc|ll)}}" |
| 93 |
|
| 94 |
// COMMON: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa" |
| 95 |
// COMMON-SAME: "-aux-triple" "x86_64-unknown-linux-gnu" |
| 96 |
// EMITBC-SAME: "-emit-llvm-bc" |
| 97 |
// EMITLL-SAME: "-emit-llvm" |
| 98 |
// COMMON-SAME: {{.*}} "-main-file-name" "b.hip" |
| 99 |
// COMMON-SAME: "-fcuda-is-device" "-fno-threadsafe-statics" "-fcuda-allow-variadic-functions" "-fvisibility=hidden" |
| 100 |
// COMMON-SAME: "-fapply-global-visibility-to-externs" |
| 101 |
// COMMON-SAME: "-target-cpu" "gfx803" |
| 102 |
// COMMON-SAME: "-fgpu-rdc" |
| 103 |
// EMITBC-SAME: {{.*}} "-o" {{".*b.*bc"}} "-x" "hip" |
| 104 |
// EMITLL-SAME: {{.*}} "-o" {{".*b.*ll"}} "-x" "hip" |
| 105 |
// COMMON-SAME: {{.*}} {{".*b.hip"}} |
| 106 |
|
| 107 |
// COMMON: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa" |
| 108 |
// COMMON-SAME: "-aux-triple" "x86_64-unknown-linux-gnu" |
| 109 |
// EMITBC-SAME: "-emit-llvm-bc" |
| 110 |
// EMITLL-SAME: "-emit-llvm" |
| 111 |
// COMMON-SAME: {{.*}} "-main-file-name" "b.hip" |
| 112 |
// COMMON-SAME: "-fcuda-is-device" "-fno-threadsafe-statics" "-fcuda-allow-variadic-functions" "-fvisibility=hidden" |
| 113 |
// COMMON-SAME: "-fapply-global-visibility-to-externs" |
| 114 |
// COMMON-SAME: "-target-cpu" "gfx900" |
| 115 |
// COMMON-SAME: "-fgpu-rdc" |
| 116 |
// EMITBC-SAME: {{.*}} "-o" {{".*b.*bc"}} "-x" "hip" |
| 117 |
// EMITLL-SAME: {{.*}} "-o" {{".*b.*ll"}} "-x" "hip" |
| 118 |
// COMMON-SAME: {{.*}} {{".*b.hip"}} |
| 119 |
|
| 120 |
// COMMON: "{{.*}}clang-offload-bundler" "-type={{(bc|ll)}}" |
| 121 |
// COMMON-SAME: "-targets=hip-amdgcn-amd-amdhsa-unknown-gfx803,hip-amdgcn-amd-amdhsa-unknown-gfx900" |
| 122 |
// COMMON-SAME: "-output=b-hip-amdgcn-amd-amdhsa.{{(bc|ll)}}" |
| 123 |
|
| 124 |
// SAVETEMP: [[CLANG:".*clang.*"]] "-cc1" "-triple" "amdgcn-amd-amdhsa" "-aux-triple" "x86_64-unknown-linux-gnu" |
| 125 |
// SAVETEMP-SAME: "-E" |
| 126 |
// SAVETEMP-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx803" |
| 127 |
// SAVETEMP-SAME: {{.*}} "-o" [[A_GFX803_CUI:"a.*hipi"]] "-x" "hip" {{".*a.cu"}} |
| 128 |
// SAVETEMP-NEXT: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa" "-aux-triple" "x86_64-unknown-linux-gnu" |
| 129 |
// SAVETEMP-SAME: "-emit-llvm-bc" |
| 130 |
// SAVETEMP-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx803" |
| 131 |
// SAVETEMP-SAME: {{.*}} "-o" [[A_GFX803_TMP_BC:"a.*tmp.bc"]] "-x" "hip-cpp-output" [[A_GFX803_CUI]] |
| 132 |
// SAVETEMP-NEXT: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa" "-aux-triple" "x86_64-unknown-linux-gnu" |
| 133 |
// SAVETEMP-SAME: "-emit-llvm" |
| 134 |
// SAVETEMP-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx803" |
| 135 |
// SAVETEMP-SAME: {{.*}} "-o" {{"a.*.ll"}} "-x" "ir" [[A_GFX803_TMP_BC]] |
| 136 |
|
| 137 |
// SAVETEMP: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa" "-aux-triple" "x86_64-unknown-linux-gnu" |
| 138 |
// SAVETEMP-SAME: "-E" |
| 139 |
// SAVETEMP-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx900" |
| 140 |
// SAVETEMP-SAME: {{.*}} "-o" [[A_GFX900_CUI:"a.*hipi"]] "-x" "hip" {{".*a.cu"}} |
| 141 |
// SAVETEMP-NEXT: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa" "-aux-triple" "x86_64-unknown-linux-gnu" |
| 142 |
// SAVETEMP-SAME: "-emit-llvm-bc" |
| 143 |
// SAVETEMP-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx900" |
| 144 |
// SAVETEMP-SAME: {{.*}} "-o" [[A_GFX900_TMP_BC:"a.*tmp.bc"]] "-x" "hip-cpp-output" [[A_GFX900_CUI]] |
| 145 |
// SAVETEMP-NEXT: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa" "-aux-triple" "x86_64-unknown-linux-gnu" |
| 146 |
// SAVETEMP-SAME: "-emit-llvm" |
| 147 |
// SAVETEMP-SAME: {{.*}} "-main-file-name" "a.cu" {{.*}} "-target-cpu" "gfx900" |
| 148 |
// SAVETEMP-SAME: {{.*}} "-o" {{"a.*.ll"}} "-x" "ir" [[A_GFX900_TMP_BC]] |
| 149 |
|
| 150 |
// SAVETEMP: "{{.*}}clang-offload-bundler" "-type=ll" |
| 151 |
// SAVETEMP-SAME: "-targets=hip-amdgcn-amd-amdhsa-unknown-gfx803,hip-amdgcn-amd-amdhsa-unknown-gfx900" |
| 152 |
// SAVETEMP-SAME: "-output=a-hip-amdgcn-amd-amdhsa.ll" |
| 153 |
|
| 154 |
// SAVETEMP: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa" "-aux-triple" "x86_64-unknown-linux-gnu" |
| 155 |
// SAVETEMP-SAME: "-E" |
| 156 |
// SAVETEMP-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx803" |
| 157 |
// SAVETEMP-SAME: {{.*}} "-o" [[B_GFX803_CUI:"b.*hipi"]] "-x" "hip" {{".*b.hip"}} |
| 158 |
// SAVETEMP-NEXT: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa" "-aux-triple" "x86_64-unknown-linux-gnu" |
| 159 |
// SAVETEMP-SAME: "-emit-llvm-bc" |
| 160 |
// SAVETEMP-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx803" |
| 161 |
// SAVETEMP-SAME: {{.*}} "-o" [[B_GFX803_TMP_BC:"b.*tmp.bc"]] "-x" "hip-cpp-output" [[B_GFX803_CUI]] |
| 162 |
// SAVETEMP-NEXT: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa" "-aux-triple" "x86_64-unknown-linux-gnu" |
| 163 |
// SAVETEMP-SAME: "-emit-llvm" |
| 164 |
// SAVETEMP-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx803" |
| 165 |
// SAVETEMP-SAME: {{.*}} "-o" {{"b.*.ll"}} "-x" "ir" [[B_GFX803_TMP_BC]] |
| 166 |
|
| 167 |
// SAVETEMP: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa" "-aux-triple" "x86_64-unknown-linux-gnu" |
| 168 |
// SAVETEMP-SAME: "-E" |
| 169 |
// SAVETEMP-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx900" |
| 170 |
// SAVETEMP-SAME: {{.*}} "-o" [[B_GFX900_CUI:"b.*hipi"]] "-x" "hip" {{".*b.hip"}} |
| 171 |
// SAVETEMP-NEXT: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa" "-aux-triple" "x86_64-unknown-linux-gnu" |
| 172 |
// SAVETEMP-SAME: "-emit-llvm-bc" |
| 173 |
// SAVETEMP-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx900" |
| 174 |
// SAVETEMP-SAME: {{.*}} "-o" [[B_GFX900_TMP_BC:"b.*tmp.bc"]] "-x" "hip-cpp-output" [[B_GFX900_CUI]] |
| 175 |
// SAVETEMP-NEXT: [[CLANG]] "-cc1" "-triple" "amdgcn-amd-amdhsa" "-aux-triple" "x86_64-unknown-linux-gnu" |
| 176 |
// SAVETEMP-SAME: "-emit-llvm" |
| 177 |
// SAVETEMP-SAME: {{.*}} "-main-file-name" "b.hip" {{.*}} "-target-cpu" "gfx900" |
| 178 |
// SAVETEMP-SAME: {{.*}} "-o" {{"b.*.ll"}} "-x" "ir" [[B_GFX900_TMP_BC]] |
| 179 |
|
| 180 |
// SAVETEMP: "{{.*}}clang-offload-bundler" "-type=ll" |
| 181 |
// SAVETEMP-SAME: "-targets=hip-amdgcn-amd-amdhsa-unknown-gfx803,hip-amdgcn-amd-amdhsa-unknown-gfx900" |
| 182 |
// SAVETEMP-SAME: "-output=b-hip-amdgcn-amd-amdhsa.ll" |
| 183 |
|
| 184 |
// FAIL: error: cannot specify -o when generating multiple output files |