From b89520af5b8933fd1e6f2e3610c7210784484159 Mon Sep 17 00:00:00 2001 From: Zhigang Gong Date: Thu, 13 Mar 2014 12:33:39 +0800 Subject: [PATCH] GBE: fix one misusage of flag in forward jump. Forward jump instruction do not need the pred when compare the pcip with next label. We should use the temporary flag register. Signed-off-by: Zhigang Gong Reviewed-by: "Yang, Rong R" Reviewed-by: "Song, Ruiling" --- backend/src/backend/gen_insn_selection.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/backend/src/backend/gen_insn_selection.cpp b/backend/src/backend/gen_insn_selection.cpp index d0b87cd..bc535b3 100644 --- a/backend/src/backend/gen_insn_selection.cpp +++ b/backend/src/backend/gen_insn_selection.cpp @@ -3282,6 +3282,9 @@ namespace gbe // Update the PcIPs sel.push(); + // we don't need to set next label to the pcip + // as if there is no backward jump latter, then obviously everything will work fine. + // If there is backward jump latter, then all the pcip will be updated correctly there. sel.curr.physicalFlag = 0; sel.curr.flagIndex = uint16_t(activePred); sel.MOV(ip, GenRegister::immuw(uint16_t(dst))); @@ -3300,8 +3303,8 @@ namespace gbe // will check those bits as well. sel.push(); - sel.curr.physicalFlag = 0; - sel.curr.flagIndex = uint16_t(activePred); + sel.curr.flag = 0; + sel.curr.subFlag = 1; sel.curr.predicate = GEN_PREDICATE_NONE; sel.CMP(GEN_CONDITIONAL_G, ip, GenRegister::immuw(nextLabel)); @@ -3313,7 +3316,7 @@ namespace gbe sel.curr.execWidth = 1; sel.curr.noMask = 1; GenRegister notEmaskReg = GenRegister::uw1grf(ocl::notemask); - sel.OR(sel.selReg(activePred, TYPE_U16), sel.selReg(activePred, TYPE_U16), notEmaskReg); + sel.OR(GenRegister::flag(0, 1), GenRegister::flag(0, 1), notEmaskReg); if (simdWidth == 8) sel.curr.predicate = GEN_PREDICATE_ALIGN1_ALL8H; -- 2.7.4