Re: Post-increment constraint in inline assembly (SuperH)

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

 



On Mon, Jan 29, 2018 at 09:39:36PM +0100, Georg-Johann Lay wrote:
> My bad.  If GCC uses post-increment, then the value in the 
> post-incremented register no more represents src. But when src+1 is used 
> in the remainder, gcc detects that this value has already been computed 
> and reuses the post-incremented reg instead of recomputing src+1.
> 
> Hence src does /not/ change, whereas the register used do address *src 
> /does/ if post-increment is used.  As src does not change, there's no 
> need to express it in terms of constraints.

Yes exactly (messages crossed, whoops).

> >Well, the problem I'm originally set out to solve is writing a decent 
> >memcpy() function for unaligned source/destination pairs. I should have 
> >mentioned it sooner (wild XY problem draws near).
> 
> Some libc implementation already perform such pre- and post-alignment, 
> e.g. Newlib provided it is compiled for speed (and the machine part 
> doesn't deviates from that default).

Things like a good memcpy I wouldn't even try to write in inline assembler,
not even for a very simple CPU; memcpy is so important that writing ~100
lines of assembler code is well worth it.  Inline assembler is more
suitable for access to, say, instructions writing special registers that
GCC does not know about.


Segher



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux