57 lines · plain
1; This test checks that functions with `convert_` prefix are translated as2; OpenCL builtins only in case they match the specification. Otherwise, we3; expect such functions to be translated to SPIR-V FunctionCall.4 5; RUN: llc -O0 -mtriple=spirv32-unknown-unknown %s -o - | FileCheck %s --check-prefix=CHECK-SPIRV6; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv32-unknown-unknown %s -o - -filetype=obj | spirv-val %}7 8; CHECK-SPIRV: OpName %[[#Func:]] "_Z18convert_float_func"9; CHECK-SPIRV: OpName %[[#Func1:]] "_Z20convert_uint_satfunc"10; CHECK-SPIRV: OpName %[[#Func2:]] "_Z21convert_float_rtzfunc"11; CHECK-SPIRV-DAG: %[[#VoidTy:]] = OpTypeVoid12; CHECK-SPIRV-DAG: %[[#CharTy:]] = OpTypeInt 813; CHECK-SPIRV-DAG: %[[#FloatTy:]] = OpTypeFloat 3214 15; CHECK-SPIRV: %[[#Func]] = OpFunction %[[#VoidTy]] None %[[#]]16; CHECK-SPIRV: %[[#ConvertId1:]] = OpUConvert %[[#CharTy]] %[[#]]17; CHECK-SPIRV: %[[#ConvertId2:]] = OpConvertSToF %[[#FloatTy]] %[[#]]18; CHECK-SPIRV: %[[#]] = OpFunctionCall %[[#VoidTy]] %[[#Func]] %[[#ConvertId2]]19; CHECK-SPIRV: %[[#]] = OpFunctionCall %[[#VoidTy]] %[[#Func1]] %[[#]]20; CHECK-SPIRV: %[[#]] = OpFunctionCall %[[#VoidTy]] %[[#Func2]] %[[#ConvertId2]]21; CHECK-SPIRV-NOT: OpFConvert22; CHECK-SPIRV-NOT: OpConvertUToF23 24define dso_local spir_func void @_Z18convert_float_func(float noundef %x) {25entry:26 %x.addr = alloca float, align 427 store float %x, ptr %x.addr, align 428 ret void29}30 31define dso_local spir_func void @_Z20convert_uint_satfunc(i32 noundef %x) {32entry:33 ret void34}35 36define dso_local spir_func void @_Z21convert_float_rtzfunc(float noundef %x) {37entry:38 ret void39}40 41define dso_local spir_func void @convert_int_bf16(i32 noundef %x) {42entry:43 %x.addr = alloca i32, align 444 store i32 %x, ptr %x.addr, align 445 %0 = load i32, ptr %x.addr, align 446 call spir_func signext i8 @_Z16convert_char_rtei(i32 noundef %0)47 %call = call spir_func float @_Z13convert_floati(i32 noundef %0)48 call spir_func void @_Z18convert_float_func(float noundef %call)49 call spir_func void @_Z20convert_uint_satfunc(i32 noundef %0)50 call spir_func void @_Z21convert_float_rtzfunc(float noundef %call)51 ret void52}53 54declare spir_func signext i8 @_Z16convert_char_rtei(i32 noundef)55 56declare spir_func float @_Z13convert_floati(i32 noundef)57