All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] sparc64: fix wrpstate and wrtl on delay slot
@ 2011-04-30 15:42 Blue Swirl
  2011-04-30 19:32 ` Igor Kovalenko
  0 siblings, 1 reply; 5+ messages in thread
From: Blue Swirl @ 2011-04-30 15:42 UTC (permalink / raw)
  To: qemu-devel, Artyom Tarasenko, Igor Kovalenko, Aurelien Jarno

Use TCG local to work around TCG register flush due to a branch.

Thanks to Artyom Tarasenko, Igor Kovalenko and Aurelien Jarno.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
I analyzed the call tree in target-sparc/translate.c for brcond* usage.
In the following lines, first level function uses brcond* directly,
second level calls the first level etc.

gen_add_tv
>gen_op_tadd_ccTV
>>taddcctv

gen_tag_tv
>gen_op_tadd_ccTV
>>taddcctv
>gen_op_tsub_ccTV
>>tsubcctv

gen_sub_tv
>gen_op_tsub_ccTV
>>tsubcctv

gen_op_mulscc
>mulscc

gen_trap_ifdivzero_tl
>gen_op_sdivx
>>sdivx
>udivx

gen_op_sdivx
>sdivx

gen_branch2
>disas_sparc_insn

gen_branch_a
>do_branch
>>bpcc
>>bn+x
>do_fbranch
>>fbpcc
>>fbn+x
>do_branch_reg
>>bpr

gen_generic_branch
>flush_cond
>>do_branch
>>>bpcc
>>>bn+x
>>do_fbranch
>>>fbpcc
>>>fbn+x
>>do_branch_reg
>>>bpr
>save_npc
>>save_state
>>>gen_trap_ifnofpu
>>>trap
>>>flushw
>>>FPU Operations
>>>taddcctv
>>>tsubcctv
>>>wrfprs
>>>wrpsr
>>>wrpstate
>>>wrtl
>>>wrhpstate
>>>return
>>>save
>>>restore
>>>ldd
>>>lda
>>>lduba
>>>lduha
>>>ldda
>>>ldsba
>>>ldsha
>>>ldstuba
>>>swapa
>>>ldswa
>>>ldxa
>>>ldfa
>>>lddfa
>>>ldqfa
>>>ldf
>>>ldfsr
>>>lddqf
>>>lddf
>>>std
>>>sta
>>>stba
>>>stha
>>>stda
>>>stxa
>>>stf
>>>stfsr
>>>stqf
>>>stdf
>>>stfa
>>>stqfa
>>>stdfa
>>>casa
>>>casxa
>>gen_intermediate_code_internal
>gen_mov_pc_npc
>>call
>>return
>>jmpl
>>rett

gen_cond_reg
>do_branch_reg
>>bpr

trap

fmovsr

fmovdr

fmovqr

fmovscc

fmovdcc

fmovqcc

movcc

movr

I only found wrtl in addition to wrpstate discovered earlier, other
use cases looked OK.

 target-sparc/translate.c |   28 ++++++++++++++++++++--------
 1 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/target-sparc/translate.c b/target-sparc/translate.c
index 3c958b2..9222cde 100644
--- a/target-sparc/translate.c
+++ b/target-sparc/translate.c
@@ -3505,16 +3505,28 @@ static void disas_sparc_insn(DisasContext * dc)
                                 tcg_gen_mov_tl(cpu_tbr, cpu_tmp0);
                                 break;
                             case 6: // pstate
-                                save_state(dc, cpu_cond);
-                                gen_helper_wrpstate(cpu_tmp0);
-                                dc->npc = DYNAMIC_PC;
+                                {
+                                    TCGv r_tmp = tcg_temp_local_new();
+
+                                    tcg_gen_mov_tl(r_tmp, cpu_tmp0);
+                                    save_state(dc, cpu_cond);
+                                    gen_helper_wrpstate(r_tmp);
+                                    tcg_temp_free(r_tmp);
+                                    dc->npc = DYNAMIC_PC;
+                                }
                                 break;
                             case 7: // tl
-                                save_state(dc, cpu_cond);
-                                tcg_gen_trunc_tl_i32(cpu_tmp32, cpu_tmp0);
-                                tcg_gen_st_i32(cpu_tmp32, cpu_env,
-                                               offsetof(CPUSPARCState, tl));
-                                dc->npc = DYNAMIC_PC;
+                                {
+                                    TCGv r_tmp = tcg_temp_local_new();
+
+                                    tcg_gen_mov_tl(r_tmp, cpu_tmp0);
+                                    save_state(dc, cpu_cond);
+                                    tcg_gen_trunc_tl_i32(cpu_tmp32, r_tmp);
+                                    tcg_temp_free(r_tmp);
+                                    tcg_gen_st_i32(cpu_tmp32, cpu_env,
+
offsetof(CPUSPARCState, tl));
+                                    dc->npc = DYNAMIC_PC;
+                                }
                                 break;
                             case 8: // pil
                                 gen_helper_wrpil(cpu_tmp0);
-- 
1.6.2.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] sparc64: fix wrpstate and wrtl on delay slot
  2011-04-30 15:42 [Qemu-devel] [PATCH] sparc64: fix wrpstate and wrtl on delay slot Blue Swirl
@ 2011-04-30 19:32 ` Igor Kovalenko
  2011-04-30 19:48   ` Super Bisquit
  2011-05-01  7:27   ` Blue Swirl
  0 siblings, 2 replies; 5+ messages in thread
From: Igor Kovalenko @ 2011-04-30 19:32 UTC (permalink / raw)
  To: Blue Swirl; +Cc: Aurelien Jarno, qemu-devel, Artyom Tarasenko

