Debian Codegraph @

clang/test/Driver/spirv-toolchain.cl

raw
1 // Check object emission.
2 // RUN: %clang -### --target=spirv64 -x cl -c %s 2>&1 | FileCheck --check-prefix=SPV64 %s
3 // RUN: %clang -### --target=spirv64 %s 2>&1 | FileCheck --check-prefix=SPV64 %s
4 // RUN: %clang -### --target=spirv64 -x ir -c %s 2>&1 | FileCheck --check-prefix=SPV64 %s
5 // RUN: %clang -### --target=spirv64 -x clcpp -c %s 2>&1 | FileCheck --check-prefix=SPV64 %s
6 // RUN: %clang -### --target=spirv64 -x c -c %s 2>&1 | FileCheck --check-prefix=SPV64 %s
7
8 // SPV64: "-cc1" "-triple" "spirv64"
9 // SPV64-SAME: "-o" {{".*o"}}
10
11 // RUN: %clang -### --target=spirv32 -x cl -c %s 2>&1 | FileCheck --check-prefix=SPV32 %s
12 // RUN: %clang -### --target=spirv32 %s 2>&1 | FileCheck --check-prefix=SPV32 %s
13 // RUN: %clang -### --target=spirv32 -x ir -c %s 2>&1 | FileCheck --check-prefix=SPV32 %s
14 // RUN: %clang -### --target=spirv32 -x clcpp -c %s 2>&1 | FileCheck --check-prefix=SPV32 %s
15 // RUN: %clang -### --target=spirv32 -x c -c %s 2>&1 | FileCheck --check-prefix=SPV32 %s
16
17 // SPV32: "-cc1" "-triple" "spirv32"
18 // SPV32-SAME: "-o" {{".*o"}}
19
20 //-----------------------------------------------------------------------------
21 // Check Assembly emission.
22 // RUN: %clang -### --target=spirv64 -x cl -S %s 2>&1 | FileCheck --check-prefix=SPT64 %s
23 // RUN: %clang -### --target=spirv64 -x ir -S %s 2>&1 | FileCheck --check-prefix=SPT64 %s
24 // RUN: %clang -### --target=spirv64 -x clcpp -c %s 2>&1 | FileCheck --check-prefix=SPV64 %s
25 // RUN: %clang -### --target=spirv64 -x c -S %s 2>&1 | FileCheck --check-prefix=SPT64 %s
26
27 // SPT64: "-cc1" "-triple" "spirv64"
28 // SPT64-SAME: "-o" {{".*s"}}
29
30 // RUN: %clang -### --target=spirv32 -x cl -S %s 2>&1 | FileCheck --check-prefix=SPT32 %s
31 // RUN: %clang -### --target=spirv32 -x ir -S %s 2>&1 | FileCheck --check-prefix=SPT32 %s
32 // RUN: %clang -### --target=spirv32 -x clcpp -c %s 2>&1 | FileCheck --check-prefix=SPV32 %s
33 // RUN: %clang -### --target=spirv32 -x c -S %s 2>&1 | FileCheck --check-prefix=SPT32 %s
34
35 // SPT32: "-cc1" "-triple" "spirv32"
36 // SPT32-SAME: "-o" {{".*s"}}
37
38 //-----------------------------------------------------------------------------
39 // Check assembly input -> object output
40 // RUN: %clang -### --target=spirv64 -x assembler -c %s 2>&1 | FileCheck --check-prefix=ASM %s
41 // RUN: %clang -### --target=spirv32 -x assembler -c %s 2>&1 | FileCheck --check-prefix=ASM %s
42 // ASM: {{spirv-as.*"}} {{".*"}} "-o" {{".*o"}}
43
44 //-----------------------------------------------------------------------------
45 // Check --save-temps.
46 // RUN: %clang -### --target=spirv64 -x cl -c %s --save-temps 2>&1 | FileCheck --check-prefix=TMP %s
47
48 // TMP: "-cc1" "-triple" "spirv64"
49 // TMP-SAME: "-E"
50 // TMP-SAME: "-o" [[I:".*i"]]
51 // TMP: "-cc1" "-triple" "spirv64"
52 // TMP-SAME: "-o" [[BC:".*bc"]]
53 // TMP-SAME: [[I]]
54 // TMP: "-cc1"
55 // TMP-SAME: "-o" [[S:".*s"]]
56 // TMP-SAME: [[BC]]
57 // TMP: {{spirv-as.*"}} [[S]] "-o" {{".*o"}}
58
59 //-----------------------------------------------------------------------------
60 // Check linking when multiple input files are passed.
61 // RUN: %clang -### -target spirv64 %s %s 2>&1 | FileCheck --check-prefix=SPLINK %s
62
63 // SPLINK: "-cc1" "-triple" "spirv64"
64 // SPLINK-SAME: "-o" [[SPV1:".*o"]]
65 // SPLINK: "-cc1" "-triple" "spirv64"
66 // SPLINK-SAME: "-o" [[SPV2:".*o"]]
67 // SPLINK: {{spirv-link.*"}} [[SPV1]] [[SPV2]] "-o" "a.out"
68
69 //-----------------------------------------------------------------------------
70 // Check bindings when linking when multiple input files are passed.
71 // RUN: %clang -### -target spirv64 -ccc-print-bindings %s %s 2>&1 | FileCheck --check-prefix=SPLINK-BINDINGS %s
72
73 // SPLINK-BINDINGS: "clang", inputs: [[[CL:".*cl"]]], output: [[OBJ1:".*o"]]
74 // SPLINK-BINDINGS: "clang", inputs: [[[CL]]], output: [[OBJ2:".*o"]]
75 // SPLINK-BINDINGS: "SPIR-V::Linker", inputs: [[[OBJ1]], [[OBJ2]]], output: "a.out"
76
77 //-----------------------------------------------------------------------------
78 // Check external vs internal object emission.
79 // RUN: %clang -### --target=spirv64 -fno-integrated-objemitter %s 2>&1 | FileCheck --check-prefix=XTOR %s
80 // RUN: %clang -### --target=spirv64 -fintegrated-objemitter %s 2>&1 | FileCheck --check-prefix=BACKEND %s
81
82 // XTOR-NOT: "llvm-spirv.*"
83 // BACKEND-NOT: "llvm-spirv.*"
84
85 //-----------------------------------------------------------------------------
86 // Check spirv-as-<LLVM_VERSION_MAJOR> is used if it is found in PATH.
87 //
88 // This test uses the PATH environment variable; on Windows, we may need to retain
89 // the original path for the built Clang binary to be able to execute (as it is
90 // used for locating dependent DLLs). Therefore, skip this test on system-windows.
91 //
92 // RUN: mkdir -p %t/versioned
93 // RUN: touch %t/versioned/spirv-as-%llvm-version-major \
94 // RUN: && chmod +x %t/versioned/spirv-as-%llvm-version-major
95 // RUN: %if !system-windows && !system-cygwin %{ env "PATH=%t/versioned" %clang -### --target=spirv64 -x cl -c --save-temps %s 2>&1 \
96 // RUN: | FileCheck -DVERSION=%llvm-version-major --check-prefix=VERSIONED %s %}
97
98 // VERSIONED: {{.*}}spirv-as-[[VERSION]]