[Spice-devel] [PATCH spice-gtk v3 1/5] Avoid clang warnings on casts with stricter alignment requirements

Christophe Fergeau cfergeau at redhat.com
Wed May 17 09:55:23 UTC 2017


On Wed, May 17, 2017 at 11:45:50AM +0200, Christophe de Dinechin wrote:
> > I'm really sure no architecture on hearth can do check and print in
> > a single machine instruction.
> 
> This is not what I said. I said that the cost in the likely case was one extra instruction.
> 
> > Actually I don't know any architecture
> > where a single check like this can be done in a single instruction.
> 
> Reduced source code: https://pastebin.com/ibZEVThA.
> 
> Machine code for x86 with clang: https://pastebin.com/Vmtwpkhf
> 
> The test follows the call to malloc. It’s a single “testb” instruction
> followed by a never-taken conditional jump to cold-code.

NB: feel free to annotate such tests with G_LIKELY/G_UNLIKELY

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20170517/589b4a0f/attachment.sig>


More information about the Spice-devel mailing list