From 2ec750ca05a87ebc20e358e73cb375a2c844ad59 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Tue, 8 May 2018 17:45:51 +0200 Subject: Fix math.nbtheory linkage to asm Don't use extern for templated functions. If the function argument is const, it gets a different mangling. So define a private function for each floatint point length and call it from template. --- arch/x64/linux/math/abs.S | 18 +++++++++--------- arch/x64/linux/math/log.S | 40 ++++++++++++++++++++-------------------- 2 files changed, 29 insertions(+), 29 deletions(-) (limited to 'arch') diff --git a/arch/x64/linux/math/abs.S b/arch/x64/linux/math/abs.S index edf8ac9..6635273 100644 --- a/arch/x64/linux/math/abs.S +++ b/arch/x64/linux/math/abs.S @@ -2,10 +2,10 @@ // fabsf. - .globl _D5tanya4math8nbtheory10__T3absTfZ3absFNaNbNiNffZf - .type _D5tanya4math8nbtheory10__T3absTfZ3absFNaNbNiNffZf, @function + .globl _D5tanya4math8nbtheory4fabsFNaNbNiNffZf + .type _D5tanya4math8nbtheory4fabsFNaNbNiNffZf, @function -_D5tanya4math8nbtheory10__T3absTfZ3absFNaNbNiNffZf: +_D5tanya4math8nbtheory4fabsFNaNbNiNffZf: mov $0x7fffffff, %eax movq %rax, %xmm1 andpd %xmm1, %xmm0 @@ -13,10 +13,10 @@ _D5tanya4math8nbtheory10__T3absTfZ3absFNaNbNiNffZf: // fabs. - .globl _D5tanya4math8nbtheory10__T3absTdZ3absFNaNbNiNfdZd - .type _D5tanya4math8nbtheory10__T3absTdZ3absFNaNbNiNfdZd, @function + .globl _D5tanya4math8nbtheory4fabsFNaNbNiNfdZd + .type _D5tanya4math8nbtheory4fabsFNaNbNiNfdZd, @function -_D5tanya4math8nbtheory10__T3absTdZ3absFNaNbNiNfdZd: +_D5tanya4math8nbtheory4fabsFNaNbNiNfdZd: mov $0x7fffffffffffffff, %rax movq %rax, %xmm1 andpd %xmm1, %xmm0 @@ -24,12 +24,12 @@ _D5tanya4math8nbtheory10__T3absTdZ3absFNaNbNiNfdZd: // fabsl. - .globl _D5tanya4math8nbtheory10__T3absTeZ3absFNaNbNiNfeZe - .type _D5tanya4math8nbtheory10__T3absTeZ3absFNaNbNiNfeZe, @function + .globl _D5tanya4math8nbtheory4fabsFNaNbNiNfeZe + .type _D5tanya4math8nbtheory4fabsFNaNbNiNfeZe, @function // Load the parameter from the stack onto FP stack, execute 'fabs' instruction // The result is returned in ST0. -_D5tanya4math8nbtheory10__T3absTeZ3absFNaNbNiNfeZe: +_D5tanya4math8nbtheory4fabsFNaNbNiNfeZe: fldt 0x8(%rsp) fabs ret diff --git a/arch/x64/linux/math/log.S b/arch/x64/linux/math/log.S index 941e399..9c5ed35 100644 --- a/arch/x64/linux/math/log.S +++ b/arch/x64/linux/math/log.S @@ -1,22 +1,29 @@ .text -// logl. - .globl _D5tanya4math8nbtheory9__T2lnTeZ2lnFNaNbNiNfeZe - .type _D5tanya4math8nbtheory9__T2lnTeZ2lnFNaNbNiNfeZe, @function +// logf. + .globl _D5tanya4math8nbtheory4logfFNaNbNiNffZf + .type _D5tanya4math8nbtheory4logfFNaNbNiNffZf, @function + +_D5tanya4math8nbtheory4logfFNaNbNiNffZf: + movss %xmm0, -4(%rsp) // Put the argument onto the stack -_D5tanya4math8nbtheory9__T2lnTeZ2lnFNaNbNiNfeZe: fldln2 // Put lb(e) onto the FPU stack - fldt 8(%rsp) // Put the argument onto the FPU stack + flds -4(%rsp) // Put a float onto the FPU stack fyl2x // %st1 * lb(%st0) + + // The result is on the FPU stack, but returned in %xmm0 + fstps -4(%rsp) + movss -4(%rsp), %xmm0 + ret // log. - .globl _D5tanya4math8nbtheory9__T2lnTdZ2lnFNaNbNiNfdZd - .type _D5tanya4math8nbtheory9__T2lnTdZ2lnFNaNbNiNfdZd, @function + .globl _D5tanya4math8nbtheory3logFNaNbNiNfdZd + .type _D5tanya4math8nbtheory3logFNaNbNiNfdZd, @function -_D5tanya4math8nbtheory9__T2lnTdZ2lnFNaNbNiNfdZd: +_D5tanya4math8nbtheory3logFNaNbNiNfdZd: movsd %xmm0, -8(%rsp) // Put the argument onto the stack fldln2 // Put lb(e) onto the FPU stack @@ -30,19 +37,12 @@ _D5tanya4math8nbtheory9__T2lnTdZ2lnFNaNbNiNfdZd: ret -// logf. - .globl _D5tanya4math8nbtheory9__T2lnTfZ2lnFNaNbNiNffZf - .type _D5tanya4math8nbtheory9__T2lnTfZ2lnFNaNbNiNffZf, @function - -_D5tanya4math8nbtheory9__T2lnTfZ2lnFNaNbNiNffZf: - movss %xmm0, -4(%rsp) // Put the argument onto the stack +// logl. + .globl _D5tanya4math8nbtheory4loglFNaNbNiNfeZe + .type _D5tanya4math8nbtheory4loglFNaNbNiNfeZe, @function +_D5tanya4math8nbtheory4loglFNaNbNiNfeZe: fldln2 // Put lb(e) onto the FPU stack - flds -4(%rsp) // Put a float onto the FPU stack + fldt 8(%rsp) // Put the argument onto the FPU stack fyl2x // %st1 * lb(%st0) - - // The result is on the FPU stack, but returned in %xmm0 - fstps -4(%rsp) - movss -4(%rsp), %xmm0 - ret -- cgit v1.2.3