On Sat, Apr 30, 2011 at 7:42 PM, Blue Swirl <blauwirbel@gmail.com> wrote:
> Use TCG local to work around TCG register flush due to a branch.
>
> Thanks to Artyom Tarasenko, Igor Kovalenko and Aurelien Jarno.
>
> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
> ---
> I analyzed the call tree in target-sparc/translate.c for brcond* usage.
> In the following lines, first level function uses brcond* directly,
> second level calls the first level etc.
>

I want to be able to do exhaustive searches as well :)
Have you used recently posted gcc save-temps method?

-- 
Kind regards,
Igor V. Kovalenko

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] sparc64: fix wrpstate and wrtl on delay slot
  2011-04-30 19:32 ` Igor Kovalenko
@ 2011-04-30 19:48   ` Super Bisquit
  2011-04-30 19:53     ` Artyom Tarasenko
  2011-05-01  7:27   ` Blue Swirl
  1 sibling, 1 reply; 5+ messages in thread
From: Super Bisquit @ 2011-04-30 19:48 UTC (permalink / raw)
  To: Igor Kovalenko; +Cc: Blue Swirl, qemu-devel, Aurelien Jarno, Artyom Tarasenko

[-- Attachment #1: Type: text/plain, Size: 763 bytes --]

Just curious, is this for host or guest?
On Sat, Apr 30, 2011 at 3:32 PM, Igor Kovalenko
<igor.v.kovalenko@gmail.com>wrote:

> On Sat, Apr 30, 2011 at 7:42 PM, Blue Swirl <blauwirbel@gmail.com> wrote:
> > Use TCG local to work around TCG register flush due to a branch.
> >
> > Thanks to Artyom Tarasenko, Igor Kovalenko and Aurelien Jarno.
> >
> > Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
> > ---
> > I analyzed the call tree in target-sparc/translate.c for brcond* usage.
> > In the following lines, first level function uses brcond* directly,
> > second level calls the first level etc.
> >
>
> I want to be able to do exhaustive searches as well :)
> Have you used recently posted gcc save-temps method?
>
> --
> Kind regards,
> Igor V. Kovalenko
>
>

[-- Attachment #2: Type: text/html, Size: 1224 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] sparc64: fix wrpstate and wrtl on delay slot
  2011-04-30 19:48   ` Super Bisquit
@ 2011-04-30 19:53     ` Artyom Tarasenko
  0 siblings, 0 replies; 5+ messages in thread
From: Artyom Tarasenko @ 2011-04-30 19:53 UTC (permalink / raw)
  To: Super Bisquit; +Cc: Blue Swirl, qemu-devel, Aurelien Jarno

On Sat, Apr 30, 2011 at 9:48 PM, Super Bisquit <superbisquit@gmail.com> wrote:
>
> Just curious, is this for host or guest?

Guest (aka target)

> On Sat, Apr 30, 2011 at 3:32 PM, Igor Kovalenko <igor.v.kovalenko@gmail.com>
> wrote:
>>
>> On Sat, Apr 30, 2011 at 7:42 PM, Blue Swirl <blauwirbel@gmail.com> wrote:
>> > Use TCG local to work around TCG register flush due to a branch.
>> >
>> > Thanks to Artyom Tarasenko, Igor Kovalenko and Aurelien Jarno.
>> >
>> > Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
>> > ---
>> > I analyzed the call tree in target-sparc/translate.c for brcond* usage.
>> > In the following lines, first level function uses brcond* directly,
>> > second level calls the first level etc.
>> >
>>
>> I want to be able to do exhaustive searches as well :)
>> Have you used recently posted gcc save-temps method?
>>
>> --
>> Kind regards,
>> Igor V. Kovalenko
>>
>
>



-- 
Regards,
Artyom Tarasenko

solaris/sparc under qemu blog: http://tyom.blogspot.com/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PATCH] sparc64: fix wrpstate and wrtl on delay slot
  2011-04-30 19:32 ` Igor Kovalenko
  2011-04-30 19:48   ` Super Bisquit
@ 2011-05-01  7:27   ` Blue Swirl
  1 sibling, 0 replies; 5+ messages in thread
From: Blue Swirl @ 2011-05-01  7:27 UTC (permalink / raw)
  To: Igor Kovalenko; +Cc: Aurelien Jarno, qemu-devel, Artyom Tarasenko

On Sat, Apr 30, 2011 at 10:32 PM, Igor Kovalenko
<igor.v.kovalenko@gmail.com> wrote:
> On Sat, Apr 30, 2011 at 7:42 PM, Blue Swirl <blauwirbel@gmail.com> wrote:
>> Use TCG local to work around TCG register flush due to a branch.
>>
>> Thanks to Artyom Tarasenko, Igor Kovalenko and Aurelien Jarno.
>>
>> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
>> ---
>> I analyzed the call tree in target-sparc/translate.c for brcond* usage.
>> In the following lines, first level function uses brcond* directly,
>> second level calls the first level etc.
>>
>
> I want to be able to do exhaustive searches as well :)
> Have you used recently posted gcc save-temps method?

No, I just used the search facilities of the editor. First, search for
brcond, examine the function for correctness and copy the function
names to scratch buffer. Next, search for the function names just
found, examine callers and copy their function names with prefix to
scratch etc. About one hour's work.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-05-01  7:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-30 15:42 [Qemu-devel] [PATCH] sparc64: fix wrpstate and wrtl on delay slot Blue Swirl
2011-04-30 19:32 ` Igor Kovalenko
2011-04-30 19:48   ` Super Bisquit
2011-04-30 19:53     ` Artyom Tarasenko
2011-05-01  7:27   ` Blue Swirl

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.