Re: TIMEOUT MERGE: fix subnormal test on AMD64



On Sun, 27 Jun 2010, Stefan Westerfeld wrote:

TIMEOUT MERGE TIMEOUT MERGE TIMEOUT MERGE TIMEOUT MERGE TIMEOUT MERGE

  Hi!

Since on AMD64, denormals are treated as zero (a feature of SSE math), the
subnormals test breaks. To fix it, I added a simple run time check (which
multiplies a subnormal with a random number and checks if the result is zero),
to skip the test IFF the processor treats denormals as zero.

repo:   http://space.twc.de/public/git/stwbeast.git
branch: subnormals-amd64

I'm not entirely happy with the implementation of check_denormals_are_zero(),
because it just measures the outcome of a computation instead of firmly
investigating actual FPU modes. E.g. compiler optimizations could be at
fault here as well. The way I read the current code, it does:
 if denormal_tests_can_succeed():
   run_denormal_tests()
While it should be doing
 if denormal_tests_are_expected_to_succeed(): # FPU DAZ mode check
   run_denormal_tests()

There should be some standardized feature test to check the CPU for
DAZ mode, have you searched the glibc FPU functions?
And if there isn't, we should come up with our own AMD64 specific
asm check (and might need to extend it in the future for other
CPUs).

  Cu... Stefan

Yours sincerely,
Tim Janik

---
http://lanedo.com/~timj/


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]