From f73c151f536aa81875285ccb38adc309d01b5915 Mon Sep 17 00:00:00 2001 From: Alberto Ruiz Date: Sat, 12 Mar 2011 13:07:30 +0000 Subject: fpudebug --- lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'lib/Numeric/LinearAlgebra') diff --git a/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c b/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c index f4ae0f6..77a8847 100644 --- a/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c +++ b/lib/Numeric/LinearAlgebra/LAPACK/lapack-aux.c @@ -47,7 +47,24 @@ //--------------------------------------- void asm_finit() { #ifdef i386 - asm("finit"); + + #if FPUDEBUG + uint val=0; + asm("fstsw" + : "=a" (val) + : "a" (val) + ); + + val = (val%16384)/2048; // bits 13-11 + + if (val != 0) { + printf("Warning: FPU Stack: %d\n",val); + asm("finit"); + } + #else + asm("finit"); + #endif + #endif } //--------------------------------------- -- cgit v1.2.3