static void push_predicate(struct fd2_compile_context *ctx, struct tgsi_src_register *src) { struct ir2_instruction *alu; struct tgsi_dst_register pred_dst; if (ctx->pred_depth == 0) { /* assign predicate register: */ ctx->pred_reg = ctx->num_regs[TGSI_FILE_TEMPORARY]; get_predicate(ctx, &pred_dst, NULL); alu = ir2_instr_create_alu_s(ctx->so->ir, PRED_SETNEs); add_dst_reg(ctx, alu, &pred_dst); add_src_reg(ctx, alu, src); } else { struct tgsi_src_register pred_src; get_predicate(ctx, &pred_dst, &pred_src); alu = ir2_instr_create_alu_v(ctx->so->ir, MULv); add_dst_reg(ctx, alu, &pred_dst); add_src_reg(ctx, alu, &pred_src); add_src_reg(ctx, alu, src); // XXX need to make PRED_SETE_PUSHv IR2_PRED_NONE.. but need to make // sure src reg is valid if it was calculated with a predicate // condition.. alu->pred = IR2_PRED_NONE; } /* save previous pred state to restore in pop_predicate(): */ ctx->pred_stack[ctx->pred_depth++] = ctx->so->ir->pred; }
static void pop_predicate(struct fd2_compile_context *ctx) { /* NOTE blob compiler seems to always puts PRED_* instrs in a CF by * themselves: */ ctx->cf = NULL; /* restore previous predicate state: */ ctx->so->ir->pred = ctx->pred_stack[--ctx->pred_depth]; if (ctx->pred_depth != 0) { struct ir2_instruction *alu; struct tgsi_dst_register pred_dst; struct tgsi_src_register pred_src; get_predicate(ctx, &pred_dst, &pred_src); alu = ir2_instr_create_alu(next_exec_cf(ctx), ~0, PRED_SET_POPs); add_regs_dummy_vector(alu); add_dst_reg(ctx, alu, &pred_dst); add_src_reg(ctx, alu, &pred_src); alu->pred = IR2_PRED_NONE; } else { /* predicate register no longer needed: */ ctx->pred_reg = -1; } ctx->cf = NULL; }
void Table::add_instruction ( std::string& predicate, std::string& operation, std::string& destination, std::string& operand1, std::string& operand2, std::string& shift_type, std::string& shamt ) { Instruction op; get_predicate(predicate, op); get_operation(operation, op); get_destination(destination, op); get_operand1(operand1, op); get_operand2(operand2, op); get_shift_type(shift_type, op); get_shamt(shamt, op); op.stop_bit = false; op.size = instruction_size[op.type]; op.address = address; address += op.size; instructions.push(op); }
static void push_predicate(struct fd2_compile_context *ctx, struct tgsi_src_register *src) { struct ir2_instruction *alu; struct tgsi_dst_register pred_dst; /* NOTE blob compiler seems to always puts PRED_* instrs in a CF by * themselves: */ ctx->cf = NULL; if (ctx->pred_depth == 0) { /* assign predicate register: */ ctx->pred_reg = ctx->num_regs[TGSI_FILE_TEMPORARY]; get_predicate(ctx, &pred_dst, NULL); alu = ir2_instr_create_alu(next_exec_cf(ctx), ~0, PRED_SETNEs); add_regs_dummy_vector(alu); add_dst_reg(ctx, alu, &pred_dst); add_src_reg(ctx, alu, src); } else { struct tgsi_src_register pred_src; get_predicate(ctx, &pred_dst, &pred_src); alu = ir2_instr_create_alu(next_exec_cf(ctx), MULv, ~0); add_dst_reg(ctx, alu, &pred_dst); add_src_reg(ctx, alu, &pred_src); add_src_reg(ctx, alu, src); // XXX need to make PRED_SETE_PUSHv IR2_PRED_NONE.. but need to make // sure src reg is valid if it was calculated with a predicate // condition.. alu->pred = IR2_PRED_NONE; } /* save previous pred state to restore in pop_predicate(): */ ctx->pred_stack[ctx->pred_depth++] = ctx->so->ir->pred; ctx->cf = NULL; }
static void pop_predicate(struct fd2_compile_context *ctx) { /* restore previous predicate state: */ ctx->so->ir->pred = ctx->pred_stack[--ctx->pred_depth]; if (ctx->pred_depth != 0) { struct ir2_instruction *alu; struct tgsi_dst_register pred_dst; struct tgsi_src_register pred_src; get_predicate(ctx, &pred_dst, &pred_src); alu = ir2_instr_create_alu_s(ctx->so->ir, PRED_SET_POPs); add_dst_reg(ctx, alu, &pred_dst); add_src_reg(ctx, alu, &pred_src); alu->pred = IR2_PRED_NONE; } else { /* predicate register no longer needed: */ ctx->pred_reg = -1; } }
inline size_t storage_size(void) const { return sizeof(derivation_direction) + sizeof(vm::depth_t) + data->get_storage_size(get_predicate()); }
inline vm::strat_level get_strat_level(void) const { return get_predicate()->get_strat_level(); }