Mesa (main): pan/va: Add MUX lowering tests
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Mon Jun 6 16:24:56 UTC 2022
Module: Mesa
Branch: main
Commit: 8f3b62f87e65ba951de4a01bccf2d2817689c526
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8f3b62f87e65ba951de4a01bccf2d2817689c526
Author: Alyssa Rosenzweig <alyssa at collabora.com>
Date: Fri May 6 17:02:57 2022 -0400
pan/va: Add MUX lowering tests
Signed-off-by: Alyssa Rosenzweig <alyssa at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16857>
---
.../bifrost/valhall/test/test-lower-isel.cpp | 33 +++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)
diff --git a/src/panfrost/bifrost/valhall/test/test-lower-isel.cpp b/src/panfrost/bifrost/valhall/test/test-lower-isel.cpp
index aec4ca6f8ff..f9c3b7874f3 100644
--- a/src/panfrost/bifrost/valhall/test/test-lower-isel.cpp
+++ b/src/panfrost/bifrost/valhall/test/test-lower-isel.cpp
@@ -43,6 +43,9 @@ protected:
LowerIsel() {
mem_ctx = ralloc_context(NULL);
reg = bi_register(1);
+ x = bi_register(2);
+ y = bi_register(3);
+ z = bi_register(4);
}
~LowerIsel() {
@@ -50,7 +53,7 @@ protected:
}
void *mem_ctx;
- bi_index reg;
+ bi_index reg, x, y, z;
};
TEST_F(LowerIsel, 8BitSwizzles) {
@@ -94,6 +97,34 @@ TEST_F(LowerIsel, IntegerCSEL) {
bi_csel_v2u16(b, reg, reg, reg, reg, BI_CMPF_EQ));
}
+TEST_F(LowerIsel, AvoidSimpleMux) {
+ CASE(bi_mux_i32(b, x, y, z, BI_MUX_INT_ZERO),
+ bi_csel_u32(b, z, bi_zero(), x, y, BI_CMPF_EQ));
+ CASE(bi_mux_i32(b, x, y, z, BI_MUX_NEG),
+ bi_csel_s32(b, z, bi_zero(), x, y, BI_CMPF_LT));
+ CASE(bi_mux_i32(b, x, y, z, BI_MUX_FP_ZERO),
+ bi_csel_f32(b, z, bi_zero(), x, y, BI_CMPF_EQ));
+
+ CASE(bi_mux_v2i16(b, x, y, z, BI_MUX_INT_ZERO),
+ bi_csel_v2u16(b, z, bi_zero(), x, y, BI_CMPF_EQ));
+ CASE(bi_mux_v2i16(b, x, y, z, BI_MUX_NEG),
+ bi_csel_v2s16(b, z, bi_zero(), x, y, BI_CMPF_LT));
+ CASE(bi_mux_v2i16(b, x, y, z, BI_MUX_FP_ZERO),
+ bi_csel_v2f16(b, z, bi_zero(), x, y, BI_CMPF_EQ));
+}
+
+TEST_F(LowerIsel, BitwiseMux) {
+ NEGCASE(bi_mux_i32(b, x, y, z, BI_MUX_BIT));
+ NEGCASE(bi_mux_v2i16(b, x, y, z, BI_MUX_BIT));
+ NEGCASE(bi_mux_v4i8(b, x, y, z, BI_MUX_BIT));
+}
+
+TEST_F(LowerIsel, MuxInt8) {
+ NEGCASE(bi_mux_v4i8(b, x, y, z, BI_MUX_INT_ZERO));
+ NEGCASE(bi_mux_v4i8(b, x, y, z, BI_MUX_NEG));
+ NEGCASE(bi_mux_v4i8(b, x, y, z, BI_MUX_FP_ZERO));
+}
+
TEST_F(LowerIsel, Smoke) {
NEGCASE(bi_fadd_f32_to(b, reg, reg, reg));
NEGCASE(bi_csel_s32_to(b, reg, reg, reg, reg, reg, BI_CMPF_LT));
More information about the mesa-commit
mailing list