Lines Matching refs:bc

47 		struct r600_bytecode *bc, struct r600_bytecode_alu *alu)
52 int r700_bytecode_alu_build(struct r600_bytecode *bc,
143 void r600_bytecode_init(struct r600_bytecode *bc,
150 bc->debug_id = ++next_shader_id;
154 bc->ar_handling = AR_HANDLE_RV6XX;
155 bc->r6xx_nop_after_rel_dst = 1;
157 bc->ar_handling = AR_HANDLE_NORMAL;
158 bc->r6xx_nop_after_rel_dst = 0;
161 LIST_INITHEAD(&bc->cf);
162 bc->chip_class = chip_class;
163 bc->family = family;
164 bc->has_compressed_msaa_texturing = has_compressed_msaa_texturing;
165 bc->stack.entry_size = stack_entry_size(family);
168 int r600_bytecode_add_cf(struct r600_bytecode *bc)
174 LIST_ADDTAIL(&cf->list, &bc->cf);
175 if (bc->cf_last) {
176 cf->id = bc->cf_last->id + 2;
177 if (bc->cf_last->eg_alu_extended) {
180 bc->ndw += 2;
183 bc->cf_last = cf;
184 bc->ncf++;
185 bc->ndw += 2;
186 bc->force_add_cf = 0;
187 bc->ar_loaded = 0;
191 int r600_bytecode_add_output(struct r600_bytecode *bc,
196 if (output->gpr >= bc->ngpr)
197 bc->ngpr = output->gpr + 1;
199 if (bc->cf_last && (bc->cf_last->op == output->op ||
200 (bc->cf_last->op == CF_OP_EXPORT &&
202 output->type == bc->cf_last->output.type &&
203 output->elem_size == bc->cf_last->output.elem_size &&
204 output->swizzle_x == bc->cf_last->output.swizzle_x &&
205 output->swizzle_y == bc->cf_last->output.swizzle_y &&
206 output->swizzle_z == bc->cf_last->output.swizzle_z &&
207 output->swizzle_w == bc->cf_last->output.swizzle_w &&
208 output->comp_mask == bc->cf_last->output.comp_mask &&
209 (output->burst_count + bc->cf_last->output.burst_count) <= 16) {
211 if ((output->gpr + output->burst_count) == bc->cf_last->output.gpr &&
212 (output->array_base + output->burst_count) == bc->cf_last->output.array_base) {
214 bc->cf_last->op = bc->cf_last->output.op = output->op;
215 bc->cf_last->output.gpr = output->gpr;
216 bc->cf_last->output.array_base = output->array_base;
217 bc->cf_last->output.burst_count += output->burst_count;
220 } else if (output->gpr == (bc->cf_last->output.gpr + bc->cf_last->output.burst_count) &&
221 output->array_base == (bc->cf_last->output.array_base + bc->cf_last->output.burst_count)) {
223 bc->cf_last->op = bc->cf_last->output.op = output->op;
224 bc->cf_last->output.burst_count += output->burst_count;
229 r = r600_bytecode_add_cf(bc);
232 bc->cf_last->op = output->op;
233 memcpy(&bc->cf_last->output, output, sizeof(struct r600_bytecode_output));
234 bc->cf_last->barrier = 1;
239 static int is_alu_once_inst(struct r600_bytecode *bc, struct r600_bytecode_alu *alu)
244 static int is_alu_reduction_inst(struct r600_bytecode *bc, struct r600_bytecode_alu *alu)
247 (r600_isa_alu_slots(bc->isa->hw_class, alu->op) == AF_4V);
250 static int is_alu_mova_inst(struct r600_bytecode *bc, struct r600_bytecode_alu *alu)
255 static int alu_uses_rel(struct r600_bytecode *bc, struct r600_bytecode_alu *alu)
257 unsigned num_src = r600_bytecode_get_num_operands(bc, alu);
277 static int alu_uses_lds(struct r600_bytecode *bc, struct r600_bytecode_alu *alu)
279 unsigned num_src = r600_bytecode_get_num_operands(bc, alu);
290 static int is_alu_64bit_inst(struct r600_bytecode *bc, struct r600_bytecode_alu *alu)
296 static int is_alu_vec_unit_inst(struct r600_bytecode *bc, struct r600_bytecode_alu *alu)
298 unsigned slots = r600_isa_alu_slots(bc->isa->hw_class, alu->op);
302 static int is_alu_trans_unit_inst(struct r600_bytecode *bc, struct r600_bytecode_alu *alu)
304 unsigned slots = r600_isa_alu_slots(bc->isa->hw_class, alu->op);
309 static int is_alu_any_unit_inst(struct r600_bytecode *bc, struct r600_bytecode_alu *alu)
311 unsigned slots = r600_isa_alu_slots(bc->isa->hw_class, alu->op);
315 static int is_nop_inst(struct r600_bytecode *bc, struct r600_bytecode_alu *alu)
320 static int assign_alu_units(struct r600_bytecode *bc, struct r600_bytecode_alu *alu_first,
325 int max_slots = bc->chip_class == CAYMAN ? 4 : 5;
334 else if (is_alu_trans_unit_inst(bc, alu))
336 else if (is_alu_vec_unit_inst(bc, alu))
409 static int reserve_cfile(struct r600_bytecode *bc, struct alu_bank_swizzle *bs, unsigned sel, unsigned chan)
412 if (bc->chip_class >= R700) {
451 static int check_vector(struct r600_bytecode *bc, struct r600_bytecode_alu *alu,
456 num_src = r600_bytecode_get_num_operands(bc, alu);
472 r = reserve_cfile(bc, bs, (alu->src[src].kc_bank<<16) + sel, elem);
481 static int check_scalar(struct r600_bytecode *bc, struct r600_bytecode_alu *alu,
486 num_src = r600_bytecode_get_num_operands(bc, alu);
499 r = reserve_cfile(bc, bs, (alu->src[src].kc_bank<<16) + sel, elem);
527 static int check_and_set_bank_swizzle(struct r600_bytecode *bc,
533 boolean scalar_only = bc->chip_class == CAYMAN ? false : true;
534 int max_slots = bc->chip_class == CAYMAN ? 4 : 5;
566 r = check_vector(bc, slots[i], &bs, bank_swizzle[i]);
575 r = check_scalar(bc, slots[4], &bs, bank_swizzle[4]);
606 static int replace_gpr_with_pv_ps(struct r600_bytecode *bc,
612 int max_slots = bc->chip_class == CAYMAN ? 4 : 5;
614 r = assign_alu_units(bc, alu_prev, prev);
621 if (is_alu_64bit_inst(bc, prev[i])) {
628 if (is_alu_reduction_inst(bc, prev[i]))
641 if (is_alu_64bit_inst(bc, alu))
643 num_src = r600_bytecode_get_num_operands(bc, alu);
648 if (bc->chip_class < CAYMAN) {
706 static int r600_bytecode_alu_nliterals(struct r600_bytecode *bc, struct r600_bytecode_alu *alu,
709 unsigned num_src = r600_bytecode_get_num_operands(bc, alu);
732 static void r600_bytecode_alu_adjust_literals(struct r600_bytecode *bc,
736 unsigned num_src = r600_bytecode_get_num_operands(bc, alu);
752 static int merge_inst_groups(struct r600_bytecode *bc, struct r600_bytecode_alu *slots[5],
764 int max_slots = bc->chip_class == CAYMAN ? 4 : 5;
766 r = assign_alu_units(bc, alu_prev, prev);
774 if (is_alu_once_inst(bc, prev[i]))
780 if (is_alu_once_inst(bc, slots[i]))
793 if (r600_bytecode_alu_nliterals(bc, prev[i], literal, &nliteral))
795 if (r600_bytecode_alu_nliterals(bc, prev[i], prev_literal, &prev_nliteral))
797 if (is_alu_mova_inst(bc, prev[i])) {
803 if (alu_uses_rel(bc, prev[i])) {
809 if (alu_uses_lds(bc, prev[i]))
812 num_once_inst += is_alu_once_inst(bc, prev[i]);
814 if (slots[i] && r600_bytecode_alu_nliterals(bc, slots[i], literal, &nliteral))
824 if (is_alu_any_unit_inst(bc, slots[i]) && !alu_uses_lds(bc, slots[i])) {
827 } else if (is_alu_any_unit_inst(bc, prev[i])) {
853 num_once_inst += is_alu_once_inst(bc, alu);
856 if (is_nop_inst(bc, alu))
859 if (is_alu_mova_inst(bc, alu)) {
866 if (alu_uses_rel(bc, alu)) {
878 num_src = r600_bytecode_get_num_operands(bc, alu);
903 r = check_and_set_bank_swizzle(bc, result);
910 bc->cf_last->ndw -= align(prev_nliteral, 2);
918 LIST_ADDTAIL(&result[i]->list, &bc->cf_last->alu);
923 LIST_ENTRY(struct r600_bytecode_alu, bc->cf_last->alu.prev, list)->last = 1;
928 bc->cf_last->curr_bs_head = result[i];
933 bc->cf_last->prev_bs_head = bc->cf_last->prev2_bs_head;
934 bc->cf_last->prev2_bs_head = NULL;
940 static int r600_bytecode_alloc_kcache_line(struct r600_bytecode *bc,
944 int i, kcache_banks = bc->chip_class >= EVERGREEN ? 4 : 2;
1002 static int r600_bytecode_alloc_inst_kcache_lines(struct r600_bytecode *bc,
1018 if ((r = r600_bytecode_alloc_kcache_line(bc, kcache, bank, line, index_mode)))
1024 static int r600_bytecode_assign_kcache_banks(struct r600_bytecode *bc,
1061 static int r600_bytecode_alloc_kcache_lines(struct r600_bytecode *bc,
1069 memcpy(kcache, bc->cf_last->kcache, 4 * sizeof(struct r600_bytecode_kcache));
1071 if ((r = r600_bytecode_alloc_inst_kcache_lines(bc, kcache, alu))) {
1073 if ((r = r600_bytecode_add_cf(bc))) {
1076 bc->cf_last->op = type;
1079 kcache = bc->cf_last->kcache;
1080 if ((r = r600_bytecode_alloc_inst_kcache_lines(bc, kcache, alu))) {
1086 memcpy(bc->cf_last->kcache, kcache, 4 * sizeof(struct r600_bytecode_kcache));
1092 if (bc->chip_class < EVERGREEN)
1094 bc->cf_last->eg_alu_extended = 1;
1100 static int insert_nop_r6xx(struct r600_bytecode *bc)
1111 r = r600_bytecode_add_alu(bc, &alu);
1118 /* load AR register from gpr (bc->ar_reg) with MOVA_INT */
1119 static int load_ar_r6xx(struct r600_bytecode *bc)
1124 if (bc->ar_loaded)
1128 if ((bc->cf_last->ndw>>1) >= 110)
1129 bc->force_add_cf = 1;
1133 alu.src[0].sel = bc->ar_reg;
1134 alu.src[0].chan = bc->ar_chan;
1137 r = r600_bytecode_add_alu(bc, &alu);
1142 bc->ar_loaded = 1;
1146 /* load AR register from gpr (bc->ar_reg) with MOVA_INT */
1147 static int load_ar(struct r600_bytecode *bc)
1152 if (bc->ar_handling)
1153 return load_ar_r6xx(bc);
1155 if (bc->ar_loaded)
1159 if ((bc->cf_last->ndw>>1) >= 110)
1160 bc->force_add_cf = 1;
1164 alu.src[0].sel = bc->ar_reg;
1165 alu.src[0].chan = bc->ar_chan;
1167 r = r600_bytecode_add_alu(bc, &alu);
1171 bc->cf_last->r6xx_uses_waterfall = 1;
1172 bc->ar_loaded = 1;
1176 int r600_bytecode_add_alu_type(struct r600_bytecode *bc,
1192 if (bc->cf_last != NULL && bc->cf_last->op != type) {
1194 if (bc->cf_last->op == CF_OP_ALU &&
1196 LIST_FOR_EACH_ENTRY(lalu, &bc->cf_last->alu, list) {
1198 bc->force_add_cf = 1;
1203 bc->force_add_cf = 1;
1207 if (bc->cf_last == NULL || bc->force_add_cf) {
1208 r = r600_bytecode_add_cf(bc);
1214 bc->cf_last->op = type;
1217 if (bc->chip_class >= EVERGREEN) {
1220 egcm_load_index_reg(bc, 0, true);
1225 if (nalu->src[i].rel && !bc->ar_loaded)
1226 load_ar(bc);
1228 if (nalu->dst.rel && !bc->ar_loaded)
1229 load_ar(bc);
1233 if ((r = r600_bytecode_alloc_kcache_lines(bc, nalu, type))) {
1238 if (!bc->cf_last->curr_bs_head) {
1239 bc->cf_last->curr_bs_head = nalu;
1243 if (nalu->src[i].sel >= bc->ngpr && nalu->src[i].sel < 128) {
1244 bc->ngpr = nalu->src[i].sel + 1;
1250 if (nalu->dst.sel >= bc->ngpr) {
1251 bc->ngpr = nalu->dst.sel + 1;
1253 LIST_ADDTAIL(&nalu->list, &bc->cf_last->alu);
1255 bc->cf_last->ndw += 2;
1256 bc->ndw += 2;
1263 int max_slots = bc->chip_class == CAYMAN ? 4 : 5;
1264 r = assign_alu_units(bc, bc->cf_last->curr_bs_head, slots);
1268 if (bc->cf_last->prev_bs_head) {
1269 r = merge_inst_groups(bc, slots, bc->cf_last->prev_bs_head);
1274 if (bc->cf_last->prev_bs_head) {
1275 r = replace_gpr_with_pv_ps(bc, slots, bc->cf_last->prev_bs_head);
1280 r = check_and_set_bank_swizzle(bc, slots);
1286 r = r600_bytecode_alu_nliterals(bc, slots[i], literal, &nliteral);
1291 bc->cf_last->ndw += align(nliteral, 2);
1295 if ((bc->cf_last->ndw >> 1) >= 120) {
1296 bc->force_add_cf = 1;
1299 bc->cf_last->prev2_bs_head = bc->cf_last->prev_bs_head;
1300 bc->cf_last->prev_bs_head = bc->cf_last->curr_bs_head;
1301 bc->cf_last->curr_bs_head = NULL;
1304 if (nalu->dst.rel && bc->r6xx_nop_after_rel_dst)
1305 insert_nop_r6xx(bc);
1310 int r600_bytecode_add_alu(struct r600_bytecode *bc, const struct r600_bytecode_alu *alu)
1312 return r600_bytecode_add_alu_type(bc, alu, CF_OP_ALU);
1315 static unsigned r600_bytecode_num_tex_and_vtx_instructions(const struct r600_bytecode *bc)
1317 switch (bc->chip_class) {
1327 R600_ERR("Unknown chip class %d.\n", bc->chip_class);
1332 static inline boolean last_inst_was_not_vtx_fetch(struct r600_bytecode *bc)
1334 return !((r600_isa_cf(bc->cf_last->op)->flags & CF_FETCH) &&
1335 (bc->chip_class == CAYMAN ||
1336 bc->cf_last->op != CF_OP_TEX));
1339 int r600_bytecode_add_vtx(struct r600_bytecode *bc, const struct r600_bytecode_vtx *vtx)
1349 if (bc->chip_class >= EVERGREEN) {
1351 egcm_load_index_reg(bc, 0, false);
1355 if (bc->cf_last == NULL ||
1356 last_inst_was_not_vtx_fetch(bc) ||
1357 bc->force_add_cf) {
1358 r = r600_bytecode_add_cf(bc);
1363 switch (bc->chip_class) {
1367 bc->cf_last->op = CF_OP_VTX;
1370 bc->cf_last->op = CF_OP_TEX;
1373 R600_ERR("Unknown chip class %d.\n", bc->chip_class);
1378 LIST_ADDTAIL(&nvtx->list, &bc->cf_last->vtx);
1380 bc->cf_last->ndw += 4;
1381 bc->ndw += 4;
1382 if ((bc->cf_last->ndw / 4) >= r600_bytecode_num_tex_and_vtx_instructions(bc))
1383 bc->force_add_cf = 1;
1385 bc->ngpr = MAX2(bc->ngpr, vtx->src_gpr + 1);
1386 bc->ngpr = MAX2(bc->ngpr, vtx->dst_gpr + 1);
1391 int r600_bytecode_add_tex(struct r600_bytecode *bc, const struct r600_bytecode_tex *tex)
1401 if (bc->chip_class >= EVERGREEN) {
1403 egcm_load_index_reg(bc, 1, false);
1407 if (bc->cf_last != NULL &&
1408 bc->cf_last->op == CF_OP_TEX) {
1410 LIST_FOR_EACH_ENTRY(ttex, &bc->cf_last->tex, list) {
1412 bc->force_add_cf = 1;
1418 bc->force_add_cf = 1;
1422 if (bc->cf_last == NULL ||
1423 bc->cf_last->op != CF_OP_TEX ||
1424 bc->force_add_cf) {
1425 r = r600_bytecode_add_cf(bc);
1430 bc->cf_last->op = CF_OP_TEX;
1432 if (ntex->src_gpr >= bc->ngpr) {
1433 bc->ngpr = ntex->src_gpr + 1;
1435 if (ntex->dst_gpr >= bc->ngpr) {
1436 bc->ngpr = ntex->dst_gpr + 1;
1438 LIST_ADDTAIL(&ntex->list, &bc->cf_last->tex);
1440 bc->cf_last->ndw += 4;
1441 bc->ndw += 4;
1442 if ((bc->cf_last->ndw / 4) >= r600_bytecode_num_tex_and_vtx_instructions(bc))
1443 bc->force_add_cf = 1;
1447 int r600_bytecode_add_gds(struct r600_bytecode *bc, const struct r600_bytecode_gds *gds)
1456 if (bc->cf_last == NULL ||
1457 bc->cf_last->op != CF_OP_GDS ||
1458 bc->force_add_cf) {
1459 r = r600_bytecode_add_cf(bc);
1464 bc->cf_last->op = CF_OP_GDS;
1467 LIST_ADDTAIL(&ngds->list, &bc->cf_last->gds);
1468 bc->cf_last->ndw += 4; /* each GDS uses 4 dwords */
1469 if ((bc->cf_last->ndw / 4) >= r600_bytecode_num_tex_and_vtx_instructions(bc))
1470 bc->force_add_cf = 1;
1474 int r600_bytecode_add_cfinst(struct r600_bytecode *bc, unsigned op)
1477 r = r600_bytecode_add_cf(bc);
1481 bc->cf_last->cond = V_SQ_CF_COND_ACTIVE;
1482 bc->cf_last->op = op;
1486 int cm_bytecode_add_cf_end(struct r600_bytecode *bc)
1488 return r600_bytecode_add_cfinst(bc, CF_OP_CF_END);
1492 static int r600_bytecode_vtx_build(struct r600_bytecode *bc, struct r600_bytecode_vtx *vtx, unsigned id)
1494 bc->bytecode[id] = S_SQ_VTX_WORD0_BUFFER_ID(vtx->buffer_id) |
1498 if (bc->chip_class < CAYMAN)
1499 bc->bytecode[id] |= S_SQ_VTX_WORD0_MEGA_FETCH_COUNT(vtx->mega_fetch_count);
1501 bc->bytecode[id++] = S_SQ_VTX_WORD1_DST_SEL_X(vtx->dst_sel_x) |
1511 bc->bytecode[id] = S_SQ_VTX_WORD2_OFFSET(vtx->offset)|
1513 if (bc->chip_class >= EVERGREEN)
1514 bc->bytecode[id] |= ((vtx->buffer_index_mode & 0x3) << 21); // S_SQ_VTX_WORD2_BIM(vtx->buffer_index_mode);
1515 if (bc->chip_class < CAYMAN)
1516 bc->bytecode[id] |= S_SQ_VTX_WORD2_MEGA_FETCH(1);
1518 bc->bytecode[id++] = 0;
1523 static int r600_bytecode_tex_build(struct r600_bytecode *bc, struct r600_bytecode_tex *tex, unsigned id)
1525 bc->bytecode[id] = S_SQ_TEX_WORD0_TEX_INST(
1526 r600_isa_fetch_opcode(bc->isa->hw_class, tex->op)) |
1531 if (bc->chip_class >= EVERGREEN)
1532 bc->bytecode[id] |= ((tex->sampler_index_mode & 0x3) << 27) | // S_SQ_TEX_WORD0_SIM(tex->sampler_index_mode);
1535 bc->bytecode[id++] = S_SQ_TEX_WORD1_DST_GPR(tex->dst_gpr) |
1546 bc->bytecode[id++] = S_SQ_TEX_WORD2_OFFSET_X(tex->offset_x) |
1554 bc->bytecode[id++] = 0;
1559 static int r600_bytecode_alu_build(struct r600_bytecode *bc, struct r600_bytecode_alu *alu, unsigned id)
1561 unsigned opcode = r600_isa_alu_opcode(bc->isa->hw_class, alu->op);
1564 bc->bytecode[id++] = S_SQ_ALU_WORD0_SRC0_SEL(alu->src[0].sel) |
1578 bc->bytecode[id++] = S_SQ_ALU_WORD1_DST_GPR(alu->dst.sel) |
1589 bc->bytecode[id++] = S_SQ_ALU_WORD1_DST_GPR(alu->dst.sel) |
1614 static int r600_bytecode_cf_build(struct r600_bytecode *bc, struct r600_bytecode_cf *cf)
1618 unsigned opcode = r600_isa_cf_opcode(bc->isa->hw_class, cf->op);
1622 bc->bytecode[id++] = cf->isa[0];
1623 bc->bytecode[id++] = cf->isa[1];
1625 bc->bytecode[id++] = S_SQ_CF_ALU_WORD0_ADDR(cf->addr >> 1) |
1630 bc->bytecode[id++] = S_SQ_CF_ALU_WORD1_CF_INST(opcode) |
1635 S_SQ_CF_ALU_WORD1_USES_WATERFALL(bc->chip_class == R600 ? cf->r6xx_uses_waterfall : 0) |
1638 if (bc->chip_class == R700)
1639 r700_bytecode_cf_vtx_build(&bc->bytecode[id], cf);
1641 r600_bytecode_cf_vtx_build(&bc->bytecode[id], cf);
1643 bc->bytecode[id++] = S_SQ_CF_ALLOC_EXPORT_WORD0_RW_GPR(cf->output.gpr) |
1648 bc->bytecode[id++] = S_SQ_CF_ALLOC_EXPORT_WORD1_BURST_COUNT(cf->output.burst_count - 1) |
1657 bc->bytecode[id++] = S_SQ_CF_ALLOC_EXPORT_WORD0_RW_GPR(cf->output.gpr) |
1662 bc->bytecode[id++] = S_SQ_CF_ALLOC_EXPORT_WORD1_BURST_COUNT(cf->output.burst_count - 1) |
1669 bc->bytecode[id++] = S_SQ_CF_WORD0_ADDR(cf->cf_addr >> 1);
1670 bc->bytecode[id++] = S_SQ_CF_WORD1_CF_INST(opcode) |
1679 int r600_bytecode_build(struct r600_bytecode *bc)
1691 if (!bc->nstack) // If not 0, Stack_size already provided by llvm
1692 bc->nstack = bc->stack.max_entries;
1694 if ((bc->type == PIPE_SHADER_VERTEX || bc->type == PIPE_SHADER_TESS_EVAL || bc->type == PIPE_SHADER_TESS_CTRL) && !bc->nstack) {
1695 bc->nstack = 1;
1700 addr = bc->cf_last->id + 2;
1701 LIST_FOR_EACH_ENTRY(cf, &bc->cf, list) {
1708 bc->ndw = cf->addr + cf->ndw;
1710 free(bc->bytecode);
1711 bc->bytecode = calloc(4, bc->ndw);
1712 if (bc->bytecode == NULL)
1714 LIST_FOR_EACH_ENTRY(cf, &bc->cf, list) {
1717 if (bc->chip_class >= EVERGREEN)
1718 r = eg_bytecode_cf_build(bc, cf);
1720 r = r600_bytecode_cf_build(bc, cf);
1727 r = r600_bytecode_alu_nliterals(bc, alu, literal, &nliteral);
1730 r600_bytecode_alu_adjust_literals(bc, alu, literal, nliteral);
1731 r600_bytecode_assign_kcache_banks(bc, alu, cf->kcache);
1733 switch(bc->chip_class) {
1735 r = r600_bytecode_alu_build(bc, alu, addr);
1738 r = r700_bytecode_alu_build(bc, alu, addr);
1742 r = eg_bytecode_alu_build(bc, alu, addr);
1745 R600_ERR("unknown chip class %d.\n", bc->chip_class);
1753 bc->bytecode[addr++] = literal[i];
1761 r = r600_bytecode_vtx_build(bc, vtx, addr);
1767 assert(bc->chip_class >= EVERGREEN);
1769 r = eg_bytecode_gds_build(bc, gds, addr);
1776 assert(bc->chip_class >= EVERGREEN);
1777 r = r600_bytecode_vtx_build(bc, vtx, addr);
1783 r = r600_bytecode_tex_build(bc, tex, addr);
1793 void r600_bytecode_clear(struct r600_bytecode *bc)
1797 free(bc->bytecode);
1798 bc->bytecode = NULL;
1800 LIST_FOR_EACH_ENTRY_SAFE(cf, next_cf, &bc->cf, list) {
2005 void r600_bytecode_disasm(struct r600_bytecode *bc)
2020 switch (bc->chip_class) {
2036 bc->ndw, bc->ngpr, bc->nstack);
2039 LIST_FOR_EACH_ENTRY(cf, &bc->cf, list) {
2042 fprintf(stderr, "%04d %08X %08X CF_NATIVE\n", id, bc->bytecode[id],
2043 bc->bytecode[id + 1]);
2048 fprintf(stderr, "%04d %08X %08X %s\n", id, bc->bytecode[id],
2049 bc->bytecode[id + 1], "ALU_EXT");
2052 fprintf(stderr, "%04d %08X %08X %s ", id, bc->bytecode[id],
2053 bc->bytecode[id + 1], cfop->name);
2067 fprintf(stderr, "%04d %08X %08X %s ", id, bc->bytecode[id],
2068 bc->bytecode[id + 1], cfop->name);
2074 o += fprintf(stderr, "%04d %08X %08X %s ", id, bc->bytecode[id],
2075 bc->bytecode[id + 1], cfop->name);
2109 bc->bytecode[id], bc->bytecode[id + 1], cfop->name);
2144 fprintf(stderr, "%04d %08X %08X %s ", id, bc->bytecode[id],
2145 bc->bytecode[id + 1], cfop->name);
2167 r600_bytecode_alu_nliterals(bc, alu, literal, &nliteral);
2168 o += fprintf(stderr, " %04d %08X %08X ", id, bc->bytecode[id], bc->bytecode[id+1]);
2197 float *f = (float*)(bc->bytecode + id);
2198 o = fprintf(stderr, " %04d %08X", id, bc->bytecode[id]);
2200 fprintf(stderr, " %f (%d)\n", *f, *(bc->bytecode + id));
2210 o += fprintf(stderr, " %04d %08X %08X %08X ", id, bc->bytecode[id],
2211 bc->bytecode[id + 1], bc->bytecode[id + 2]);
2258 o += fprintf(stderr, " %04d %08X %08X %08X ", id, bc->bytecode[id],
2259 bc->bytecode[id + 1], bc->bytecode[id + 2]);
2283 if (bc->chip_class < CAYMAN && vtx->mega_fetch_count)
2286 if (bc->chip_class >= EVERGREEN && vtx->buffer_index_mode)
2300 o += fprintf(stderr, " %04d %08X %08X %08X ", id, bc->bytecode[id],
2301 bc->bytecode[id + 1], bc->bytecode[id + 2]);
2492 struct r600_bytecode bc;
2505 memset(&bc, 0, sizeof(bc));
2506 r600_bytecode_init(&bc, rctx->b.chip_class, rctx->b.family,
2509 bc.isa = rctx->isa;
2526 if ((r = r600_bytecode_add_alu(&bc, &alu))) {
2527 r600_bytecode_clear(&bc);
2543 if ((r = r600_bytecode_add_alu(&bc, &alu))) {
2544 r600_bytecode_clear(&bc);
2557 r600_bytecode_clear(&bc);
2563 r600_bytecode_clear(&bc);
2585 if ((r = r600_bytecode_add_vtx(&bc, &vtx))) {
2586 r600_bytecode_clear(&bc);
2591 r600_bytecode_add_cfinst(&bc, CF_OP_RET);
2593 if ((r = r600_bytecode_build(&bc))) {
2594 r600_bytecode_clear(&bc);
2608 r600_bytecode_disasm(&bc);
2612 r600_sb_bytecode_process(rctx, &bc, NULL, 1 /*dump*/, 0 /*optimize*/);
2616 fs_size = bc.ndw*4;
2621 r600_bytecode_clear(&bc);
2629 r600_bytecode_clear(&bc);
2639 bytecode[i] = util_cpu_to_le32(bc.bytecode[i]);
2642 memcpy(bytecode, bc.bytecode, fs_size);
2646 r600_bytecode_clear(&bc);
2650 void r600_bytecode_alu_read(struct r600_bytecode *bc,
2681 alu->op = r600_isa_alu_by_opcode(bc->isa,
2689 alu->op = r600_isa_alu_by_opcode(bc->isa,
2700 void r600_bytecode_export_read(struct r600_bytecode *bc,
2714 output->op = r600_isa_cf_by_opcode(bc->isa,