[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patches] [PATCH] make eglibc 2.13 work on powerpcspe (e500 etc.)


the following two patches are required to make eglibc 2.13 compile and
work for powerpc cores with 'SPE' FPU (e500 cores e.g. used by
freescale's p2020 CPU).

These patches were tested on debian sid's version of eglibc 2.13-8,
compiled with gcc-4.4.6. on a p2020 system running debian's (unofficial)
powerpcspe port [1].

The result of 'make check' lists a few errors that are not anticipated
by Debian

  bug-nextafter.out, Error 18
  bug-nexttoward.out, Error 18
  test-double.out, Error 1
  test-fenv.out, Error 1
  test-float.out, Error 1
  test-idouble.out, Error 1
  test-ifloat.out, Error 1
  test-misc.out, Error 1
  tst-setcontext-fpscr.o, Error 1

Looking into the logs these all complain about exception, overflow,
rounding behaviour or minor deviations of floating point results, which
might just be due to hardware limitations of the SPE FPU that is
designed for signal processing and not scientific computing.

The tst-setcontext-fpscr testcase fails to compile, as it uses ppc FPU
assembly code.

I haven't signed a copyright assignment for eglibc yet, but won't
hesitate to do so if required (though I somehow doubt that my two-line
patch local-no-fma.patch qualifies for copyright protection).

The local-Powerpc-trampline-consider-__NO_FPRS__.patch is from Sebastian
Andrzej Siewior (CC), copied from the eglibc sources in the debian-ports
powerpcspe archive.  We'll have to ask him about the assignment.



[1] http://wiki.debian.org/PowerPCSPEPort
GnuPG public key: http://dvdkhlng.users.sourceforge.net/dk.gpg
Fingerprint: B17A DC95 D293 657B 4205  D016 7DEF 5323 C174 7D40

Override s_fma[f] assembly routines with C-code when compiling for powerpcspe.

Signed-off-by: David Kuehling <dvdkhlng AT gmx DOT de>

Index: eglibc-2.13/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fma.c
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ eglibc-2.13/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fma.c	2011-07-04 15:53:26.000000000 +0200
@@ -0,0 +1 @@
+#include <math/s_fma.c>
Index: eglibc-2.13/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fmaf.c
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ eglibc-2.13/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fmaf.c	2011-07-04 15:53:12.000000000 +0200
@@ -0,0 +1 @@
+#include <math/s_fmaf.c>
From 5f2110f9ce203c42aadc3968ddc487a8c9cc6c83 Mon Sep 17 00:00:00 2001
From: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
Date: Sat, 15 May 2010 21:51:49 +0200
Subject: [PATCH] Powerpc/trampline: consider __NO_FPRS__

don't save/restore FPRs on FPR less systems

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>
 sysdeps/powerpc/powerpc32/dl-trampoline.S |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/sysdeps/powerpc/powerpc32/dl-trampoline.S b/sysdeps/powerpc/powerpc32/dl-trampoline.S
index 6a158c3..bd815c7 100644
--- a/sysdeps/powerpc/powerpc32/dl-trampoline.S
+++ b/sysdeps/powerpc/powerpc32/dl-trampoline.S
@@ -137,6 +137,7 @@ _dl_prof_resolve:
 	stw r9,40(r1)
 	stw r10,44(r1)
 	stw r0,8(r1)
+#ifndef __NO_FPRS__
  # Save the floating point registers
 	stfd fp1,48(r1)
 	stfd fp2,56(r1)
@@ -146,6 +147,7 @@ _dl_prof_resolve:
 	stfd fp6,88(r1)
 	stfd fp7,96(r1)
 	stfd fp8,104(r1)
  # XXX TODO: store vmx registers
  # Load the extra parameters.
 	addi r6,r1,16
@@ -169,6 +171,7 @@ _dl_prof_resolve:
 	lwz r4,20(r1)
 	lwz r3,16(r1)
         lwz r0,12(r1)
+#ifndef __NO_FPRS__
  # Load the floating point registers.
 	lfd fp1,48(r1)
 	lfd fp2,56(r1)
@@ -178,6 +181,7 @@ _dl_prof_resolve:
 	lfd fp6,88(r1)
 	lfd fp7,96(r1)
 	lfd fp8,104(r1)
  # ...unwind the stack frame, and jump to the PLT entry we updated.
 	addi r1,r1,320

Attachment: pgpAcAqEJ8Whe.pgp
Description: PGP signature