Remove __ELF__ conditionals
[platform/upstream/glibc.git] / sysdeps / x86_64 / fpu / e_log2l.S
index 7a89b94..140b93d 100644 (file)
@@ -9,12 +9,9 @@
 
 #include <machine/asm.h>
 
-#ifdef __ELF__
-       .section .rodata
-#else
-       .text
-#endif
-       .align ALIGNARG(4)
+       .section .rodata.cst8,"aM",@progbits,8
+
+       .p2align 3
        ASM_TYPE_DIRECTIVE(one,@object)
 one:   .double 1.0
        ASM_SIZE_DIRECTIVE(one)
@@ -27,9 +24,9 @@ limit:        .double 0.29
 
 
 #ifdef PIC
-#define MO(op) op##(%rip)
+# define MO(op) op##(%rip)
 #else
-#define MO(op) op
+# define MO(op) op
 #endif
 
        .text
@@ -39,7 +36,7 @@ ENTRY(__ieee754_log2l)
        fxam
        fnstsw
        fld     %st             // x : x : 1
-       andb    $1,%ah
+       testb   $1, %ah
        jnz     3f              // in case x is NaN or ±Inf
 4:     fsub    %st(2), %st     // x-1 : x : 1
        fld     %st             // x-1 : x-1 : x : 1
@@ -56,8 +53,26 @@ ENTRY(__ieee754_log2l)
        fyl2x                   // log(x)
        ret
 
-3:     jp      4b              // in case x is ±Inf
+3:     testb   $4, %ah
+       jnz     4b              // in case x is ±Inf
        fstp    %st(1)
        fstp    %st(1)
        ret
 END (__ieee754_log2l)
+
+
+ENTRY(__log2l_finite)
+       fldl    MO(one)
+       fldt    8(%rsp)         // x : 1
+       fld     %st             // x : x : 1
+       fsub    %st(2), %st     // x-1 : x : 1
+       fld     %st             // x-1 : x-1 : x : 1
+       fabs                    // |x-1| : x-1 : x : 1
+       fcompl  MO(limit)       // x-1 : x : 1
+       fnstsw                  // x-1 : x : 1
+       andb    $0x45, %ah
+       jz      2b
+       fstp    %st(1)          // x-1 : 1
+       fyl2xp1                 // log(x)
+       ret
+END (__log2l_finite)