Debian Codegraph @

llvm-project/llvm/projects/llvm-spirv/test/phi-multiple-predecessors.spvasm

raw
1 ; REQUIRES: spirv-as
2 ; RUN: spirv-as --target-env spv1.0 -o %t.spv %s
3 ; RUN: spirv-val %t.spv
4 ; RUN: llvm-spirv -r -o - %t.spv | llvm-dis | FileCheck %s
5
6 OpCapability Kernel
7 OpCapability Addresses
8 OpCapability Int64
9 OpCapability Linkage
10 %1 = OpExtInstImport "OpenCL.std"
11 OpMemoryModel Physical64 OpenCL
12 OpSource OpenCL_CPP 100000
13 OpName %foo "foo"
14 OpName %get "get"
15 OpDecorate %foo LinkageAttributes "foo" Export
16 OpDecorate %get LinkageAttributes "get" Import
17 %uint = OpTypeInt 32 0
18 %3 = OpTypeFunction %uint
19 %ulong = OpTypeInt 64 0
20 %uint_2 = OpConstant %uint 2
21 %uint_4 = OpConstant %uint 4
22 %get = OpFunction %uint None %3
23 OpFunctionEnd
24 %foo = OpFunction %uint None %3
25 %11 = OpLabel
26 %9 = OpFunctionCall %uint %get
27 OpSwitch %9 %12 10 %13 4 %13 0 %13 42 %13
28 %12 = OpLabel
29 OpBranch %13
30 %13 = OpLabel
31 %10 = OpPhi %uint %uint_4 %11 %uint_2 %12
32 %14 = OpPhi %uint %uint_2 %12 %uint_4 %11
33 OpReturnValue %14
34 OpFunctionEnd
35
36 ; CHECK: phi i32 [ 4, %0 ], [ 4, %0 ], [ 4, %0 ], [ 4, %0 ], [ 2, %2 ]
37 ; CHECK: phi i32 [ 2, %2 ], [ 4, %0 ], [ 4, %0 ], [ 4, %0 ], [ 4, %0 ]