[Beignet] [PATCH] Backend: Fix half->long convertion bug for BSW.

junyan.he at inbox.com junyan.he at inbox.com
Wed Oct 28 01:49:06 PDT 2015


From: Junyan He <junyan.he at linux.intel.com>

Signed-off-by: Junyan He <junyan.he at linux.intel.com>
---
 backend/src/backend/gen_insn_selection.cpp | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/backend/src/backend/gen_insn_selection.cpp b/backend/src/backend/gen_insn_selection.cpp
index 7c000ef..de8f7e1 100644
--- a/backend/src/backend/gen_insn_selection.cpp
+++ b/backend/src/backend/gen_insn_selection.cpp
@@ -4603,7 +4603,7 @@ namespace gbe
           sel.CONVF_TO_I64(dst, src, tmp);
           sel.pop();
         }
-      } else if (srcType == ir::TYPE_HALF) { // TODO: We may consider bsw's hasLongRegRestrict case here.
+      } else if (srcType == ir::TYPE_HALF) {
         /* No need to consider old platform. if we support half, we must have native long. */
         GBE_ASSERT(sel.hasLongType());
         GBE_ASSERT(sel.hasHalfType());
@@ -4615,9 +4615,19 @@ namespace gbe
           sel.curr.predicate = GEN_PREDICATE_NONE;
           sel.curr.noMask = 1;
         }
+
         sel.MOV(tmp, src);
-        sel.pop();
-        sel.MOV(dst, tmp);
+
+        if (sel.hasLongRegRestrict()) { // special for BSW case.
+          GenRegister unpacked = sel.unpacked_ud(sel.reg(FAMILY_QWORD, sel.isScalarReg(insn.getSrc(0))));
+          unpacked = GenRegister::retype(unpacked, type);
+          sel.MOV(unpacked, tmp);
+          sel.pop();
+          sel.MOV(dst, unpacked);
+        } else {
+          sel.pop();
+          sel.MOV(dst, tmp);
+        }
       } else if (src.type == GEN_TYPE_DF) {
         GBE_ASSERT(sel.hasDoubleType());
         GBE_ASSERT(sel.hasLongType()); //So far, if we support double, we support native long.
-- 
1.9.1





More information about the Beignet mailing list