passed piglit test case: piglit/bin/cl-program-tester tests/cl/program/execute/vector-conversion.cl
remark: this patch does not include updating of "ocl_convert.h", because in that case, the patch is larger than max email size. "ocl_convert.h" can be auto gen by "gen_convert.sh". Signed-off-by: Homer Hsing <[email protected]> --- backend/src/gen_convert.sh | 83 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/backend/src/gen_convert.sh b/backend/src/gen_convert.sh index 1d1c0e7..0d84e50 100755 --- a/backend/src/gen_convert.sh +++ b/backend/src/gen_convert.sh @@ -314,3 +314,86 @@ for vector_length in $VECTOR_LENGTHS; do done done done + +# convert_DSTTYPE_sat_ROUNDING function +for vector_length in $VECTOR_LENGTHS; do + for ftype in $TYPES; do + fbasetype=`IFS=:; set -- dummy $ftype; echo $2` + if test $fbasetype = "double"; then continue; fi + + for ttype in $TYPES; do + tbasetype=`IFS=:; set -- dummy $ttype; echo $2` + if test $tbasetype = "double" -o $tbasetype = "float"; then continue; fi + + if test $vector_length -eq 1; then + echo "INLINE_OVERLOADABLE $tbasetype convert_${tbasetype}_sat_rte($fbasetype x)" + if test $fbasetype = "float"; then + echo "{ return convert_${tbasetype}_sat(__gen_ocl_rnde(x)); }" + else + echo "{ return convert_${tbasetype}_sat(x); }" + fi + + echo "INLINE_OVERLOADABLE $tbasetype convert_${tbasetype}_sat_rtz($fbasetype x)" + if test $fbasetype = "float"; then + echo "{ return convert_${tbasetype}_sat(__gen_ocl_rndz(x)); }" + else + echo "{ return convert_${tbasetype}_sat(x); }" + fi + + echo "INLINE_OVERLOADABLE $tbasetype convert_${tbasetype}_sat_rtp($fbasetype x)" + if test $fbasetype = "float"; then + echo "{ return convert_${tbasetype}_sat(__gen_ocl_rndu(x)); }" + else + echo "{ return convert_${tbasetype}_sat(x); }" + fi + + echo "INLINE_OVERLOADABLE $tbasetype convert_${tbasetype}_sat_rtn($fbasetype x)" + if test $fbasetype = "float"; then + echo "{ return convert_${tbasetype}_sat(__gen_ocl_rndd(x)); }" + else + echo "{ return convert_${tbasetype}_sat(x); }" + fi + + continue + fi + + for rounding in $ROUNDING_MODES; do + fvectortype=$fbasetype$vector_length + tvectortype=$tbasetype$vector_length + conv="convert_${tbasetype}_sat_${rounding}" + + construct="$conv(v.s0)" + if test $vector_length -gt 1; then + construct="$construct, $conv(v.s1)" + fi + if test $vector_length -gt 2; then + construct="$construct, $conv(v.s2)" + fi + if test $vector_length -gt 3; then + construct="$construct, $conv(v.s3)" + fi + if test $vector_length -gt 4; then + construct="$construct, $conv(v.s4)" + construct="$construct, $conv(v.s5)" + construct="$construct, $conv(v.s6)" + construct="$construct, $conv(v.s7)" + fi + if test $vector_length -gt 8; then + construct="$construct, $conv(v.s8)" + construct="$construct, $conv(v.s9)" + construct="$construct, $conv(v.sA)" + construct="$construct, $conv(v.sB)" + construct="$construct, $conv(v.sC)" + construct="$construct, $conv(v.sD)" + construct="$construct, $conv(v.sE)" + construct="$construct, $conv(v.sF)" + fi + + echo "INLINE OVERLOADABLE $tvectortype convert_${tvectortype}_sat_${rounding}($fvectortype v) {" + echo " return ($tvectortype)($construct);" + echo "}" + echo + done + done + done +done -- 1.8.3.2 _______________________________________________ Beignet mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/beignet
