unsigned unk3 : 1; // part of clauseType?
unsigned next_clause_type: 4;
unsigned unk4 : 1; // part of nextClauseType?
+} __attribute__((packed));
+
+enum bifrost_packed_src {
+ BIFROST_SRC_PORT0 = 0,
+ BIFROST_SRC_PORT1 = 1,
+ BIFROST_SRC_PORT3 = 2,
+ BIFROST_SRC_STAGE = 3,
+ BIFROST_SRC_CONST_LO = 4,
+ BIFROST_SRC_CONST_HI = 5,
+ BIFROST_SRC_PASS_FMA = 6,
+ BIFROST_SRC_PASS_ADD = 7,
};
struct bifrost_fma_inst {
unsigned src0 : 3;
unsigned op : 20;
-};
+} __attribute__((packed));
struct bifrost_add_inst {
unsigned src0 : 3;
unsigned op : 17;
-};
+} __attribute__((packed));
enum bifrost_outmod {
BIFROST_NONE = 0x0,
BIFROST_SRC0_WINS = 0x3,
};
+#define BIFROST_FMA_OP_FADD32 (0x58 >> 2)
+
struct bifrost_fma_add {
unsigned src0 : 3;
unsigned src1 : 3;
enum bifrost_outmod outmod : 2;
enum bifrost_roundmode roundmode : 2;
unsigned op : 6;
-};
+} __attribute__((packed));
+
+#define BIFROST_FMA_OP_FMA (0x00)
+
+struct bifrost_fma_fma {
+ unsigned src0 : 3;
+ unsigned src1 : 3;
+ unsigned src2 : 3;
+ unsigned src_expand : 3;
+ unsigned src0_abs : 1;
+ unsigned unk : 4;
+ unsigned src0_neg : 1;
+ unsigned src2_neg : 1;
+ unsigned src1_abs : 1;
+ unsigned src2_abs : 1;
+ unsigned op : 5;
+} __attribute__((packed));
enum bifrost_csel_cond {
BIFROST_FEQ_F = 0x0,
unsigned src3 : 3;
enum bifrost_csel_cond cond : 3;
unsigned op : 8;
-};
+} __attribute__((packed));
struct bifrost_shift_fma {
unsigned src0 : 3;
/* For XOR, switches RSHIFT to LSHIFT since only one invert needed */
unsigned invert_2 : 1;
unsigned op : 8;
-};
+} __attribute__((packed));
struct bifrost_shift_add {
unsigned src0 : 3;
unsigned invert_2 : 1;
unsigned op : 7;
-};
+} __attribute__((packed));
enum bifrost_ldst_type {
BIFROST_LDST_F16 = 0,
unsigned location : 5;
enum bifrost_ldst_type type : 2;
unsigned op : 7;
-};
+} __attribute__((packed));
struct bifrost_ld_attr {
unsigned src0 : 3;
unsigned channels : 2; /* MALI_POSITIVE */
enum bifrost_ldst_type type : 2;
unsigned op : 5;
-};
+} __attribute__((packed));
enum bifrost_interp_mode {
BIFROST_INTERP_PER_FRAG = 0x0,
BIFROST_INTERP_EXPLICIT = 0x3
};
+#define BIFROST_ADD_OP_LD_VAR_16 (0x1a << 1)
+#define BIFROST_ADD_OP_LD_VAR_32 (0x0a << 1)
+
struct bifrost_ld_var {
unsigned src0 : 3;
unsigned reuse : 1;
unsigned flat : 1;
unsigned op : 6;
-};
+} __attribute__((packed));
struct bifrost_tex_ctrl {
unsigned sampler_index : 4; // also used to signal indirects
unsigned unk1 : 1;
unsigned result_type : 4; // integer, unsigned, float TODO: why is this 4 bits?
unsigned unk2 : 4;
-};
+} __attribute__((packed));
struct bifrost_dual_tex_ctrl {
unsigned sampler_index0 : 2;
unsigned sampler_index1 : 2;
unsigned tex_index1 : 2;
unsigned unk1 : 22;
-};
+} __attribute__((packed));
enum branch_bit_size {
BR_SIZE_32 = 0,
unsigned reg0 : 5;
unsigned reg1 : 6;
unsigned ctrl : 4;
-};
+} __attribute__((packed));
enum bifrost_branch_cond {
BR_COND_LT = 0,
/* Clause packing */
+#define BIFROST_FMA_NOP (0x701960)
+#define BIFROST_ADD_NOP (0x3D960)
+
struct bifrost_fmt1 {
unsigned ins_0 : 3;
unsigned tag : 5;
#define BIFROST_FMT1_FINAL 0b01001
#define BIFROST_FMT1_CONSTANTS 0b00001
+enum bifrost_reg_control {
+ BIFROST_WRITE_FMA_P2 = 1,
+ BIFROST_WRITE_FMA_P2_READ_P3 = 2,
+ BIFROST_WRITE_FMA_P2_READ_P3_ALT = 3,
+ BIFROST_READ_P3 = 4,
+ BIFROST_WRITE_ADD_P2 = 5,
+ BIFROST_WRITE_ADD_P2_READ_P3 = 6,
+ BIFROST_WRITE_ADD_P2_FMA_P3 = 7,
+
+ BIFROST_FIRST_NONE = 8,
+ BIFROST_FIRST_WRITE_FMA_P2 = 9,
+ BIFROST_REG_NONE = 11,
+ BIFROST_FIRST_READ_P3 = 12,
+ BIFROST_FIRST_WRITE_ADD_P2 = 13,
+ BIFROST_FIRST_WRITE_ADD_P2_READ_P3 = 14,
+ BIFROST_FIRST_WRITE_ADD_P2_FMA_P3 = 15
+};
+
#endif