pan/bit: Add fexp2_fast interp
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 14 Apr 2020 20:59:41 +0000 (16:59 -0400)
committerAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Fri, 17 Apr 2020 20:25:36 +0000 (16:25 -0400)
Kind of a hack and not at all how the h/w does it.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4615>

src/panfrost/bifrost/test/bi_interpret.c

index 9e88795b3241714b6b7babe164bad903d951fde9..1d7b51bba17478bcc276c7cfe1839f51fa5e1f2d 100644 (file)
@@ -489,7 +489,14 @@ bit_step(struct bit_state *s, bi_instruction *ins, bool FMA)
 
         case BI_SPECIAL: {
                 assert(nir_alu_type_get_base_type(ins->dest_type) == nir_type_float);
-                assert(nir_alu_type_get_base_type(ins->dest_type) != nir_type_float64);
+                assert(ins->dest_type != nir_type_float64);
+
+                if (ins->op.special == BI_SPECIAL_EXP2_LOW) {
+                        assert(ins->dest_type == nir_type_float32);
+                        dest.f32 = exp2f(srcs[1].f32);
+                        break;
+                }
+
                 float Q = (ins->dest_type == nir_type_float16) ?
                         bf(srcs[0].u16[ins->swizzle[0][0]]) :
                         srcs[0].f32;