This is the mail archive of the libffi-discuss@sourceware.org mailing list for the libffi 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]

Re: libffi: Simplify PowerPC assembly and avoid CPU-specific string instructions


On Nov 01, 2011, at 11:53, Kyle Moffett wrote:
> After upgrading to a new version of GNU ld for PowerPC e500, I started
> seeing build errors on e500 systems again.  It turns out that the
> PowerPC "string instructions" are unimplemented on PPC440 and most other
> embedded cores, and also cause unexpectedly high instruction latencies
> and pipeline stalls even on POWER processors.
> 
> This historically worked in the past because the unknown string opcodes
> are trapped on PPC440 and similar systems and emulated in the kernel,
> though that is obviously very inefficient and undesirable.
> 
> Since the struct-copy code doesn't really need to be implemented in
> assembly, this patch ensures that there is always enough space to store
> both r3 and r4 and then uses C to extract the 1-8 byte "small struct"
> into the user-provided memory.
> 
> Even with all the big new comments, it's still removes 11 lines of code,
> and the ASM is much simpler and easier to understand now.
> 
> Please consider applying.

Oh, I forgot to mention the testing I did on this patch:

I have applied this patch on top of the previous PowerPC SPE patches
(Debian version 3.0.10-3) and it builds, passes the testsuite, and
correctly installs on powerpc, powerpc64, and e500v2.

NOTE: The e500v2 testsuite does have one unrelated failure with GCC-4.6
even with this patch due to GCC PR target/50906:
  http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50906

Cheers,
Kyle Moffett

--
Curious about my work on the Debian powerpcspe port?
I'm keeping a blog here: http://pureperl.blogspot.com/


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