summaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorJunyan He <junyan.he@linux.intel.com>2015-11-05 16:15:47 +0800
committerYang Rong <rong.r.yang@intel.com>2015-11-06 14:30:55 +0800
commita5e016313f32e397da4d62def01dbbb810c04fba (patch)
tree4d25d0d9f27a3a46e2ccb4824f8eccb4a682846a /backend
parent00144a8eedf5056e821d28563290ae312713e5d8 (diff)
Backend: Fix half->long convertion bug for BSW.
Signed-off-by: Junyan He <junyan.he@linux.intel.com> Reviewed-by: Yang Rong <rong.r.yang@intel.com>
Diffstat (limited to 'backend')
-rw-r--r--backend/src/backend/gen_insn_selection.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/backend/src/backend/gen_insn_selection.cpp b/backend/src/backend/gen_insn_selection.cpp
index f4f9d03c..e9c3d63d 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.