------- Comment #13 from rguenth at gcc dot gnu dot org 2010-09-02 09:07 ------- (In reply to comment #11) > (In reply to comment #10) > > 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; > > } > > It does not: > READ_UINT32: > j $31 > lw $2,0($4) > > The aligned attribute is ignored there I think.
It is if the target is STRICT_ALIGNMENT (which of course is a bug, but well ... and I happen to have a fix as well) > memcpy produces: > lbu $2,3($4) > lbu $6,0($4) > lbu $5,1($4) > lbu $3,2($4) > addiu $sp,$sp,-16 > sb $6,0($sp) > sb $5,1($sp) > sb $3,2($sp) > sb $2,3($sp) > lw $2,0($sp) > j $31 > addiu $sp,$sp,16 > > Which is bad and could be improved by using lwl/lwr. I will file a bug about > that. > -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45462