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: "-no-opaque-pointers"
10// SPV64-SAME: "-o" [[BC:".*bc"]]
11// SPV64: {{llvm-spirv.*"}} [[BC]] "-o" {{".*o"}}
12
13// RUN: %clang -### --target=spirv32 -x cl -c %s 2>&1 | FileCheck --check-prefix=SPV32 %s
14// RUN: %clang -### --target=spirv32 %s 2>&1 | FileCheck --check-prefix=SPV32 %s
15// RUN: %clang -### --target=spirv32 -x ir -c %s 2>&1 | FileCheck --check-prefix=SPV32 %s
16// RUN: %clang -### --target=spirv32 -x clcpp -c %s 2>&1 | FileCheck --check-prefix=SPV32 %s
17// RUN: %clang -### --target=spirv32 -x c -c %s 2>&1 | FileCheck --check-prefix=SPV32 %s
18
19// SPV32: "-cc1" "-triple" "spirv32"
20// SPV32-SAME: "-no-opaque-pointers"
21// SPV32-SAME: "-o" [[BC:".*bc"]]
22// SPV32: {{llvm-spirv.*"}} [[BC]] "-o" {{".*o"}}
23
24//-----------------------------------------------------------------------------
25// Check Assembly emission.
26// RUN: %clang -### --target=spirv64 -x cl -S %s 2>&1 | FileCheck --check-prefix=SPT64 %s
27// RUN: %clang -### --target=spirv64 -x ir -S %s 2>&1 | FileCheck --check-prefix=SPT64 %s
28// RUN: %clang -### --target=spirv64 -x clcpp -c %s 2>&1 | FileCheck --check-prefix=SPV64 %s
29// RUN: %clang -### --target=spirv64 -x c -S %s 2>&1 | FileCheck --check-prefix=SPT64 %s
30
31// SPT64: "-cc1" "-triple" "spirv64"
32// SPT64-SAME: "-o" [[BC:".*bc"]]
33// SPT64: {{llvm-spirv.*"}} [[BC]] "--spirv-tools-dis" "-o" {{".*s"}}
34
35// RUN: %clang -### --target=spirv32 -x cl -S %s 2>&1 | FileCheck --check-prefix=SPT32 %s
36// RUN: %clang -### --target=spirv32 -x ir -S %s 2>&1 | FileCheck --check-prefix=SPT32 %s
37// RUN: %clang -### --target=spirv32 -x clcpp -c %s 2>&1 | FileCheck --check-prefix=SPV32 %s
38// RUN: %clang -### --target=spirv32 -x c -S %s 2>&1 | FileCheck --check-prefix=SPT32 %s
39
40// SPT32: "-cc1" "-triple" "spirv32"
41// SPT32-SAME: "-o" [[BC:".*bc"]]
42// SPT32: {{llvm-spirv.*"}} [[BC]] "--spirv-tools-dis" "-o" {{".*s"}}
43
44//-----------------------------------------------------------------------------
45// Check assembly input -> object output
46// RUN: %clang -### --target=spirv64 -x assembler -c %s 2>&1 | FileCheck --check-prefix=ASM %s
47// RUN: %clang -### --target=spirv32 -x assembler -c %s 2>&1 | FileCheck --check-prefix=ASM %s
48// ASM: {{llvm-spirv.*"}} {{".*"}} "-to-binary" "-o" {{".*o"}}
49
50//-----------------------------------------------------------------------------
51// Check --save-temps.
52// RUN: %clang -### --target=spirv64 -x cl -c %s --save-temps 2>&1 | FileCheck --check-prefix=TMP %s
53
54// TMP: "-cc1" "-triple" "spirv64"
55// TMP-SAME: "-E"
56// TMP-SAME: "-o" [[I:".*i"]]
57// TMP: "-cc1" "-triple" "spirv64"
58// TMP-SAME: "-o" [[BC:".*bc"]]
59// TMP-SAME: [[I]]
60// TMP: {{llvm-spirv.*"}} [[BC]] "--spirv-tools-dis" "-o" [[S:".*s"]]
61// TMP: {{llvm-spirv.*"}} [[S]] "-to-binary" "-o" {{".*o"}}
62
63//-----------------------------------------------------------------------------
64// Check linking when multiple input files are passed.
65// RUN: %clang -### -target spirv64 %s %s 2>&1 | FileCheck --check-prefix=SPLINK %s
66
67// SPLINK: "-cc1" "-triple" "spirv64"
68// SPLINK-SAME: "-o" [[BC:".*bc"]]
69// SPLINK: {{llvm-spirv.*"}} [[BC]] "-o" [[SPV1:".*o"]]
70// SPLINK: "-cc1" "-triple" "spirv64"
71// SPLINK-SAME: "-o" [[BC:".*bc"]]
72// SPLINK: {{llvm-spirv.*"}} [[BC]] "-o" [[SPV2:".*o"]]
73// SPLINK: {{spirv-link.*"}} [[SPV1]] [[SPV2]] "-o" "a.out"
74
75//-----------------------------------------------------------------------------
76// Check external vs internal object emission.
77// RUN: %clang -### --target=spirv64 -fno-integrated-objemitter %s 2>&1 | FileCheck --check-prefix=XTOR %s
78// RUN: %clang -### --target=spirv64 -fintegrated-objemitter %s 2>&1 | FileCheck --check-prefix=BACKEND %s
79
80// XTOR: {{llvm-spirv.*"}}
81// BACKEND-NOT: {{llvm-spirv.*"}}
82