]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/doc/gccint/target-macros/defining-coprocessor-specifics-for-mips-targets.rst
sphinx: add missing trailing newline
[thirdparty/gcc.git] / gcc / doc / gccint / target-macros / defining-coprocessor-specifics-for-mips-targets.rst
CommitLineData
c63539ff
ML
1..
2 Copyright 1988-2022 Free Software Foundation, Inc.
3 This is part of the GCC manual.
4 For copying conditions, see the copyright.rst file.
5
6.. index:: MIPS coprocessor-definition macros
7
8.. _mips-coprocessors:
9
10Defining coprocessor specifics for MIPS targets.
11************************************************
12
13The MIPS specification allows MIPS implementations to have as many as 4
14coprocessors, each with as many as 32 private registers. GCC supports
15accessing these registers and transferring values between the registers
16and memory using asm-ized variables. For example:
17
18.. code-block:: c++
19
20 register unsigned int cp0count asm ("c0r1");
21 unsigned int d;
22
23 d = cp0count + 3;
24
25('c0r1' is the default name of register 1 in coprocessor 0; alternate
26names may be added as described below, or the default names may be
27overridden entirely in ``SUBTARGET_CONDITIONAL_REGISTER_USAGE``.)
28
29Coprocessor registers are assumed to be epilogue-used; sets to them will
30be preserved even if it does not appear that the register is used again
31later in the function.
32
33Another note: according to the MIPS spec, coprocessor 1 (if present) is
34the FPU. One accesses COP1 registers through standard mips
3ed1b4ce 35floating-point support; they are not included in this mechanism.