[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
PPC float context only 4 Bytes per register?
- Date: Mon, 12 Nov 2001 14:22:31 -0800
- From: strauman at SLAC.Stanford.EDU (Till Straumann)
- Subject: PPC float context only 4 Bytes per register?
To quote from a lesson out of my first English textbook:
"What a shock for Mrs. Dent..."
I had a look at the code in question and I must agree. This simple
test program confirms our suspicions:
void fpctxt_tst(void *parm)
volatile double val;
register double tst;
tst = val = sqrt(2.);
if (j) rtems_task_wake_after(2);
i = (tst == val);
} while( i );
printf("FP register mismatch in %ith loop, should be %s but is
I must admit that I'm quite a bit shocked -
thanks to Thomas for pointing this out. How come that this
has been known for a while (see Sergej's message) but not fixed?
IMO, this deserved at least a 'known-issues' entry or similar.
Luckily, it should be easy - is somebody working on this already?
Thomas Doerfler wrote:
> I have just had some looks into the
> libcpu/powerpc/new_exception_processing/cpu_asm.S code to
> save/restore a floating-point context. In there it seems that
> for every context switch all the float registers are saved
> into 4 byte locations (in "single" precision format).
> From my point of view this results in rounding errors for
> "double precision" (64 bit) float arithmetics. So if I have
> written some code using "double precision" variables I will
> get roundoff errors, if there has been a context switch during
> calculations. (I did not try that out, but it seems logical to
> Did I miss something there?
> Any comments welcome...
> Thomas Doerfler.
> IMD Ingenieurbuero fuer Microcomputertechnik
> Thomas Doerfler Herbststrasse 8
> D-82178 Puchheim Germany
> email: Thomas.Doerfler at imd-systems.de
> PGP public key available at: http://www.imd-