mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 13:28:06 +02:00
pan/bi: Test avoiding *FADD.v2f16 hazard in optimizer
This hazard exists but is obscure enough to be missed on our existing test coverage (e.g the conformance tests). Add piles of unit tests for it. Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15072>
This commit is contained in:
parent
24d2bdb1e0
commit
9d95561c93
1 changed files with 72 additions and 0 deletions
|
|
@ -107,6 +107,78 @@ TEST_F(Optimizer, FusedFABSNEGForFP16)
|
|||
bi_fmin_v2f16_to(b, reg, negabsx, bi_neg(y)));
|
||||
}
|
||||
|
||||
TEST_F(Optimizer, FuseFADD_F32WithEqualSourcesAbsAbsAndClamp)
|
||||
{
|
||||
CASE({
|
||||
bi_instr *I = bi_fadd_f32_to(b, reg, bi_fabsneg_f32(b, bi_abs(x)), bi_abs(x), BI_ROUND_NONE);
|
||||
I->clamp = BI_CLAMP_CLAMP_0_1;
|
||||
}, {
|
||||
bi_instr *I = bi_fadd_f32_to(b, reg, bi_abs(x), bi_abs(x), BI_ROUND_NONE);
|
||||
I->clamp = BI_CLAMP_CLAMP_0_1;
|
||||
});
|
||||
|
||||
CASE({
|
||||
bi_instr *I = bi_fadd_f32_to(b, reg, bi_abs(x), bi_fabsneg_f32(b, bi_abs(x)), BI_ROUND_NONE);
|
||||
I->clamp = BI_CLAMP_CLAMP_0_1;
|
||||
}, {
|
||||
bi_instr *I = bi_fadd_f32_to(b, reg, bi_abs(x), bi_abs(x), BI_ROUND_NONE);
|
||||
I->clamp = BI_CLAMP_CLAMP_0_1;
|
||||
});
|
||||
|
||||
CASE({
|
||||
bi_instr *I = bi_fclamp_f32_to(b, reg, bi_fadd_f32(b, bi_abs(x), bi_abs(x), BI_ROUND_NONE));
|
||||
I->clamp = BI_CLAMP_CLAMP_0_INF;
|
||||
}, {
|
||||
bi_instr *I = bi_fadd_f32_to(b, reg, bi_abs(x), bi_abs(x), BI_ROUND_NONE);
|
||||
I->clamp = BI_CLAMP_CLAMP_0_INF;
|
||||
});
|
||||
}
|
||||
|
||||
TEST_F(Optimizer, FuseFADD_V2F16WithDifferentSourcesAbsAbsAndClamp)
|
||||
{
|
||||
CASE({
|
||||
bi_instr *I = bi_fadd_v2f16_to(b, reg, bi_fabsneg_v2f16(b, bi_abs(x)), bi_abs(y), BI_ROUND_NONE);
|
||||
I->clamp = BI_CLAMP_CLAMP_0_1;
|
||||
}, {
|
||||
bi_instr *I = bi_fadd_v2f16_to(b, reg, bi_abs(x), bi_abs(y), BI_ROUND_NONE);
|
||||
I->clamp = BI_CLAMP_CLAMP_0_1;
|
||||
});
|
||||
|
||||
CASE({
|
||||
bi_instr *I = bi_fadd_v2f16_to(b, reg, bi_abs(x), bi_fabsneg_v2f16(b, bi_abs(y)), BI_ROUND_NONE);
|
||||
I->clamp = BI_CLAMP_CLAMP_0_1;
|
||||
}, {
|
||||
bi_instr *I = bi_fadd_v2f16_to(b, reg, bi_abs(x), bi_abs(y), BI_ROUND_NONE);
|
||||
I->clamp = BI_CLAMP_CLAMP_0_1;
|
||||
});
|
||||
|
||||
CASE({
|
||||
bi_instr *I = bi_fclamp_v2f16_to(b, reg, bi_fadd_v2f16(b, bi_abs(x), bi_abs(y), BI_ROUND_NONE));
|
||||
I->clamp = BI_CLAMP_CLAMP_0_INF;
|
||||
}, {
|
||||
bi_instr *I = bi_fadd_v2f16_to(b, reg, bi_abs(x), bi_abs(y), BI_ROUND_NONE);
|
||||
I->clamp = BI_CLAMP_CLAMP_0_INF;
|
||||
});
|
||||
}
|
||||
|
||||
TEST_F(Optimizer, AvoidFADD_V2F16WithEqualSourcesAbsAbsAndClamp)
|
||||
{
|
||||
NEGCASE({
|
||||
bi_instr *I = bi_fadd_v2f16_to(b, reg, bi_fabsneg_v2f16(b, bi_abs(x)), bi_abs(x), BI_ROUND_NONE);
|
||||
I->clamp = BI_CLAMP_CLAMP_0_1;
|
||||
});
|
||||
|
||||
NEGCASE({
|
||||
bi_instr *I = bi_fadd_v2f16_to(b, reg, bi_abs(x), bi_fabsneg_v2f16(b, bi_abs(x)), BI_ROUND_NONE);
|
||||
I->clamp = BI_CLAMP_CLAMP_0_1;
|
||||
});
|
||||
|
||||
NEGCASE({
|
||||
bi_instr *I = bi_fclamp_v2f16_to(b, reg, bi_fadd_v2f16(b, bi_abs(x), bi_abs(x), BI_ROUND_NONE));
|
||||
I->clamp = BI_CLAMP_CLAMP_0_INF;
|
||||
});
|
||||
}
|
||||
|
||||
TEST_F(Optimizer, SwizzlesComposedForFP16)
|
||||
{
|
||||
CASE(bi_fadd_v2f16_to(b, reg, bi_fabsneg_v2f16(b, bi_swz_16(negabsx, true, false)), y, BI_ROUND_RTP),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue