This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: PPC AltiVec request: add an abi variant
- From: Peter Bergner <peter at bergner dot org>
- To: Kumar Gala <kumar dot gala at motorola dot com>, Matt Thomas <matt at 3am-software dot com>
- Cc: gcc at sources dot redhat dot com
- Date: Tue, 04 Mar 2003 12:27:22 -0600
- Subject: Re: PPC AltiVec request: add an abi variant
- References: <B30CDA52-4E55-11D7-9B21-000393DBC2E8@motorola.com>
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