This is the mail archive of the mailing list for the glibc 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: [PATCH][PPC] Remove unnecessary local variable mptwo

On Thu, 2013-01-10 at 10:23 -0800, Roland McGrath wrote:
> > By which, you mean, if the element access is predictable enough the
> > compiler will simply populate a register with the referenced value and
> > use it instead of checking any actual data structure constructed on
> > the stack, and will in-fact decline to generated that data structure
> > at all?
> Exactly.  (I have no idea if anything like that is feasible in this
> particular case.)

For an array of this size, what Ryan suggests is unlikely, unless we
also use aggressive loop unrolling. Also extern vs static, vs static
const have different access costs in the PPC64 ABI.

extern is always indirect via the pointer load from the TOC, while
static (file local) and static const allow for TOC relative addressing
(with newer GCC). Also with newer binutils ld has a chance to optimize
one of the generated instructions away (nop) for the static (not extern)

So static const is better then extern because the we remove the
indirection and eliminate the (potential TOC cache miss). static const
should allow ld to common the named static const data into the RODATA
section. And for reasonable sized binaries the linker (ld) with furture
optimize some of the sequences generated by gcc.

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