brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.7 KiB · 83ba0d2 Raw
57 lines · plain
1; RUN: llc -O0 -verify-machineinstrs -mtriple=spirv-unknown-vulkan %s -o - | FileCheck %s2; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-vulkan %s -o - -filetype=obj | spirv-val %}3 4; Make sure SPIRV operation function calls for lerp are generated as FMix5 6; CHECK-DAG: %[[#op_ext_glsl:]] = OpExtInstImport "GLSL.std.450"7; CHECK-DAG: %[[#float_32:]] = OpTypeFloat 328; CHECK-DAG: %[[#float_16:]] = OpTypeFloat 169; CHECK-DAG: %[[#vec4_float_16:]] = OpTypeVector %[[#float_16]] 410; CHECK-DAG: %[[#vec4_float_32:]] = OpTypeVector %[[#float_32]] 411 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.lerp20}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.lerp31}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.lerp41}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.lerp51}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