1 ; RUN: llc -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s
2 ; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %}
4 ; Make sure SPIRV operation function calls for lerp are generated as FMix
6 ; CHECK-DAG: %[[#op_ext_glsl:]] = OpExtInstImport "GLSL.std.450"
7 ; CHECK-DAG: %[[#float_32:]] = OpTypeFloat 32
8 ; CHECK-DAG: %[[#float_16:]] = OpTypeFloat 16
9 ; CHECK-DAG: %[[#vec4_float_16:]] = OpTypeVector %[[#float_16]] 4
10 ; CHECK-DAG: %[[#vec4_float_32:]] = OpTypeVector %[[#float_32]] 4
12 define noundef half @lerp_half(half noundef %a, half noundef %b, half noundef %c) {
14 ; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]]
15 ; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#]]
16 ; CHECK: %[[#arg2:]] = OpFunctionParameter %[[#]]
17 ; CHECK: %[[#]] = OpExtInst %[[#float_16]] %[[#op_ext_glsl]] FMix %[[#arg0]] %[[#arg1]] %[[#arg2]]
18 %hlsl.lerp = call half @llvm.spv.lerp.f16(half %a, half %b, half %c)
23 define noundef float @lerp_float(float noundef %a, float noundef %b, float noundef %c) {
25 ; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]]
26 ; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#]]
27 ; CHECK: %[[#arg2:]] = OpFunctionParameter %[[#]]
28 ; CHECK: %[[#]] = OpExtInst %[[#float_32]] %[[#op_ext_glsl]] FMix %[[#arg0]] %[[#arg1]] %[[#arg2]]
29 %hlsl.lerp = call float @llvm.spv.lerp.f32(float %a, float %b, float %c)
33 define noundef <4 x half> @lerp_half4(<4 x half> noundef %a, <4 x half> noundef %b, <4 x half> noundef %c) {
35 ; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]]
36 ; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#]]
37 ; CHECK: %[[#arg2:]] = OpFunctionParameter %[[#]]
38 ; CHECK: %[[#]] = OpExtInst %[[#vec4_float_16]] %[[#op_ext_glsl]] FMix %[[#arg0]] %[[#arg1]] %[[#arg2]]
39 %hlsl.lerp = call <4 x half> @llvm.spv.lerp.v4f16(<4 x half> %a, <4 x half> %b, <4 x half> %c)
40 ret <4 x half> %hlsl.lerp
43 define noundef <4 x float> @lerp_float4(<4 x float> noundef %a, <4 x float> noundef %b, <4 x float> noundef %c) {
45 ; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]]
46 ; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#]]
47 ; CHECK: %[[#arg2:]] = OpFunctionParameter %[[#]]
48 ; CHECK: %[[#]] = OpExtInst %[[#vec4_float_32]] %[[#op_ext_glsl]] FMix %[[#arg0]] %[[#arg1]] %[[#arg2]]
49 %hlsl.lerp = call <4 x float> @llvm.spv.lerp.v4f32(<4 x float> %a, <4 x float> %b, <4 x float> %c)
50 ret <4 x float> %hlsl.lerp
53 declare half @llvm.spv.lerp.f16(half, half, half)
54 declare float @llvm.spv.lerp.f32(float, float, float)
55 declare <4 x half> @llvm.spv.lerp.v4f16(<4 x half>, <4 x half>, <4 x half>)
56 declare <4 x float> @llvm.spv.lerp.v4f32(<4 x float>, <4 x float>, <4 x float>)