Debian Codegraph @

clang/test/Driver/hip-spirv-backend-opt.c

raw
1 // This test case validates the behavior of -use-spirv-backend
2
3 // --offload-device-only is always set --- testing interactions with -S and -fgpu-rdc
4
5 // RUN: %clang --offload-new-driver --target=x86_64-unknown-linux-gnu --offload-arch=amdgcnspirv \
6 // RUN: -nogpuinc -nogpulib -### -x hip %s -save-temps \
7 // RUN: -use-spirv-backend --offload-device-only -S -no-canonical-prefixes \
8 // RUN: 2>&1 | FileCheck %s --check-prefixes=CHECK-SPIRV-TRANSLATOR,CHECK-SPIRV-BACKEND-TEXTUAL
9
10 // RUN: %clang --offload-new-driver --target=x86_64-unknown-linux-gnu --offload-arch=amdgcnspirv \
11 // RUN: -nogpuinc -nogpulib -### -x hip %s -save-temps \
12 // RUN: -use-spirv-backend --offload-device-only -no-canonical-prefixes \
13 // RUN: 2>&1 | FileCheck %s --check-prefixes=CHECK-SPIRV-TRANSLATOR,CHECK-SPIRV-BACKEND-BINARY
14
15 // The new driver's behavior is to emit LLVM IR for --offload-device-only and -fgpu-rdc (independently of SPIR-V).
16 // RUN: %clang --offload-new-driver --target=x86_64-unknown-linux-gnu --offload-arch=amdgcnspirv \
17 // RUN: -### -nogpuinc -nogpulib -x hip %s -save-temps \
18 // RUN: -use-spirv-backend --offload-device-only -S -fgpu-rdc -no-canonical-prefixes \
19 // RUN: 2>&1 | FileCheck %s --check-prefixes=CHECK-SPIRV-TRANSLATOR,CHECK-SPIRV-BACKEND-LL,CHECK-FGPU-RDC
20
21 // The new driver's behavior is to emit LLVM IR for --offload-device-only and -fgpu-rdc (independently of SPIR-V).
22 // RUN: %clang --offload-new-driver --target=x86_64-unknown-linux-gnu --offload-arch=amdgcnspirv \
23 // RUN: -nogpuinc -nogpulib -### -x hip %s -save-temps \
24 // RUN: -use-spirv-backend --offload-device-only -fgpu-rdc -no-canonical-prefixes \
25 // RUN: 2>&1 | FileCheck %s --check-prefixes=CHECK-SPIRV-TRANSLATOR,CHECK-SPIRV-BACKEND-BC,CHECK-FGPU-RDC
26
27 // --offload-device-only is always unset --- testing interactions with -S and -fgpu-rdc
28
29 // RUN: %clang --offload-new-driver --target=x86_64-unknown-linux-gnu --offload-arch=amdgcnspirv \
30 // RUN: -nogpuinc -nogpulib -### -x hip %s -save-temps \
31 // RUN: -use-spirv-backend -S -fgpu-rdc -no-canonical-prefixes \
32 // RUN: 2>&1 | FileCheck %s --check-prefixes=CHECK-SPIRV-TRANSLATOR,CHECK-SPIRV-BACKEND-BC,CHECK-FGPU-RDC
33
34 // RUN: %clang --offload-new-driver --target=x86_64-unknown-linux-gnu --offload-arch=amdgcnspirv \
35 // RUN: -nogpuinc -nogpulib -### -x hip %s -save-temps \
36 // RUN: -use-spirv-backend -S -no-canonical-prefixes \
37 // RUN: 2>&1 | FileCheck %s --check-prefixes=CHECK-SPIRV-TRANSLATOR,CHECK-SPIRV-BACKEND-BC
38
39 // RUN: %clang --offload-new-driver --target=x86_64-unknown-linux-gnu --offload-arch=amdgcnspirv \
40 // RUN: -nogpuinc -nogpulib -### -x hip %s -save-temps \
41 // RUN: -use-spirv-backend -fgpu-rdc -no-canonical-prefixes \
42 // RUN: 2>&1 | FileCheck %s --check-prefixes=CHECK-SPIRV-TRANSLATOR,CHECK-SPIRV-BACKEND-BC,CHECK-CLANG-LINKER-WRAPPER
43
44 // RUN: %clang --offload-new-driver --target=x86_64-unknown-linux-gnu --offload-arch=amdgcnspirv \
45 // RUN: -nogpuinc -nogpulib -### -x hip %s -save-temps \
46 // RUN: -use-spirv-backend -no-canonical-prefixes \
47 // RUN: 2>&1 | FileCheck %s --check-prefixes=CHECK-SPIRV-TRANSLATOR,CHECK-SPIRV-BACKEND-BC,CHECK-CLANG-LINKER-WRAPPER
48
49 // RUN: %clang --no-offload-new-driver --target=x86_64-unknown-linux-gnu --offload-arch=amdgcnspirv \
50 // RUN: -nogpuinc -nogpulib -### -x hip %s -save-temps \
51 // RUN: -use-spirv-backend -no-canonical-prefixes \
52 // RUN: 2>&1 | FileCheck %s --check-prefixes=CHECK-SPIRV-TRANSLATOR,CHECK-SPIRV-BACKEND-BC,CHECK-SPIRV-BACKEND-BINARY-EQ-TRIPLE
53
54 // CHECK-SPIRV-TRANSLATOR-NOT: "{{.*llvm-spirv.*}}"
55 // CHECK-SPIRV-BACKEND-TEXTUAL: "{{.*clang(\.exe)?}}" "-cc1" "-triple" "spirv64-amd-amdhsa" {{.*}} "-S"
56 // CHECK-SPIRV-BACKEND-BINARY: "{{.*clang(\.exe)?}}" "-cc1" "-triple" "spirv64-amd-amdhsa" {{.*}} "-emit-obj"
57 // CHECK-SPIRV-BACKEND-BC: "{{.*clang(\.exe)?}}" "-cc1" "-triple" "spirv64-amd-amdhsa" {{.*}} "-emit-llvm-bc"
58 // CHECK-SPIRV-BACKEND-LL: "{{.*clang(\.exe)?}}" "-cc1" "-triple" "spirv64-amd-amdhsa" {{.*}} "-emit-llvm"
59 // CHECK-SPIRV-BACKEND-BINARY-EQ-TRIPLE: "{{.*clang(\.exe)?}}" "-cc1" {{.*}}"-triple=spirv64-amd-amdhsa" {{.*}}"-emit-obj"
60 // CHECK-FGPU-RDC-SAME: {{.*}} "-fgpu-rdc"
61 // CHECK-CLANG-LINKER-WRAPPER: "{{.*}}clang-linker-wrapper" "--should-extract=amdgcnspirv" {{.*}} "--device-compiler=spirv64-amd-amdhsa=-use-spirv-backend"