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@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9330>
This commit is contained in:
Gert Wollny 2021-02-28 22:52:58 +01:00
parent 49b0e8657e
commit 4d91812d3c
3 changed files with 4 additions and 13 deletions

View file

@ -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;

View file

@ -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);

View file

@ -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;
}