Geert Bosch - Re: [PATCH]: Expand finite() as inline i386 asm (original) (raw)

This is the mail archive of the gcc-patches@gcc.gnu.orgmailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

On Jan 31, 2007, at 19:58, Richard Henderson wrote:

Second, as I mentioned in the notes for PR 30652, I suspect that using non-trapping comparisons will result in better code than all these bit manipulations. I.e.

isfinite(d) => islessequal(fabs(d), DBL_MAX)

The 'Valid attribute in Ada (see s-fatgen.adb, function Valid) does essentially the same in a target-independent way. Also, by keeping the entire operation in the integer domain, it avoids trapping on some architectures (e.g. MIPS).

It generates the following code for x86 (single): _ada_is_valid: .LFB4: movl 4(%esp), %eax andl $2139095040, %eax cmpl $2139095040, %eax setne %al ret

for x86 double: _ada_is_valid: .LFB4: subl $28, %esp .LCFI0: movl 36(%esp), %eax andl $2146435072, %eax shrl $20, %eax cmpl $2047, %eax setne %al addl $28, %esp ret .LFE4:

(Of course the extra stack adjustments should have been optimized away)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]