1 ;; __kernel void test_switch(__global int* res, uchar val)
17 ; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV
19 ; CHECK-SPIRV: OpSwitch %[[#]] %[[#]] 0 %[[#]] 1 %[[#]] 2 %[[#]]
21 define spir_kernel void @test_switch(i32 addrspace(1)* %res, i8 zeroext %val) {
23 %res.addr = alloca i32 addrspace(1)*, align 4
24 %val.addr = alloca i8, align 1
25 store i32 addrspace(1)* %res, i32 addrspace(1)** %res.addr, align 4
26 store i8 %val, i8* %val.addr, align 1
27 %0 = load i8, i8* %val.addr, align 1
28 switch i8 %0, label %sw.epilog [
34 sw.bb: ; preds = %entry
35 %1 = load i32 addrspace(1)*, i32 addrspace(1)** %res.addr, align 4
36 store i32 1, i32 addrspace(1)* %1, align 4
39 sw.bb1: ; preds = %entry
40 %2 = load i32 addrspace(1)*, i32 addrspace(1)** %res.addr, align 4
41 store i32 2, i32 addrspace(1)* %2, align 4
44 sw.bb2: ; preds = %entry
45 %3 = load i32 addrspace(1)*, i32 addrspace(1)** %res.addr, align 4
46 store i32 3, i32 addrspace(1)* %3, align 4
49 sw.epilog: ; preds = %entry, %sw.bb2, %sw.bb1, %sw.bb