[Beignet] [PATCH] GBE: refine convert sat.
Yang Rong
rong.r.yang at intel.com
Fri Oct 9 00:32:09 PDT 2015
LLVM will introduce if/else/endif block if clamp the value in one statement.
Split to two select to avoid branching.
It seems that LLVM 3.6 is not correct when convert one statement. Split also workaround this issue.
Signed-off-by: Yang Rong <rong.r.yang at intel.com>
---
backend/src/libocl/script/ocl_convert.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/backend/src/libocl/script/ocl_convert.sh b/backend/src/libocl/script/ocl_convert.sh
index 4f720fe..736452c 100755
--- a/backend/src/libocl/script/ocl_convert.sh
+++ b/backend/src/libocl/script/ocl_convert.sh
@@ -161,7 +161,8 @@ else
echo '
#define DEF(DSTTYPE, SRCTYPE, MIN, MAX) \
OVERLOADABLE DSTTYPE convert_ ## DSTTYPE ## _sat(SRCTYPE x) { \
- return x >= MAX ? (DSTTYPE)MAX : x <= MIN ? (DSTTYPE)MIN : x; \
+ x = x >= MAX ? MAX : x; \
+ return x <= MIN ? (DSTTYPE)MIN : x; \
}
'
fi
--
1.9.1
More information about the Beignet
mailing list