From 6f589f4e045c0e3a353e15899e67729d08a1ded0 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Wed, 27 May 2020 12:32:28 -0400 Subject: [PATCH] pan/bi: Add CSEL.16 packing tests Passing but let's increase coverage. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/test/bi_interpret.c | 20 +++++++++++++++++--- src/panfrost/bifrost/test/bi_test_pack.c | 2 +- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/panfrost/bifrost/test/bi_interpret.c b/src/panfrost/bifrost/test/bi_interpret.c index 7f18fbc5554..43777ca72f8 100644 --- a/src/panfrost/bifrost/test/bi_interpret.c +++ b/src/panfrost/bifrost/test/bi_interpret.c @@ -511,10 +511,24 @@ bit_step(struct bit_state *s, bi_instruction *ins, bool FMA) case BI_CSEL: { bool direct = ins->cond == BI_COND_ALWAYS; - bool cond = direct ? srcs[0].u32 : - bit_eval_cond(ins->cond, srcs[0], srcs[1], ins->src_types[0], 0, 0); + unsigned sz = nir_alu_type_get_type_size(ins->src_types[0]); + + if (sz == 32) { + bool cond = direct ? srcs[0].u32 : + bit_eval_cond(ins->cond, srcs[0], srcs[1], ins->src_types[0], 0, 0); + + dest = cond ? srcs[2] : srcs[3]; + } else if (sz == 16) { + for (unsigned c = 0; c < 2; ++c) { + bool cond = direct ? srcs[0].u16[c] : + bit_eval_cond(ins->cond, srcs[0], srcs[1], ins->src_types[0], c, c); + + dest.u16[c] = cond ? srcs[2].u16[c] : srcs[3].u16[c]; + } + } else { + unreachable("Remaining types todo"); + } - dest = cond ? srcs[2] : srcs[3]; break; } diff --git a/src/panfrost/bifrost/test/bi_test_pack.c b/src/panfrost/bifrost/test/bi_test_pack.c index 352a7794b51..81bf0b02263 100644 --- a/src/panfrost/bifrost/test/bi_test_pack.c +++ b/src/panfrost/bifrost/test/bi_test_pack.c @@ -585,7 +585,7 @@ bit_packing(struct panfrost_device *dev, enum bit_debug debug) bit_icmp_helper(dev, input, sz, nir_type_int, debug); } - for (unsigned sz = 32; sz <= 32; sz *= 2) + for (unsigned sz = 16; sz <= 32; sz *= 2) bit_csel_helper(dev, sz, (uint32_t *) input32, debug); float special[4] = { 0.9 }; -- 2.30.2