[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 19/26] target-xtensa: implement loop option
From: |
Max Filippov |
Subject: |
Re: [Qemu-devel] [PATCH 19/26] target-xtensa: implement loop option |
Date: |
Fri, 20 May 2011 13:10:33 +0400 |
>> > + if (env->sregs[LEND] != v) {
>> > + tb_invalidate_phys_page_range(
>> > + env->sregs[LEND] - 1, env->sregs[LEND], 0);
>> > + env->sregs[LEND] = v;
>> > + tb_invalidate_phys_page_range(
>> > + env->sregs[LEND] - 1, env->sregs[LEND], 0);
>> > + }
>>
>> Why are you invalidating twice?
>
> TB at the old LEND and at the new. Although it will work correctly without
> first invalidation.
>
>> > +static void gen_check_loop_end(DisasContext *dc, int slot)
>> > +{
>> > + if (option_enabled(dc, XTENSA_OPTION_LOOP) &&
>> > + !(dc->tb->flags & XTENSA_TBFLAG_EXCM) &&
>> > + dc->next_pc == dc->lend) {
>> > + int label = gen_new_label();
>> > +
>> > + tcg_gen_brcondi_i32(TCG_COND_NE, cpu_SR[LEND], dc->next_pc,
>> > label);
>> > + tcg_gen_brcondi_i32(TCG_COND_EQ, cpu_SR[LCOUNT], 0, label);
>> > + tcg_gen_subi_i32(cpu_SR[LCOUNT], cpu_SR[LCOUNT], 1);
>> > + gen_jump(dc, cpu_SR[LBEG]);
>> > + gen_set_label(label);
>> > + gen_jumpi(dc, dc->next_pc, slot);
>>
>> If you're going to pretend that LEND is a constant, you might as well
>> pretend that LBEG is also a constant, so that you get to chain the TB's
>> around the loop.
>
> But there may be three exits from TB at the LEND if its last command is a
> branch: to the LBEG, to the branch target and to the next insn.
Ok, I guess that I need to add gen_wsr_lbeg that invalidates TB at the
current LEND, pretend that LBEG is constant and use given slot to jump
to it. And also to get rid of tcg_gen_brcondi_i32(TCG_COND_NE,
cpu_SR[LEND], dc->next_pc, label);
--
Thanks.
-- Max
- [Qemu-devel] [PATCH 12/26] target-xtensa: implement LSAI group, (continued)
- [Qemu-devel] [PATCH 12/26] target-xtensa: implement LSAI group, Max Filippov, 2011/05/17
- [Qemu-devel] [PATCH 13/26] target-xtensa: mark reserved and TBD opcodes, Max Filippov, 2011/05/17
- [Qemu-devel] [PATCH 14/26] target-xtensa: implement SYNC group, Max Filippov, 2011/05/17
- [Qemu-devel] [PATCH 15/26] target-xtensa: implement CACHE group, Max Filippov, 2011/05/17
- [Qemu-devel] [PATCH 16/26] target-xtensa: implement exceptions, Max Filippov, 2011/05/17
- [Qemu-devel] [PATCH 17/26] target-xtensa: implement RST2 group (32 bit mul/div/rem), Max Filippov, 2011/05/17
- [Qemu-devel] [PATCH 18/26] target-xtensa: implement windowed registers, Max Filippov, 2011/05/17
- [Qemu-devel] [PATCH 19/26] target-xtensa: implement loop option, Max Filippov, 2011/05/17
[Qemu-devel] [PATCH 20/26] target-xtensa: implement extended L32R, Max Filippov, 2011/05/17
[Qemu-devel] [PATCH 21/26] target-xtensa: implement unaligned exception option, Max Filippov, 2011/05/17