diff --git a/src/etnaviv/isa/asm.h b/src/etnaviv/isa/asm.h index f08bd1f83d7..1f2e9dffd46 100644 --- a/src/etnaviv/isa/asm.h +++ b/src/etnaviv/isa/asm.h @@ -16,6 +16,26 @@ /* Number of source operands per instruction */ #define ETNA_NUM_SRC (3) +#define SWIZ_X(x) (((x) & 0x03) << 0) +#define SWIZ_Y(y) (((y) & 0x03) << 2) +#define SWIZ_Z(z) (((z) & 0x03) << 4) +#define SWIZ_W(w) (((w) & 0x03) << 6) + +/* Broadcast swizzle to all four components */ +#define INST_SWIZ_BROADCAST(x) \ + (SWIZ_X(x) | SWIZ_Y(x) | SWIZ_Z(x) | SWIZ_W(x)) +/* Identity (NOP) swizzle */ +#define INST_SWIZ_IDENTITY \ + (SWIZ_X(0) | SWIZ_Y(1) | SWIZ_Z(2) | SWIZ_W(3)) +/* Fully specified swizzle */ +#define INST_SWIZ(x, y, z, w) \ + (SWIZ_X(x) | SWIZ_Y(y) | SWIZ_Z(z) | SWIZ_W(w)) +#define SWIZZLE(c0, c1, c2, c3) \ + INST_SWIZ(ISA_SWIZ_##c0, \ + ISA_SWIZ_##c1, \ + ISA_SWIZ_##c2, \ + ISA_SWIZ_##c3) + /*** operands ***/ /* destination operand */ diff --git a/src/gallium/drivers/etnaviv/etnaviv_asm.h b/src/gallium/drivers/etnaviv/etnaviv_asm.h index 0259ec413c5..e20585c5dd0 100644 --- a/src/gallium/drivers/etnaviv/etnaviv_asm.h +++ b/src/gallium/drivers/etnaviv/etnaviv_asm.h @@ -37,22 +37,6 @@ /* Size of an instruction in 32-bit words */ #define ETNA_INST_SIZE (4) -/* Broadcast swizzle to all four components */ -#define INST_SWIZ_BROADCAST(x) \ - (INST_SWIZ_X(x) | INST_SWIZ_Y(x) | INST_SWIZ_Z(x) | INST_SWIZ_W(x)) -/* Identity (NOP) swizzle */ -#define INST_SWIZ_IDENTITY \ - (INST_SWIZ_X(0) | INST_SWIZ_Y(1) | INST_SWIZ_Z(2) | INST_SWIZ_W(3)) -/* Fully specified swizzle */ -#define INST_SWIZ(x,y,z,w) \ - (INST_SWIZ_X(x) | INST_SWIZ_Y(y) | INST_SWIZ_Z(z) | INST_SWIZ_W(w)) -#define SWIZZLE(c0,c1,c2,c3) \ - INST_SWIZ(INST_SWIZ_COMP_##c0, \ - INST_SWIZ_COMP_##c1, \ - INST_SWIZ_COMP_##c2, \ - INST_SWIZ_COMP_##c3) - - /* Compose two swizzles (computes swz1.swz2) */ static inline uint32_t inst_swiz_compose(uint32_t swz1, uint32_t swz2) {