1; RUN: llc -O0 -verify-machineinstrs -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 %} 3 4; Make sure SPIRV operation function calls for lerp are generated as FMix 5 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 11 12define noundef half @lerp_half(half noundef %a, half noundef %b, half noundef %c) { 13entry: 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) 19 ret half %hlsl.lerp 20} 21 22 23define noundef float @lerp_float(float noundef %a, float noundef %b, float noundef %c) { 24entry: 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) 30 ret float %hlsl.lerp 31} 32 33define noundef <4 x half> @lerp_half4(<4 x half> noundef %a, <4 x half> noundef %b, <4 x half> noundef %c) { 34entry: 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 41} 42 43define noundef <4 x float> @lerp_float4(<4 x float> noundef %a, <4 x float> noundef %b, <4 x float> noundef %c) { 44entry: 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 51} 52 53declare half @llvm.spv.lerp.f16(half, half, half) 54declare float @llvm.spv.lerp.f32(float, float, float) 55declare <4 x half> @llvm.spv.lerp.v4f16(<4 x half>, <4 x half>, <4 x half>) 56declare <4 x float> @llvm.spv.lerp.v4f32(<4 x float>, <4 x float>, <4 x float>) 57