qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] exec: optimize phys_page_set_level


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH] exec: optimize phys_page_set_level
Date: Wed, 03 Jun 2015 09:03:48 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0


On 03/06/2015 06:30, Richard Henderson wrote:
> On 05/21/2015 06:19 AM, Paolo Bonzini wrote:
>> memcpy is faster than struct assignment, which copies each bitfield
>> individually.  Arguably a compiler bug, but memcpy is super-special
>> cased anyway so what could go wrong?
> 
> The compiler has the option of doing the copy either way.  Any way to
> actually show that the small memcpy is faster?  That's one of those
> things where I'm sure there's a cost calculation that said per member
> was better.

Because the struct size is 32 bits, it's a no brainer that full copy is
faster.  However, SRA gets in the way, and causes the struct assignment
to be compiled as two separate bitfield assignment.  Later GCC passes
don't have the means to merge them again.  I filed
https://gcc.gnu.org/PR66391 about this and CCed Martin Jambor.

Paolo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]