diff options
author | rander <rander.wang@intel.com> | 2017-03-17 09:37:10 +0800 |
---|---|---|
committer | Yang Rong <rong.r.yang@intel.com> | 2017-04-17 16:08:48 +0800 |
commit | d0ff1d6350244de326dde56d119edf6918417513 (patch) | |
tree | c28e6de971df1a36c86f9cb7a09962ccb65e91d9 | |
parent | 5e6c8c098503563c36afc24082fd99d4b1604e8f (diff) |
backend: add double support to convert_u|char|short|int_rtp(double x)
first convert double to u|long, then convert to smaller type And converting
double directly to smaller type does not save any instructions
Signed-off-by: rander <rander.wang@intel.com>
Tested-by: Yang Rong <rong.r.yang@intel.com>
-rwxr-xr-x | backend/src/libocl/script/ocl_convert.sh | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/backend/src/libocl/script/ocl_convert.sh b/backend/src/libocl/script/ocl_convert.sh index ed9abebc..b23022ec 100755 --- a/backend/src/libocl/script/ocl_convert.sh +++ b/backend/src/libocl/script/ocl_convert.sh @@ -758,6 +758,7 @@ OVERLOADABLE long convert_long_rtp(double x) ' fi +# convert_u|char|short|int_rte(double x) ITYPES="int:4 uint:4 short:2 ushort:2 char:1 uchar:1" for ttype in $ITYPES; do tbasetype=`IFS=:; set -- dummy $ttype; echo $2` @@ -767,6 +768,7 @@ for ttype in $ITYPES; do fi done +# convert_u|char|short|int_rte(double x) IUTYPES="ulong:8 uint:4 ushort:2 uchar:1" for ttype in $IUTYPES; do tbasetype=`IFS=:; set -- dummy $ttype; echo $2` @@ -788,6 +790,25 @@ for ttype in $ITYPES; do fi done +# convert_u|char|short|int_rtp(double x) +IUTYPES="uint:4 ushort:2 uchar:1" +for ttype in $IUTYPES; do + tbasetype=`IFS=:; set -- dummy $ttype; echo $2` + if [ $1"a" != "-pa" ]; then + echo "OVERLOADABLE $tbasetype convert_${tbasetype}_rtp(double x)" + echo "{ return ($tbasetype)convert_ulong_rtp(x);}" + fi +done + +ITYPES="int:4 short:2 char:1" +for ttype in $ITYPES; do + tbasetype=`IFS=:; set -- dummy $ttype; echo $2` + if [ $1"a" != "-pa" ]; then + echo "OVERLOADABLE $tbasetype convert_${tbasetype}_rtp(double x)" + echo " { return ($tbasetype)convert_long_rtp(x);}" + fi +done + # convert_DSTTYPE_ROUNDING function for vector_length in $VECTOR_LENGTHS; do for ftype in $TYPES; do |