[Mesa-dev] [PATCH 08/10] i965: Add Gen assertion checks for newer instructions.

Matt Turner mattst88 at gmail.com
Mon Sep 23 16:13:05 PDT 2013


---
 src/mesa/drivers/dri/i965/brw_fs_emit.cpp   | 11 +++++++++++
 src/mesa/drivers/dri/i965/brw_vec4_emit.cpp | 11 +++++++++++
 2 files changed, 22 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_emit.cpp b/src/mesa/drivers/dri/i965/brw_fs_emit.cpp
index 9b897c5..d76934f 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_emit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_emit.cpp
@@ -1178,6 +1178,7 @@ fs_generator::generate_code(exec_list *instructions)
 	 break;
 
       case BRW_OPCODE_MAD:
+         assert(brw->gen >= 6);
 	 brw_set_access_mode(p, BRW_ALIGN_16);
 	 if (dispatch_width == 16) {
 	    brw_set_compression_control(p, BRW_COMPRESSION_NONE);
@@ -1192,6 +1193,7 @@ fs_generator::generate_code(exec_list *instructions)
 	 break;
 
       case BRW_OPCODE_LRP:
+         assert(brw->gen >= 6);
 	 brw_set_access_mode(p, BRW_ALIGN_16);
 	 if (dispatch_width == 16) {
 	    brw_set_compression_control(p, BRW_COMPRESSION_NONE);
@@ -1240,9 +1242,11 @@ fs_generator::generate_code(exec_list *instructions)
 	 brw_SHL(p, dst, src[0], src[1]);
 	 break;
       case BRW_OPCODE_F32TO16:
+         assert(brw->gen >= 7);
          brw_F32TO16(p, dst, src[0]);
          break;
       case BRW_OPCODE_F16TO32:
+         assert(brw->gen >= 7);
          brw_F16TO32(p, dst, src[0]);
          break;
       case BRW_OPCODE_CMP:
@@ -1252,19 +1256,23 @@ fs_generator::generate_code(exec_list *instructions)
 	 brw_SEL(p, dst, src[0], src[1]);
 	 break;
       case BRW_OPCODE_BFREV:
+         assert(brw->gen >= 7);
          /* BFREV only supports UD type for src and dst. */
          brw_BFREV(p, retype(dst, BRW_REGISTER_TYPE_UD),
                       retype(src[0], BRW_REGISTER_TYPE_UD));
          break;
       case BRW_OPCODE_FBH:
+         assert(brw->gen >= 7);
          /* FBH only supports UD type for dst. */
          brw_FBH(p, retype(dst, BRW_REGISTER_TYPE_UD), src[0]);
          break;
       case BRW_OPCODE_FBL:
+         assert(brw->gen >= 7);
          /* FBL only supports UD type for dst. */
          brw_FBL(p, retype(dst, BRW_REGISTER_TYPE_UD), src[0]);
          break;
       case BRW_OPCODE_CBIT:
+         assert(brw->gen >= 7);
          /* CBIT only supports UD type for dst. */
          brw_CBIT(p, retype(dst, BRW_REGISTER_TYPE_UD), src[0]);
          break;
@@ -1282,6 +1290,7 @@ fs_generator::generate_code(exec_list *instructions)
          break;
 
       case BRW_OPCODE_BFE:
+         assert(brw->gen >= 7);
          brw_set_access_mode(p, BRW_ALIGN_16);
          if (dispatch_width == 16) {
             brw_set_compression_control(p, BRW_COMPRESSION_NONE);
@@ -1296,9 +1305,11 @@ fs_generator::generate_code(exec_list *instructions)
          break;
 
       case BRW_OPCODE_BFI1:
+         assert(brw->gen >= 7);
          brw_BFI1(p, dst, src[0], src[1]);
          break;
       case BRW_OPCODE_BFI2:
+         assert(brw->gen >= 7);
          brw_set_access_mode(p, BRW_ALIGN_16);
          if (dispatch_width == 16) {
             brw_set_compression_control(p, BRW_COMPRESSION_NONE);
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp b/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
index 49f7859..fcaaa38 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_emit.cpp
@@ -866,6 +866,7 @@ vec4_generator::generate_vec4_instruction(vec4_instruction *instruction,
       break;
 
    case BRW_OPCODE_MAD:
+      assert(brw->gen >= 6);
       brw_MAD(p, dst, src[0], src[1], src[2]);
       break;
 
@@ -928,31 +929,38 @@ vec4_generator::generate_vec4_instruction(vec4_instruction *instruction,
       break;
 
    case BRW_OPCODE_F32TO16:
+      assert(brw->gen >= 7);
       brw_F32TO16(p, dst, src[0]);
       break;
 
    case BRW_OPCODE_F16TO32:
+      assert(brw->gen >= 7);
       brw_F16TO32(p, dst, src[0]);
       break;
 
    case BRW_OPCODE_LRP:
+      assert(brw->gen >= 6);
       brw_LRP(p, dst, src[0], src[1], src[2]);
       break;
 
    case BRW_OPCODE_BFREV:
+      assert(brw->gen >= 7);
       /* BFREV only supports UD type for src and dst. */
       brw_BFREV(p, retype(dst, BRW_REGISTER_TYPE_UD),
                    retype(src[0], BRW_REGISTER_TYPE_UD));
       break;
    case BRW_OPCODE_FBH:
+      assert(brw->gen >= 7);
       /* FBH only supports UD type for dst. */
       brw_FBH(p, retype(dst, BRW_REGISTER_TYPE_UD), src[0]);
       break;
    case BRW_OPCODE_FBL:
+      assert(brw->gen >= 7);
       /* FBL only supports UD type for dst. */
       brw_FBL(p, retype(dst, BRW_REGISTER_TYPE_UD), src[0]);
       break;
    case BRW_OPCODE_CBIT:
+      assert(brw->gen >= 7);
       /* CBIT only supports UD type for dst. */
       brw_CBIT(p, retype(dst, BRW_REGISTER_TYPE_UD), src[0]);
       break;
@@ -970,13 +978,16 @@ vec4_generator::generate_vec4_instruction(vec4_instruction *instruction,
       break;
 
    case BRW_OPCODE_BFE:
+      assert(brw->gen >= 7);
       brw_BFE(p, dst, src[0], src[1], src[2]);
       break;
 
    case BRW_OPCODE_BFI1:
+      assert(brw->gen >= 7);
       brw_BFI1(p, dst, src[0], src[1]);
       break;
    case BRW_OPCODE_BFI2:
+      assert(brw->gen >= 7);
       brw_BFI2(p, dst, src[0], src[1], src[2]);
       break;
 
-- 
1.8.3.2



More information about the mesa-dev mailing list