This is the mail archive of the gcc@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: PPC AltiVec request: add an abi variant


Kumar Gala wrote:
> I think Matt's desire is to actually use AltiVec code in the kernel to
> enhance certain kernel operations, however he needs to ensure that the
> registers are restored to the state that started in to do this.

Yes, I know that.


> Since Linux/PPC does NOT use FP or Avec for anything inside the kernel > this issue does not come up, and is why data corruption can occur if > driver writers use fp and do not compile with soft-float.

Actually, Linux/PPC and Linux/PPC64 both use some small amount of FP
in the kernel, see arch/ppc{,64}/kernel/align.c.


Matt Thomas wrote: > Since most of the routines use a few altivec registers (2..6), it seems > to me that it's much less overhead to save/restore these on a per-routine > basis that to save the AltiVec state and then take an exception to restore > it.

If the kernel only uses those few AltiVec regs, yeah.  For the FP use in
the Linux/PPC64 kernel, we surround any FP use with enable_kernel_fp() and
disable_kernel_fp() which flushes any user FP state that might be in the FP regs.

You could try something similar by surrounding your kernel AltiVec use with
enable_kernel_altivec() and disable_kernel_altivec() which in addition to
enabling AltiVec, would save/restore the few (2..6) AltiVec registers the
kernel needs to use.  This assumes you have control over which AltiVec
registers are used...


Peter




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