From 7ac62121e037f3d9fbd3612d936ff736835e0b1f Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 2 Mar 2020 20:38:26 -0500 Subject: [PATCH] pan/bi: Add class properties We need to keep track of what specific classes support. For now just track floating point modifiers. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/panfrost/Makefile.sources | 1 + src/panfrost/bifrost/bi_tables.c | 53 ++++++++++++++++++++++++++++++++ src/panfrost/bifrost/compiler.h | 9 ++++++ src/panfrost/bifrost/meson.build | 1 + 4 files changed, 64 insertions(+) create mode 100644 src/panfrost/bifrost/bi_tables.c diff --git a/src/panfrost/Makefile.sources b/src/panfrost/Makefile.sources index 93b7418737c..1099ec528d2 100644 --- a/src/panfrost/Makefile.sources +++ b/src/panfrost/Makefile.sources @@ -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 index 00000000000..914acd1e218 --- /dev/null +++ b/src/panfrost/bifrost/bi_tables.c @@ -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 + */ + +#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, +}; diff --git a/src/panfrost/bifrost/compiler.h b/src/panfrost/bifrost/compiler.h index 9903bb6ee7c..8e66eb07e02 100644 --- a/src/panfrost/bifrost/compiler.h +++ b/src/panfrost/bifrost/compiler.h @@ -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 diff --git a/src/panfrost/bifrost/meson.build b/src/panfrost/bifrost/meson.build index db17294259c..f7141eb69e1 100644 --- a/src/panfrost/bifrost/meson.build +++ b/src/panfrost/bifrost/meson.build @@ -21,6 +21,7 @@ libpanfrost_bifrost_files = files( 'disassemble.c', + 'bi_tables.c', 'bifrost_compile.c', ) -- 2.30.2