1*cf3d6fdeSNathan Gauër; RUN: llc -O0 -verify-machineinstrs -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s 2c4c54af5SFarzon Lotfi; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %} 3c4c54af5SFarzon Lotfi 4c4c54af5SFarzon Lotfi; Make sure SPIRV operation function calls for lerp are generated as FMix 5c4c54af5SFarzon Lotfi 6c4c54af5SFarzon Lotfi; CHECK-DAG: %[[#op_ext_glsl:]] = OpExtInstImport "GLSL.std.450" 7c4c54af5SFarzon Lotfi; CHECK-DAG: %[[#float_32:]] = OpTypeFloat 32 8c4c54af5SFarzon Lotfi; CHECK-DAG: %[[#float_16:]] = OpTypeFloat 16 9c4c54af5SFarzon Lotfi; CHECK-DAG: %[[#vec4_float_16:]] = OpTypeVector %[[#float_16]] 4 10c4c54af5SFarzon Lotfi; CHECK-DAG: %[[#vec4_float_32:]] = OpTypeVector %[[#float_32]] 4 11c4c54af5SFarzon Lotfi 12c4c54af5SFarzon Lotfidefine noundef half @lerp_half(half noundef %a, half noundef %b, half noundef %c) { 13c4c54af5SFarzon Lotfientry: 14c4c54af5SFarzon Lotfi ; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]] 15c4c54af5SFarzon Lotfi ; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#]] 16c4c54af5SFarzon Lotfi ; CHECK: %[[#arg2:]] = OpFunctionParameter %[[#]] 17c4c54af5SFarzon Lotfi ; CHECK: %[[#]] = OpExtInst %[[#float_16]] %[[#op_ext_glsl]] FMix %[[#arg0]] %[[#arg1]] %[[#arg2]] 18c4c54af5SFarzon Lotfi %hlsl.lerp = call half @llvm.spv.lerp.f16(half %a, half %b, half %c) 19c4c54af5SFarzon Lotfi ret half %hlsl.lerp 20c4c54af5SFarzon Lotfi} 21c4c54af5SFarzon Lotfi 22c4c54af5SFarzon Lotfi 23c4c54af5SFarzon Lotfidefine noundef float @lerp_float(float noundef %a, float noundef %b, float noundef %c) { 24c4c54af5SFarzon Lotfientry: 25c4c54af5SFarzon Lotfi ; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]] 26c4c54af5SFarzon Lotfi ; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#]] 27c4c54af5SFarzon Lotfi ; CHECK: %[[#arg2:]] = OpFunctionParameter %[[#]] 28c4c54af5SFarzon Lotfi ; CHECK: %[[#]] = OpExtInst %[[#float_32]] %[[#op_ext_glsl]] FMix %[[#arg0]] %[[#arg1]] %[[#arg2]] 29c4c54af5SFarzon Lotfi %hlsl.lerp = call float @llvm.spv.lerp.f32(float %a, float %b, float %c) 30c4c54af5SFarzon Lotfi ret float %hlsl.lerp 31c4c54af5SFarzon Lotfi} 32c4c54af5SFarzon Lotfi 33c4c54af5SFarzon Lotfidefine noundef <4 x half> @lerp_half4(<4 x half> noundef %a, <4 x half> noundef %b, <4 x half> noundef %c) { 34c4c54af5SFarzon Lotfientry: 35c4c54af5SFarzon Lotfi ; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]] 36c4c54af5SFarzon Lotfi ; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#]] 37c4c54af5SFarzon Lotfi ; CHECK: %[[#arg2:]] = OpFunctionParameter %[[#]] 38c4c54af5SFarzon Lotfi ; CHECK: %[[#]] = OpExtInst %[[#vec4_float_16]] %[[#op_ext_glsl]] FMix %[[#arg0]] %[[#arg1]] %[[#arg2]] 39c4c54af5SFarzon Lotfi %hlsl.lerp = call <4 x half> @llvm.spv.lerp.v4f16(<4 x half> %a, <4 x half> %b, <4 x half> %c) 40c4c54af5SFarzon Lotfi ret <4 x half> %hlsl.lerp 41c4c54af5SFarzon Lotfi} 42c4c54af5SFarzon Lotfi 43c4c54af5SFarzon Lotfidefine noundef <4 x float> @lerp_float4(<4 x float> noundef %a, <4 x float> noundef %b, <4 x float> noundef %c) { 44c4c54af5SFarzon Lotfientry: 45c4c54af5SFarzon Lotfi ; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#]] 46c4c54af5SFarzon Lotfi ; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#]] 47c4c54af5SFarzon Lotfi ; CHECK: %[[#arg2:]] = OpFunctionParameter %[[#]] 48c4c54af5SFarzon Lotfi ; CHECK: %[[#]] = OpExtInst %[[#vec4_float_32]] %[[#op_ext_glsl]] FMix %[[#arg0]] %[[#arg1]] %[[#arg2]] 49c4c54af5SFarzon Lotfi %hlsl.lerp = call <4 x float> @llvm.spv.lerp.v4f32(<4 x float> %a, <4 x float> %b, <4 x float> %c) 50c4c54af5SFarzon Lotfi ret <4 x float> %hlsl.lerp 51c4c54af5SFarzon Lotfi} 52c4c54af5SFarzon Lotfi 53c4c54af5SFarzon Lotfideclare half @llvm.spv.lerp.f16(half, half, half) 54c4c54af5SFarzon Lotfideclare float @llvm.spv.lerp.f32(float, float, float) 55c4c54af5SFarzon Lotfideclare <4 x half> @llvm.spv.lerp.v4f16(<4 x half>, <4 x half>, <4 x half>) 56c4c54af5SFarzon Lotfideclare <4 x float> @llvm.spv.lerp.v4f32(<4 x float>, <4 x float>, <4 x float>) 57