Mesa (main): r300: Remove unused RC_OPCODE_ABS.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Dec 16 17:06:31 UTC 2021


Module: Mesa
Branch: main
Commit: 2e2b755ecbe643dbc89b0406c5c72158669c5d21
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2e2b755ecbe643dbc89b0406c5c72158669c5d21

Author: Emma Anholt <emma at anholt.net>
Date:   Wed Dec  8 12:17:43 2021 -0800

r300: Remove unused RC_OPCODE_ABS.

Nothing generates it in the backend.

Reviewed-by: Adam Jackson <ajax at redhat.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14211>

---

 src/gallium/drivers/r300/compiler/radeon_opcodes.c |  7 -------
 src/gallium/drivers/r300/compiler/radeon_opcodes.h |  3 ---
 .../drivers/r300/compiler/radeon_program_alu.c     | 24 +---------------------
 3 files changed, 1 insertion(+), 33 deletions(-)

diff --git a/src/gallium/drivers/r300/compiler/radeon_opcodes.c b/src/gallium/drivers/r300/compiler/radeon_opcodes.c
index f9097243180..efc54725da9 100644
--- a/src/gallium/drivers/r300/compiler/radeon_opcodes.c
+++ b/src/gallium/drivers/r300/compiler/radeon_opcodes.c
@@ -41,13 +41,6 @@ const struct rc_opcode_info rc_opcodes[MAX_RC_OPCODE] = {
 		.Opcode = RC_OPCODE_ILLEGAL_OPCODE,
 		.Name = "ILLEGAL OPCODE"
 	},
-	{
-		.Opcode = RC_OPCODE_ABS,
-		.Name = "ABS",
-		.NumSrcRegs = 1,
-		.HasDstReg = 1,
-		.IsComponentwise = 1
-	},
 	{
 		.Opcode = RC_OPCODE_ADD,
 		.Name = "ADD",
diff --git a/src/gallium/drivers/r300/compiler/radeon_opcodes.h b/src/gallium/drivers/r300/compiler/radeon_opcodes.h
index da62c8ecbee..472fd23be05 100644
--- a/src/gallium/drivers/r300/compiler/radeon_opcodes.h
+++ b/src/gallium/drivers/r300/compiler/radeon_opcodes.h
@@ -37,9 +37,6 @@ typedef enum {
 	RC_OPCODE_NOP = 0,
 	RC_OPCODE_ILLEGAL_OPCODE,
 
-	/** vec4 instruction: dst.c = abs(src0.c); */
-	RC_OPCODE_ABS,
-
 	/** vec4 instruction: dst.c = src0.c + src1.c; */
 	RC_OPCODE_ADD,
 
diff --git a/src/gallium/drivers/r300/compiler/radeon_program_alu.c b/src/gallium/drivers/r300/compiler/radeon_program_alu.c
index c26ec9334ed..1b9c09f97b2 100644
--- a/src/gallium/drivers/r300/compiler/radeon_program_alu.c
+++ b/src/gallium/drivers/r300/compiler/radeon_program_alu.c
@@ -226,16 +226,6 @@ static struct rc_dst_register try_to_reuse_dst(struct radeon_compiler *c,
 	return dstregtmpmask(tmp, inst->U.I.DstReg.WriteMask);
 }
 
-static void transform_ABS(struct radeon_compiler* c,
-	struct rc_instruction* inst)
-{
-	struct rc_src_register src = inst->U.I.SrcReg[0];
-	src.Abs = 1;
-	src.Negate = RC_MASK_NONE;
-	emit1(c, inst->Prev, RC_OPCODE_MOV, &inst->U.I, inst->U.I.DstReg, src);
-	rc_remove_instruction(inst);
-}
-
 static void transform_CEIL(struct radeon_compiler* c,
 	struct rc_instruction* inst)
 {
@@ -647,7 +637,7 @@ static void transform_XPD(struct radeon_compiler* c,
  * no userData necessary.
  *
  * Eliminates the following ALU instructions:
- *  ABS, CEIL, DPH, DST, FLR, LIT, LRP, POW, SEQ, SFL, SGE, SGT, SLE, SLT, SNE, SUB, SWZ, XPD
+ *  CEIL, DPH, DST, FLR, LIT, LRP, POW, SEQ, SFL, SGE, SGT, SLE, SLT, SNE, SUB, SWZ, XPD
  * using:
  *  MOV, ADD, MUL, MAD, FRC, DP3, LG2, EX2, CMP
  *
@@ -662,7 +652,6 @@ int radeonTransformALU(
 	void* unused)
 {
 	switch(inst->U.I.Opcode) {
-	case RC_OPCODE_ABS: transform_ABS(c, inst); return 1;
 	case RC_OPCODE_CEIL: transform_CEIL(c, inst); return 1;
 	case RC_OPCODE_CLAMP: transform_CLAMP(c, inst); return 1;
 	case RC_OPCODE_DP2: transform_DP2(c, inst); return 1;
@@ -691,16 +680,6 @@ int radeonTransformALU(
 	}
 }
 
-
-static void transform_r300_vertex_ABS(struct radeon_compiler* c,
-	struct rc_instruction* inst)
-{
-	/* Note: r500 can take absolute values, but r300 cannot. */
-	inst->U.I.Opcode = RC_OPCODE_MAX;
-	inst->U.I.SrcReg[1] = inst->U.I.SrcReg[0];
-	inst->U.I.SrcReg[1].Negate ^= RC_MASK_XYZW;
-}
-
 static void transform_r300_vertex_CMP(struct radeon_compiler* c,
 	struct rc_instruction* inst)
 {
@@ -906,7 +885,6 @@ int r300_transform_vertex_alu(
 	void* unused)
 {
 	switch(inst->U.I.Opcode) {
-	case RC_OPCODE_ABS: transform_r300_vertex_ABS(c, inst); return 1;
 	case RC_OPCODE_CEIL: transform_CEIL(c, inst); return 1;
 	case RC_OPCODE_CLAMP: transform_CLAMP(c, inst); return 1;
 	case RC_OPCODE_CMP: transform_r300_vertex_CMP(c, inst); return 1;



More information about the mesa-commit mailing list