From 15fe8d5d7b0d7edc976ad39d93e76aab6ad0e929 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Tue, 14 Apr 2020 17:00:31 -0400 Subject: [PATCH] pan/bit: Add fexp2_fast test Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/bifrost/test/bi_test_pack.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/panfrost/bifrost/test/bi_test_pack.c b/src/panfrost/bifrost/test/bi_test_pack.c index e097d74b8d9..ac0a80572db 100644 --- a/src/panfrost/bifrost/test/bi_test_pack.c +++ b/src/panfrost/bifrost/test/bi_test_pack.c @@ -295,14 +295,28 @@ static void bit_special_helper(struct panfrost_device *dev, unsigned size, uint32_t *input, enum bit_debug debug) { - bi_instruction ins = bit_ins(BI_SPECIAL, 1, nir_type_float, size); + bi_instruction ins = bit_ins(BI_SPECIAL, 2, nir_type_float, size); + uint32_t exp_input[4]; + + for (enum bi_special_op op = BI_SPECIAL_FRCP; op <= BI_SPECIAL_EXP2_LOW; ++op) { + if (op == BI_SPECIAL_EXP2_LOW) { + /* exp2 only supported in fp32 mode */ + if (size != 32) + continue; + + /* Give expected input */ + exp_input[1] = input[0]; + float *ff = (float *) input; + exp_input[0] = (int) (ff[0] * (1 << 24)); + } - for (enum bi_special_op op = BI_SPECIAL_FRCP; op <= BI_SPECIAL_FRSQ; ++op) { for (unsigned c = 0; c < ((size == 16) ? 2 : 1); ++c) { ins.op.special = op; ins.swizzle[0][0] = c; - if (!bit_test_single(dev, &ins, input, false, debug)) { + if (!bit_test_single(dev, &ins, + op == BI_SPECIAL_EXP2_LOW ? exp_input : input, + false, debug)) { fprintf(stderr, "FAIL: special%u.%s\n", size, bi_special_op_name(op)); } -- 2.30.2