summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrander <rander.wang@intel.com>2017-03-16 16:01:43 +0800
committerYang Rong <rong.r.yang@intel.com>2017-04-17 16:08:48 +0800
commit5e6c8c098503563c36afc24082fd99d4b1604e8f (patch)
treeb2194db1de7663f4f5bc2813f59ac7fb39007da1
parent7e296cec37f28e34b80d8925dbc668c9cf468b4c (diff)
backend: add int8 convert to double.
the algorithm is very simple, for convert_double_rte|z|p|n(int8 x) the input from -128 ~ 127 or 0 ~ 255 should get the same result Signed-off-by: rander <rander.wang@intel.com> Tested-by: Yang Rong <rong.r.yang@intel.com>
-rwxr-xr-xbackend/src/libocl/script/ocl_convert.sh72
1 files changed, 72 insertions, 0 deletions
diff --git a/backend/src/libocl/script/ocl_convert.sh b/backend/src/libocl/script/ocl_convert.sh
index 3ef283b1..ed9abebc 100755
--- a/backend/src/libocl/script/ocl_convert.sh
+++ b/backend/src/libocl/script/ocl_convert.sh
@@ -1033,6 +1033,78 @@ for vector_length in $VECTOR_LENGTHS; do
done
done
+# convert_double_roundingmode( int32, int16 ,int8)
+ITYPES=" int:4 uint:4 short:2 ushort:2 char:1 uchar:1"
+for vector_length in $VECTOR_LENGTHS; do
+ for ftype in $ITYPES; do
+ fbasetype=`IFS=:; set -- dummy $ftype; echo $2`
+
+ if test $vector_length -eq 1; then
+ if [ $1"a" = "-pa" ]; then
+ echo "OVERLOADABLE double convert_double_rte($fbasetype x);"
+ echo "OVERLOADABLE double convert_double_rtz($fbasetype x);"
+ echo "OVERLOADABLE double convert_double_rtp($fbasetype x);"
+ echo "OVERLOADABLE double convert_double_rtn($fbasetype x);"
+ else
+ echo "OVERLOADABLE double convert_double_rte($fbasetype x)"
+ echo "{ return convert_double(x); }"
+
+ echo "OVERLOADABLE double convert_double_rtz($fbasetype x)"
+ echo "{ return convert_double(x); }"
+
+ echo "OVERLOADABLE double convert_double_rtp($fbasetype x)"
+ echo "{ return convert_double(x); }"
+
+ echo "OVERLOADABLE double convert_double_rtn($fbasetype x)"
+ echo "{ return convert_double(x); }"
+ fi
+ continue
+ fi
+
+ for rounding in $ROUNDING_MODES; do
+ fvectortype=$fbasetype$vector_length
+ tvectortype=double$vector_length
+ conv="convert_double_${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
+
+ if [ $1"a" = "-pa" ]; then
+ echo "OVERLOADABLE $tvectortype convert_${tvectortype}_${rounding}($fvectortype v);"
+ else
+ echo "OVERLOADABLE $tvectortype convert_${tvectortype}_${rounding}($fvectortype v) {"
+ echo " return ($tvectortype)($construct);"
+ echo "}"
+ echo
+ fi
+ done
+ done
+done
+
if [ $1"a" = "-pa" ]; then
echo "#endif /* __OCL_CONVERT_H__ */"
fi