------- Comment #10 from rguenth at gcc dot gnu dot org  2010-09-01 09:45 
-------
(In reply to comment #8)
> Unfortunately, a lib based solutions are difficult for me to implement. The
> reason is that the current PSP SDK uses newlib. I can probably change my
> personal toolchain with some work, but then it's a custom modification that
> needs to be replicated to every other ScummVM dev as well as our buildbot. Not
> impossible, but not work I'd like to get in to right now. 
> 
> In any case, it sounds like what you're saying is that memcpy has asm
> instructions in the right place to use lwl and lwr. I can also do that in my
> implementation.
> 
> My request was more general, as in gcc needs some kind of custom keyword to
> tell it to allow unaligned pointers and to generate appropriate unaligned 
> code,
> so we don't have to trick the compiler into doing it in a way that ruins
> optimization. Something like __unaligned__ uint32 *ptr32 = bytePtr; 
> 

typedef my_unaligned_aliasing_uint32 uint32
__attribute__((aligned(1),may_alias));

inline __attribute__((__always_inline__)) uint32 READ_UINT32(const void *ptr)
{
  return *(const my_unaligned_aliasing_uint32 *)ptr;
}

should do it and does not require -fno-strict-aliasing.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45462

Reply via email to