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 <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4061>
This commit is contained in:
Alyssa Rosenzweig 2020-03-02 20:38:26 -05:00 committed by Marge Bot
parent 230be61f20
commit 7ac62121e0
4 changed files with 64 additions and 0 deletions

View 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 \

View File

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

View 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

View File

@ -21,6 +21,7 @@
libpanfrost_bifrost_files = files(
'disassemble.c',
'bi_tables.c',
'bifrost_compile.c',
)