On Sat, May 16, 2020 at 2:35 PM Brad Spencer <brad@anduin.eldar.org> wrote:
Paul Winalski <paul.winalski@gmail.com> writes:

> On 5/15/20, Warner Losh <imp@bsdimp.com> wrote:
>>
>> arm has been the biggest outlier in terms of unsigned char. In FreeBSD,
>> this has been the second largest source of bugs with the platform... the
>> OABI weird alignment requirements being the first (thankfully behind us)...
>
> Why did the implementers of the Unix ABI for ARM decide to have char
> be unsigned?  Was there an architectural reason for it?
>
> -Paul W.


My understanding is that it is a lot more efficient to use unsigned char
on arm.  You can make gcc, for example, deal with this, but it costs.  I
remember having to tell gcc to deal with it when I ported the Doom
engine to a StrongARM processor device under NetBSD many years ago.  I
mostly remember the code running well enough, but it was larger.

I've seen numbers that suggest it's about 10% smaller to use unsigned characters, and the code runs 5-10% faster. I've not looked at the generated code to understand why, exactly, that might be the case.

Warner