Debian Codegraph @

llvm/test/CodeGen/SPIRV/optimizations/switch-condition-type.ll

raw
1 ; RUN: llc -O2 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s
2 ; RUN: %if spirv-tools %{ llc -O2 -mtriple=spirv32-unknown-unknown %s -o - -filetype=obj | spirv-val %}
3
4 ; CHECK: %[[#INT16:]] = OpTypeInt 16 0
5 ; CHECK: %[[#PARAM:]] = OpFunctionParameter %[[#INT16]]
6 ; CHECK: OpSwitch %[[#PARAM]] %[[#]] 1 %[[#]] 2 %[[#]]
7
8 define i32 @test_switch(i16 %cond) {
9 entry:
10 switch i16 %cond, label %default [ i16 1, label %case_one
11 i16 2, label %case_two ]
12 case_one:
13 ret i32 1
14 case_two:
15 ret i32 2
16 default:
17 ret i32 3
18 }