[Development] Passing QSize, QPoint, QTime and other small structs by value

Shawn Rutledge Shawn.Rutledge at qt.io
Fri Apr 7 21:38:37 CEST 2017

On Apr 7, 2017, at 19:54, Thiago Macieira <thiago.macieira at intel.com> wrote:

> Em sexta-feira, 7 de abril de 2017, às 10:10:38 PDT, Giuseppe D'Angelo 
> escreveu:
>> Il 07/04/2017 17:45, Thiago Macieira ha scritto:
>>> We're not talking about primitives. We're talking about structs that are
>>> very small and trivial. See for yourself:
>>> https://godbolt.org/g/pvwjWE
>>> Direct primitive passing is fine:
>>> https://godbolt.org/g/Ghj8US
>> Sorry, what do you mean "is fine"? What's not fine?
> Passing float or double by value means they get passed in the x87 registers. 

SIMD registers you mean, or are those the same?  At some point I read that the 387-era FPU instructions are way too slow by comparison nowadays, but I thought if that’s the case then probably the compilers are doing whatever is fastest by now...

> Passing float inside a struct means it's passed in the x86 stack instead.

No difference whether by value or by reference?  The compiler couldn’t break up the struct and put different members in different registers?

More information about the Development mailing list