public inbox for sid@sourceware.org
 help / color / mirror / Atom feed
From: "Harry Hsin-Hua Pan(潘欣華)" <harry@andestech.com>
To: <sid@sourceware.org>
Subject: Float point display in arm-elf-sid
Date: Wed, 29 Mar 2006 06:34:00 -0000	[thread overview]
Message-ID: <5678A43F683CDC488405E3DF4CE92BCF076D37@atcpcs02.andestech.com> (raw)

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

Hi,
 
I've tried to build a SID with --target=arm-elf
Then I ran a test to displaying a float point.
But I got an incorrect display like following:
 
<arm-elf-sid-dir>/bin
$arm-elf-gcc test.c -o test.arm
$ ./arm-elf-sid -EL test.arm
hello! world
i=2
f=-2589673925853444962162817833395304976613376.000000
j=125
 
While tracing this issue, I found the arm7.cxx seems to not support "rotate right with extend" (RRX).
(Readers could refer to ARM DDI 0100E page A-17)
So I updated my arm7.cxx then re-built again.
Now I got correct display like following:
 
$ ./arm-elf-sid -EL test.arm
hello! world
i=2
f=123.456001
j=125
 
This issue seems to explain the strange result in the SID screen shot here.
http://sources.redhat.com/sid/screenshots/run-dhrystone.jpg
 
I attached my patch which was generated with the CVS snapshot in 20060325.
I didn't verified it to check whether there is another side effect.
So, would somebody like to verify this patch?
 
Regards,
Harry.
 
 
 

[-- Attachment #2: sid-20060325-patch.diff --]
[-- Type: application/octet-stream, Size: 640 bytes --]

--- sid-20060325/sid/component/cgen-cpu/arm7t/arm7f.cxx	2004-08-04 23:42:00.000000000 +0800
+++ sid-20060325-patch/sid/component/cgen-cpu/arm7t/arm7f.cxx	2006-03-29 12:56:55.021225400 +0800
@@ -1443,7 +1443,11 @@
     case SHIFT_TYPE_LSL : return rm << shift;
     case SHIFT_TYPE_LSR : return (USI) rm >> shift;
     case SHIFT_TYPE_ASR : return rm >> shift;
-    case SHIFT_TYPE_ROR : return RORSI (rm, shift);
+    case SHIFT_TYPE_ROR : //return RORSI (rm, shift); // old
+        if (shift == 0) // it is RRX
+	    return ((USI)rm >> 1) | ((USI)this->hardware.h_cbit << 31);
+	else
+	    return RORSI (rm, shift);
     }
   abort();
 }

[-- Attachment #3: test.c --]
[-- Type: application/octet-stream, Size: 277 bytes --]

#include <stdio.h>

static char hello[] = "hello! world";

int main(void)
{
	int i = 2;
	float f = 123.456;
	int j;
	
	printf("%s\n", hello);
	printf("i=%d\n", i);
check_point01:
	printf("f=%f\n", f);

	j = (int)f + i;

	printf("j=%d\n", j);
	return 0;
}


             reply	other threads:[~2006-03-29  6:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-29  6:34 Harry Hsin-Hua Pan(潘欣華) [this message]
2006-03-29 21:22 ` Frank Ch. Eigler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5678A43F683CDC488405E3DF4CE92BCF076D37@atcpcs02.andestech.com \
    --to=harry@andestech.com \
    --cc=sid@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).