summaryrefslogtreecommitdiffstats
path: root/src/panfrost
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2020-03-27 18:34:21 -0400
committerMarge Bot <[email protected]>2020-03-31 01:12:26 +0000
commit902f99a45d3e1a7e1ef85429c0ed4e067b2656f3 (patch)
treec6d6e107b2acc495fbf47ee4b646c448032a1dbc /src/panfrost
parent73715124ea53df1a3ef8cae6097556b98611dbb4 (diff)
pan/bi: Expand out FMA conversion opcodes
There are a *lot* of them, with lots of symmetry we can exploit to simplify the packing logic (but not entirely). Let's add the corresponding header structs/defines, although we don't actually poke the disassembler at this stage. Signed-off-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4382>
Diffstat (limited to 'src/panfrost')
-rw-r--r--src/panfrost/bifrost/bifrost.h34
-rw-r--r--src/panfrost/bifrost/disassemble.c7
2 files changed, 41 insertions, 0 deletions
diff --git a/src/panfrost/bifrost/bifrost.h b/src/panfrost/bifrost/bifrost.h
index 77a641d7135..1c06968d70a 100644
--- a/src/panfrost/bifrost/bifrost.h
+++ b/src/panfrost/bifrost/bifrost.h
@@ -283,6 +283,40 @@ struct bifrost_shift_add {
unsigned op : 7;
} __attribute__((packed));
+#define BIFROST_FMA_INT16_TO_32 (0xe0198 >> 3)
+
+struct bifrost_fma_int16_to_32 {
+ unsigned src0 : 3;
+ unsigned is_unsigned : 1;
+ unsigned swizzle : 1;
+ unsigned to_float : 1;
+ unsigned op : 17;
+} __attribute__((packed));
+
+/* We could combine but it's easier to just use FMA_ONE_SRC */
+#define BIFROST_FMA_FLOAT16_TO_32(y) (0xe01a2 | ((y) ? 1 : 0))
+
+/* Two sources for vectorization */
+#define BIFROST_FMA_FLOAT32_TO_16 (0xdd000 >> 3)
+
+/* Again we could combine but easier to just ONE_SRC with an
+ * argumnt for unsignedness */
+#define BIFROST_FMA_FLOAT32_TO_INT(u) (0xe0136 | ((u) ? 1 : 0))
+#define BIFROST_FMA_INT_TO_FLOAT32(u) (0xe0178 | ((u) ? 1 : 0))
+
+/* Used for f2i16 and i2f16 */
+#define BIFROST_FMA_F2I16 (0xe00)
+
+struct bifrost_fma_f2i_i2f16 {
+ unsigned src0 : 3;
+ unsigned is_unsigned : 1;
+ unsigned direction : 2; /* 00 for i2f, 11 for f2i */
+ unsigned swizzle : 2;
+ unsigned unk : 2; /* always 10 */
+ unsigned direction_2 : 1; /* 0 for f2i, 1 for i2f */
+ unsigned op : 12;
+} __attribute__((packed));
+
enum bifrost_ldst_type {
BIFROST_LDST_F16 = 0,
BIFROST_LDST_F32 = 1,
diff --git a/src/panfrost/bifrost/disassemble.c b/src/panfrost/bifrost/disassemble.c
index e025d5c89d4..cef8b58462e 100644
--- a/src/panfrost/bifrost/disassemble.c
+++ b/src/panfrost/bifrost/disassemble.c
@@ -480,6 +480,8 @@ static const struct fma_op_info FMAOpInfos[] = {
{ false, 0xd8000, "ADD.v2f16", FMA_FADD16 },
{ false, 0xdc000, "CSEL4.v16", FMA_CSEL4 },
{ false, 0xdd000, "F32_TO_F16", FMA_TWO_SRC },
+
+ /* TODO: Combine to bifrost_fma_f2i_i2f16 */
{ true, 0x00046, "F16_TO_I16.XX", FMA_ONE_SRC },
{ true, 0x00047, "F16_TO_U16.XX", FMA_ONE_SRC },
{ true, 0x0004e, "F16_TO_I16.YX", FMA_ONE_SRC },
@@ -496,10 +498,13 @@ static const struct fma_op_info FMAOpInfos[] = {
{ true, 0x000d1, "U16_TO_F16.XY", FMA_ONE_SRC },
{ true, 0x000d8, "I16_TO_F16.YY", FMA_ONE_SRC },
{ true, 0x000d9, "U16_TO_F16.YY", FMA_ONE_SRC },
+
{ true, 0x00136, "F32_TO_I32", FMA_ONE_SRC },
{ true, 0x00137, "F32_TO_U32", FMA_ONE_SRC },
{ true, 0x00178, "I32_TO_F32", FMA_ONE_SRC },
{ true, 0x00179, "U32_TO_F32", FMA_ONE_SRC },
+
+ /* TODO: cleanup to use bifrost_fma_int16_to_32 */
{ true, 0x00198, "I16_TO_I32.X", FMA_ONE_SRC },
{ true, 0x00199, "U16_TO_U32.X", FMA_ONE_SRC },
{ true, 0x0019a, "I16_TO_I32.Y", FMA_ONE_SRC },
@@ -508,8 +513,10 @@ static const struct fma_op_info FMAOpInfos[] = {
{ true, 0x0019d, "U16_TO_F32.X", FMA_ONE_SRC },
{ true, 0x0019e, "I16_TO_F32.Y", FMA_ONE_SRC },
{ true, 0x0019f, "U16_TO_F32.Y", FMA_ONE_SRC },
+
{ true, 0x001a2, "F16_TO_F32.X", FMA_ONE_SRC },
{ true, 0x001a3, "F16_TO_F32.Y", FMA_ONE_SRC },
+
{ true, 0x0032c, "NOP", FMA_ONE_SRC },
{ true, 0x0032d, "MOV", FMA_ONE_SRC },
{ true, 0x0032f, "SWZ.YY.v2i16", FMA_ONE_SRC },