[Beignet] [PATCH] support vectorized saturated converting builtin functions

Homer Hsing homer.xing at intel.com
Sun Oct 13 19:15:55 PDT 2013


Signed-off-by: Homer Hsing <homer.xing at intel.com>
---
 backend/src/gen_convert.sh | 51 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/backend/src/gen_convert.sh b/backend/src/gen_convert.sh
index 6cc81f1..a68e20d 100755
--- a/backend/src/gen_convert.sh
+++ b/backend/src/gen_convert.sh
@@ -70,3 +70,54 @@ for vector_length in $VECTOR_LENGTHS; do
           done
         fi
 done
+
+# vector convert_DSTTYPE_sat function
+for vector_length in $VECTOR_LENGTHS; do
+  if test $vector_length -eq 1; then continue; fi
+
+  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"; then continue; fi
+
+      fvectortype=$fbasetype$vector_length
+      tvectortype=$tbasetype$vector_length
+      conv="convert_${tbasetype}_sat"
+
+      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($fvectortype v) {"
+      echo "  return ($tvectortype)($construct);"
+      echo "}"
+      echo
+    done
+  done
+done
-- 
1.8.1.2



More information about the Beignet mailing list