This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How does GCC access global variables on x86


On 02/07/2012 06:01 PM, Xin Tong wrote:
> Is there a performance penalty for accessing global with rip on
> architecture as new as nehalem, in comparsion to access variables
> using rsp?

No.

>>>>> >>>>   4006f9:       f0 80 0d bf 0b 20 00    lock orb $0x0,0x200bbf(%rip)
>>>>> >>>>      # 6012c0 <t2lockor>
>>>>> >>>>   400700:       00
>>>>> >>>>   4006f9:       f0 80 0d bf 0b 20 00    lock orb $0x0,0x0(%rsp)
>>>>> >>>>      # 6012c0 <t2lockor>
>>>>> >>>>   400700:       00
> The later seems to perform better.

Well, yes, it would: it's local.  That means it is already in cache
by the time you execute that load.

Andrew.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]