www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5386] New: Initialising out float parameter causes FPU exception

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5386

           Summary: Initialising out float parameter causes FPU exception
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: pvm_2004 yahoo.co.uk


--- Comment #0 from Peter Moore <pvm_2004 yahoo.co.uk> 2010-12-28 04:50:04 PST
---
The following short code snippet causes slow code caused by FPU exception:

float f;
func(f);

void func(out float ff) {
ff = 1;
} 

The following code is produced for the function:

func  LABEL NEAR
push    ebp
mov     ebp, esp
push    eax       
fld     dword ptr [_nan]
fstp    dword ptr [eax]
fld     dword ptr [_one]
fstp    dword ptr [eax]
mov     esp, ebp
pop     ebp
ret 

It appears that in DMD2 a float NaN is 0x7FE00000 (in dword format) but when it
initialises a float 'out' parameter it
initialises it with 0x7FA00000. This causes an FPU trap which unnecessarily
eats up around 250 ticks.

I had a quick look at doubles too. This uses 7FF4000000000000 to initialise a
double out parameter which also traps the FPU.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 28 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5386


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |performance
                 CC|                            |clugdbug yahoo.com.au
           Severity|normal                      |major


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 30 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5386


Martin Krejcirik <mk krej.cz> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |mk krej.cz
         Resolution|                            |WORKSFORME


--- Comment #1 from Martin Krejcirik <mk krej.cz> 2013-11-03 02:18:53 CET ---
I see no such behavior, float is initialized with 7FC0.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Nov 02 2013