Mesa (master): r600: Don't optimize using source modifiers on literals

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Mar 2 18:03:30 UTC 2021


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

Author: Gert Wollny <gert.wollny at collabora.com>
Date:   Sun Feb 28 22:52:58 2021 +0100

r600: Don't optimize using source modifiers on literals

The code improvement is limited and it interferes with using literals
directly in LDS index ops, since here source modifiers are not
supported, but the current assembler code might inject the modifiers.

Signed-off-by: Gert Wollny <gert.wollny at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9330>

---

 src/gallium/drivers/r600/r600_asm.c    | 12 ++----------
 src/gallium/drivers/r600/r600_asm.h    |  3 +--
 src/gallium/drivers/r600/r600_shader.c |  2 +-
 3 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_asm.c b/src/gallium/drivers/r600/r600_asm.c
index f7bb4d3ecba..922cc4883ca 100644
--- a/src/gallium/drivers/r600/r600_asm.c
+++ b/src/gallium/drivers/r600/r600_asm.c
@@ -686,7 +686,7 @@ static int replace_gpr_with_pv_ps(struct r600_bytecode *bc,
 	return 0;
 }
 
-void r600_bytecode_special_constants(uint32_t value, unsigned *sel, unsigned *neg, unsigned abs)
+void r600_bytecode_special_constants(uint32_t value, unsigned *sel)
 {
 	switch(value) {
 	case 0:
@@ -704,14 +704,6 @@ void r600_bytecode_special_constants(uint32_t value, unsigned *sel, unsigned *ne
 	case 0x3F000000: /* 0.5f */
 		*sel = V_SQ_ALU_SRC_0_5;
 		break;
-	case 0xBF800000: /* -1.0f */
-		*sel = V_SQ_ALU_SRC_1;
-		*neg ^= !abs;
-		break;
-	case 0xBF000000: /* -0.5f */
-		*sel = V_SQ_ALU_SRC_0_5;
-		*neg ^= !abs;
-		break;
 	default:
 		*sel = V_SQ_ALU_SRC_LITERAL;
 		break;
@@ -1261,7 +1253,7 @@ int r600_bytecode_add_alu_type(struct r600_bytecode *bc,
 		}
 		if (nalu->src[i].sel == V_SQ_ALU_SRC_LITERAL)
 			r600_bytecode_special_constants(nalu->src[i].value,
-				&nalu->src[i].sel, &nalu->src[i].neg, nalu->src[i].abs);
+				&nalu->src[i].sel);
 	}
 	if (nalu->dst.sel >= bc->ngpr) {
 		bc->ngpr = nalu->dst.sel + 1;
diff --git a/src/gallium/drivers/r600/r600_asm.h b/src/gallium/drivers/r600/r600_asm.h
index 390b15422f6..a526993b318 100644
--- a/src/gallium/drivers/r600/r600_asm.h
+++ b/src/gallium/drivers/r600/r600_asm.h
@@ -321,8 +321,7 @@ int r600_bytecode_add_cfinst(struct r600_bytecode *bc,
 		unsigned op);
 int r600_bytecode_add_alu_type(struct r600_bytecode *bc,
 		const struct r600_bytecode_alu *alu, unsigned type);
-void r600_bytecode_special_constants(uint32_t value,
-		unsigned *sel, unsigned *neg, unsigned abs);
+void r600_bytecode_special_constants(uint32_t value, unsigned *sel);
 void r600_bytecode_disasm(struct r600_bytecode *bc);
 void r600_bytecode_alu_read(struct r600_bytecode *bc,
 		struct r600_bytecode_alu *alu, uint32_t word0, uint32_t word1);
diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index 54235937a4a..e24338514b1 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -1702,7 +1702,7 @@ static void tgsi_src(struct r600_shader_ctx *ctx,
 			(tgsi_src->Register.SwizzleX == tgsi_src->Register.SwizzleW)) {
 
 			index = tgsi_src->Register.Index * 4 + tgsi_src->Register.SwizzleX;
-			r600_bytecode_special_constants(ctx->literals[index], &r600_src->sel, &r600_src->neg, r600_src->abs);
+			r600_bytecode_special_constants(ctx->literals[index], &r600_src->sel);
 			if (r600_src->sel != V_SQ_ALU_SRC_LITERAL)
 				return;
 		}



More information about the mesa-commit mailing list