gcc: Clean-up of non-C++0x compliant code, first steps
[gem5.git] / src / arch / x86 / regs / float.hh
1 /*
2 * Copyright (c) 2007 The Hewlett-Packard Development Company
3 * All rights reserved.
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed hereunder. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated
11 * unmodified and in its entirety in all distributions of the software,
12 * modified or unmodified, in source code or in binary form.
13 *
14 * Redistribution and use in source and binary forms, with or without
15 * modification, are permitted provided that the following conditions are
16 * met: redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer;
18 * redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution;
21 * neither the name of the copyright holders nor the names of its
22 * contributors may be used to endorse or promote products derived from
23 * this software without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 *
37 * Authors: Gabe Black
38 */
39
40 #ifndef __ARCH_X86_FLOATREGS_HH__
41 #define __ARCH_X86_FLOATREGS_HH__
42
43 #include "arch/x86/x86_traits.hh"
44 #include "base/bitunion.hh"
45
46 namespace X86ISA
47 {
48 enum FloatRegIndex
49 {
50 // MMX/X87 registers
51 FLOATREG_MMX_BASE,
52 FLOATREG_FPR_BASE = FLOATREG_MMX_BASE,
53 FLOATREG_MMX0 = FLOATREG_MMX_BASE,
54 FLOATREG_MMX1,
55 FLOATREG_MMX2,
56 FLOATREG_MMX3,
57 FLOATREG_MMX4,
58 FLOATREG_MMX5,
59 FLOATREG_MMX6,
60 FLOATREG_MMX7,
61
62 FLOATREG_FPR0 = FLOATREG_FPR_BASE,
63 FLOATREG_FPR1,
64 FLOATREG_FPR2,
65 FLOATREG_FPR3,
66 FLOATREG_FPR4,
67 FLOATREG_FPR5,
68 FLOATREG_FPR6,
69 FLOATREG_FPR7,
70
71 FLOATREG_XMM_BASE = FLOATREG_MMX_BASE + NumMMXRegs,
72 FLOATREG_XMM0_LOW = FLOATREG_XMM_BASE,
73 FLOATREG_XMM0_HIGH,
74 FLOATREG_XMM1_LOW,
75 FLOATREG_XMM1_HIGH,
76 FLOATREG_XMM2_LOW,
77 FLOATREG_XMM2_HIGH,
78 FLOATREG_XMM3_LOW,
79 FLOATREG_XMM3_HIGH,
80 FLOATREG_XMM4_LOW,
81 FLOATREG_XMM4_HIGH,
82 FLOATREG_XMM5_LOW,
83 FLOATREG_XMM5_HIGH,
84 FLOATREG_XMM6_LOW,
85 FLOATREG_XMM6_HIGH,
86 FLOATREG_XMM7_LOW,
87 FLOATREG_XMM7_HIGH,
88 FLOATREG_XMM8_LOW,
89 FLOATREG_XMM8_HIGH,
90 FLOATREG_XMM9_LOW,
91 FLOATREG_XMM9_HIGH,
92 FLOATREG_XMM10_LOW,
93 FLOATREG_XMM10_HIGH,
94 FLOATREG_XMM11_LOW,
95 FLOATREG_XMM11_HIGH,
96 FLOATREG_XMM12_LOW,
97 FLOATREG_XMM12_HIGH,
98 FLOATREG_XMM13_LOW,
99 FLOATREG_XMM13_HIGH,
100 FLOATREG_XMM14_LOW,
101 FLOATREG_XMM14_HIGH,
102 FLOATREG_XMM15_LOW,
103 FLOATREG_XMM15_HIGH,
104
105 FLOATREG_MICROFP_BASE = FLOATREG_XMM_BASE + 2 * NumXMMRegs,
106 FLOATREG_MICROFP0 = FLOATREG_MICROFP_BASE,
107 FLOATREG_MICROFP1,
108 FLOATREG_MICROFP2,
109 FLOATREG_MICROFP3,
110 FLOATREG_MICROFP4,
111 FLOATREG_MICROFP5,
112 FLOATREG_MICROFP6,
113 FLOATREG_MICROFP7,
114
115 NUM_FLOATREGS = FLOATREG_MICROFP_BASE + NumMicroFpRegs
116 };
117
118 static inline FloatRegIndex
119 FLOATREG_MMX(int index)
120 {
121 return (FloatRegIndex)(FLOATREG_MMX_BASE + index);
122 }
123
124 static inline FloatRegIndex
125 FLOATREG_FPR(int index)
126 {
127 return (FloatRegIndex)(FLOATREG_FPR_BASE + index);
128 }
129
130 static inline FloatRegIndex
131 FLOATREG_XMM_LOW(int index)
132 {
133 return (FloatRegIndex)(FLOATREG_XMM_BASE + 2 * index);
134 }
135
136 static inline FloatRegIndex
137 FLOATREG_XMM_HIGH(int index)
138 {
139 return (FloatRegIndex)(FLOATREG_XMM_BASE + 2 * index + 1);
140 }
141
142 static inline FloatRegIndex
143 FLOATREG_MICROFP(int index)
144 {
145 return (FloatRegIndex)(FLOATREG_MICROFP_BASE + index);
146 }
147
148 static inline FloatRegIndex
149 FLOATREG_STACK(int index, int top)
150 {
151 return FLOATREG_FPR((top + index + 8) % 8);
152 }
153 }
154
155 #endif // __ARCH_X86_FLOATREGS_HH__