summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/freedreno/ir3/instr-a3xx.h
diff options
context:
space:
mode:
authorRob Clark <[email protected]>2018-01-21 12:20:01 -0500
committerRob Clark <[email protected]>2018-02-10 14:54:58 -0500
commitb2fc94f0745b375b586dbd2685b1c268f4267747 (patch)
tree9e357b45d69b6826029b24485eb42eec80cf16c5 /src/gallium/drivers/freedreno/ir3/instr-a3xx.h
parent1b658533e1109b8ff9a6578a7eb4b390454e7876 (diff)
freedreno/ir3: add encoding/decoding for (sat) bit
Seems to be there since a3xx, but we always lowered fsat. But we can shave some instructions, especially in shaders that use lots of clamp(foo, 0.0, 1.0) by not lowering fsat. Signed-off-by: Rob Clark <[email protected]>
Diffstat (limited to 'src/gallium/drivers/freedreno/ir3/instr-a3xx.h')
-rw-r--r--src/gallium/drivers/freedreno/ir3/instr-a3xx.h38
1 files changed, 32 insertions, 6 deletions
diff --git a/src/gallium/drivers/freedreno/ir3/instr-a3xx.h b/src/gallium/drivers/freedreno/ir3/instr-a3xx.h
index 65fc212c1c2..6aebb057619 100644
--- a/src/gallium/drivers/freedreno/ir3/instr-a3xx.h
+++ b/src/gallium/drivers/freedreno/ir3/instr-a3xx.h
@@ -410,7 +410,8 @@ typedef struct PACKED {
/* dword1: */
uint32_t dst : 8;
- uint32_t repeat : 3;
+ uint32_t repeat : 2;
+ uint32_t sat : 1;
uint32_t src1_r : 1;
uint32_t ss : 1;
uint32_t ul : 1; /* dunno */
@@ -473,7 +474,8 @@ typedef struct PACKED {
/* dword1: */
uint32_t dst : 8;
- uint32_t repeat : 3;
+ uint32_t repeat : 2;
+ uint32_t sat : 1;
uint32_t src1_r : 1;
uint32_t ss : 1;
uint32_t ul : 1;
@@ -529,7 +531,8 @@ typedef struct PACKED {
/* dword1: */
uint32_t dst : 8;
- uint32_t repeat : 3;
+ uint32_t repeat : 2;
+ uint32_t sat : 1;
uint32_t src_r : 1;
uint32_t ss : 1;
uint32_t ul : 1;
@@ -752,9 +755,10 @@ typedef union PACKED {
instr_cat7_t cat7;
struct PACKED {
/* dword0: */
- uint64_t pad1 : 40;
- uint32_t repeat : 3; /* cat0-cat4 */
- uint32_t pad2 : 1;
+ uint32_t pad1 : 32;
+
+ /* dword1: */
+ uint32_t pad2 : 12;
uint32_t ss : 1; /* cat1-cat4 (cat0??) and cat7 (?) */
uint32_t ul : 1; /* cat2-cat4 (and cat1 in blob.. which may be bug??) */
uint32_t pad3 : 13;
@@ -765,6 +769,28 @@ typedef union PACKED {
};
} instr_t;
+static inline uint32_t instr_repeat(instr_t *instr)
+{
+ switch (instr->opc_cat) {
+ case 0: return instr->cat0.repeat;
+ case 1: return instr->cat1.repeat;
+ case 2: return instr->cat2.repeat;
+ case 3: return instr->cat3.repeat;
+ case 4: return instr->cat4.repeat;
+ default: return 0;
+ }
+}
+
+static inline bool instr_sat(instr_t *instr)
+{
+ switch (instr->opc_cat) {
+ case 2: return instr->cat2.sat;
+ case 3: return instr->cat3.sat;
+ case 4: return instr->cat4.sat;
+ default: return false;
+ }
+}
+
static inline uint32_t instr_opc(instr_t *instr)
{
switch (instr->opc_cat) {