xref: /llvm-project/llvm/test/CodeGen/SPIRV/optimizations/switch-condition-type.ll (revision ca6386073308d3c41647d8fc3e2cf72a77d46c76)
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
8define i32 @test_switch(i16 %cond) {
9entry:
10  switch i16 %cond, label %default [ i16 1, label %case_one
11                                     i16 2, label %case_two ]
12case_one:
13  ret i32 1
14case_two:
15  ret i32 2
16default:
17  ret i32 3
18}
19