2.5-18.1
[glibc.git] / powerpc-cpu / README
bloba83a4de24ed7e668aa5bbb2aac566ff5aaa141c7
1 Powerpc-cpu add-on V0.1
3 What is it:
5 The powerpc-cpu directory is an add-on for the GNU C Library (glibc).
6 It provides additional platform/cpu specific optimizations when the
7 --with-cpu= configure option is specified.  On the glibc configure,
8 specifying --with-cpu=<cpu_type>, inserts the -mcpu=<cpu_type> option
9 for all 'C' compiles in the glibc make.  It also inserts <cpu_type>
10 specific directories into the source search path for glibc.  Source from
11 these <cpu_type> specific directories and override header or code source
12 from glibc.
14 How do I use it:
16 To build glibc with this add-on you need to configure glibc specifying both
17 --enable-add-ons=powerpc-cpu,.. and --with-cpu=<cpu_type> options.  The
18 add-on source can be a direct subdirectory of glibc (i.e.
19 ./libc/powerpc-cpu) which allows the short name, or a separate directory
20 from glibc, this requires a fully qualified path. (i.e.
21 --enable-add-ons=$HOME/powerpc-cpu,..).
23 If you specify multiple add-ons, powerpc-cpu should be first to insure that
24 any optimizations can override the corresponding source files from mainline
25 glibc. For example: "--enable-add-ons=powerpc-cpu,nptl".
27 How do I extent it:
29 The optimized source code is found in the sysdeps/powerpc/powerpc32 and
30 sysdeps/powerpc/powerpc64 subdirectories.  These directories support the 32-
31 and 64-bit ELF ABIs of the powerpc platform.  The next directory level is
32 "<cpu_type>" where the names match supported gcc -mcpu= options.  When
33 --with-cpu=<cpu_type> is specified, the <cpu_type> must match one of the
34 directories at this level.
36 The mechanism is generalized and can be extended to any "cpu-type" that is
37 accepted by gcc's -mcpu= option.  To support another "cpu_type" simply add a
38 directory of the form:
40 ./powerpc-cpu/sysdeps/powerpc/powerpc32/<cpu_type>
42 and for 64-bit implementations also:
44 ./powerpc-cpu/sysdeps/powerpc/powerpc64/<cpu_type>
46 See the GCC online documentation <http://gcc.gnu.org/onlinedocs> 
47 3.17.24 "IBM RS/6000 and PowerPC Options" for the complete list of -mcpu=
48 options.
50 Currently supported cpu_types are:
52 power4
53 power5
54 power5+
55 power6
56 970
58 The --with-cpu=<cpu_type> option requires that corresponding directory
59 ./powerpc-cpu/sysdeps/powerpc/powerpc[32|64]/<cpu_type> exists.  This
60 directory can be empty in which case you get the benefit of -mcpu=<cpu_type>
61 which implies -mtune=<cpu_type>.  To override source implementation from
62 glibc mainline simple provide an alternative implementation with the same
63 name in the appropriate ./<cpu_type> subdirectory. 
65 So far 970, power4, power5, power5+, and power6 are enabled with specific
66 assembler implementations and have corresponding directories for both
67 powerpc32 and powerpc64.  For 64-bit <cpu_types>, implementations of the
68 32-bit ABI can share code exploiting 64-bit instructions from the generic
69 cpu_type powerpc64 (directory sysdeps/powerpc/powerpc32/powerpc64).
70 Specifically an "Implies" file, can be included in any
71 sysdeps/powerpc/powerpc32/<cpu_type> directory where <cpu_type> is a 64-bit
72 processor.  This is useful when the implementation wants to exploit 64-bit
73 instructions in 32-bit mode.
75 Special note: While this add-on is currently focused on powerpc, the
76 mechanism is general enough to be used by any platform which also supports
77 gcc's -mcpu= option.  Simply add the appropriate ./sysdeps/<target>/<cpu_type>
78 directories.
80 Special note: Currently the "970" implementation is implied to the power4
81 implementation.  The internal micro-architecture of the 970 chip is based on
82 the power4 design and scheduling for integer and floating point
83 units are the same for power4 and 970.  Any 970 unique codes would be specific
84 to Altivec/VMX exploitation which we don't have any examples of yet.
86 Special note: The directory search order has changed for glibc-2.4. So if your
87 optimization needs to override source files in mainline
88 ./sysdeps/powerpc/powerpc[32|64]/fpu, additional tricks are needed.
90 Normally ./sysdeps/powerpc/powerpc[32|64]/fpu from mainline will be searched
91 before ./powerpc-cpu/sysdeps/powerpc/powerpc[32|64]/<cpu_type>/fpu. However
92 ./powerpc-cpu/sysdeps/unix/sysv/linux/powerpc/powerpc[32|64]/<cpu_type>/fpu
93 will be searched before either.  So add an "Implies" file containing
94 "powerpc/powerpc[32|64]/<cpu_type>/fpu" in
95 ./powerpc-cpu/sysdeps/unix/sysv/linux/powerpc/powerpc[32|64]/<cpu_type>/fpu as
96 a work around. You will need to repeat this for each <cpu_type> that needs to
97 override mainline.