|
1 | | -// Tests the clang-sycl-linker tool |
| 1 | +// Tests the clang-sycl-linker tool. |
2 | 2 | // |
3 | | -// Test a simple case without arguments |
| 3 | +// Test a simple case without arguments. |
4 | 4 | // RUN: %clangxx -fsycl -emit-llvm -c %s -o %t.bc |
| 5 | +// RUN: clang-sycl-linker --dry-run -triple spirv64 %t.bc -o a.spv 2>&1 \ |
| 6 | +// RUN: | FileCheck %s --check-prefix=SIMPLE |
| 7 | +// SIMPLE: "{{.*}}llvm-link{{.*}}" {{.*}}.bc -o [[FIRSTLLVMLINKOUT:.*]].bc --suppress-warnings |
| 8 | +// SIMPLE-NEXT: "{{.*}}llvm-spirv{{.*}}" {{.*}}-o a.spv [[FIRSTLLVMLINKOUT]].bc |
| 9 | +// |
| 10 | +// Test a simple case with device library files specified. |
5 | 11 | // RUN: echo ' ' > %T/lib1.bc |
6 | 12 | // RUN: echo ' ' > %T/lib2.bc |
7 | 13 | // RUN: clang-sycl-linker --dry-run -triple spirv64 %t.bc --library-path=%T --device-libs=lib1.bc,lib2.bc -o a.spv 2>&1 \ |
8 | | -// RUN: | FileCheck %s --check-prefix=CMDS |
9 | | -// CMDS: "{{.*}}llvm-link{{.*}}" {{.*}}.bc -o [[FIRSTLLVMLINKOUT:.*]].bc --suppress-warnings |
10 | | -// CMDS-NEXT: "{{.*}}llvm-link{{.*}}" -only-needed [[FIRSTLLVMLINKOUT]].bc {{.*}}lib1.bc {{.*}}lib2.bc -o [[SECONDLLVMLINKOUT:.*]].bc --suppress-warnings |
11 | | -// CMDS-NEXT: "{{.*}}llvm-spirv{{.*}}" {{.*}}-o a.spv [[SECONDLLVMLINKOUT]].bc |
| 14 | +// RUN: | FileCheck %s --check-prefix=DEVLIBS |
| 15 | +// DEVLIBS: "{{.*}}llvm-link{{.*}}" {{.*}}.bc -o [[FIRSTLLVMLINKOUT:.*]].bc --suppress-warnings |
| 16 | +// DEVLIBS-NEXT: "{{.*}}llvm-link{{.*}}" -only-needed [[FIRSTLLVMLINKOUT]].bc {{.*}}lib1.bc {{.*}}lib2.bc -o [[SECONDLLVMLINKOUT:.*]].bc --suppress-warnings |
| 17 | +// DEVLIBS-NEXT: "{{.*}}llvm-spirv{{.*}}" {{.*}}-o a.spv [[SECONDLLVMLINKOUT]].bc |
| 18 | +// |
| 19 | +// Test a simple case with .o (fat object) as input. |
| 20 | +// TODO: Remove this test once fat object support is added. |
| 21 | +// RUN: %clangxx -fsycl -c %s -o %t.o |
| 22 | +// RUN: not clang-sycl-linker --dry-run -triple spirv64 %t.o -o a.spv 2>&1 \ |
| 23 | +// RUN: | FileCheck %s --check-prefix=FILETYPEERROR |
| 24 | +// FILETYPEERROR: Unsupported file type |
| 25 | +// |
| 26 | +// Test to see if device library related errors are emitted. |
| 27 | +// RUN: not clang-sycl-linker --dry-run -triple spirv64 %t.bc --library-path=%T --device-libs= -o a.spv 2>&1 \ |
| 28 | +// RUN: | FileCheck %s --check-prefix=DEVLIBSERR1 |
| 29 | +// DEVLIBSERR1: Number of device library files cannot be zero |
| 30 | +// RUN: not clang-sycl-linker --dry-run -triple spirv64 %t.bc --library-path=%T --device-libs=lib3.bc -o a.spv 2>&1 \ |
| 31 | +// RUN: | FileCheck %s --check-prefix=DEVLIBSERR2 |
| 32 | +// DEVLIBSERR2: SYCL device library file is not found |
| 33 | +// |
| 34 | +// Test if correct set of llvm-spirv options are emitted for windows environment. |
| 35 | +// RUN: clang-sycl-linker --dry-run -triple spirv64 --is-windows-msvc-env %t.bc -o a.spv 2>&1 \ |
| 36 | +// RUN: | FileCheck %s --check-prefix=LLVMOPTSWIN |
| 37 | +// LLVMOPTSWIN: -spirv-debug-info-version=ocl-100 -spirv-allow-extra-diexpressions -spirv-allow-unknown-intrinsics=llvm.genx. -spirv-ext= |
| 38 | +// |
| 39 | +// Test if correct set of llvm-spirv options are emitted for linux environment. |
| 40 | +// RUN: clang-sycl-linker --dry-run -triple spirv64 %t.bc -o a.spv 2>&1 \ |
| 41 | +// RUN: | FileCheck %s --check-prefix=LLVMOPTSLIN |
| 42 | +// LLVMOPTSLIN: -spirv-debug-info-version=nonsemantic-shader-200 -spirv-allow-unknown-intrinsics=llvm.genx. -spirv-ext= |
| 43 | +// |
| 44 | +// Test that no llvm-spirv error is emitted as expected. |
| 45 | +// RUN: not clang-sycl-linker -triple spirv64 %t.bc -o a.spv 2>&1 \ |
| 46 | +// RUN: | FileCheck %s --check-prefix=LLVMSPIRVERR |
| 47 | +// LLVMSPIRVERR: Unable to find 'llvm-spirv' in path |
0 commit comments