pan/bi: Add class properties
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tue, 3 Mar 2020 01:38:26 +0000 (20:38 -0500)
committerMarge Bot <eric+marge@anholt.net>
Thu, 5 Mar 2020 14:35:38 +0000 (14:35 +0000)
We need to keep track of what specific classes support. For now just
track floating point modifiers.

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

src/panfrost/Makefile.sources
src/panfrost/bifrost/bi_tables.c [new file with mode: 0644]
src/panfrost/bifrost/compiler.h
src/panfrost/bifrost/meson.build

index 93b7418737ccdd0488a3eb87e27968d8a97522a4..1099ec528d2829afea60b9502de07ea17b49b47a 100644 (file)
@@ -2,6 +2,7 @@ bifrost_FILES := \
         bifrost/bifrost.h \
         bifrost/bifrost_compile.c \
         bifrost/bifrost_compile.h \
+        bifrost/bifrost_tables.c \
         bifrost/compiler.h \
         bifrost/cmdline.c \
         bifrost/disassemble.c \
diff --git a/src/panfrost/bifrost/bi_tables.c b/src/panfrost/bifrost/bi_tables.c
new file mode 100644 (file)
index 0000000..914acd1
--- /dev/null
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2020 Collabora Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Authors (Collabora):
+ *      Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
+ */
+
+#include "compiler.h"
+
+unsigned bi_class_props[BI_NUM_CLASSES] = {
+        [BI_ADD]               = BI_MODS,
+        [BI_ATEST]             = 0,
+        [BI_BRANCH]            = 0,
+        [BI_CMP]               = BI_MODS,
+        [BI_BLEND]             = 0,
+        [BI_BITWISE]           = 0,
+        [BI_CONVERT]           = 0,
+        [BI_CSEL]              = 0,
+        [BI_DISCARD]           = 0,
+        [BI_FMA]               = 0,
+        [BI_FREXP]             = 0,
+        [BI_LOAD]              = 0,
+        [BI_LOAD_ATTR]                 = 0,
+        [BI_LOAD_VAR]          = 0,
+        [BI_LOAD_VAR_ADDRESS]  = 0,
+        [BI_MINMAX]            = 0,
+        [BI_MOV]               = BI_MODS,
+        [BI_SHIFT]             = 0,
+        [BI_STORE]             = 0,
+        [BI_STORE_VAR]                 = 0,
+        [BI_SPECIAL]           = 0,
+        [BI_TEX]               = 0,
+        [BI_ROUND]             = 0,
+};
index 9903bb6ee7c6bcaf876b8f01076139e0bc0e57ec..8e66eb07e02c1217398b7048f9630ef3104397fc 100644 (file)
@@ -27,6 +27,8 @@
 #ifndef __BIFROST_COMPILER_H
 #define __BIFROST_COMPILER_H
 
+#include "compiler/nir/nir.h"
+
 /* Bifrost opcodes are tricky -- the same op may exist on both FMA and
  * ADD with two completely different opcodes, and opcodes can be varying
  * length in some cases. Then we have different opcodes for int vs float
@@ -66,8 +68,15 @@ enum bi_class {
         BI_SPECIAL, /* _FAST, _TABLE on supported GPUs */
         BI_TEX,
         BI_ROUND,
+        BI_NUM_CLASSES
 };
 
+/* Properties of a class... */
+extern unsigned bi_class_props[BI_NUM_CLASSES];
+
+/* abs/neg/outmod valid for a float op */
+#define BI_MODS (1 << 0)
+
 /* It can't get any worse than csel4... can it? */
 #define BIR_SRC_COUNT 4
 
index db17294259ca95e85eef600a05d3c9278ea02fc0..f7141eb69e1f7c8a92b3ad3b9d3a5d8776fdf0ff 100644 (file)
@@ -21,6 +21,7 @@
 
 libpanfrost_bifrost_files = files(
   'disassemble.c',
+  'bi_tables.c',
   'bifrost_compile.c',
 )