From: Alyssa Rosenzweig Date: Wed, 15 Apr 2020 15:40:59 +0000 (-0400) Subject: pan/bit: Add constants test X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=532dfebc713bac114aa7a0f12f340f2cfae1ed52;p=mesa.git pan/bit: Add constants test Signed-off-by: Alyssa Rosenzweig Part-of: --- diff --git a/src/panfrost/bifrost/test/bi_test_pack.c b/src/panfrost/bifrost/test/bi_test_pack.c index ac0a80572db..e127ea3b8de 100644 --- a/src/panfrost/bifrost/test/bi_test_pack.c +++ b/src/panfrost/bifrost/test/bi_test_pack.c @@ -422,6 +422,33 @@ bit_convert_helper(struct panfrost_device *dev, unsigned from_size, } } +static void +bit_constant_helper(struct panfrost_device *dev, + uint32_t *input, enum bit_debug debug) +{ + enum bi_class C[3] = { BI_MOV, BI_ADD, BI_FMA }; + + for (unsigned doubled = 0; doubled < 2; ++doubled) { + for (unsigned count = 1; count <= 3; ++count) { + bi_instruction ins = bit_ins(C[count - 1], count, nir_type_float, 32); + + ins.src[0] = BIR_INDEX_CONSTANT | 0; + ins.src[1] = (count >= 2) ? BIR_INDEX_CONSTANT | (doubled ? 32 : 0) : 0; + ins.src[2] = (count >= 3) ? BIR_INDEX_ZERO : 0; + + ins.constant.u64 = doubled ? + 0x3f800000ull | (0x3f000000ull << 32ull) : + 0x3f800000ull; + + if (!bit_test_single(dev, &ins, input, true, debug)) { + fprintf(stderr, "FAIL: constants.%s.%u\n", + doubled ? "two" : "one", + count); + } + } + } +} + void bit_packing(struct panfrost_device *dev, enum bit_debug debug) { @@ -431,6 +458,8 @@ bit_packing(struct panfrost_device *dev, enum bit_debug debug) bit_generate_float4(input32); bit_generate_half8(input16); + bit_constant_helper(dev, (uint32_t *) input32, debug); + for (unsigned sz = 16; sz <= 32; sz *= 2) { uint32_t *input = (sz == 16) ? (uint32_t *) input16 :