pan/bi: Add swizzles

Requires a new field on bifrost_instruction, as well as a new class
property and a new class for the dedicated swizzle ops.

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-03 08:35:51 -05:00 committed by Marge Bot
parent c70a198f24
commit 5896db9578
2 changed files with 13 additions and 1 deletions

View file

@ -33,7 +33,7 @@ unsigned bi_class_props[BI_NUM_CLASSES] = {
[BI_CMP] = BI_GENERIC | BI_MODS | BI_SCHED_ALL,
[BI_BLEND] = BI_ADD,
[BI_BITWISE] = BI_GENERIC | BI_SCHED_ALL,
[BI_CONVERT] = BI_SCHED_ALL,
[BI_CONVERT] = BI_SCHED_ALL | BI_SWIZZLABLE,
[BI_CSEL] = BI_SCHED_FMA,
[BI_DISCARD] = BI_SCHED_ADD,
[BI_FMA] = BI_ROUNDMODE | BI_SCHED_FMA,
@ -48,6 +48,7 @@ unsigned bi_class_props[BI_NUM_CLASSES] = {
[BI_STORE] = BI_SCHED_ADD,
[BI_STORE_VAR] = BI_SCHED_ADD,
[BI_SPECIAL] = BI_SCHED_ADD | BI_SCHED_SLOW,
[BI_SWIZZLE] = BI_SCHED_ALL | BI_SWIZZLABLE,
[BI_TEX] = BI_SCHED_ADD,
[BI_ROUND] = BI_GENERIC | BI_ROUNDMODE | BI_SCHED_ALL,
};

View file

@ -67,6 +67,7 @@ enum bi_class {
BI_STORE,
BI_STORE_VAR,
BI_SPECIAL, /* _FAST, _TABLE on supported GPUs */
BI_SWIZZLE,
BI_TEX,
BI_ROUND,
BI_NUM_CLASSES
@ -99,6 +100,9 @@ extern unsigned bi_class_props[BI_NUM_CLASSES];
* nopped out. Used for _FAST operations. */
#define BI_SCHED_SLOW (1 << 5)
/* Swizzling allowed for the 8/16-bit source */
#define BI_SWIZZLABLE (1 << 6)
/* It can't get any worse than csel4... can it? */
#define BIR_SRC_COUNT 4
@ -171,6 +175,13 @@ typedef struct {
* int). Zero if there is no destination. Bitsize included */
nir_alu_type dest_type;
/* If the source type is 8-bit or 16-bit such that SIMD is possible, and
* the class has BI_SWIZZLABLE, this is a swizzle for the input. Swizzles
* in practice only occur with one-source arguments (conversions,
* dedicated swizzle ops) and as component selection on two-sources
* where it is unambiguous which is which. Bounds are 32/type_size. */
unsigned swizzle[4];
/* A class-specific op from which the actual opcode can be derived
* (along with the above information) */