#include <stdbool.h>
#include "brw_inst.h"
-#include "brw_structs.h"
#include "brw_defines.h"
#include "brw_reg.h"
#include "intel_asm_annotation.h"
-#include "program/prog_instruction.h"
#ifdef __cplusplus
extern "C" {
brw_inst *current;
bool single_program_flow;
- bool compressed;
- const struct brw_device_info *devinfo;
+ const struct gen_device_info *devinfo;
/* Control flow stacks:
* - if_stack contains IF and ELSE instructions which must be patched
void brw_set_default_mask_control( struct brw_codegen *p, unsigned value );
void brw_set_default_saturate( struct brw_codegen *p, bool enable );
void brw_set_default_access_mode( struct brw_codegen *p, unsigned access_mode );
+void brw_inst_set_compression(const struct gen_device_info *devinfo,
+ brw_inst *inst, bool on);
+void brw_set_default_compression(struct brw_codegen *p, bool on);
+void brw_inst_set_group(const struct gen_device_info *devinfo,
+ brw_inst *inst, unsigned group);
+void brw_set_default_group(struct brw_codegen *p, unsigned group);
void brw_set_default_compression_control(struct brw_codegen *p, enum brw_compression c);
void brw_set_default_predicate_control( struct brw_codegen *p, unsigned pc );
void brw_set_default_predicate_inverse(struct brw_codegen *p, bool predicate_inverse);
void brw_set_default_flag_reg(struct brw_codegen *p, int reg, int subreg);
void brw_set_default_acc_write_control(struct brw_codegen *p, unsigned value);
-void brw_init_codegen(const struct brw_device_info *, struct brw_codegen *p,
+void brw_init_codegen(const struct gen_device_info *, struct brw_codegen *p,
void *mem_ctx);
-void brw_disassemble(const struct brw_device_info *devinfo, void *assembly,
+void brw_disassemble(const struct gen_device_info *devinfo, void *assembly,
int start, int end, FILE *out);
const unsigned *brw_get_program( struct brw_codegen *p, unsigned *sz );
ALU2(XOR)
ALU2(SHR)
ALU2(SHL)
+ALU1(DIM)
ALU2(ASR)
ALU1(F32TO16)
ALU1(F16TO32)
unsigned simd_mode,
unsigned return_format);
+void brw_set_message_descriptor(struct brw_codegen *p,
+ brw_inst *inst,
+ enum brw_message_target sfid,
+ unsigned msg_length,
+ unsigned response_length,
+ bool header_present,
+ bool end_of_thread);
+
void brw_set_dp_read_message(struct brw_codegen *p,
brw_inst *insn,
unsigned binding_table_index,
bool send_commit_msg);
void brw_fb_WRITE(struct brw_codegen *p,
- int dispatch_width,
struct brw_reg payload,
struct brw_reg implied_header,
unsigned msg_control,
bool last_render_target,
bool header_present);
+brw_inst *gen9_fb_READ(struct brw_codegen *p,
+ struct brw_reg dst,
+ struct brw_reg payload,
+ unsigned binding_table_index,
+ unsigned msg_length,
+ unsigned response_length,
+ bool per_sample);
+
void brw_SAMPLE(struct brw_codegen *p,
struct brw_reg dest,
unsigned msg_reg_nr,
uint32_t offset,
uint32_t bind_table_index);
+unsigned brw_scratch_surface_idx(const struct brw_codegen *p);
+
void brw_oword_block_read_scratch(struct brw_codegen *p,
struct brw_reg dest,
struct brw_reg mrf,
* instruction.
*/
static inline unsigned
-brw_jump_scale(const struct brw_device_info *devinfo)
+brw_jump_scale(const struct gen_device_info *devinfo)
{
/* Broadwell measures jump targets in bytes. */
if (devinfo->gen >= 8)
return 1;
}
+void brw_barrier(struct brw_codegen *p, struct brw_reg src);
+
/* If/else/endif. Works by manipulating the execution flags on each
* channel.
*/
void brw_NOP(struct brw_codegen *p);
+void brw_WAIT(struct brw_codegen *p);
+
/* Special case: there is never a destination, execution size will be
* taken from src0:
*/
unsigned msg_length,
unsigned num_channels);
+void
+brw_memory_fence(struct brw_codegen *p,
+ struct brw_reg dst);
+
void
brw_pixel_interpolator_query(struct brw_codegen *p,
struct brw_reg dest,
struct brw_reg mrf,
bool noperspective,
unsigned mode,
- unsigned data,
+ struct brw_reg data,
unsigned msg_length,
unsigned response_length);
+void
+brw_find_live_channel(struct brw_codegen *p,
+ struct brw_reg dst,
+ struct brw_reg mask);
+
+void
+brw_broadcast(struct brw_codegen *p,
+ struct brw_reg dst,
+ struct brw_reg src,
+ struct brw_reg idx);
+
/***********************************************************************
* brw_eu_util.c:
*/
void brw_set_src1(struct brw_codegen *p, brw_inst *insn, struct brw_reg reg);
-void brw_set_uip_jip(struct brw_codegen *p);
+void brw_set_uip_jip(struct brw_codegen *p, int start_offset);
enum brw_conditional_mod brw_negate_cmod(uint32_t cmod);
enum brw_conditional_mod brw_swap_cmod(uint32_t cmod);
/* brw_eu_compact.c */
-void brw_init_compaction_tables(const struct brw_device_info *devinfo);
+void brw_init_compaction_tables(const struct gen_device_info *devinfo);
void brw_compact_instructions(struct brw_codegen *p, int start_offset,
int num_annotations, struct annotation *annotation);
-void brw_uncompact_instruction(const struct brw_device_info *devinfo,
+void brw_uncompact_instruction(const struct gen_device_info *devinfo,
brw_inst *dst, brw_compact_inst *src);
-bool brw_try_compact_instruction(const struct brw_device_info *devinfo,
+bool brw_try_compact_instruction(const struct gen_device_info *devinfo,
brw_compact_inst *dst, brw_inst *src);
-void brw_debug_compact_uncompact(const struct brw_device_info *devinfo,
+void brw_debug_compact_uncompact(const struct gen_device_info *devinfo,
brw_inst *orig, brw_inst *uncompacted);
+/* brw_eu_validate.c */
+bool brw_validate_instructions(const struct brw_codegen *p, int start_offset,
+ struct annotation_info *annotation);
+
static inline int
-next_offset(const struct brw_device_info *devinfo, void *store, int offset)
+next_offset(const struct gen_device_info *devinfo, void *store, int offset)
{
brw_inst *insn = (brw_inst *)((char *)store + offset);
return offset + 16;
}
+struct opcode_desc {
+ /* The union is an implementation detail used by brw_opcode_desc() to handle
+ * opcodes that have been reused for different instructions across hardware
+ * generations.
+ *
+ * The gens field acts as a tag. If it is non-zero, name points to a string
+ * containing the instruction mnemonic. If it is zero, the table field is
+ * valid and either points to a secondary opcode_desc table with 'size'
+ * elements or is NULL and no such instruction exists for the opcode.
+ */
+ union {
+ struct {
+ char *name;
+ int nsrc;
+ };
+ struct {
+ const struct opcode_desc *table;
+ unsigned size;
+ };
+ };
+ int ndst;
+ int gens;
+};
+
+const struct opcode_desc *
+brw_opcode_desc(const struct gen_device_info *devinfo, enum opcode opcode);
+
+static inline bool
+is_3src(const struct gen_device_info *devinfo, enum opcode opcode)
+{
+ const struct opcode_desc *desc = brw_opcode_desc(devinfo, opcode);
+ return desc && desc->nsrc == 3;
+}
+
+/** Maximum SEND message length */
+#define BRW_MAX_MSG_LENGTH 15
+
+/** First MRF register used by pull loads */
+#define FIRST_SPILL_MRF(gen) ((gen) == 6 ? 21 : 13)
+
+/** First MRF register used by spills */
+#define FIRST_PULL_LOAD_MRF(gen) ((gen) == 6 ? 16 : 13)
+
#ifdef __cplusplus
}
#endif