62 lines · plain
1; RUN: llc -verify-machineinstrs -O0 -mtriple=spirv64-unknown-unknown --spirv-ext=+SPV_KHR_float_controls2 %s -o - | FileCheck %s2; RUN: %if spirv-tools %{ llc -O0 -mtriple=spirv64-unknown-unknown --spirv-ext=+SPV_KHR_float_controls2 %s -o - -filetype=obj | spirv-val %}3 4;; This test checks that the OpenCL.std instructions fmin_common, fmax_common are replaced with fmin, fmax with NInf and NNaN instead.5 6; CHECK-DAG: Capability FloatControls27; CHECK: Extension "SPV_KHR_float_controls2"8 9; CHECK: OpName %[[#maxRes:]] "maxRes"10; CHECK: OpName %[[#maxCommonRes:]] "maxCommonRes"11; CHECK: OpName %[[#minRes:]] "minRes"12; CHECK: OpName %[[#minCommonRes:]] "minCommonRes"13; CHECK: OpName %[[#maxResV:]] "maxResV"14; CHECK: OpName %[[#maxCommonResV:]] "maxCommonResV"15; CHECK: OpName %[[#minResV:]] "minResV"16; CHECK: OpName %[[#minCommonResV:]] "minCommonResV"17; CHECK: OpDecorate %[[#maxRes]] FPFastMathMode NotNaN|NotInf|NSZ|AllowRecip|AllowContract|AllowReassoc|AllowTransform18; CHECK: OpDecorate %[[#maxCommonRes]] FPFastMathMode NotNaN|NotInf19; CHECK: OpDecorate %[[#minRes]] FPFastMathMode NotNaN|NotInf|NSZ|AllowRecip|AllowContract|AllowReassoc|AllowTransform20; CHECK: OpDecorate %[[#minCommonRes]] FPFastMathMode NotNaN|NotInf21; CHECK: OpDecorate %[[#maxResV]] FPFastMathMode NotNaN|NotInf|NSZ|AllowRecip|AllowContract|AllowReassoc|AllowTransform22; CHECK: OpDecorate %[[#maxCommonResV]] FPFastMathMode NotNaN|NotInf23; CHECK: OpDecorate %[[#minResV]] FPFastMathMode NotNaN|NotInf|NSZ|AllowRecip|AllowContract|AllowReassoc|AllowTransform24; CHECK: OpDecorate %[[#minCommonResV]] FPFastMathMode NotNaN|NotInf25; CHECK: %[[#maxRes]] = OpExtInst {{.*}} fmax26; CHECK: %[[#maxCommonRes]] = OpExtInst {{.*}} fmax27; CHECK: %[[#minRes]] = OpExtInst {{.*}} fmin28; CHECK: %[[#minCommonRes]] = OpExtInst {{.*}} fmin29; CHECK: %[[#maxResV]] = OpExtInst {{.*}} fmax30; CHECK: %[[#maxCommonResV]] = OpExtInst {{.*}} fmax31; CHECK: %[[#minResV]] = OpExtInst {{.*}} fmin32; CHECK: %[[#minCommonResV]] = OpExtInst {{.*}} fmin33 34; Function Attrs: convergent mustprogress nofree nounwind willreturn memory(none)35declare spir_func float @_Z4fmodff(float, float)36declare dso_local spir_func noundef nofpclass(nan inf) float @_Z16__spirv_ocl_fmaxff(float noundef nofpclass(nan inf), float noundef nofpclass(nan inf)) local_unnamed_addr #137declare dso_local spir_func noundef nofpclass(nan inf) float @_Z23__spirv_ocl_fmax_commonff(float noundef nofpclass(nan inf), float noundef nofpclass(nan inf)) local_unnamed_addr #138declare dso_local spir_func noundef nofpclass(nan inf) float @_Z16__spirv_ocl_fminff(float noundef nofpclass(nan inf), float noundef nofpclass(nan inf)) local_unnamed_addr #139declare dso_local spir_func noundef nofpclass(nan inf) float @_Z23__spirv_ocl_fmin_commonff(float noundef nofpclass(nan inf), float noundef nofpclass(nan inf)) local_unnamed_addr #140declare dso_local spir_func noundef nofpclass(nan inf) <2 x float> @_Z16__spirv_ocl_fmaxDv2_fDv2_f(<2 x float> noundef nofpclass(nan inf), <2 x float> noundef nofpclass(nan inf)) local_unnamed_addr #141declare dso_local spir_func noundef nofpclass(nan inf) <2 x float> @_Z23__spirv_ocl_fmax_commonDv2_fDv2_f(<2 x float> noundef nofpclass(nan inf), <2 x float> noundef nofpclass(nan inf)) local_unnamed_addr #142declare dso_local spir_func noundef nofpclass(nan inf) <2 x float> @_Z16__spirv_ocl_fminDv2_fDv2_f(<2 x float> noundef nofpclass(nan inf), <2 x float> noundef nofpclass(nan inf)) local_unnamed_addr #143declare dso_local spir_func noundef nofpclass(nan inf) <2 x float> @_Z23__spirv_ocl_fmin_commonDv2_fDv2_f(<2 x float> noundef nofpclass(nan inf), <2 x float> noundef nofpclass(nan inf)) local_unnamed_addr #144 45; Function Attrs: convergent mustprogress norecurse nounwind46define weak_odr dso_local spir_kernel void @foo(float %1, float %2) {47entry:48 %maxRes = tail call fast spir_func noundef nofpclass(nan inf) float @_Z16__spirv_ocl_fmaxff(float noundef nofpclass(nan inf) %1, float noundef nofpclass(nan inf) %2)49 %maxCommonRes = tail call spir_func noundef float @_Z23__spirv_ocl_fmax_commonff(float noundef nofpclass(nan inf) %1, float noundef nofpclass(nan inf) %2)50 %minRes = tail call fast spir_func noundef nofpclass(nan inf) float @_Z16__spirv_ocl_fminff(float noundef nofpclass(nan inf) %1, float noundef nofpclass(nan inf) %2)51 %minCommonRes = tail call spir_func noundef float @_Z23__spirv_ocl_fmin_commonff(float noundef nofpclass(nan inf) %1, float noundef nofpclass(nan inf) %2)52 ret void53}54 55define weak_odr dso_local spir_kernel void @fooV(<2 x float> %v1, <2 x float> %v2) {56 %maxResV = tail call fast spir_func noundef nofpclass(nan inf) <2 x float> @_Z16__spirv_ocl_fmaxDv2_fDv2_f(<2 x float> noundef nofpclass(nan inf) %v1, <2 x float> noundef nofpclass(nan inf) %v2)57 %maxCommonResV = tail call spir_func noundef <2 x float> @_Z23__spirv_ocl_fmax_commonDv2_fDv2_f(<2 x float> noundef nofpclass(nan inf) %v1, <2 x float> noundef nofpclass(nan inf) %v2)58 %minResV = tail call fast spir_func noundef nofpclass(nan inf) <2 x float> @_Z16__spirv_ocl_fminDv2_fDv2_f(<2 x float> noundef nofpclass(nan inf) %v1, <2 x float> noundef nofpclass(nan inf) %v2)59 %minCommonResV = tail call spir_func noundef <2 x float> @_Z23__spirv_ocl_fmin_commonDv2_fDv2_f(<2 x float> noundef nofpclass(nan inf) %v1, <2 x float> noundef nofpclass(nan inf) %v2)60 ret void61}62