pan/bi: Lower swizzles for 8-bit shifts
Fixes integers_ops.integer_ctz Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18656>
This commit is contained in:
committed by
Marge Bot
parent
2e1b02e6a3
commit
377bf3a5a4
@@ -30,6 +30,20 @@
|
||||
* recombine swizzles where we can as an optimization.
|
||||
*/
|
||||
|
||||
static bool
|
||||
bi_swizzle_replicates_8(enum bi_swizzle swz)
|
||||
{
|
||||
switch (swz) {
|
||||
case BI_SWIZZLE_B0000:
|
||||
case BI_SWIZZLE_B1111:
|
||||
case BI_SWIZZLE_B2222:
|
||||
case BI_SWIZZLE_B3333:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
lower_swizzle(bi_context *ctx, bi_instr *ins, unsigned src)
|
||||
{
|
||||
@@ -99,6 +113,19 @@ lower_swizzle(bi_context *ctx, bi_instr *ins, unsigned src)
|
||||
case BI_OPCODE_IADD_IMM_V4I8:
|
||||
break;
|
||||
|
||||
case BI_OPCODE_LSHIFT_AND_V4I8:
|
||||
case BI_OPCODE_LSHIFT_OR_V4I8:
|
||||
case BI_OPCODE_LSHIFT_XOR_V4I8:
|
||||
case BI_OPCODE_RSHIFT_AND_V4I8:
|
||||
case BI_OPCODE_RSHIFT_OR_V4I8:
|
||||
case BI_OPCODE_RSHIFT_XOR_V4I8:
|
||||
/* Last source allows identity or replication */
|
||||
if (src == 2 && bi_swizzle_replicates_8(ins->src[src].swizzle))
|
||||
return;
|
||||
|
||||
/* Others do not allow swizzles */
|
||||
break;
|
||||
|
||||
/* We don't want to deal with reswizzling logic in modifier prop. Move
|
||||
* the swizzle outside, it's easier for clamp propagation. */
|
||||
case BI_OPCODE_FCLAMP_V2F16:
|
||||
@@ -149,20 +176,6 @@ lower_swizzle(bi_context *ctx, bi_instr *ins, unsigned src)
|
||||
ins->src[src].swizzle = BI_SWIZZLE_H01;
|
||||
}
|
||||
|
||||
static bool
|
||||
bi_swizzle_replicates_8(enum bi_swizzle swz)
|
||||
{
|
||||
switch (swz) {
|
||||
case BI_SWIZZLE_B0000:
|
||||
case BI_SWIZZLE_B1111:
|
||||
case BI_SWIZZLE_B2222:
|
||||
case BI_SWIZZLE_B3333:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
bi_swizzle_replicates_16(enum bi_swizzle swz)
|
||||
{
|
||||
|
||||
@@ -75,3 +75,26 @@ TEST_F(LowerSwizzle, ClzHadd8)
|
||||
CASE(bi_hadd_v4u8_to(b, reg, y, x3210, BI_ROUND_RTP),
|
||||
bi_hadd_v4u8_to(b, reg, y, bi_swz_v4i8(b, x3210), BI_ROUND_RTP));
|
||||
}
|
||||
|
||||
TEST_F(LowerSwizzle, FirstShift8)
|
||||
{
|
||||
enum bi_opcode ops[] = {
|
||||
BI_OPCODE_LSHIFT_AND_V4I8,
|
||||
BI_OPCODE_LSHIFT_OR_V4I8,
|
||||
BI_OPCODE_LSHIFT_XOR_V4I8,
|
||||
BI_OPCODE_RSHIFT_AND_V4I8,
|
||||
BI_OPCODE_RSHIFT_OR_V4I8,
|
||||
BI_OPCODE_RSHIFT_XOR_V4I8,
|
||||
};
|
||||
|
||||
for (unsigned i = 0; i < ARRAY_SIZE(ops); ++i) {
|
||||
CASE({
|
||||
bi_instr *I = bi_lshift_and_v4i8_to(b, reg, x3210, y, z);
|
||||
I->op = ops[i];
|
||||
},
|
||||
{
|
||||
bi_instr *I = bi_lshift_and_v4i8_to(b, reg, bi_swz_v4i8(b, x3210), y, z);
|
||||
I->op = ops[i];
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user