Re: [tip:core/types] bitops: Add sign_extend8(), 16 and 64 functions

From: Linus Torvalds
Date: Sun Jan 18 2015 - 23:00:31 EST


On Mon, Jan 19, 2015 at 7:54 AM, Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
>
> The 8- and 16- bit versions are the same as the 32-bit one.

Side note: the 64-bit one is actually different on 32-bit
architectures, not because it would generate a different value, but
because the 64-bit overhead likely kills you. It might be that the
compiler is smart enough that we'd *only* need the 64-bit version, but
for non-constant bit numbers, it's likely hard for gcc to generate
sane single-register versions, and so the 64-bit version is likely
fine.

But I don't see the 8-bit and 16-bit versions generating better code
on any sane architecture.

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/