lkml.org 
[lkml]   [2015]   [May]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [v2,2/2] powerpc32: add support for csum_add()
On Fri, May 01, 2015 at 08:00:14PM -0500, Scott Wood wrote:
> On Tue, 2015-04-28 at 21:01 +0200, christophe leroy wrote:
> > The generated code is most likely different on ppc64. I have no ppc64
> > compiler

For reference: yes you do. Just add -m64.

> Ideal (short of a 64-bit __wsum) would probably be something like (untested):
>
> add r3,r3,r4
> srdi r5,r3,32
> add r3,r3,r5
> clrldi r3,r3,32
>
> Or in C code (which would let the compiler schedule it better):
>
> static inline __wsum csum_add(__wsum csum, __wsum addend)
> {
> u64 res = (__force u64)csum;
> res += (__force u32)addend;
> return (__force __wsum)((u32)res + (res >> 32));
> }

Older GCC make exactly your asm code for that, in 64-bit; newer GCC get
two adds (one as 32-bit, one as 64-bit, it does not see those are the
same, grrr); and GCC 5 makes the perfect addc 3,4,3 ; addze 3,3 for
this in 32-bit mode. You don't want to see what older GCC does with
32-bit though :-/


Segher


\
 
 \ /
  Last update: 2015-05-05 00:41    [W:0.050 / U:1.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site