#include "brw_eu_defines.h"
#include "brw_eu.h"
#include "brw_shader.h"
+#include "brw_gen_enum.h"
#include "dev/gen_debug.h"
#include "util/ralloc.h"
p->store = (brw_inst *)reralloc_size(p->mem_ctx, p->store, p->next_insn_offset);
assert(p->store);
- read(fd, p->store + start_offset, sb.st_size);
+ ssize_t ret = read(fd, p->store + start_offset, sb.st_size);
close(fd);
+ if (ret != sb.st_size) {
+ return false;
+ }
ASSERTED bool valid =
brw_validate_instructions(p->devinfo, p->store,
start_offset, p->next_insn_offset,
- 0);
+ NULL);
assert(valid);
return true;
}
}
-enum gen {
- GEN4 = (1 << 0),
- GEN45 = (1 << 1),
- GEN5 = (1 << 2),
- GEN6 = (1 << 3),
- GEN7 = (1 << 4),
- GEN75 = (1 << 5),
- GEN8 = (1 << 6),
- GEN9 = (1 << 7),
- GEN10 = (1 << 8),
- GEN11 = (1 << 9),
- GEN12 = (1 << 10),
- GEN_ALL = ~0
-};
-
-#define GEN_LT(gen) ((gen) - 1)
-#define GEN_GE(gen) (~GEN_LT(gen))
-#define GEN_LE(gen) (GEN_LT(gen) | (gen))
-
static const struct opcode_desc opcode_descs[] = {
/* IR, HW, name, nsrc, ndst, gens */
{ BRW_OPCODE_ILLEGAL, 0, "illegal", 0, 0, GEN_ALL },
{ BRW_OPCODE_GOTO, 46, "goto", 0, 0, GEN_GE(GEN8) },
{ BRW_OPCODE_POP, 47, "pop", 2, 0, GEN_LE(GEN5) },
{ BRW_OPCODE_WAIT, 48, "wait", 1, 0, GEN_LT(GEN12) },
- { BRW_OPCODE_SEND, 49, "send", 1, 1, GEN_ALL },
- { BRW_OPCODE_SENDC, 50, "sendc", 1, 1, GEN_ALL },
+ { BRW_OPCODE_SEND, 49, "send", 1, 1, GEN_LT(GEN12) },
+ { BRW_OPCODE_SENDC, 50, "sendc", 1, 1, GEN_LT(GEN12) },
+ { BRW_OPCODE_SEND, 49, "send", 2, 1, GEN_GE(GEN12) },
+ { BRW_OPCODE_SENDC, 50, "sendc", 2, 1, GEN_GE(GEN12) },
{ BRW_OPCODE_SENDS, 51, "sends", 2, 1, GEN_GE(GEN9) & GEN_LT(GEN12) },
{ BRW_OPCODE_SENDSC, 52, "sendsc", 2, 1, GEN_GE(GEN9) & GEN_LT(GEN12) },
{ BRW_OPCODE_MATH, 56, "math", 2, 1, GEN_GE(GEN6) },
{ BRW_OPCODE_NOP, 96, "nop", 0, 0, GEN_GE(GEN12) }
};
-static enum gen
-gen_from_devinfo(const struct gen_device_info *devinfo)
-{
- switch (devinfo->gen) {
- case 4: return devinfo->is_g4x ? GEN45 : GEN4;
- case 5: return GEN5;
- case 6: return GEN6;
- case 7: return devinfo->is_haswell ? GEN75 : GEN7;
- case 8: return GEN8;
- case 9: return GEN9;
- case 10: return GEN10;
- case 11: return GEN11;
- case 12: return GEN12;
- default:
- unreachable("not reached");
- }
-}
-
/**
* Look up the opcode_descs[] entry with \p key member matching \p k which is
* supported by the device specified by \p devinfo, or NULL if there is no