Lines Matching refs:bc

139 void r600_bytecode_init(struct r600_bytecode *bc,
146 bc->debug_id = ++next_shader_id;
150 bc->ar_handling = AR_HANDLE_RV6XX;
159 bc->r6xx_nop_after_rel_dst = 1;
161 bc->ar_handling = AR_HANDLE_NORMAL;
162 bc->r6xx_nop_after_rel_dst = 1;
164 bc->ar_handling = AR_HANDLE_NORMAL;
165 bc->r6xx_nop_after_rel_dst = 0;
168 list_inithead(&bc->cf);
169 bc->gfx_level = gfx_level;
170 bc->family = family;
171 bc->has_compressed_msaa_texturing = has_compressed_msaa_texturing;
172 bc->stack.entry_size = stack_entry_size(family);
175 int r600_bytecode_add_cf(struct r600_bytecode *bc)
181 list_addtail(&cf->list, &bc->cf);
182 if (bc->cf_last) {
183 cf->id = bc->cf_last->id + 2;
184 if (bc->cf_last->eg_alu_extended) {
187 bc->ndw += 2;
190 bc->cf_last = cf;
191 bc->ncf++;
192 bc->ndw += 2;
193 bc->force_add_cf = 0;
194 bc->ar_loaded = 0;
198 int r600_bytecode_add_output(struct r600_bytecode *bc,
203 if (output->gpr >= bc->ngpr)
204 bc->ngpr = output->gpr + 1;
206 if (bc->cf_last && (bc->cf_last->op == output->op ||
207 (bc->cf_last->op == CF_OP_EXPORT &&
209 output->type == bc->cf_last->output.type &&
210 output->elem_size == bc->cf_last->output.elem_size &&
211 output->swizzle_x == bc->cf_last->output.swizzle_x &&
212 output->swizzle_y == bc->cf_last->output.swizzle_y &&
213 output->swizzle_z == bc->cf_last->output.swizzle_z &&
214 output->swizzle_w == bc->cf_last->output.swizzle_w &&
215 output->comp_mask == bc->cf_last->output.comp_mask &&
216 (output->burst_count + bc->cf_last->output.burst_count) <= 16) {
218 if ((output->gpr + output->burst_count) == bc->cf_last->output.gpr &&
219 (output->array_base + output->burst_count) == bc->cf_last->output.array_base) {
221 bc->cf_last->op = bc->cf_last->output.op = output->op;
222 bc->cf_last->output.gpr = output->gpr;
223 bc->cf_last->output.array_base = output->array_base;
224 bc->cf_last->output.burst_count += output->burst_count;
227 } else if (output->gpr == (bc->cf_last->output.gpr + bc->cf_last->output.burst_count) &&
228 output->array_base == (bc->cf_last->output.array_base + bc->cf_last->output.burst_count)) {
230 bc->cf_last->op = bc->cf_last->output.op = output->op;
231 bc->cf_last->output.burst_count += output->burst_count;
236 r = r600_bytecode_add_cf(bc);
239 bc->cf_last->op = output->op;
240 memcpy(&bc->cf_last->output, output, sizeof(struct r600_bytecode_output));
241 bc->cf_last->barrier = 1;
245 int r600_bytecode_add_pending_output(struct r600_bytecode *bc,
248 assert(bc->n_pending_outputs + 1 < ARRAY_SIZE(bc->pending_outputs));
249 bc->pending_outputs[bc->n_pending_outputs++] = *output;
255 r600_bytecode_add_ack(struct r600_bytecode *bc)
257 bc->need_wait_ack = true;
261 r600_bytecode_wait_acks(struct r600_bytecode *bc)
264 if (bc->gfx_level < R700)
267 if (!bc->need_wait_ack)
270 int ret = r600_bytecode_add_cfinst(bc, CF_OP_WAIT_ACK);
274 struct r600_bytecode_cf *cf = bc->cf_last;
283 r600_bytecode_write_export_ack_type(struct r600_bytecode *bc, bool indirect)
285 if (bc->gfx_level >= R700) {
304 static int is_alu_reduction_inst(struct r600_bytecode *bc, struct r600_bytecode_alu *alu)
307 (r600_isa_alu_slots(bc->isa->hw_class, alu->op) == AF_4V);
356 static int is_alu_vec_unit_inst(struct r600_bytecode *bc, struct r600_bytecode_alu *alu)
358 unsigned slots = r600_isa_alu_slots(bc->isa->hw_class, alu->op);
362 static int is_alu_trans_unit_inst(struct r600_bytecode *bc, struct r600_bytecode_alu *alu)
364 unsigned slots = r600_isa_alu_slots(bc->isa->hw_class, alu->op);
369 static int is_alu_any_unit_inst(struct r600_bytecode *bc, struct r600_bytecode_alu *alu)
371 unsigned slots = r600_isa_alu_slots(bc->isa->hw_class, alu->op);
380 static int assign_alu_units(struct r600_bytecode *bc, struct r600_bytecode_alu *alu_first,
385 int max_slots = bc->gfx_level == CAYMAN ? 4 : 5;
394 else if (is_alu_trans_unit_inst(bc, alu))
396 else if (is_alu_vec_unit_inst(bc, alu))
469 static int reserve_cfile(const struct r600_bytecode *bc,
473 if (bc->gfx_level >= R700) {
512 static int check_vector(const struct r600_bytecode *bc, const struct r600_bytecode_alu *alu,
533 r = reserve_cfile(bc, bs, (alu->src[src].kc_bank<<16) + sel, elem);
542 static int check_scalar(const struct r600_bytecode *bc, const struct r600_bytecode_alu *alu,
560 r = reserve_cfile(bc, bs, (alu->src[src].kc_bank<<16) + sel, elem);
588 static int check_and_set_bank_swizzle(const struct r600_bytecode *bc,
594 boolean scalar_only = bc->gfx_level == CAYMAN ? false : true;
595 int max_slots = bc->gfx_level == CAYMAN ? 4 : 5;
628 r = check_vector(bc, slots[i], &bs, bank_swizzle[i]);
637 r = check_scalar(bc, slots[4], &bs, bank_swizzle[4]);
668 static int replace_gpr_with_pv_ps(struct r600_bytecode *bc,
674 int max_slots = bc->gfx_level == CAYMAN ? 4 : 5;
676 r = assign_alu_units(bc, alu_prev, prev);
690 if (is_alu_reduction_inst(bc, prev[i]))
710 if (bc->gfx_level < CAYMAN) {
805 static int merge_inst_groups(struct r600_bytecode *bc, struct r600_bytecode_alu *slots[5],
819 int max_slots = bc->gfx_level == CAYMAN ? 4 : 5;
821 r = assign_alu_units(bc, alu_prev, prev);
894 if (is_alu_any_unit_inst(bc, slots[i]) && !alu_uses_lds(slots[i])) {
897 } else if (is_alu_any_unit_inst(bc, prev[i])) {
973 r = check_and_set_bank_swizzle(bc, result);
980 bc->cf_last->ndw -= align(prev_nliteral, 2);
988 list_addtail(&result[i]->list, &bc->cf_last->alu);
993 list_entry(bc->cf_last->alu.prev, struct r600_bytecode_alu, list)->last = 1;
998 bc->cf_last->curr_bs_head = result[i];
1003 bc->cf_last->prev_bs_head = bc->cf_last->prev2_bs_head;
1004 bc->cf_last->prev2_bs_head = NULL;
1010 static int r600_bytecode_alloc_kcache_line(struct r600_bytecode *bc,
1014 int i, kcache_banks = bc->gfx_level >= EVERGREEN ? 4 : 2;
1072 static int r600_bytecode_alloc_inst_kcache_lines(struct r600_bytecode *bc,
1089 if ((r = r600_bytecode_alloc_kcache_line(bc, kcache, bank, line, index_mode)))
1132 static int r600_bytecode_alloc_kcache_lines(struct r600_bytecode *bc,
1140 memcpy(kcache, bc->cf_last->kcache, 4 * sizeof(struct r600_bytecode_kcache));
1142 if ((r = r600_bytecode_alloc_inst_kcache_lines(bc, kcache, alu))) {
1147 if (!list_is_empty(&bc->cf_last->alu)) {
1149 list_last_entry(&bc->cf_last->alu, struct r600_bytecode_alu, list);
1153 if ((r = r600_bytecode_add_cf(bc))) {
1156 bc->cf_last->op = type;
1159 kcache = bc->cf_last->kcache;
1160 if ((r = r600_bytecode_alloc_inst_kcache_lines(bc, kcache, alu))) {
1166 memcpy(bc->cf_last->kcache, kcache, 4 * sizeof(struct r600_bytecode_kcache));
1172 if (bc->gfx_level < EVERGREEN)
1174 bc->cf_last->eg_alu_extended = 1;
1180 static int insert_nop_r6xx(struct r600_bytecode *bc, int max_slots)
1191 r = r600_bytecode_add_alu(bc, &alu);
1198 /* load AR register from gpr (bc->ar_reg) with MOVA_INT */
1199 static int load_ar_r6xx(struct r600_bytecode *bc, bool for_src)
1204 if (bc->ar_loaded)
1208 if ((bc->cf_last->ndw>>1) >= 110)
1209 bc->force_add_cf = 1;
1211 insert_nop_r6xx(bc, 4);
1212 bc->nalu_groups++;
1217 alu.src[0].sel = bc->ar_reg;
1218 alu.src[0].chan = bc->ar_chan;
1221 r = r600_bytecode_add_alu(bc, &alu);
1226 bc->ar_loaded = 1;
1230 /* load AR register from gpr (bc->ar_reg) with MOVA_INT */
1231 int r600_load_ar(struct r600_bytecode *bc, bool for_src)
1236 if (bc->ar_handling)
1237 return load_ar_r6xx(bc, for_src);
1239 if (bc->ar_loaded)
1243 if ((bc->cf_last->ndw>>1) >= 110)
1244 bc->force_add_cf = 1;
1248 alu.src[0].sel = bc->ar_reg;
1249 alu.src[0].chan = bc->ar_chan;
1251 r = r600_bytecode_add_alu(bc, &alu);
1255 bc->cf_last->r6xx_uses_waterfall = 1;
1256 bc->ar_loaded = 1;
1260 int r600_bytecode_add_alu_type(struct r600_bytecode *bc,
1276 if (bc->cf_last != NULL && bc->cf_last->op != type) {
1278 if ((bc->cf_last->op == CF_OP_ALU && type == CF_OP_ALU_PUSH_BEFORE) ||
1279 (bc->cf_last->op == CF_OP_ALU_PUSH_BEFORE && type == CF_OP_ALU)) {
1280 LIST_FOR_EACH_ENTRY(lalu, &bc->cf_last->alu, list) {
1282 bc->force_add_cf = 1;
1288 bc->force_add_cf = 1;
1292 if (bc->cf_last == NULL || bc->force_add_cf) {
1293 if (bc->cf_last && bc->cf_last->curr_bs_head)
1294 bc->cf_last->curr_bs_head->last = 1;
1295 r = r600_bytecode_add_cf(bc);
1301 bc->cf_last->op = type;
1304 if (bc->gfx_level >= EVERGREEN) {
1307 egcm_load_index_reg(bc, 0, true);
1312 if (nalu->src[i].rel && !bc->ar_loaded)
1313 r600_load_ar(bc, true);
1315 if (nalu->dst.rel && !bc->ar_loaded)
1316 r600_load_ar(bc, false);
1320 if ((r = r600_bytecode_alloc_kcache_lines(bc, nalu, type))) {
1325 if (!bc->cf_last->curr_bs_head) {
1326 bc->cf_last->curr_bs_head = nalu;
1330 if (nalu->src[i].sel >= bc->ngpr && nalu->src[i].sel < 128) {
1331 bc->ngpr = nalu->src[i].sel + 1;
1337 if (nalu->dst.write && nalu->dst.sel >= bc->ngpr) {
1338 bc->ngpr = nalu->dst.sel + 1;
1340 list_addtail(&nalu->list, &bc->cf_last->alu);
1342 bc->cf_last->ndw += 2;
1343 bc->ndw += 2;
1350 int max_slots = bc->gfx_level == CAYMAN ? 4 : 5;
1351 r = assign_alu_units(bc, bc->cf_last->curr_bs_head, slots);
1355 if (bc->cf_last->prev_bs_head) {
1356 struct r600_bytecode_alu *cur_prev_head = bc->cf_last->prev_bs_head;
1357 r = merge_inst_groups(bc, slots, cur_prev_head);
1360 if (cur_prev_head != bc->cf_last->prev_bs_head)
1361 bc->nalu_groups--;
1364 if (bc->cf_last->prev_bs_head) {
1365 r = replace_gpr_with_pv_ps(bc, slots, bc->cf_last->prev_bs_head);
1370 r = check_and_set_bank_swizzle(bc, slots);
1381 bc->cf_last->ndw += align(nliteral, 2);
1385 if ((bc->cf_last->ndw >> 1) >= 120) {
1386 bc->force_add_cf = 1;
1389 bc->cf_last->prev2_bs_head = bc->cf_last->prev_bs_head;
1390 bc->cf_last->prev_bs_head = bc->cf_last->curr_bs_head;
1391 bc->cf_last->curr_bs_head = NULL;
1393 bc->nalu_groups++;
1395 if (bc->r6xx_nop_after_rel_dst) {
1398 insert_nop_r6xx(bc, max_slots);
1399 bc->nalu_groups++;
1407 if (nalu->last && bc->n_pending_outputs) {
1408 while (bc->n_pending_outputs) {
1409 r = r600_bytecode_add_output(bc, &bc->pending_outputs[--bc->n_pending_outputs]);
1418 int r600_bytecode_add_alu(struct r600_bytecode *bc, const struct r600_bytecode_alu *alu)
1420 return r600_bytecode_add_alu_type(bc, alu, CF_OP_ALU);
1423 static unsigned r600_bytecode_num_tex_and_vtx_instructions(const struct r600_bytecode *bc)
1425 switch (bc->gfx_level) {
1435 R600_ERR("Unknown gfx level %d.\n", bc->gfx_level);
1440 static inline boolean last_inst_was_not_vtx_fetch(struct r600_bytecode *bc)
1442 return !((r600_isa_cf(bc->cf_last->op)->flags & CF_FETCH) &&
1443 bc->cf_last->op != CF_OP_GDS &&
1444 (bc->gfx_level == CAYMAN ||
1445 bc->cf_last->op != CF_OP_TEX));
1448 static int r600_bytecode_add_vtx_internal(struct r600_bytecode *bc, const struct r600_bytecode_vtx *vtx,
1459 if (bc->gfx_level >= EVERGREEN) {
1461 egcm_load_index_reg(bc, vtx->buffer_index_mode - 1, false);
1465 if (bc->cf_last == NULL ||
1466 last_inst_was_not_vtx_fetch(bc) ||
1467 bc->force_add_cf) {
1468 r = r600_bytecode_add_cf(bc);
1473 switch (bc->gfx_level) {
1476 bc->cf_last->op = CF_OP_VTX;
1480 bc->cf_last->op = CF_OP_TEX;
1482 bc->cf_last->op = CF_OP_VTX;
1485 bc->cf_last->op = CF_OP_TEX;
1488 R600_ERR("Unknown gfx level %d.\n", bc->gfx_level);
1493 list_addtail(&nvtx->list, &bc->cf_last->vtx);
1495 bc->cf_last->ndw += 4;
1496 bc->ndw += 4;
1497 if ((bc->cf_last->ndw / 4) >= r600_bytecode_num_tex_and_vtx_instructions(bc))
1498 bc->force_add_cf = 1;
1500 bc->ngpr = MAX2(bc->ngpr, vtx->src_gpr + 1);
1501 bc->ngpr = MAX2(bc->ngpr, vtx->dst_gpr + 1);
1506 int r600_bytecode_add_vtx(struct r600_bytecode *bc, const struct r600_bytecode_vtx *vtx)
1508 return r600_bytecode_add_vtx_internal(bc, vtx, false);
1511 int r600_bytecode_add_vtx_tc(struct r600_bytecode *bc, const struct r600_bytecode_vtx *vtx)
1513 return r600_bytecode_add_vtx_internal(bc, vtx, true);
1516 int r600_bytecode_add_tex(struct r600_bytecode *bc, const struct r600_bytecode_tex *tex)
1526 if (bc->gfx_level >= EVERGREEN) {
1528 egcm_load_index_reg(bc, 1, false);
1532 if (bc->cf_last != NULL &&
1533 bc->cf_last->op == CF_OP_TEX) {
1535 LIST_FOR_EACH_ENTRY(ttex, &bc->cf_last->tex, list) {
1539 bc->force_add_cf = 1;
1546 if (!list_is_empty(&bc->cf_last->vtx))
1547 bc->force_add_cf = 1;
1551 bc->force_add_cf = 1;
1555 if (bc->cf_last == NULL ||
1556 bc->cf_last->op != CF_OP_TEX ||
1557 bc->force_add_cf) {
1558 r = r600_bytecode_add_cf(bc);
1563 bc->cf_last->op = CF_OP_TEX;
1565 if (ntex->src_gpr >= bc->ngpr) {
1566 bc->ngpr = ntex->src_gpr + 1;
1568 if (ntex->dst_gpr >= bc->ngpr) {
1569 bc->ngpr = ntex->dst_gpr + 1;
1571 list_addtail(&ntex->list, &bc->cf_last->tex);
1573 bc->cf_last->ndw += 4;
1574 bc->ndw += 4;
1575 if ((bc->cf_last->ndw / 4) >= r600_bytecode_num_tex_and_vtx_instructions(bc))
1576 bc->force_add_cf = 1;
1580 int r600_bytecode_add_gds(struct r600_bytecode *bc, const struct r600_bytecode_gds *gds)
1589 if (bc->gfx_level >= EVERGREEN) {
1591 egcm_load_index_reg(bc, gds->uav_index_mode - 1, false);
1594 if (bc->cf_last == NULL ||
1595 bc->cf_last->op != CF_OP_GDS ||
1596 bc->force_add_cf) {
1597 r = r600_bytecode_add_cf(bc);
1602 bc->cf_last->op = CF_OP_GDS;
1605 list_addtail(&ngds->list, &bc->cf_last->gds);
1606 bc->cf_last->ndw += 4; /* each GDS uses 4 dwords */
1607 if ((bc->cf_last->ndw / 4) >= r600_bytecode_num_tex_and_vtx_instructions(bc))
1608 bc->force_add_cf = 1;
1612 int r600_bytecode_add_cfinst(struct r600_bytecode *bc, unsigned op)
1618 r600_bytecode_wait_acks(bc);
1620 r = r600_bytecode_add_cf(bc);
1624 bc->cf_last->cond = V_SQ_CF_COND_ACTIVE;
1625 bc->cf_last->op = op;
1629 int cm_bytecode_add_cf_end(struct r600_bytecode *bc)
1631 return r600_bytecode_add_cfinst(bc, CF_OP_CF_END);
1635 static int r600_bytecode_vtx_build(struct r600_bytecode *bc, struct r600_bytecode_vtx *vtx, unsigned id)
1638 return r700_bytecode_fetch_mem_build(bc, vtx, id);
1639 bc->bytecode[id] = S_SQ_VTX_WORD0_VTX_INST(r600_isa_fetch_opcode(bc->isa->hw_class, vtx->op)) |
1644 if (bc->gfx_level < CAYMAN)
1645 bc->bytecode[id] |= S_SQ_VTX_WORD0_MEGA_FETCH_COUNT(vtx->mega_fetch_count);
1647 bc->bytecode[id++] = S_SQ_VTX_WORD1_DST_SEL_X(vtx->dst_sel_x) |
1657 bc->bytecode[id] = S_SQ_VTX_WORD2_OFFSET(vtx->offset)|
1659 if (bc->gfx_level >= EVERGREEN)
1660 bc->bytecode[id] |= ((vtx->buffer_index_mode & 0x3) << 21); // S_SQ_VTX_WORD2_BIM(vtx->buffer_index_mode);
1661 if (bc->gfx_level < CAYMAN)
1662 bc->bytecode[id] |= S_SQ_VTX_WORD2_MEGA_FETCH(1);
1664 bc->bytecode[id++] = 0;
1669 static int r600_bytecode_tex_build(struct r600_bytecode *bc, struct r600_bytecode_tex *tex, unsigned id)
1671 bc->bytecode[id] = S_SQ_TEX_WORD0_TEX_INST(
1672 r600_isa_fetch_opcode(bc->isa->hw_class, tex->op)) |
1677 if (bc->gfx_level >= EVERGREEN)
1678 bc->bytecode[id] |= ((tex->sampler_index_mode & 0x3) << 27) | // S_SQ_TEX_WORD0_SIM(tex->sampler_index_mode);
1681 bc->bytecode[id++] = S_SQ_TEX_WORD1_DST_GPR(tex->dst_gpr) |
1692 bc->bytecode[id++] = S_SQ_TEX_WORD2_OFFSET_X(tex->offset_x) |
1700 bc->bytecode[id++] = 0;
1705 static int r600_bytecode_alu_build(struct r600_bytecode *bc, struct r600_bytecode_alu *alu, unsigned id)
1707 unsigned opcode = r600_isa_alu_opcode(bc->isa->hw_class, alu->op);
1710 bc->bytecode[id++] = S_SQ_ALU_WORD0_SRC0_SEL(alu->src[0].sel) |
1724 bc->bytecode[id++] = S_SQ_ALU_WORD1_DST_GPR(alu->dst.sel) |
1735 bc->bytecode[id++] = S_SQ_ALU_WORD1_DST_GPR(alu->dst.sel) |
1761 static int r600_bytecode_cf_build(struct r600_bytecode *bc, struct r600_bytecode_cf *cf)
1765 unsigned opcode = r600_isa_cf_opcode(bc->isa->hw_class, cf->op);
1769 bc->bytecode[id++] = cf->isa[0];
1770 bc->bytecode[id++] = cf->isa[1];
1772 bc->bytecode[id++] = S_SQ_CF_ALU_WORD0_ADDR(cf->addr >> 1) |
1777 bc->bytecode[id++] = S_SQ_CF_ALU_WORD1_CF_INST(opcode) |
1782 S_SQ_CF_ALU_WORD1_USES_WATERFALL(bc->gfx_level == R600 ? cf->r6xx_uses_waterfall : 0) |
1785 if (bc->gfx_level == R700)
1786 r700_bytecode_cf_vtx_build(&bc->bytecode[id], cf);
1788 r600_bytecode_cf_vtx_build(&bc->bytecode[id], cf);
1790 bc->bytecode[id++] = S_SQ_CF_ALLOC_EXPORT_WORD0_RW_GPR(cf->output.gpr) |
1795 bc->bytecode[id++] = S_SQ_CF_ALLOC_EXPORT_WORD1_BURST_COUNT(cf->output.burst_count - 1) |
1804 bc->bytecode[id++] = S_SQ_CF_ALLOC_EXPORT_WORD0_RW_GPR(cf->output.gpr) |
1809 bc->bytecode[id++] = S_SQ_CF_ALLOC_EXPORT_WORD1_BURST_COUNT(cf->output.burst_count - 1) |
1816 bc->bytecode[id++] = S_SQ_CF_WORD0_ADDR(cf->cf_addr >> 1);
1817 bc->bytecode[id++] = S_SQ_CF_WORD1_CF_INST(opcode) |
1826 int r600_bytecode_build(struct r600_bytecode *bc)
1838 if (!bc->nstack) { // If not 0, Stack_size already provided by llvm
1839 if (bc->stack.max_entries)
1840 bc->nstack = bc->stack.max_entries;
1841 else if (bc->type == PIPE_SHADER_VERTEX ||
1842 bc->type == PIPE_SHADER_TESS_EVAL ||
1843 bc->type == PIPE_SHADER_TESS_CTRL)
1844 bc->nstack = 1;
1849 addr = bc->cf_last->id + 2;
1850 LIST_FOR_EACH_ENTRY(cf, &bc->cf, list) {
1857 bc->ndw = cf->addr + cf->ndw;
1859 free(bc->bytecode);
1860 bc->bytecode = calloc(4, bc->ndw);
1861 if (bc->bytecode == NULL)
1863 LIST_FOR_EACH_ENTRY(cf, &bc->cf, list) {
1866 if (bc->gfx_level >= EVERGREEN)
1867 r = eg_bytecode_cf_build(bc, cf);
1869 r = r600_bytecode_cf_build(bc, cf);
1882 switch(bc->gfx_level) {
1884 r = r600_bytecode_alu_build(bc, alu, addr);
1887 r = r700_bytecode_alu_build(bc, alu, addr);
1891 r = eg_bytecode_alu_build(bc, alu, addr);
1894 R600_ERR("unknown gfx level %d.\n", bc->gfx_level);
1902 bc->bytecode[addr++] = literal[i];
1910 r = r600_bytecode_vtx_build(bc, vtx, addr);
1916 assert(bc->gfx_level >= EVERGREEN);
1918 r = eg_bytecode_gds_build(bc, gds, addr);
1925 assert(bc->gfx_level >= EVERGREEN);
1926 r = r600_bytecode_vtx_build(bc, vtx, addr);
1932 r = r600_bytecode_tex_build(bc, tex, addr);
1942 void r600_bytecode_clear(struct r600_bytecode *bc)
1946 free(bc->bytecode);
1947 bc->bytecode = NULL;
1949 LIST_FOR_EACH_ENTRY_SAFE(cf, next_cf, &bc->cf, list) {
2169 void r600_bytecode_disasm(struct r600_bytecode *bc)
2184 switch (bc->gfx_level) {
2200 bc->ndw, bc->ngpr, bc->nstack);
2203 LIST_FOR_EACH_ENTRY(cf, &bc->cf, list) {
2206 fprintf(stderr, "%04d %08X %08X CF_NATIVE\n", id, bc->bytecode[id],
2207 bc->bytecode[id + 1]);
2212 fprintf(stderr, "%04d %08X %08X %s\n", id, bc->bytecode[id],
2213 bc->bytecode[id + 1], "ALU_EXT");
2216 fprintf(stderr, "%04d %08X %08X %s ", id, bc->bytecode[id],
2217 bc->bytecode[id + 1], cfop->name);
2231 fprintf(stderr, "%04d %08X %08X %s ", id, bc->bytecode[id],
2232 bc->bytecode[id + 1], cfop->name);
2243 o += fprintf(stderr, "%04d %08X %08X %s ", id, bc->bytecode[id],
2244 bc->bytecode[id + 1], cfop->name);
2280 bc->bytecode[id], bc->bytecode[id + 1], cfop->name);
2331 fprintf(stderr, "%04d %08X %08X %s ", id, bc->bytecode[id],
2332 bc->bytecode[id + 1], cfop->name);
2357 o += fprintf(stderr, " %04d %08X %08X ", id, bc->bytecode[id], bc->bytecode[id+1]);
2386 float *f = (float*)(bc->bytecode + id);
2387 o = fprintf(stderr, " %04d %08X", id, bc->bytecode[id]);
2389 fprintf(stderr, " %f (%d)\n", *f, *(bc->bytecode + id));
2399 o += fprintf(stderr, " %04d %08X %08X %08X ", id, bc->bytecode[id],
2400 bc->bytecode[id + 1], bc->bytecode[id + 2]);
2447 o += fprintf(stderr, " %04d %08X %08X %08X ", id, bc->bytecode[id],
2448 bc->bytecode[id + 1], bc->bytecode[id + 2]);
2474 if (bc->gfx_level < CAYMAN && vtx->mega_fetch_count)
2477 if (bc->gfx_level >= EVERGREEN && vtx->buffer_index_mode)
2504 o += fprintf(stderr, " %04d %08X %08X %08X ", id, bc->bytecode[id],
2505 bc->bytecode[id + 1], bc->bytecode[id + 2]);
2722 struct r600_bytecode bc;
2736 memset(&bc, 0, sizeof(bc));
2737 r600_bytecode_init(&bc, rctx->b.gfx_level, rctx->b.family,
2740 bc.isa = rctx->isa;
2757 if ((r = r600_bytecode_add_alu(&bc, &alu))) {
2758 r600_bytecode_clear(&bc);
2774 if ((r = r600_bytecode_add_alu(&bc, &alu))) {
2775 r600_bytecode_clear(&bc);
2789 r600_bytecode_clear(&bc);
2811 if ((r = r600_bytecode_add_vtx(&bc, &vtx))) {
2812 r600_bytecode_clear(&bc);
2817 r600_bytecode_add_cfinst(&bc, CF_OP_RET);
2819 if ((r = r600_bytecode_build(&bc))) {
2820 r600_bytecode_clear(&bc);
2834 r600_bytecode_disasm(&bc);
2838 r600_sb_bytecode_process(rctx, &bc, NULL, 1 /*dump*/, 0 /*optimize*/);
2842 fs_size = bc.ndw*4;
2847 r600_bytecode_clear(&bc);
2855 r600_bytecode_clear(&bc);
2867 bytecode[i] = util_cpu_to_le32(bc.bytecode[i]);
2870 memcpy(bytecode, bc.bytecode, fs_size);
2874 r600_bytecode_clear(&bc);
2878 void r600_bytecode_alu_read(struct r600_bytecode *bc,
2909 alu->op = r600_isa_alu_by_opcode(bc->isa,
2917 alu->op = r600_isa_alu_by_opcode(bc->isa,
2928 void r600_bytecode_export_read(struct r600_bytecode *bc,
2942 output->op = r600_isa_cf_by_opcode(bc->isa,