1e4e938f3SJoshua Batista; RUN: llc -O0 -mtriple=spirv-unknown-unknown %s -o - | FileCheck %s 2e4e938f3SJoshua Batista; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv-unknown-unknown %s -o - -filetype=obj | spirv-val %} 3e4e938f3SJoshua Batista 4e4e938f3SJoshua Batista; Make sure SPIRV operation function calls for length are lowered correctly. 5e4e938f3SJoshua Batista 6e4e938f3SJoshua Batista; CHECK-DAG: %[[#op_ext_glsl:]] = OpExtInstImport "GLSL.std.450" 7e4e938f3SJoshua Batista; CHECK-DAG: %[[#float_32:]] = OpTypeFloat 32 8e4e938f3SJoshua Batista; CHECK-DAG: %[[#float_16:]] = OpTypeFloat 16 9e4e938f3SJoshua Batista; CHECK-DAG: %[[#vec4_float_16:]] = OpTypeVector %[[#float_16]] 4 10e4e938f3SJoshua Batista; CHECK-DAG: %[[#vec4_float_32:]] = OpTypeVector %[[#float_32]] 4 11e4e938f3SJoshua Batista 12e4e938f3SJoshua Batistadefine noundef half @length_half4(<4 x half> noundef %a) { 13e4e938f3SJoshua Batistaentry: 14*90b04bf8SFarzon Lotfi ; CHECK: %[[#]] = OpFunction %[[#float_16]] None %[[#]] 15*90b04bf8SFarzon Lotfi ; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#vec4_float_16]] 16e4e938f3SJoshua Batista ; CHECK: %[[#]] = OpExtInst %[[#float_16]] %[[#op_ext_glsl]] Length %[[#arg0]] 17*90b04bf8SFarzon Lotfi %hlsl.length = call half @llvm.spv.length.f16(<4 x half> %a) 18e4e938f3SJoshua Batista ret half %hlsl.length 19e4e938f3SJoshua Batista} 20e4e938f3SJoshua Batista 21e4e938f3SJoshua Batistadefine noundef float @length_float4(<4 x float> noundef %a) { 22e4e938f3SJoshua Batistaentry: 23*90b04bf8SFarzon Lotfi ; CHECK: %[[#]] = OpFunction %[[#float_32]] None %[[#]] 24*90b04bf8SFarzon Lotfi ; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#vec4_float_32]] 25e4e938f3SJoshua Batista ; CHECK: %[[#]] = OpExtInst %[[#float_32]] %[[#op_ext_glsl]] Length %[[#arg0]] 26*90b04bf8SFarzon Lotfi %hlsl.length = call float @llvm.spv.length.f32(<4 x float> %a) 27e4e938f3SJoshua Batista ret float %hlsl.length 28e4e938f3SJoshua Batista} 29e4e938f3SJoshua Batista 30*90b04bf8SFarzon Lotfideclare half @llvm.spv.length.f16(<4 x half>) 31*90b04bf8SFarzon Lotfideclare float @llvm.spv.length.f32(<4 x float>) 32