intel/assembler: Add labels support
[mesa.git] / src / intel / compiler / brw_inst.h
index 3927190f776457fadc20b8a6685feaf6123c527b..550dfb0db49cfcaa55c8718718565652c4631f4e 100644 (file)
@@ -1273,6 +1273,7 @@ BRW_IA16_ADDR_IMM(send_dst,    -1, -1,  62,  56,  52)
 static inline uint64_t
 brw_inst_bits(const brw_inst *inst, unsigned high, unsigned low)
 {
+   assert(high < 128);
    assert(high >= low);
    /* We assume the field doesn't cross 64-bit boundaries. */
    const unsigned word = high / 64;
@@ -1294,6 +1295,7 @@ brw_inst_bits(const brw_inst *inst, unsigned high, unsigned low)
 static inline void
 brw_inst_set_bits(brw_inst *inst, unsigned high, unsigned low, uint64_t value)
 {
+   assert(high < 128);
    assert(high >= low);
    const unsigned word = high / 64;
    assert(word == low / 64);
@@ -1397,6 +1399,18 @@ FC(swsb,            /* 4+ */ -1, -1, /* 12+ */ 15,  8, devinfo->gen >= 12)
 F(debug_control,    /* 4+ */  7,  7, /* 12+ */  7,  7)
 F(hw_opcode,        /* 4+ */  6,  0, /* 12+ */  6,  0) /* Same location as brw_inst */
 
+static inline unsigned
+brw_compact_inst_imm(const struct gen_device_info *devinfo,
+                     const brw_compact_inst *inst)
+{
+   if (devinfo->gen >= 12) {
+      return brw_compact_inst_bits(inst, 63, 52);
+   } else {
+      return (brw_compact_inst_bits(inst, 39, 35) << 8) |
+             (brw_compact_inst_bits(inst, 63, 56));
+   }
+}
+
 /**
  * (Gen8+) Compacted three-source instructions:
  *  @{