i965/fs: add PACK opcode
authorConnor Abbott <cwabbott0@gmail.com>
Thu, 5 May 2016 09:40:41 +0000 (11:40 +0200)
committerSamuel Iglesias Gonsálvez <siglesias@igalia.com>
Tue, 10 May 2016 09:25:05 +0000 (11:25 +0200)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_defines.h
src/mesa/drivers/dri/i965/brw_fs.cpp
src/mesa/drivers/dri/i965/brw_fs_copy_propagation.cpp
src/mesa/drivers/dri/i965/brw_fs_cse.cpp
src/mesa/drivers/dri/i965/brw_shader.cpp

index 60b696cfb98de3b578c7a577b0d12e5476ce1557..4696faf082e83912e4650f060fb2cda50c0f63b2 100644 (file)
@@ -1013,6 +1013,15 @@ enum opcode {
     */
    SHADER_OPCODE_LOAD_PAYLOAD,
 
+   /**
+    * Packs a number of sources into a single value. Unlike LOAD_PAYLOAD, this
+    * acts intra-channel, obtaining the final value for each channel by
+    * combining the sources values for the same channel, the first source
+    * occupying the lowest bits and the last source occupying the highest
+    * bits.
+    */
+   FS_OPCODE_PACK,
+
    SHADER_OPCODE_SHADER_TIME_ADD,
 
    /**
index b02f1dc0b9130426589bb110fbd14c91cca80e0a..d32d75990de731caccc4fef3954dcab45f23f634 100644 (file)
@@ -4523,7 +4523,8 @@ get_lowered_simd_width(const struct brw_device_info *devinfo,
    case SHADER_OPCODE_INT_QUOTIENT:
    case SHADER_OPCODE_INT_REMAINDER:
    case SHADER_OPCODE_SIN:
-   case SHADER_OPCODE_COS: {
+   case SHADER_OPCODE_COS:
+   case FS_OPCODE_PACK: {
       /* According to the PRMs:
        *  "A. In Direct Addressing mode, a source cannot span more than 2
        *      adjacent GRF registers.
index 4d727c131d5d956d60f4ede2a43f04bc20a366af..3c702d8b36ec8a29e63d8bf6401a9ba71df7c6f0 100644 (file)
@@ -550,6 +550,7 @@ fs_visitor::try_constant_propagate(fs_inst *inst, acp_entry *entry)
       switch (inst->opcode) {
       case BRW_OPCODE_MOV:
       case SHADER_OPCODE_LOAD_PAYLOAD:
+      case FS_OPCODE_PACK:
          inst->src[i] = val;
          progress = true;
          break;
index 0e743de7faf7ee5f2e12282b77d65c3cf62dc37e..15af2c1fabf6a9d5a24ee1de19cade56271d5c7d 100644 (file)
@@ -81,6 +81,7 @@ is_expression(const fs_visitor *v, const fs_inst *const inst)
    case SHADER_OPCODE_EXTRACT_BYTE:
    case SHADER_OPCODE_EXTRACT_WORD:
    case SHADER_OPCODE_MOV_INDIRECT:
+   case FS_OPCODE_PACK:
       return true;
    case SHADER_OPCODE_RCP:
    case SHADER_OPCODE_RSQ:
index 325141b2d6b1d509f5efee78f9d92dfb394aa384..0e33953f8cfe0b8093b44d5b7949f265a6ef9884 100644 (file)
@@ -289,6 +289,8 @@ brw_instruction_name(const struct brw_device_info *devinfo, enum opcode op)
 
    case SHADER_OPCODE_LOAD_PAYLOAD:
       return "load_payload";
+   case FS_OPCODE_PACK:
+      return "pack";
 
    case SHADER_OPCODE_GEN4_SCRATCH_READ:
       return "gen4_scratch_read";