Port-powerpc archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: powerpc FPU emulation fails for single precision arithmetic (Was: kernel panic on ibm4xx-based powerpc box with DDB)



On 2016/12/28 19:31, Simon Burge wrote:
How exactly does single precision fail without this fix?  I haven't
looked, but is there any simple single precision IEEE test suite that
shows this?

I'm all for the fix BTW :)

Cheers,
Simon.


Without this fix, the calculation results are clearly wrong, e.g.:

  % cat fp.c
  #include <stdio.h>
  int main(){
          double dx = 1.0, dy = 2.0;
          float  sx = 1.0, sy = 2.0;
          printf("DP: %f / %f = %f\n", dx, dy, dx / dy);
          printf("SP: %f / %f = %f\n", sx, sy, sx / sy);
          return 0;
  }
  % cc fp.c && ./a.out
  DP: 1.000000 / 2.000000 = 0.500000
  SP: 1.000000 / 2.000000 = 0.003906 <--- OOPS!!

Probably we need some ATF tests for FPU emulation, not only for
powerpc, but also for other archs.

Thanks,
Rin


Home | Main Index | Thread Index | Old Index