[Beignet] [PATCH] GBE: fix a bug in byte scatter write.

Zhigang Gong zhigang.gong at intel.com
Sun Apr 12 19:38:01 PDT 2015


In uniform mode, we should set simd width to 1 and set noMask bit.

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

diff --git a/backend/src/backend/gen_insn_selection.cpp b/backend/src/backend/gen_insn_selection.cpp
index 2c5e9a1..4a7cca5 100644
--- a/backend/src/backend/gen_insn_selection.cpp
+++ b/backend/src/backend/gen_insn_selection.cpp
@@ -3466,11 +3466,17 @@ namespace gbe
         const GenRegister value = sel.selReg(insn.getValue(0));
         GBE_ASSERT(insn.getValueNum() == 1);
         const GenRegister tmp = sel.selReg(sel.reg(FAMILY_DWORD, isUniform), ir::TYPE_U32);
-        if (elemSize == GEN_BYTE_SCATTER_WORD) {
-          sel.MOV(tmp, GenRegister::retype(value, GEN_TYPE_UW));
-        } else if (elemSize == GEN_BYTE_SCATTER_BYTE) {
-          sel.MOV(tmp, GenRegister::retype(value, GEN_TYPE_UB));
-        }
+        sel.push();
+          if (isUniform) {
+            sel.curr.noMask = 1;
+            sel.curr.execWidth = 1;
+          }
+
+          if (elemSize == GEN_BYTE_SCATTER_WORD)
+            sel.MOV(tmp, GenRegister::retype(value, GEN_TYPE_UW));
+          else if (elemSize == GEN_BYTE_SCATTER_BYTE)
+            sel.MOV(tmp, GenRegister::retype(value, GEN_TYPE_UB));
+        sel.pop();
         sel.BYTE_SCATTER(addr, tmp, elemSize, bti);
       }
     }
-- 
1.9.1



More information about the Beignet mailing list