1 /// Perform several driver tests for SYCL offloading for JIT 2 3 /// Check the phases graph with -fsycl. Use of -fsycl enables offload 4 // RUN: %clang -ccc-print-phases --target=x86_64-unknown-linux-gnu -fsycl %s 2>&1 \ 5 // RUN: | FileCheck -check-prefixes=CHK-PHASES %s 6 // RUN: %clang_cl -ccc-print-phases --target=x86_64-pc-windows-msvc -fsycl -- %s 2>&1 \ 7 // RUN: | FileCheck -check-prefixes=CHK-PHASES %s 8 // CHK-PHASES: 0: input, "[[INPUT:.+\.cpp]]", c++, (host-sycl) 9 // CHK-PHASES-NEXT: 1: preprocessor, {0}, c++-cpp-output, (host-sycl) 10 // CHK-PHASES-NEXT: 2: compiler, {1}, ir, (host-sycl) 11 // CHK-PHASES-NEXT: 3: input, "[[INPUT]]", c++, (device-sycl) 12 // CHK-PHASES-NEXT: 4: preprocessor, {3}, c++-cpp-output, (device-sycl) 13 // CHK-PHASES-NEXT: 5: compiler, {4}, ir, (device-sycl) 14 // CHK-PHASES-NEXT: 6: backend, {5}, ir, (device-sycl) 15 // CHK-PHASES-NEXT: 7: offload, "device-sycl (spirv64-unknown-unknown)" {6}, ir 16 // CHK-PHASES-NEXT: 8: clang-offload-packager, {7}, image, (device-sycl) 17 // CHK-PHASES-NEXT: 9: offload, "host-sycl (x86_64{{.*}})" {2}, "device-sycl (x86_64{{.*}})" {8}, ir 18 // CHK-PHASES-NEXT: 10: backend, {9}, assembler, (host-sycl) 19 // CHK-PHASES-NEXT: 11: assembler, {10}, object, (host-sycl) 20 // CHK-PHASES-NEXT: 12: clang-linker-wrapper, {11}, image, (host-sycl) 21 22 /// Check expected default values for device compilation when using -fsycl as 23 /// well as clang-offload-packager inputs. 24 // RUN: %clang -### -fsycl -c --target=x86_64-unknown-linux-gnu %s 2>&1 \ 25 // RUN: | FileCheck -check-prefix=CHK-DEVICE-TRIPLE %s 26 // CHK-DEVICE-TRIPLE: "-cc1"{{.*}} "-triple" "spirv64-unknown-unknown" 27 // CHK-DEVICE-TRIPLE-SAME: "-aux-triple" "x86_64-unknown-linux-gnu" 28 // CHK-DEVICE-TRIPLE-SAME: "-fsycl-is-device" 29 // CHK-DEVICE-TRIPLE-SAME: "-O2" 30 // CHK-DEVICE-TRIPLE: clang-offload-packager{{.*}} "--image=file={{.*}}.bc,triple=spirv64-unknown-unknown,arch=,kind=sycl" 31 32 /// Check -fsycl-is-device is passed when compiling for the device. 33 /// Check -fsycl-is-host is passed when compiling for host. 34 // RUN: %clang -### -fsycl -c %s 2>&1 \ 35 // RUN: | FileCheck -check-prefixes=CHK-FSYCL-IS-DEVICE,CHK-FSYCL-IS-HOST %s 36 // RUN: %clang -### -fsycl -fsycl-device-only %s 2>&1 \ 37 // RUN: | FileCheck -check-prefix=CHK-FSYCL-IS-DEVICE %s 38 // RUN: %clang_cl -### -fsycl -c -- %s 2>&1 \ 39 // RUN: | FileCheck -check-prefixes=CHK-FSYCL-IS-DEVICE,CHK-FSYCL-IS-HOST %s 40 // RUN: %clang -### -fsycl -fsycl-host-only %s 2>&1 \ 41 // RUN: | FileCheck -check-prefix=CHK-FSYCL-IS-HOST %s 42 // CHK-FSYCL-IS-DEVICE: "-cc1"{{.*}} "-fsycl-is-device" {{.*}} "-emit-llvm-bc" 43 // CHK-FSYCL-IS-HOST: "-cc1"{{.*}} "-fsycl-is-host" 44 45 /// Check for option incompatibility with -fsycl 46 // RUN: not %clang -### -fsycl -ffreestanding %s 2>&1 \ 47 // RUN: | FileCheck -check-prefix=CHK-INCOMPATIBILITY %s -DINCOMPATOPT=-ffreestanding 48 // RUN: not %clang -### -fsycl --offload-new-driver -static-libstdc++ %s 2>&1 \ 49 // RUN: | FileCheck -check-prefix=CHK-INCOMPATIBILITY %s -DINCOMPATOPT=-static-libstdc++ 50 // CHK-INCOMPATIBILITY: error: invalid argument '[[INCOMPATOPT]]' not allowed with '-fsycl' 51