[PATCH] m32r-*-as For a code depended for host word size.

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] m32r-*-as For a code depended for host word size.

Kazuhiro Inaoka
Hi Nick,

This patch is to change for a code depended for host word size.

Please commit it and regenerate opcodes/m32r-asm.c.

Regards,
Kazuhiro Inaoka

ChangeLog

2005-10-14  Kazuhiro Inaoka <[hidden email]>

    * cpu/m32r.opc (parse_slo16): Changed for a code depended
    for host word size.

Index: m32r.opc
===================================================================
RCS file: /cvs/src/src/cpu/m32r.opc,v
retrieving revision 1.6
diff -u -p -r1.6 m32r.opc
--- m32r.opc 1 Jul 2005 11:16:30 -0000 1.6
+++ m32r.opc 14 Oct 2005 07:33:21 -0000
@@ -182,7 +182,7 @@ parse_slo16 (CGEN_CPU_DESC cd,
         {
   value &= 0xffff;
           if (value & 0x8000)
-             value |= 0xffff0000;
+             value |= ~0xffff;
         }
       *valuep = value;
       return errmsg;
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] m32r-*-as For a code depended for host word size.

Nick Clifton
Hi Kazu,

> 2005-10-14  Kazuhiro Inaoka <[hidden email]>
>
>    * cpu/m32r.opc (parse_slo16): Changed for a code depended
>    for host word size.

Approved and applied.  I have also applied the patch to
cgen/cpu/m32r.opc for completeness, even though this file is now
redundant.  I also regenerated opcodes/m32r-asm.c and checked that in.

I hope that you not mind, but I took the liberty of rewording your
ChangeLog entry into what I thought was a more appropriate form:

        * cpu/m32r.opc (parse_slo16): Do not assume a 32-bit host word
        size.

Cheers
   Nick
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] m32r-*-as For a code depended for host word size.

Andreas Schwab
In reply to this post by Kazuhiro Inaoka
Kazuhiro Inaoka <[hidden email]> writes:

> 2005-10-14  Kazuhiro Inaoka <[hidden email]>
>
>    * cpu/m32r.opc (parse_slo16): Changed for a code depended
>    for host word size.
> Index: m32r.opc
> ===================================================================
> RCS file: /cvs/src/src/cpu/m32r.opc,v
> retrieving revision 1.6
> diff -u -p -r1.6 m32r.opc
> --- m32r.opc 1 Jul 2005 11:16:30 -0000 1.6
> +++ m32r.opc 14 Oct 2005 07:33:21 -0000
> @@ -182,7 +182,7 @@ parse_slo16 (CGEN_CPU_DESC cd,
>          {
>    value &= 0xffff;
>            if (value & 0x8000)
> -             value |= 0xffff0000;
> +             value |= ~0xffff;

~0xffff is still 0xffff0000 for 32 bit ints and will be zero extended.
You probably want ~(bfd_vma)0xffff here.  Alternatively you can use

          value = ((value & 0xffff) ^ 0x8000) - 0x8000.

Andreas.

--
Andreas Schwab, SuSE Labs, [hidden email]
SuSE Linux Products GmbH, Maxfeldstra?e 5, 90409 N?rnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] m32r-*-as For a code depended for host word size.

Kazuhiro Inaoka
Thanks  Andreas,

> ~0xffff is still 0xffff0000 for 32 bit ints and will be zero extended.
> You probably want ~(bfd_vma)0xffff here.  Alternatively you can use
>
>           value = ((value & 0xffff) ^ 0x8000) - 0x8000.

It's better code.

Hi Nick,
Should I make and send the patch again?

Regards,

Kazuhiro Inaoka

Andreas Schwab wrote:

>>2005-10-14  Kazuhiro Inaoka <[hidden email]>
>>
>>   * cpu/m32r.opc (parse_slo16): Changed for a code depended
>>   for host word size.
>>Index: m32r.opc
>>===================================================================
>>RCS file: /cvs/src/src/cpu/m32r.opc,v
>>retrieving revision 1.6
>>diff -u -p -r1.6 m32r.opc
>>--- m32r.opc 1 Jul 2005 11:16:30 -0000 1.6
>>+++ m32r.opc 14 Oct 2005 07:33:21 -0000
>>@@ -182,7 +182,7 @@ parse_slo16 (CGEN_CPU_DESC cd,
>>         {
>>  value &= 0xffff;
>>           if (value & 0x8000)
>>-             value |= 0xffff0000;
>>+             value |= ~0xffff;
>>    
>>
>
>~0xffff is still 0xffff0000 for 32 bit ints and will be zero extended.
>You probably want ~(bfd_vma)0xffff here.  Alternatively you can use
>
>          value = ((value & 0xffff) ^ 0x8000) - 0x8000.
>

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] m32r-*-as For a code depended for host word size.

Nick Clifton
Hi Kazuhiro,

> Thanks  Andreas,

>>           value = ((value & 0xffff) ^ 0x8000) - 0x8000.

> It's better code.

> Hi Nick,
> Should I make and send the patch again?

No need - I have checked this patch in and attributed it to Andreas.

Cheers
   Nick

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] m32r-*-as For a code depended for host word size.

Kazuhiro Inaoka
 > No need - I have checked this patch in and attributed it to Andreas.

Thanks Nick,

I checked your committed patch. But It's not so good.

I think Andreas meant the attached patch.

Regards,

Kazuhiro Inaoka

Index: m32r.opc
===================================================================
RCS file: /cvs/src/src/cpu/m32r.opc,v
retrieving revision 1.8
diff -u -r1.8 m32r.opc
--- m32r.opc 18 Oct 2005 07:53:17 -0000 1.8
+++ m32r.opc 18 Oct 2005 08:55:24 -0000
@@ -180,9 +180,7 @@
       if (errmsg == NULL
   && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
         {
-  value &= 0xffff;
-          if (value & 0x8000)
-    value = ((value & 0xffff) ^ 0x8000) - 0x8000;
+  value = ((value & 0xffff) ^ 0x8000) - 0x8000;
  }
       *valuep = value;
       return errmsg;
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] m32r-*-as For a code depended for host word size.

Nick Clifton
Hi Kazuhiro,

> I checked your committed patch. But It's not so good.
> I think Andreas meant the attached patch.

Oops - yes, sorry about that.  I have checked in the corrected version
of the patch.

Cheers
   Nick

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] m32r-*-as For a code depended for host word size.

