qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH target-arm] Don' use T[x] in helper
@ 2009-03-24 19:59 Torbjörn Andersson
  0 siblings, 0 replies; 3+ messages in thread
From: Torbjörn Andersson @ 2009-03-24 19:59 UTC (permalink / raw)
  To: qemu-devel

Hi all!

I hit a strange issue with add_cc, can't really explain how it appeared but
it did. The patch below solved my problem.

Can someone make a qualified guess why? I'm compling with gcc 4.

However, T0 and T1 in a helper should not be used, because it creates a
unnecessary dependency between translate.c and op_helper.c. Am I correct?

Further, if we cannot trust T0 and T1 in a helper, what about the global
env-variable?

/Best regards Torbjörn Andersson

Index: op_helper.c
===================================================================
--- op_helper.c	(revision 6883)
+++ op_helper.c	(working copy)
@@ -307,7 +307,7 @@
 uint32_t HELPER (add_cc)(uint32_t a, uint32_t b)
 {
     uint32_t result;
-    result = T0 + T1;
+    result = a + b;
     env->NF = env->ZF = result;
     env->CF = result < a;
     env->VF = (a ^ b ^ -1) & (a ^ result);

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

* Re: [Qemu-devel] [PATCH target-arm] Don' use T[x] in helper
       [not found] <-4209888356038288037@unknownmsgid>
@ 2009-03-24 20:37 ` Laurent Desnogues
  0 siblings, 0 replies; 3+ messages in thread
From: Laurent Desnogues @ 2009-03-24 20:37 UTC (permalink / raw)
  To: qemu-devel

2009/3/24 Torbjörn Andersson <tobbe.tt@home.se>:
>
> I hit a strange issue with add_cc, can't really explain how it appeared but
> it did. The patch below solved my problem.
>
> Can someone make a qualified guess why? I'm compling with gcc 4.
>
> However, T0 and T1 in a helper should not be used, because it creates a
> unnecessary dependency between translate.c and op_helper.c. Am I correct?
>
> Further, if we cannot trust T0 and T1 in a helper, what about the global
> env-variable?

Your patch is correct and the previous code works by accident
since add_cc is called this way:

   gen_helper_add_cc(cpu_T[0], cpu_T[0], cpu_T[1])

What I find strange is that you had issue with the code in svn.  I
didn't have before I fixed it, but it was perhaps using some old
compiler at that time.


Laurent

Acked-by: Laurent Desnogues <laurent.desnogues@gmail.com>

> /Best regards Torbjörn Andersson
>
> Index: op_helper.c
> ===================================================================
> --- op_helper.c (revision 6883)
> +++ op_helper.c (working copy)
> @@ -307,7 +307,7 @@
>  uint32_t HELPER (add_cc)(uint32_t a, uint32_t b)
>  {
>     uint32_t result;
> -    result = T0 + T1;
> +    result = a + b;
>     env->NF = env->ZF = result;
>     env->CF = result < a;
>     env->VF = (a ^ b ^ -1) & (a ^ result);

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

* Re: [Qemu-devel] [PATCH target-arm] Don' use T[x] in helper
@ 2009-04-07 22:48 Aurelien Jarno
  0 siblings, 0 replies; 3+ messages in thread
From: Aurelien Jarno @ 2009-04-07 22:48 UTC (permalink / raw)
  To: Torbjörn Andersson; +Cc: qemu-devel

On Tue, Mar 24, 2009 at 08:59:16PM +0100, Torbjörn Andersson wrote:
> Hi all!
> 
> I hit a strange issue with add_cc, can't really explain how it appeared but
> it did. The patch below solved my problem.
> 
> Can someone make a qualified guess why? I'm compling with gcc 4.
> 
> However, T0 and T1 in a helper should not be used, because it creates a
> unnecessary dependency between translate.c and op_helper.c. Am I correct?
> 
> Further, if we cannot trust T0 and T1 in a helper, what about the global
> env-variable?

Thanks, I applied your patch.

> /Best regards Torbjörn Andersson
> 
> Index: op_helper.c
> ===================================================================
> --- op_helper.c	(revision 6883)
> +++ op_helper.c	(working copy)
> @@ -307,7 +307,7 @@
>  uint32_t HELPER (add_cc)(uint32_t a, uint32_t b)
>  {
>      uint32_t result;
> -    result = T0 + T1;
> +    result = a + b;
>      env->NF = env->ZF = result;
>      env->CF = result < a;
>      env->VF = (a ^ b ^ -1) & (a ^ result);
> 
> 
> 
> 

-- 
Aurelien Jarno	                        GPG: 1024D/F1BCDB73
aurelien@aurel32.net                 http://www.aurel32.net

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

end of thread, other threads:[~2009-04-07 22:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-24 19:59 [Qemu-devel] [PATCH target-arm] Don' use T[x] in helper Torbjörn Andersson
     [not found] <-4209888356038288037@unknownmsgid>
2009-03-24 20:37 ` Laurent Desnogues
  -- strict thread matches above, loose matches on Subject: below --
2009-04-07 22:48 Aurelien Jarno

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).