blob: 962c19bdff160198c03384b719aeb60db8c11286 [file] [edit]
// Tests the driver when linking LLVM IR bitcode files and targeting SPIR-V
// architecture.
//
// REQUIRES: spirv-registered-target
//
// Test that -Xlinker options are being passed to clang-sycl-linker.
// RUN: touch %t.bc
// RUN: %clangxx -### --target=spirv64 --sycl-link -Xlinker --test-arg-1 -Xlinker --test-arg-2=value1,value2 %t.bc 2>&1 \
// RUN: | FileCheck %s -check-prefix=XLINKEROPTS
// XLINKEROPTS: "{{.*}}clang-sycl-linker{{.*}}" "--test-arg-1" "--test-arg-2=value1,value2" "{{.*}}.bc" "-o" "a.out"
// Test that -v is forwarded to clang-sycl-linker when --sycl-link is used.
// RUN: touch %t.bc
// RUN: %clangxx -### --target=spirv64 --sycl-link -v %t.bc 2>&1 \
// RUN: | FileCheck %s -check-prefix=VERBOSE
// VERBOSE: "{{.*}}clang-sycl-linker{{.*}}" {{.*}}"-v"
// Test that -triple is propagated from --target and passed to clang-sycl-linker.
// Test that no -march= results in no -arch= in clang-sycl-linker command line.
// RUN: %clangxx -### --target=spirv64-unknown-unknown --sycl-link %t.bc 2>&1 \
// RUN: | FileCheck %s -check-prefix=FINALIZE --implicit-check-not=-arch
// FINALIZE: "{{.*}}clang-sycl-linker{{.*}}" "-triple=spirv64-unknown-unknown" "{{.*}}.bc" "-o" "a.out"{{$}}
// Test -triple=/-arch= passed to clang-sycl-linker, when they are
// passed via -Xlinker, and derived from --target/-march=.
// Test that the target triple is passed on as spelled rather than padded out to a full triple.
// RUN: %clangxx -### --target=spirv64 --sycl-link -march=bmg_g21 -Xlinker -triple=spirv64-unknown-unknown -Xlinker -arch=bar %t.bc 2>&1 \
// RUN: | FileCheck %s -check-prefix=OVERRIDE
// OVERRIDE: "{{.*}}clang-sycl-linker{{.*}}" "-triple=spirv64" "-arch=bmg_g21" "-triple=spirv64-unknown-unknown" "-arch=bar" "{{.*}}.bc" "-o" "a.out"{{$}}