brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.2 KiB · ed32917 Raw
46 lines · plain
1; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown %s -o - | FileCheck %s2; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s3; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown %s -o - -filetype=obj | spirv-val %}4; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown %s -o - -filetype=obj | spirv-val %}5 6; CHECK-DAG: %[[#op_ext_cl:]] = OpExtInstImport "OpenCL.std"7 8; CHECK-DAG: %[[#float_16:]] = OpTypeFloat 169; CHECK-DAG: %[[#vec4_float_16:]] = OpTypeVector %[[#float_16]] 410; CHECK-DAG: %[[#float_32:]] = OpTypeFloat 3211; CHECK-DAG: %[[#vec4_float_32:]] = OpTypeVector %[[#float_32]] 412 13define noundef half @distance_half4(<4 x half> noundef %a, <4 x half> noundef %b) {14entry:15  ; CHECK: %[[#]] = OpFunction %[[#float_16]] None %[[#]]16  ; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#vec4_float_16]]17  ; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#vec4_float_16]]18  ; CHECK: %[[#]] = OpExtInst %[[#float_16]] %[[#op_ext_cl]] distance %[[#arg0]] %[[#arg1]]19  %spv.distance = call half @llvm.spv.distance.f16(<4 x half> %a, <4 x half> %b)20  ret half %spv.distance21}22 23define noundef float @distance_float4(<4 x float> noundef %a, <4 x float> noundef %b) {24entry:25  ; CHECK: %[[#]] = OpFunction %[[#float_32]] None %[[#]]26  ; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#vec4_float_32]]27  ; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#vec4_float_32]]28  ; CHECK: %[[#]] = OpExtInst %[[#float_32]] %[[#op_ext_cl]] distance %[[#arg0]] %[[#arg1]]29  %spv.distance = call float @llvm.spv.distance.f32(<4 x float> %a, <4 x float> %b)30  ret float %spv.distance31}32 33define noundef float @distance_instcombine_float4(<4 x float> noundef %a, <4 x float> noundef %b) {34entry:35  ; CHECK: %[[#]] = OpFunction %[[#float_32]] None %[[#]]36  ; CHECK: %[[#arg0:]] = OpFunctionParameter %[[#vec4_float_32]]37  ; CHECK: %[[#arg1:]] = OpFunctionParameter %[[#vec4_float_32]]38  ; CHECK: %[[#]] = OpExtInst %[[#float_32]] %[[#op_ext_cl]] distance %[[#arg0]] %[[#arg1]]39  %delta = fsub  <4 x float> %a, %b40  %spv.length = call float @llvm.spv.length.f32(<4 x float> %delta)41  ret float %spv.length42}43 44declare half @llvm.spv.distance.f16(<4 x half>, <4 x half>)45declare float @llvm.spv.distance.f32(<4 x float>, <4 x float>)46