This is the mail archive of the mailing list for the GCC 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: Endian swapping with C code on ARM

Richard Henderson <> writes:

> On Fri, Jul 09, 2004 at 07:00:37PM +0200, Falk Hueffner wrote:
>> I've attached my old patch. It uses a libgcc function as fallback. If
>> it seems OK, I could tie up the loose ends and send it to gcc-patches.
> I think this is probably worthwhile.
>> +    case BUILT_IN_BSWAP32:
> I'm not sure I'd call them this though; bswap{,l,ll} would be more
> in line with existing builtins.

Indeed, however it seems to me that pretty much never would anybody
want to byte swap a long, but rather always a 32- or 64-bit word,
since the whole point of bswap is to adapt to an externally imposed
protocol...  but I don't feel very strongly about this.

>> +extern USItype __bswapsi2 (USItype);
>> +extern UDItype __bswapdi2 (UDItype);
> You need the same mode name frobbing bits as with the other functions.

I have trouble understanding the point of this frobbing. On 64 bit
platforms, it produces only DImode and TImode functions, forcing the
32-bit functions to be done with 64 bit precision, which incurs quite
some overhead. Also, for bswap it would force me to add extra code in
optabs.c for calculating bswap in a wider than necessary mode, which
seems silly. Can somebody explain?


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