pan/bit: Add fexp2_fast test

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4615>
This commit is contained in:
Alyssa Rosenzweig 2020-04-14 17:00:31 -04:00
parent 20f255b18e
commit 15fe8d5d7b

View file

@ -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));
}