mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 02:58:05 +02:00
agx: Remove and/or/xor pseudo ops
Switch back to bitop while keeping the aliases on agx_print_instr. Also add all variants of 2 args of agx_bitop_table. Signed-off-by: Mary Guillemard <mary@mary.zone> Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27616>
This commit is contained in:
parent
a5b6ff3ccc
commit
ba508fe854
5 changed files with 53 additions and 20 deletions
|
|
@ -129,6 +129,34 @@ enum agx_bitop_table {
|
|||
AGX_BITOP_OR = 0xE
|
||||
};
|
||||
|
||||
#define BINOP_BITOP(name, table) \
|
||||
static inline agx_instr * \
|
||||
agx_## name ##_to(agx_builder *b, agx_index dst0, agx_index src0, agx_index src1) \
|
||||
{ \
|
||||
return agx_bitop_to(b, dst0, src0, src1, AGX_BITOP_ ## table); \
|
||||
} \
|
||||
\
|
||||
static inline agx_index \
|
||||
agx_## name (agx_builder *b, agx_index src0, agx_index src1) \
|
||||
{ \
|
||||
agx_index tmp = agx_temp(b->shader, src0.size); \
|
||||
agx_##name##_to(b, tmp, src0, src1); \
|
||||
return tmp; \
|
||||
}
|
||||
|
||||
BINOP_BITOP(nor, NOR)
|
||||
BINOP_BITOP(andn2, ANDN2)
|
||||
BINOP_BITOP(andn1, ANDN1)
|
||||
BINOP_BITOP(xor, XOR)
|
||||
BINOP_BITOP(nand, NAND)
|
||||
BINOP_BITOP(and, AND)
|
||||
BINOP_BITOP(xnor, XNOR)
|
||||
BINOP_BITOP(orn2, ORN2)
|
||||
BINOP_BITOP(orn1, ORN1)
|
||||
BINOP_BITOP(or, OR)
|
||||
|
||||
#undef BINOP_BITOP
|
||||
|
||||
static inline agx_instr *
|
||||
agx_fmov_to(agx_builder *b, agx_index dst0, agx_index src0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -56,15 +56,6 @@ 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);
|
||||
|
||||
case AGX_OPCODE_AND:
|
||||
return agx_bitop_to(b, I->dest[0], I->src[0], I->src[1], AGX_BITOP_AND);
|
||||
|
||||
case AGX_OPCODE_XOR:
|
||||
return agx_bitop_to(b, I->dest[0], I->src[0], I->src[1], AGX_BITOP_XOR);
|
||||
|
||||
case AGX_OPCODE_OR:
|
||||
return agx_bitop_to(b, I->dest[0], I->src[0], I->src[1], AGX_BITOP_OR);
|
||||
|
||||
/* 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],
|
||||
|
|
|
|||
|
|
@ -463,9 +463,6 @@ op("stack_store",
|
|||
# Convenient aliases.
|
||||
op("mov", _, srcs = 1)
|
||||
op("not", _, srcs = 1)
|
||||
op("xor", _, srcs = 2)
|
||||
op("and", _, srcs = 2)
|
||||
op("or", _, srcs = 2)
|
||||
|
||||
op("collect", _, srcs = VARIABLE)
|
||||
op("split", _, srcs = 1, dests = VARIABLE)
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include "agx_builder.h"
|
||||
#include "agx_compiler.h"
|
||||
|
||||
static void
|
||||
|
|
@ -88,11 +89,34 @@ agx_print_index(agx_index index, bool is_float, FILE *fp)
|
|||
fprintf(fp, ".neg");
|
||||
}
|
||||
|
||||
static struct agx_opcode_info
|
||||
agx_get_opcode_info_for_print(const agx_instr *I)
|
||||
{
|
||||
struct agx_opcode_info info = agx_opcodes_info[I->op];
|
||||
|
||||
if (I->op == AGX_OPCODE_BITOP) {
|
||||
const char *bitops[16] = {
|
||||
[AGX_BITOP_NOR] = "nor", [AGX_BITOP_ANDN2] = "andn2",
|
||||
[AGX_BITOP_ANDN1] = "andn1", [AGX_BITOP_XOR] = "xor",
|
||||
[AGX_BITOP_NAND] = "nand", [AGX_BITOP_AND] = "and",
|
||||
[AGX_BITOP_XNOR] = "xnor", [AGX_BITOP_ORN2] = "orn2",
|
||||
[AGX_BITOP_ORN1] = "orn1", [AGX_BITOP_OR] = "or",
|
||||
};
|
||||
|
||||
if (bitops[I->truth_table] != NULL) {
|
||||
info.name = bitops[I->truth_table];
|
||||
info.immediates &= ~AGX_IMMEDIATE_TRUTH_TABLE;
|
||||
}
|
||||
}
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
void
|
||||
agx_print_instr(const agx_instr *I, FILE *fp)
|
||||
{
|
||||
assert(I->op < AGX_NUM_OPCODES);
|
||||
struct agx_opcode_info info = agx_opcodes_info[I->op];
|
||||
struct agx_opcode_info info = agx_get_opcode_info_for_print(I);
|
||||
bool print_comma = false;
|
||||
|
||||
fprintf(fp, " ");
|
||||
|
|
|
|||
|
|
@ -40,10 +40,3 @@ TEST_F(LowerPseudo, Not)
|
|||
{
|
||||
CASE(agx_not_to(b, wx, wy), agx_bitop_to(b, wx, wy, agx_zero(), 0x5));
|
||||
}
|
||||
|
||||
TEST_F(LowerPseudo, BinaryBitwise)
|
||||
{
|
||||
CASE(agx_and_to(b, wx, wy, wz), agx_bitop_to(b, wx, wy, wz, 0x8));
|
||||
CASE(agx_xor_to(b, wx, wy, wz), agx_bitop_to(b, wx, wy, wz, 0x6));
|
||||
CASE(agx_or_to(b, wx, wy, wz), agx_bitop_to(b, wx, wy, wz, 0xE));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue