1/* 2 * Public domain. 3 */ 4 5#include <machine/asm.h> 6#include <i386-math-asm.h> 7 8RCSID("$NetBSD: s_log1pf.S,v 1.4 1995/05/09 00:13:05 jtc Exp $") 9 10 .section .rodata 11 12 .align ALIGNARG(4) 13 /* The fyl2xp1 can only be used for values in 14 -1 + sqrt(2) / 2 <= x <= 1 - sqrt(2) / 2 15 0.29 is a safe value. 16 */ 17limit: .float 0.29 18one: .float 1.0 19 20DEFINE_FLT_MIN 21 22#ifdef PIC 23# define MO(op) op##@GOTOFF(%edx) 24#else 25# define MO(op) op 26#endif 27 28/* 29 * Use the fyl2xp1 function when the argument is in the range -0.29 to 0.29, 30 * otherwise fyl2x with the needed extra computation. 31 */ 32 .text 33ENTRY(__log1pf) 34 fldln2 35 36 flds 4(%esp) 37 38#ifdef PIC 39 LOAD_PIC_REG (dx) 40#endif 41 42 fxam 43 fnstsw 44 fld %st 45 sahf 46 jc 3f // in case x is NaN or �Inf 474: fabs 48 fcomps MO(limit) 49 fnstsw 50 sahf 51 jc 2f 52 53 fadds MO(one) 54 fyl2x 55 ret 56 572: fyl2xp1 58 FLT_CHECK_FORCE_UFLOW_NONNAN 59 ret 60 613: jp 4b // in case x is �Inf 62 fstp %st(1) 63 fstp %st(1) 64 ret 65 66END (__log1pf) 67