By: dmcq (dmcq.delete@this.fano.co.uk), September 21, 2022 7:14 am
Room: Moderated Discussions
Michael S (already5chosen.delete@this.yahoo.com) on September 21, 2022 7:11 am wrote:
> dmcq (dmcq.delete@this.fano.co.uk) on September 21, 2022 4:53 am wrote:
> > TimMc (timcaffrey.delete@this.aol.com) on September 20, 2022 8:56 pm wrote:
> > > Michael S (already5chosen.delete@this.yahoo.com) on September 20, 2022 1:44 pm wrote:
> > > > I'm trying to understand the reasoning behind decision of designers of System-V
> > > > x86-64 ABI to have no callee-save vector (or floating-point) registers.
> > > > So far, I have no idea. With total of 16 XMM registers defining at least 4, but more
> > > > likely 6 to 8 registers as callee-save sounds to me as obviously sane thing to do.
> > > > What am i missing?
> > > >
> > > 1) Callee-save means that if the function needs those registers, it has to save them.
> > > 2) Most functions don't use floating point or SSE.
> > >
> > > I suspect that, unlike general purpose registers, there is no good performance advantage
> > > to callee-saved SSE registers. For instance, you might save a loop counter in a callee-saved
> > > register when you have a function call in a loop. For floating point you may need to save a
> > > partial result of a calculation (e.g. X = sin(y)**2 + cos(z)**2), but it is probably (usually)
> > > more efficient for the caller to save off what it needs than the callee.
> > >
> > > Just guessing, I have not done the analysis.
> >
> > Just reading the ARM aapcs document about their ABI, they seem to have come to the same conclusion
> > - preserve none
>
> Huh?
> aarch64 ABI that I am aware of specifies lower 64 bits of V8 to V15 as callee-saved.
That isn't really saving the vector registers, it is saving the floating point registers.
> > except if the interface uses SVE when all except the first eight need to
> > be preserved - basically any vector function. I can see a few problems with nested calls
> > with that - for instance any call to a non vector function within one will require all those
> > SVE registers be saved. Tradeoffs always leave one with a FoMO feeling :-)
> dmcq (dmcq.delete@this.fano.co.uk) on September 21, 2022 4:53 am wrote:
> > TimMc (timcaffrey.delete@this.aol.com) on September 20, 2022 8:56 pm wrote:
> > > Michael S (already5chosen.delete@this.yahoo.com) on September 20, 2022 1:44 pm wrote:
> > > > I'm trying to understand the reasoning behind decision of designers of System-V
> > > > x86-64 ABI to have no callee-save vector (or floating-point) registers.
> > > > So far, I have no idea. With total of 16 XMM registers defining at least 4, but more
> > > > likely 6 to 8 registers as callee-save sounds to me as obviously sane thing to do.
> > > > What am i missing?
> > > >
> > > 1) Callee-save means that if the function needs those registers, it has to save them.
> > > 2) Most functions don't use floating point or SSE.
> > >
> > > I suspect that, unlike general purpose registers, there is no good performance advantage
> > > to callee-saved SSE registers. For instance, you might save a loop counter in a callee-saved
> > > register when you have a function call in a loop. For floating point you may need to save a
> > > partial result of a calculation (e.g. X = sin(y)**2 + cos(z)**2), but it is probably (usually)
> > > more efficient for the caller to save off what it needs than the callee.
> > >
> > > Just guessing, I have not done the analysis.
> >
> > Just reading the ARM aapcs document about their ABI, they seem to have come to the same conclusion
> > - preserve none
>
> Huh?
> aarch64 ABI that I am aware of specifies lower 64 bits of V8 to V15 as callee-saved.
That isn't really saving the vector registers, it is saving the floating point registers.
> > except if the interface uses SVE when all except the first eight need to
> > be preserved - basically any vector function. I can see a few problems with nested calls
> > with that - for instance any call to a non vector function within one will require all those
> > SVE registers be saved. Tradeoffs always leave one with a FoMO feeling :-)