1 ; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
2 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}
4 ; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
5 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown %s -o - -filetype=obj | spirv-val %}
7 define i32 @test_switch_branches(i32 %a) {
10 ; CHECK-SPIRV: OpSwitch %[[#]] %[[#DEFAULT:]] 1 %[[#CASE1:]] 2 %[[#CASE2:]] 3 %[[#CASE3:]]
11 switch i32 %a, label %default [
18 store i32 1, ptr %alloc
22 store i32 2, ptr %alloc
26 store i32 3, ptr %alloc
30 store i32 0, ptr %alloc
34 %result = load i32, ptr %alloc
37 ; CHECK-SPIRV: %[[#DEFAULT]] = OpLabel
38 ; CHECK-SPIRV: OpBranch %[[#END:]]
40 ; CHECK-SPIRV: %[[#CASE1]] = OpLabel
41 ; CHECK-SPIRV: OpBranch %[[#END]]
43 ; CHECK-SPIRV: %[[#CASE2]] = OpLabel
44 ; CHECK-SPIRV: OpBranch %[[#END]]
46 ; CHECK-SPIRV: %[[#CASE3]] = OpLabel
47 ; CHECK-SPIRV: OpBranch %[[#END]]
49 ; CHECK-SPIRV: %[[#END]] = OpLabel
50 ; CHECK-SPIRV: OpReturnValue