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