else if (index & BIR_INDEX_UNIFORM)
fprintf(fp, "u%u", index & ~BIR_INDEX_UNIFORM);
else if (index & BIR_INDEX_CONSTANT)
- fprintf(fp, "#0x%" PRIx64, ins->constant.u64);
+ fprintf(fp, "#0x%" PRIx64, bi_get_immediate(ins, index));
else if (index & BIR_INDEX_ZERO)
fprintf(fp, "#0");
else if (index & BIR_IS_REG)
return mask;
}
+
+uint64_t
+bi_get_immediate(bi_instruction *ins, unsigned index)
+{
+ assert(index & BIR_INDEX_CONSTANT);
+ unsigned shift = index & ~BIR_INDEX_CONSTANT;
+ return ins->constant.u64 >> shift;
+}
*
* Fixed register: do not allocate register, do not collect $200.
* Uniform: access a uniform register given by low bits.
- * Constant: access the specified constant
+ * Constant: access the specified constant (specifies a bit offset / shift)
* Zero: special cased to avoid wasting a constant
* Passthrough: a bifrost_packed_src to passthrough T/T0/T1
*/
unsigned bi_get_component_count(bi_instruction *ins, unsigned s);
unsigned bi_load32_components(bi_instruction *ins);
uint16_t bi_bytemask_of_read_components(bi_instruction *ins, unsigned node);
+uint64_t bi_get_immediate(bi_instruction *ins, unsigned index);
/* BIR passes */