Runtime Altivec detection
benh at kernel.crashing.org
Sat Mar 8 04:41:05 EST 2003
On Fri, 2003-03-07 at 18:24, Dan Malek wrote:
> Nathan Ingersoll wrote:
> > I've recently been working on some Altivec optimizations for a library,
> > and was looking for a relatively clean way to perform runtime detection.
> For some time now the Linux kernel has provided support for emulating
> the 'mfspr rd, PVR' instruction in user space. Do this once, get the
> PVR and determine the processor type.
> You can also just read /proc/cpuinfo and search for the 'cpu :' line.
> It will indicate the processor type and if altivec is supported.
> There are probably other ways as well....
There's a much better way. The kernel passes down CPU features
bits down to userland via ELF AUX tables.
** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
More information about the Linuxppc-dev