mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 13:28:06 +02:00
pan/bi: Test CMP result_type optimization
Add unit tests ensuring the optimization applies in all the cases we care about, as functional integration tests (CTS and Piglit) won't test this. Also add unit tests for a few cases where we specifically cannot fuse, in case these cases are missed by the tests. Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16725>
This commit is contained in:
parent
501a66cb5c
commit
01ba3460a9
1 changed files with 69 additions and 0 deletions
|
|
@ -352,3 +352,72 @@ TEST_F(Optimizer, DoNotFuseSpecialComparisons)
|
|||
NEGCASE(bi_discard_b32(b, bi_fcmp_f32(b, x, y, BI_CMPF_GTLT, BI_RESULT_TYPE_F1)));
|
||||
NEGCASE(bi_discard_b32(b, bi_fcmp_f32(b, x, y, BI_CMPF_TOTAL, BI_RESULT_TYPE_F1)));
|
||||
}
|
||||
|
||||
TEST_F(Optimizer, FuseResultType)
|
||||
{
|
||||
CASE(bi_mux_i32_to(b, reg, bi_imm_f32(0.0), bi_imm_f32(1.0),
|
||||
bi_fcmp_f32(b, x, y, BI_CMPF_LE, BI_RESULT_TYPE_M1),
|
||||
BI_MUX_INT_ZERO),
|
||||
bi_fcmp_f32_to(b, reg, x, y, BI_CMPF_LE, BI_RESULT_TYPE_F1));
|
||||
|
||||
CASE(bi_mux_i32_to(b, reg, bi_imm_f32(0.0), bi_imm_f32(1.0),
|
||||
bi_fcmp_f32(b, bi_abs(x), bi_neg(y), BI_CMPF_LE, BI_RESULT_TYPE_M1),
|
||||
BI_MUX_INT_ZERO),
|
||||
bi_fcmp_f32_to(b, reg, bi_abs(x), bi_neg(y), BI_CMPF_LE, BI_RESULT_TYPE_F1));
|
||||
|
||||
CASE(bi_mux_i32_to(b, reg, bi_imm_u32(0), bi_imm_u32(1),
|
||||
bi_fcmp_f32(b, bi_abs(x), bi_neg(y), BI_CMPF_LE, BI_RESULT_TYPE_M1),
|
||||
BI_MUX_INT_ZERO),
|
||||
bi_fcmp_f32_to(b, reg, bi_abs(x), bi_neg(y), BI_CMPF_LE, BI_RESULT_TYPE_I1));
|
||||
|
||||
CASE(bi_mux_v2i16_to(b, reg, bi_imm_f16(0.0), bi_imm_f16(1.0),
|
||||
bi_fcmp_v2f16(b, bi_abs(x), bi_neg(y), BI_CMPF_LE, BI_RESULT_TYPE_M1),
|
||||
BI_MUX_INT_ZERO),
|
||||
bi_fcmp_v2f16_to(b, reg, bi_abs(x), bi_neg(y), BI_CMPF_LE, BI_RESULT_TYPE_F1));
|
||||
|
||||
CASE(bi_mux_v2i16_to(b, reg, bi_imm_u16(0), bi_imm_u16(1),
|
||||
bi_fcmp_v2f16(b, bi_abs(x), bi_neg(y), BI_CMPF_LE, BI_RESULT_TYPE_M1),
|
||||
BI_MUX_INT_ZERO),
|
||||
bi_fcmp_v2f16_to(b, reg, bi_abs(x), bi_neg(y), BI_CMPF_LE, BI_RESULT_TYPE_I1));
|
||||
|
||||
CASE(bi_mux_i32_to(b, reg, bi_imm_u32(0), bi_imm_u32(1),
|
||||
bi_icmp_u32(b, x, y, BI_CMPF_LE, BI_RESULT_TYPE_M1),
|
||||
BI_MUX_INT_ZERO),
|
||||
bi_icmp_u32_to(b, reg, x, y, BI_CMPF_LE, BI_RESULT_TYPE_I1));
|
||||
|
||||
CASE(bi_mux_v2i16_to(b, reg, bi_imm_u16(0), bi_imm_u16(1),
|
||||
bi_icmp_v2u16(b, x, y, BI_CMPF_LE, BI_RESULT_TYPE_M1),
|
||||
BI_MUX_INT_ZERO),
|
||||
bi_icmp_v2u16_to(b, reg, x, y, BI_CMPF_LE, BI_RESULT_TYPE_I1));
|
||||
|
||||
CASE(bi_mux_v4i8_to(b, reg, bi_imm_u8(0), bi_imm_u8(1),
|
||||
bi_icmp_v4u8(b, x, y, BI_CMPF_LE, BI_RESULT_TYPE_M1),
|
||||
BI_MUX_INT_ZERO),
|
||||
bi_icmp_v4u8_to(b, reg, x, y, BI_CMPF_LE, BI_RESULT_TYPE_I1));
|
||||
|
||||
CASE(bi_mux_i32_to(b, reg, bi_imm_u32(0), bi_imm_u32(1),
|
||||
bi_icmp_s32(b, x, y, BI_CMPF_LE, BI_RESULT_TYPE_M1),
|
||||
BI_MUX_INT_ZERO),
|
||||
bi_icmp_s32_to(b, reg, x, y, BI_CMPF_LE, BI_RESULT_TYPE_I1));
|
||||
|
||||
CASE(bi_mux_v2i16_to(b, reg, bi_imm_u16(0), bi_imm_u16(1),
|
||||
bi_icmp_v2s16(b, x, y, BI_CMPF_LE, BI_RESULT_TYPE_M1),
|
||||
BI_MUX_INT_ZERO),
|
||||
bi_icmp_v2s16_to(b, reg, x, y, BI_CMPF_LE, BI_RESULT_TYPE_I1));
|
||||
|
||||
CASE(bi_mux_v4i8_to(b, reg, bi_imm_u8(0), bi_imm_u8(1),
|
||||
bi_icmp_v4s8(b, x, y, BI_CMPF_LE, BI_RESULT_TYPE_M1),
|
||||
BI_MUX_INT_ZERO),
|
||||
bi_icmp_v4s8_to(b, reg, x, y, BI_CMPF_LE, BI_RESULT_TYPE_I1));
|
||||
}
|
||||
|
||||
TEST_F(Optimizer, DoNotFuseMixedSizeResultType)
|
||||
{
|
||||
NEGCASE(bi_mux_i32_to(b, reg, bi_imm_f32(0.0), bi_imm_f32(1.0),
|
||||
bi_fcmp_v2f16(b, bi_abs(x), bi_neg(y), BI_CMPF_LE, BI_RESULT_TYPE_M1),
|
||||
BI_MUX_INT_ZERO));
|
||||
|
||||
NEGCASE(bi_mux_v2i16_to(b, reg, bi_imm_f16(0.0), bi_imm_f16(1.0),
|
||||
bi_fcmp_f32(b, bi_abs(x), bi_neg(y), BI_CMPF_LE, BI_RESULT_TYPE_M1),
|
||||
BI_MUX_INT_ZERO));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue