For Programmers: Free Programming Magazines  


Home > Archive > Fortran > November 2004 > re: Windows PL/I cant inline math functions









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author re: Windows PL/I cant inline math functions
robin

2004-11-16, 3:56 am

From: "David Frank" <dave_frank@hotmail.com>, Road Runner High Speed Online http://www.rr.com
Date: Fri, 05 Nov 2004 12:07:21 GMT
..
| I assert that IBM compiler writers fall into the category mentioned below,
| prove me wrong by posting PL/I's assy listing of y = exp(x)
..
IBM PL/I for Windows, OS/2 etc, uses hardware SIN, COS etc
for the various BIF etc.
..
For these it uses:
FSIN for sine
FCOS for cosine
FPTAN for tangent
FPATAN for arcsine
FPATAN for arccosine
FPATAN for arctangent
FSQRT for square root
etc etc

example:

;***** 6 Y = SINF(X);
FLD DWORD PTR [EBP-08H]; X
FSIN
FSTP ST(0)
..
| CVF takes considerably more than that to compute EXP(x), see below 17
| consecutive floating inst. plus additional housekeeping.
|
| -------------
| program test
| x = 3.33
| y = exp(x)
| end program
| -------------
| .486
| .MODEL flat
| COMM .bss$:12
| .data
| .literal$ REAL4 040551EB8r ; REAL4 3.330000
| SDWORD 00h ; SDWORD 0
| .data
| .drectve$ BYTE "-defaultlib:dfor.lib "
| BYTE "-defaultlib:libc.lib "
| BYTE "-defaultlib:dfconsol.lib "
| BYTE "-defaultlib:dfport.lib "
| BYTE "-defaultlib:kernel32.lib "
| BYTE 0
| REPEAT 4
| BYTE 0
| ENDM
| EXTERN _for_set_reentrancy@4:PROC
| .CODE
| ; 1 program test
| PUBLIC _MAIN__
| _MAIN__ PROC
| push ebp
| mov ebp, esp
| sub esp, 32
| sub esp, 4
| lea eax, dword ptr .literal$+4
| push eax
| ffree st(6)
| ffree st(5)
| call _for_set_reentrancy@4
| add esp, 4
| mov eax, dword ptr .literal$ ; 000002
| mov dword ptr .bss$+8, eax
| fld dword ptr .bss$+8 ; 000003
| ffree st(6)
| ffree st(7)
| fldl2e
| fmulp st(1), st(0)
| fld st(0)
| frndint
| fxch st(1)
| fsub st(0), st(1)
| f2xm1
| fld1
| faddp st(1), st(0)
| fscale
| fstp st(1)
| fstp st(6)
| fld st(5)
| fstp dword ptr .bss$+4
| mov eax, 1 ; 000004
| ffree st(6)
| ffree st(5)
| mov esp, ebp
| pop ebp
| ret
| _MAIN__ ENDP
| END
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com