Module: Mesa
Branch: master
Commit: 17b9b757b704e0dcf370f7ae6e72c6e22601363d
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=17b9b757b704e0dcf370f7ae6e72c6e22601363d

Author: Christian König <deathsim...@vodafone.de>
Date:   Sat Mar  5 13:40:55 2011 +0100

r600g: simplify instance addr calculation

Use MULHI_UINT instead of the more complex
INT_TO_FLT->MUL->TRUNC->FLT_TO_INT

---

 src/gallium/drivers/r600/r600_asm.c |   51 +++--------------------------------
 1 files changed, 4 insertions(+), 47 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_asm.c 
b/src/gallium/drivers/r600/r600_asm.c
index 626eb71..d4d8de2 100644
--- a/src/gallium/drivers/r600/r600_asm.c
+++ b/src/gallium/drivers/r600/r600_asm.c
@@ -53,6 +53,7 @@ static inline unsigned int r600_bc_get_num_operands(struct 
r600_bc *bc, struct r
                case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGE:
                case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLNE:
                case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL:
+               case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULHI_UINT:
                case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX:
                case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN:
                case V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE:
@@ -102,6 +103,7 @@ static inline unsigned int r600_bc_get_num_operands(struct 
r600_bc *bc, struct r
                case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLGE:
                case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_KILLNE:
                case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL:
+               case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULHI_UINT:
                case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MAX:
                case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MIN:
                case EG_V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_SETE:
@@ -2095,57 +2097,12 @@ int r600_vertex_elements_build_fetch_shader(struct 
r600_pipe_context *rctx, stru
                        struct r600_bc_alu alu;
 
                        memset(&alu, 0, sizeof(alu));
-                       alu.inst = BC_INST(&bc, 
V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_INT_TO_FLT);
+                       alu.inst = BC_INST(&bc, 
V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MULHI_UINT);
                        alu.src[0].sel = 0;
                        alu.src[0].chan = 3;
 
-                       alu.dst.sel = i + 1;
-                       alu.dst.chan = 3;
-                       alu.dst.write = 1;
-                       alu.last = 1;
-
-                       if ((r = r600_bc_add_alu(&bc, &alu))) {
-                               r600_bc_clear(&bc);
-                               return r;
-                       }
-
-                       memset(&alu, 0, sizeof(alu));
-                       alu.inst = BC_INST(&bc, 
V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MUL);
-                       alu.src[0].sel = i + 1;
-                       alu.src[0].chan = 3;
-
                        alu.src[1].sel = V_SQ_ALU_SRC_LITERAL;
-                       alu.src[1].value = fui(1.0f / 
(float)elements[i].instance_divisor);
-
-                       alu.dst.sel = i + 1;
-                       alu.dst.chan = 3;
-                       alu.dst.write = 1;
-                       alu.last = 1;
-
-                       if ((r = r600_bc_add_alu(&bc, &alu))) {
-                               r600_bc_clear(&bc);
-                               return r;
-                       }
-
-                       memset(&alu, 0, sizeof(alu));
-                       alu.inst = BC_INST(&bc, 
V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_TRUNC);
-                       alu.src[0].sel = i + 1;
-                       alu.src[0].chan = 3;
-
-                       alu.dst.sel = i + 1;
-                       alu.dst.chan = 3;
-                       alu.dst.write = 1;
-                       alu.last = 1;
-
-                       if ((r = r600_bc_add_alu(&bc, &alu))) {
-                               r600_bc_clear(&bc);
-                               return r;
-                       }
-
-                       memset(&alu, 0, sizeof(alu));
-                       alu.inst = BC_INST(&bc, 
V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_FLT_TO_INT);
-                       alu.src[0].sel = i + 1;
-                       alu.src[0].chan = 3;
+                       alu.src[1].value = (1l << 32) / 
elements[i].instance_divisor + 1;
 
                        alu.dst.sel = i + 1;
                        alu.dst.chan = 3;

_______________________________________________
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to