* Float point display in arm-elf-sid
@ 2006-03-29 6:34 Harry Hsin-Hua Pan(潘欣華)
2006-03-29 21:22 ` Frank Ch. Eigler
0 siblings, 1 reply; 2+ messages in thread
From: Harry Hsin-Hua Pan(潘欣華) @ 2006-03-29 6:34 UTC (permalink / raw)
To: sid
[-- 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;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-03-29 21:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-03-29 6:34 Float point display in arm-elf-sid Harry Hsin-Hua Pan(潘欣華)
2006-03-29 21:22 ` Frank Ch. Eigler
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).