[Beignet] [PATCH 15/18] GBE: don't emit jmpi to next label.

Zhigang Gong zhigang.gong at intel.com
Fri Mar 28 00:10:53 PDT 2014


As the following if will do the same thing, don't need to
add the jmpi instruction.

Signed-off-by: Zhigang Gong <zhigang.gong at intel.com>
---
 backend/src/backend/gen_insn_selection.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/backend/src/backend/gen_insn_selection.cpp b/backend/src/backend/gen_insn_selection.cpp
index 560d3dc..a7baf72 100644
--- a/backend/src/backend/gen_insn_selection.cpp
+++ b/backend/src/backend/gen_insn_selection.cpp
@@ -3045,7 +3045,11 @@ namespace gbe
         sel.pop();
       }
       else {
-        if (sel.ctx.hasJIP(&insn)) {
+        if (sel.ctx.hasJIP(&insn) &&
+            // If jump to next label and the endif offset is -1, then
+            // We don't need to add a jmpi here, as the following IF will do the same
+            // thing if all channels are disabled.
+            (jip != nextLabel || sel.block->endifOffset != -1)) {
           // If it is required, insert a JUMP to bypass the block
           sel.push();
             if (simdWidth == 8)
-- 
1.8.3.2



More information about the Beignet mailing list