This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [RFC][BZ #17943] Use long for int_fast8_t
- From: Rich Felker <dalias at libc dot org>
- To: OndÅej BÃlka <neleai at seznam dot cz>
- Cc: libc-alpha at sourceware dot org
- Date: Mon, 9 Feb 2015 13:13:24 -0500
- Subject: Re: [RFC][BZ #17943] Use long for int_fast8_t
- Authentication-results: sourceware.org; auth=none
- References: <20150208110426 dot GA28729 at domone>
On Sun, Feb 08, 2015 at 12:04:26PM +0100, OndÅej BÃlka wrote:
> Hi, as in bugzilla entry what is rationale of using char as int_fast8_t?
>
> It is definitely slower with division, following code is 25% slower on
> haswell with char than when you use long.
This claim is nonsense. It's a compiler bug. If the 8-bit divide
instruction is slow, then the compiler should use 32-bit or 64-bit
divide instructions to divide 8-bit types. (Note: there's actually no
such thing as a division of 8-byte types; formally, they're promoted
to int, so it's the compiler being stupid if it generates a slow 8-bit
divide instruction for operands that are formally int!) There's no
reason to use a different type for the _storage_.
The only legigimate reason to change the int_fast types is when the
_storage_ in certain sizes is slow to access.
Rich