OrcOpcodeExecutor opcode_ex;
ex->accumulators[0] = 0;
+ ex->accumulators[1] = 0;
+ ex->accumulators[2] = 0;
+ ex->accumulators[3] = 0;
memset (&opcode_ex, 0, sizeof(opcode_ex));
ORC_ERROR("unhandled size %d", program->vars[insn->dest_args[k]].size);
}
} else if (var->vartype == ORC_VAR_TYPE_ACCUMULATOR) {
+ switch (var->size) {
+ case 2:
+ ex->accumulators[insn->dest_args[k] - ORC_VAR_A1] +=
+ opcode_ex.dest_values[k];
+ ex->accumulators[insn->dest_args[k] - ORC_VAR_A1] &= 0xffff;
+ break;
+ case 4:
+ ex->accumulators[insn->dest_args[k] - ORC_VAR_A1] +=
+ opcode_ex.dest_values[k];
+ break;
+ default:
+ ORC_ERROR("unhandled size %d",program->vars[insn->dest_args[k]].size);
+ }
ex->accumulators[0] += opcode_ex.dest_values[k];
} else {
ORC_ERROR("shouldn't be reached (%d)", var->vartype);
if (var->name == NULL) continue;
switch (var->vartype) {
case ORC_VAR_TYPE_ACCUMULATOR:
- ORC_ASM_CODE(compiler," ex->accumulators[%d] = var%d;\n",
- i - ORC_VAR_A1, i);
+ if (var->size == 2) {
+ ORC_ASM_CODE(compiler," ex->accumulators[%d] = (var%d & 0xffff);\n",
+ i - ORC_VAR_A1, i);
+ } else {
+ ORC_ASM_CODE(compiler," ex->accumulators[%d] = var%d;\n",
+ i - ORC_VAR_A1, i);
+ }
break;
default:
break;
if (compiler->vars[i].size == 2) {
orc_x86_emit_mov_sse_reg (compiler, src, compiler->gp_tmpreg);
- orc_x86_emit_mov_reg_memoffset (compiler, 2, compiler->gp_tmpreg,
+ orc_x86_emit_and_imm_reg (compiler, 4, 0xffff, compiler->gp_tmpreg);
+ orc_x86_emit_mov_reg_memoffset (compiler, 4, compiler->gp_tmpreg,
(int)ORC_STRUCT_OFFSET(OrcExecutor, accumulators[i-ORC_VAR_A1]),
compiler->exec_reg);
} else {