[Beignet] [PATCH 02/14] Backend: Refine GenRegiter::offset

Xiuli Pan xiuli.pan at intel.com
Wed Oct 12 08:56:32 UTC 2016


From: Pan Xiuli <xiuli.pan at intel.com>

Convert the subnr into nr if the subnr is bigger than 32, this will make
offset usage universally.

Signed-off-by: Pan Xiuli <xiuli.pan at intel.com>
---
 backend/src/backend/gen_register.hpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/backend/src/backend/gen_register.hpp b/backend/src/backend/gen_register.hpp
index bbea761..bda35e4 100644
--- a/backend/src/backend/gen_register.hpp
+++ b/backend/src/backend/gen_register.hpp
@@ -268,6 +268,10 @@ namespace gbe
 
     static INLINE GenRegister offset(GenRegister reg, int nr, int subnr = 0) {
       GenRegister r = reg;
+      if(subnr >= 32){
+        nr += subnr / 32;
+        subnr = subnr % 32;
+      }
       r.nr += nr;
       r.subnr += subnr;
       r.subphysical = 1;
-- 
2.7.4



More information about the Beignet mailing list