ilo: fix JIP/UIP on Gen8

UIP is in DW2 and JIP is in DW3 on Gen8.  Also, the units are in bytes.
This commit is contained in:
Chia-I Wu 2015-02-14 06:28:12 +08:00
parent c62507f42c
commit 8323796840
2 changed files with 25 additions and 9 deletions

View file

@ -444,8 +444,12 @@ translate_src_gen6(const struct codegen *cg, int idx)
/* special treatment may be needed if any of the operand is immediate */
if (cg->src[0].file == GEN6_FILE_IMM) {
assert(!cg->src[0].absolute && !cg->src[0].negate);
/* only the last src operand can be an immediate */
assert(src_is_null(cg, 1));
/* only the last src operand can be an immediate unless it is Gen8+ */
assert(ilo_dev_gen(cg->dev) >= ILO_GEN(8) || src_is_null(cg, 1));
if (!src_is_null(cg, 1))
return cg->src[idx].origin;
if (idx == 0) {
if (ilo_dev_gen(cg->dev) >= ILO_GEN(8)) {

View file

@ -335,7 +335,9 @@ patch_while_jip(struct toy_compiler *tc, struct toy_inst *inst)
dist--;
}
if (ilo_dev_gen(tc->dev) >= ILO_GEN(7))
if (ilo_dev_gen(tc->dev) >= ILO_GEN(8))
inst->src[1] = tsrc_imm_d(dist * 16);
else if (ilo_dev_gen(tc->dev) >= ILO_GEN(7))
inst->src[1] = tsrc_imm_w(dist * 2);
else
inst->dst = tdst_imm_w(dist * 2);
@ -388,13 +390,16 @@ patch_if_else_jip(struct toy_compiler *tc, struct toy_inst *inst)
dist++;
}
if (ilo_dev_gen(tc->dev) >= ILO_GEN(7)) {
if (ilo_dev_gen(tc->dev) >= ILO_GEN(8)) {
inst->dst.type = TOY_TYPE_D;
inst->src[0] = tsrc_imm_d(uip * 8);
inst->src[1] = tsrc_imm_d(jip * 8);
} else if (ilo_dev_gen(tc->dev) >= ILO_GEN(7)) {
/* what should the type be? */
inst->dst.type = TOY_TYPE_D;
inst->src[0].type = TOY_TYPE_D;
inst->src[1] = tsrc_imm_d(uip << 16 | jip);
}
else {
} else {
inst->dst = tdst_imm_w(jip);
}
}
@ -431,7 +436,9 @@ patch_endif_jip(struct toy_compiler *tc, struct toy_inst *inst)
if (!found)
dist = 1;
if (ilo_dev_gen(tc->dev) >= ILO_GEN(7))
if (ilo_dev_gen(tc->dev) >= ILO_GEN(8))
inst->src[1] = tsrc_imm_d(dist * 16);
else if (ilo_dev_gen(tc->dev) >= ILO_GEN(7))
inst->src[1] = tsrc_imm_w(dist * 2);
else
inst->dst = tdst_imm_w(dist * 2);
@ -495,8 +502,13 @@ patch_break_continue_jip(struct toy_compiler *tc, struct toy_inst *inst)
/* should the type be D or W? */
inst->dst.type = TOY_TYPE_D;
inst->src[0].type = TOY_TYPE_D;
inst->src[1] = tsrc_imm_d(uip << 16 | jip);
if (ilo_dev_gen(tc->dev) >= ILO_GEN(8)) {
inst->src[0] = tsrc_imm_d(uip * 8);
inst->src[1] = tsrc_imm_d(jip * 8);
} else {
inst->src[0].type = TOY_TYPE_D;
inst->src[1] = tsrc_imm_d(uip << 16 | jip);
}
}
/**