[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Driver / spirv-toolchain.cl
blobeff02f809ce83c281649a8ffb27d38f824f1128e
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
8 // SPV64: "-cc1" "-triple" "spirv64"
9 // SPV64-SAME: "-o" [[BC:".*bc"]]
10 // SPV64: {{llvm-spirv.*"}} [[BC]] "-o" {{".*o"}}
12 // RUN: %clang -### --target=spirv32 -x cl -c %s 2>&1 | FileCheck --check-prefix=SPV32 %s
13 // RUN: %clang -### --target=spirv32 %s 2>&1 | FileCheck --check-prefix=SPV32 %s
14 // RUN: %clang -### --target=spirv32 -x ir -c %s 2>&1 | FileCheck --check-prefix=SPV32 %s
15 // RUN: %clang -### --target=spirv32 -x clcpp -c %s 2>&1 | FileCheck --check-prefix=SPV32 %s
16 // RUN: %clang -### --target=spirv32 -x c -c %s 2>&1 | FileCheck --check-prefix=SPV32 %s
18 // SPV32: "-cc1" "-triple" "spirv32"
19 // SPV32-SAME: "-o" [[BC:".*bc"]]
20 // SPV32: {{llvm-spirv.*"}} [[BC]] "-o" {{".*o"}}
22 //-----------------------------------------------------------------------------
23 // Check Assembly emission.
24 // RUN: %clang -### --target=spirv64 -x cl -S %s 2>&1 | FileCheck --check-prefix=SPT64 %s
25 // RUN: %clang -### --target=spirv64 -x ir -S %s 2>&1 | FileCheck --check-prefix=SPT64 %s
26 // RUN: %clang -### --target=spirv64 -x clcpp -c %s 2>&1 | FileCheck --check-prefix=SPV64 %s
27 // RUN: %clang -### --target=spirv64 -x c -S %s 2>&1 | FileCheck --check-prefix=SPT64 %s
29 // SPT64: "-cc1" "-triple" "spirv64"
30 // SPT64-SAME: "-o" [[BC:".*bc"]]
31 // SPT64: {{llvm-spirv.*"}} [[BC]] "--spirv-tools-dis" "-o" {{".*s"}}
33 // RUN: %clang -### --target=spirv32 -x cl -S %s 2>&1 | FileCheck --check-prefix=SPT32 %s
34 // RUN: %clang -### --target=spirv32 -x ir -S %s 2>&1 | FileCheck --check-prefix=SPT32 %s
35 // RUN: %clang -### --target=spirv32 -x clcpp -c %s 2>&1 | FileCheck --check-prefix=SPV32 %s
36 // RUN: %clang -### --target=spirv32 -x c -S %s 2>&1 | FileCheck --check-prefix=SPT32 %s
38 // SPT32: "-cc1" "-triple" "spirv32"
39 // SPT32-SAME: "-o" [[BC:".*bc"]]
40 // SPT32: {{llvm-spirv.*"}} [[BC]] "--spirv-tools-dis" "-o" {{".*s"}}
42 //-----------------------------------------------------------------------------
43 // Check assembly input -> object output
44 // RUN: %clang -### --target=spirv64 -x assembler -c %s 2>&1 | FileCheck --check-prefix=ASM %s
45 // RUN: %clang -### --target=spirv32 -x assembler -c %s 2>&1 | FileCheck --check-prefix=ASM %s
46 // ASM: {{llvm-spirv.*"}} {{".*"}} "-to-binary" "-o" {{".*o"}}
48 //-----------------------------------------------------------------------------
49 // Check --save-temps.
50 // RUN: %clang -### --target=spirv64 -x cl -c %s --save-temps 2>&1 | FileCheck --check-prefix=TMP %s
52 // TMP: "-cc1" "-triple" "spirv64"
53 // TMP-SAME: "-E"
54 // TMP-SAME: "-o" [[I:".*i"]]
55 // TMP: "-cc1" "-triple" "spirv64"
56 // TMP-SAME: "-o" [[BC:".*bc"]]
57 // TMP-SAME: [[I]]
58 // TMP: {{llvm-spirv.*"}} [[BC]] "--spirv-tools-dis" "-o" [[S:".*s"]]
59 // TMP: {{llvm-spirv.*"}} [[S]] "-to-binary" "-o" {{".*o"}}
61 //-----------------------------------------------------------------------------
62 // Check linking when multiple input files are passed.
63 // RUN: %clang -### -target spirv64 %s %s 2>&1 | FileCheck --check-prefix=SPLINK %s
65 // SPLINK: "-cc1" "-triple" "spirv64"
66 // SPLINK-SAME: "-o" [[BC:".*bc"]]
67 // SPLINK: {{llvm-spirv.*"}} [[BC]] "-o" [[SPV1:".*o"]]
68 // SPLINK: "-cc1" "-triple" "spirv64"
69 // SPLINK-SAME: "-o" [[BC:".*bc"]]
70 // SPLINK: {{llvm-spirv.*"}} [[BC]] "-o" [[SPV2:".*o"]]
71 // SPLINK: {{spirv-link.*"}} [[SPV1]] [[SPV2]] "-o" "a.out"
73 //-----------------------------------------------------------------------------
74 // Check external vs internal object emission.
75 // RUN: %clang -### --target=spirv64 -fno-integrated-objemitter %s 2>&1 | FileCheck --check-prefix=XTOR %s
76 // RUN: %clang -### --target=spirv64 -fintegrated-objemitter %s 2>&1 | FileCheck --check-prefix=BACKEND %s
78 // XTOR: {{llvm-spirv.*"}}
79 // BACKEND-NOT: {{llvm-spirv.*"}}
81 //-----------------------------------------------------------------------------
82 // Check llvm-spirv-<LLVM_VERSION_MAJOR> is used if it is found in PATH.
84 // This test uses the PATH environment variable; on Windows, we may need to retain
85 // the original path for the built Clang binary to be able to execute (as it is
86 // used for locating dependent DLLs). Therefore, skip this test on system-windows.
88 // RUN: mkdir -p %t/versioned
89 // RUN: touch %t/versioned/llvm-spirv-%llvm-version-major \
90 // RUN: && chmod +x %t/versioned/llvm-spirv-%llvm-version-major
91 // RUN: %if !system-windows %{ env "PATH=%t/versioned" %clang -### --target=spirv64 -x cl -c %s 2>&1 \
92 // RUN: | FileCheck -DVERSION=%llvm-version-major --check-prefix=VERSIONED %s %}
94 // VERSIONED: {{.*}}llvm-spirv-[[VERSION]]