agx: add pseudo for signext

easier to optimize

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32081>
This commit is contained in:
Alyssa Rosenzweig
2024-10-30 12:36:28 -04:00
committed by Marge Bot
parent 8de339c0d8
commit cfe0a9acec
3 changed files with 6 additions and 1 deletions
+1 -1
View File
@@ -1982,7 +1982,7 @@ agx_emit_alu(agx_builder *b, nir_alu_instr *instr)
return agx_asr_to(b, dst, ishl16, agx_immediate(8));
} else {
assert(s0.size == AGX_SIZE_16 && "other conversions lowered");
return agx_iadd_to(b, dst, s0, i0, 0);
return agx_signext_to(b, dst, s0);
}
}
+4
View File
@@ -83,6 +83,10 @@ lower(agx_builder *b, agx_instr *I)
case AGX_OPCODE_NOT:
return agx_bitop_to(b, I->dest[0], I->src[0], agx_zero(), AGX_BITOP_NOT);
/* We can sign-extend with an add */
case AGX_OPCODE_SIGNEXT:
return agx_iadd_to(b, I->dest[0], I->src[0], agx_zero(), 0);
/* Unfused comparisons are fused with a 0/1 select */
case AGX_OPCODE_ICMP:
return agx_icmpsel_to(b, I->dest[0], I->src[0], I->src[1],
+1
View File
@@ -501,6 +501,7 @@ op("stack_store",
# Convenient aliases.
op("mov", _, srcs = 1)
op("not", _, srcs = 1)
op("signext", _, srcs = 1)
op("collect", _, srcs = VARIABLE)
op("split", _, srcs = 1, dests = VARIABLE)