[01/13] Backend: Add sr0 reg helper function.

Submitted by junyan.he@inbox.com on Dec. 1, 2015, 8:10 a.m.

Details

Message ID 1448957440-3391-1-git-send-email-junyan.he@inbox.com
State New
Headers show
Series "Series without cover letter" ( rev: 1 ) in Beignet

Not browsing as part of any series.

Commit Message

junyan.he@inbox.com Dec. 1, 2015, 8:10 a.m.
From: Junyan He <junyan.he@linux.intel.com>

sr0 is used to specify the state reigster where we can get the
state of each EU thread.

Signed-off-by: Junyan He <junyan.he@linux.intel.com>
---
 backend/src/backend/gen75_context.cpp |    8 +-------
 backend/src/backend/gen_register.hpp  |   10 ++++++++++
 2 files changed, 11 insertions(+), 7 deletions(-)

Patch hide | download patch | download mbox

diff --git a/backend/src/backend/gen75_context.cpp b/backend/src/backend/gen75_context.cpp
index 7d407c3..fa8b029 100644
--- a/backend/src/backend/gen75_context.cpp
+++ b/backend/src/backend/gen75_context.cpp
@@ -44,13 +44,7 @@  namespace gbe
     p->push();
       p->curr.execWidth = 1;
       p->curr.predicate = GEN_PREDICATE_NONE;
-      GenRegister sr0 = GenRegister(GEN_ARCHITECTURE_REGISTER_FILE,
-                                    GEN_ARF_STATE,
-                                    1,
-                                    GEN_TYPE_UD,
-                                    GEN_VERTICAL_STRIDE_8,
-                                    GEN_WIDTH_8,
-                                    GEN_HORIZONTAL_STRIDE_1);
+      GenRegister sr0 = GenRegister::sr(0, 1);
       p->SHR(sr0, slm_index, GenRegister::immud(16));
     p->pop();
   }
diff --git a/backend/src/backend/gen_register.hpp b/backend/src/backend/gen_register.hpp
index 5c813be..aa0744b 100644
--- a/backend/src/backend/gen_register.hpp
+++ b/backend/src/backend/gen_register.hpp
@@ -828,6 +828,16 @@  namespace gbe
                          GEN_HORIZONTAL_STRIDE_0);
     }
 
+    static INLINE GenRegister sr(uint32_t nr, uint32_t subnr = 0) {
+      return GenRegister(GEN_ARCHITECTURE_REGISTER_FILE,
+                         GEN_ARF_STATE | nr,
+                         subnr,
+                         GEN_TYPE_UD,
+                         GEN_VERTICAL_STRIDE_8,
+                         GEN_WIDTH_8,
+                         GEN_HORIZONTAL_STRIDE_1);
+    }
+
     static INLINE GenRegister notification0(uint32_t subnr) {
       return GenRegister(GEN_ARCHITECTURE_REGISTER_FILE,
                          GEN_ARF_NOTIFICATION_COUNT,

Comments

This is V2.

V2:
   Just rebase to master and ping for review.


On Tue, Dec 01, 2015 at 04:10:28PM +0800, junyan.he@inbox.com wrote:
> Date: Tue,  1 Dec 2015 16:10:28 +0800
> From: junyan.he@inbox.com
> To: beignet@lists.freedesktop.org
> Subject: [Beignet] [PATCH 01/13] Backend: Add sr0 reg helper function.
> X-Mailer: git-send-email 1.7.9.5
> 
> From: Junyan He <junyan.he@linux.intel.com>
> 
> sr0 is used to specify the state reigster where we can get the
> state of each EU thread.
> 
> Signed-off-by: Junyan He <junyan.he@linux.intel.com>
> ---
>  backend/src/backend/gen75_context.cpp |    8 +-------
>  backend/src/backend/gen_register.hpp  |   10 ++++++++++
>  2 files changed, 11 insertions(+), 7 deletions(-)
> 
> diff --git a/backend/src/backend/gen75_context.cpp b/backend/src/backend/gen75_context.cpp
> index 7d407c3..fa8b029 100644
> --- a/backend/src/backend/gen75_context.cpp
> +++ b/backend/src/backend/gen75_context.cpp
> @@ -44,13 +44,7 @@ namespace gbe
>      p->push();
>        p->curr.execWidth = 1;
>        p->curr.predicate = GEN_PREDICATE_NONE;
> -      GenRegister sr0 = GenRegister(GEN_ARCHITECTURE_REGISTER_FILE,
> -                                    GEN_ARF_STATE,
> -                                    1,
> -                                    GEN_TYPE_UD,
> -                                    GEN_VERTICAL_STRIDE_8,
> -                                    GEN_WIDTH_8,
> -                                    GEN_HORIZONTAL_STRIDE_1);
> +      GenRegister sr0 = GenRegister::sr(0, 1);
>        p->SHR(sr0, slm_index, GenRegister::immud(16));
>      p->pop();
>    }
> diff --git a/backend/src/backend/gen_register.hpp b/backend/src/backend/gen_register.hpp
> index 5c813be..aa0744b 100644
> --- a/backend/src/backend/gen_register.hpp
> +++ b/backend/src/backend/gen_register.hpp
> @@ -828,6 +828,16 @@ namespace gbe
>                           GEN_HORIZONTAL_STRIDE_0);
>      }
>  
> +    static INLINE GenRegister sr(uint32_t nr, uint32_t subnr = 0) {
> +      return GenRegister(GEN_ARCHITECTURE_REGISTER_FILE,
> +                         GEN_ARF_STATE | nr,
> +                         subnr,
> +                         GEN_TYPE_UD,
> +                         GEN_VERTICAL_STRIDE_8,
> +                         GEN_WIDTH_8,
> +                         GEN_HORIZONTAL_STRIDE_1);
> +    }
> +
>      static INLINE GenRegister notification0(uint32_t subnr) {
>        return GenRegister(GEN_ARCHITECTURE_REGISTER_FILE,
>                           GEN_ARF_NOTIFICATION_COUNT,
> -- 
> 1.7.9.5
> 
> 
> 
> _______________________________________________
> Beignet mailing list
> Beignet@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet