1 ; RUN: llc -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 ; CHECK-SPIRV-DAG: %[[#TyInt32:]] = OpTypeInt 32 0
5 ; CHECK-SPIRV-DAG: %[[#TyInt16:]] = OpTypeInt 16 0
6 ; CHECK-SPIRV-DAG: %[[#TyHalf:]] = OpTypeFloat 16
7 ; CHECK-SPIRV-DAG: %[[#Arg32:]] = OpFunctionParameter %[[#TyInt32]]
8 ; CHECK-SPIRV-DAG: %[[#Arg16:]] = OpUConvert %[[#TyInt16]] %[[#Arg32]]
9 ; CHECK-SPIRV-DAG: %[[#ValHalf:]] = OpBitcast %[[#TyHalf]] %8
10 ; CHECK-SPIRV-DAG: %[[#ValHalf2:]] = OpFMul %[[#TyHalf]] %[[#ValHalf]] %[[#ValHalf]]
11 ; CHECK-SPIRV-DAG: %[[#Res16:]] = OpBitcast %[[#TyInt16]] %[[#ValHalf2]]
12 ; CHECK-SPIRV-DAG: OpReturnValue %[[#Res16]]
14 define i16 @foo(i32 %arg) {
16 %op16 = trunc i32 %arg to i16
17 %val = bitcast i16 %op16 to half
18 %val2 = fmul half %val, %val
19 %res = bitcast half %val2 to i16