Kazuhiro Inaoka
Thanks Nick!

Kazuhiro Inaoka

Nick Clifton wrote:

> Hi Kazuhiro,
>
>> I checked your committed patch. But It's not so good.
>> I think Andreas meant the attached patch.
>
>
> Oops - yes, sorry about that.  I have checked in the corrected version
> of the patch.
>
> Cheers
>   Nick
>
>

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] m32r-*-as For a code depended for host word size.

Kazuhiro Inaoka
In reply to this post by Kazuhiro Inaoka
Hi Nick,

This patch is to fix FAIL at testsuite/gas/m32r/seth on x86_64 host.

Please commit it and regenerate opcodes/m32r-asm.c.

Regards,
Kazuhiro Inaoka

ChangeLog

2005-10-26  Kazuhiro Inaoka <[hidden email]>

    * cpu/m32r.opc (parse_hi16): Do not assume a 32-bit host word
    size.


Index: m32r.opc
===================================================================
RCS file: /cvs/src/src/cpu/m32r.opc,v
retrieving revision 1.9
diff -p -u -r1.9 m32r.opc
--- m32r.opc 19 Oct 2005 14:44:17 -0000 1.9
+++ m32r.opc 26 Oct 2005 05:24:14 -0000
@@ -144,6 +144,7 @@ parse_hi16 (CGEN_CPU_DESC cd,
         {
           value = value + (value & 0x8000 ? 0x10000 : 0);
           value >>= 16;
+          value &= 0xffff;
         }
       *valuep = value;
       return errmsg;
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] m32r-*-as For a code depended for host word size.

Alan Modra
On Wed, Oct 26, 2005 at 02:39:35PM +0900, Kazuhiro Inaoka wrote:
> This patch is to fix FAIL at testsuite/gas/m32r/seth on x86_64 host.

Should high() be treated the same, as follows?

Index: cpu/m32r.opc
===================================================================
RCS file: /cvs/src/src/cpu/m32r.opc,v
retrieving revision 1.9
diff -u -p -r1.9 m32r.opc
--- cpu/m32r.opc 19 Oct 2005 14:44:17 -0000 1.9
+++ cpu/m32r.opc 26 Oct 2005 06:03:13 -0000
@@ -127,7 +127,10 @@ parse_hi16 (CGEN_CPU_DESC cd,
       ++*strp;
       if (errmsg == NULL
     && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
- value >>= 16;
+ {
+  value >>= 16;
+  value &= 0xffff;
+ }
       *valuep = value;
       return errmsg;
     }
@@ -142,8 +145,9 @@ parse_hi16 (CGEN_CPU_DESC cd,
       if (errmsg == NULL
   && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
         {
-          value = value + (value & 0x8000 ? 0x10000 : 0);
+          value += 0x8000;
           value >>= 16;
+          value &= 0xffff;
         }
       *valuep = value;
       return errmsg;

--
Alan Modra
IBM OzLabs - Linux Technology Centre
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] m32r-*-as For a code depended for host word size.

Kazuhiro Inaoka
That's OK.

Thanks,
Kazuhiro Inaoka

Alan Modra wrote:

>On Wed, Oct 26, 2005 at 02:39:35PM +0900, Kazuhiro Inaoka wrote:
>  
>
>>This patch is to fix FAIL at testsuite/gas/m32r/seth on x86_64 host.
>>    
>>
>
>Should high() be treated the same, as follows?
>
>Index: cpu/m32r.opc
>===================================================================
>RCS file: /cvs/src/src/cpu/m32r.opc,v
>retrieving revision 1.9
>diff -u -p -r1.9 m32r.opc
>--- cpu/m32r.opc 19 Oct 2005 14:44:17 -0000 1.9
>+++ cpu/m32r.opc 26 Oct 2005 06:03:13 -0000
>@@ -127,7 +127,10 @@ parse_hi16 (CGEN_CPU_DESC cd,
>       ++*strp;
>       if (errmsg == NULL
>    && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
>- value >>= 16;
>+ {
>+  value >>= 16;
>+  value &= 0xffff;
>+ }
>       *valuep = value;
>       return errmsg;
>     }
>@@ -142,8 +145,9 @@ parse_hi16 (CGEN_CPU_DESC cd,
>       if (errmsg == NULL
>  && result_type == CGEN_PARSE_OPERAND_RESULT_NUMBER)
>         {
>-          value = value + (value & 0x8000 ? 0x10000 : 0);
>+          value += 0x8000;
>           value >>= 16;
>+          value &= 0xffff;
>         }
>       *valuep = value;
>       return errmsg;
>
>  
>

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] m32r-*-as For a code depended for host word size.

Alan Modra
Applied.

--
Alan Modra
IBM OzLabs - Linux Technology Centre
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] m32r-*-as For a code depended for host word size.

Kazuhiro Inaoka
Thanks Alan,

Alan Modra wrote:

>Applied.
>
Could you apply the path to cgen/cpu/m32r.opc too?

Regards,

Kazuhiro Inaoka