macromem.cc (7310:239ab4e0c7d4) macromem.cc (7342:72166bc39ff8)
1/*
2 * Copyright (c) 2010 ARM Limited
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

--- 122 unchanged lines hidden (view full) ---

131}
132
133MacroVFPMemOp::MacroVFPMemOp(const char *mnem, ExtMachInst machInst,
134 OpClass __opClass, IntRegIndex rn,
135 RegIndex vd, bool single, bool up,
136 bool writeback, bool load, uint32_t offset) :
137 PredMacroOp(mnem, machInst, __opClass)
138{
1/*
2 * Copyright (c) 2010 ARM Limited
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

--- 122 unchanged lines hidden (view full) ---

131}
132
133MacroVFPMemOp::MacroVFPMemOp(const char *mnem, ExtMachInst machInst,
134 OpClass __opClass, IntRegIndex rn,
135 RegIndex vd, bool single, bool up,
136 bool writeback, bool load, uint32_t offset) :
137 PredMacroOp(mnem, machInst, __opClass)
138{
139 const int maxMicroops = 17;
140 microOps = new StaticInstPtr[maxMicroops];
141 int i = 0;
142
143 // The lowest order bit selects fldmx (set) or fldmd (clear). These seem
144 // to be functionally identical except that fldmx is deprecated. For now
145 // we'll assume they're otherwise interchangable.
146 int count = (single ? offset : (offset / 2));
147 if (count == 0 || count > NumFloatArchRegs)
148 warn_once("Bad offset field for VFP load/store multiple.\n");
149 if (count == 0) {
150 // Force there to be at least one microop so the macroop makes sense.
151 writeback = true;
152 }
153 if (count > NumFloatArchRegs)
154 count = NumFloatArchRegs;
155
139 int i = 0;
140
141 // The lowest order bit selects fldmx (set) or fldmd (clear). These seem
142 // to be functionally identical except that fldmx is deprecated. For now
143 // we'll assume they're otherwise interchangable.
144 int count = (single ? offset : (offset / 2));
145 if (count == 0 || count > NumFloatArchRegs)
146 warn_once("Bad offset field for VFP load/store multiple.\n");
147 if (count == 0) {
148 // Force there to be at least one microop so the macroop makes sense.
149 writeback = true;
150 }
151 if (count > NumFloatArchRegs)
152 count = NumFloatArchRegs;
153
154 numMicroops = count * (single ? 1 : 2) + (writeback ? 1 : 0);
155 microOps = new StaticInstPtr[numMicroops];
156
156 uint32_t addr = 0;
157
157 uint32_t addr = 0;
158
158 if (up)
159 addr = -4 * offset;
159 if (!up)
160 addr = 4 * offset;
160
161
162 bool tempUp = up;
161 for (int j = 0; j < count; j++) {
162 if (load) {
163 microOps[i++] = new MicroLdrFpUop(machInst, vd++, rn,
163 for (int j = 0; j < count; j++) {
164 if (load) {
165 microOps[i++] = new MicroLdrFpUop(machInst, vd++, rn,
164 true, addr);
166 tempUp, addr);
165 if (!single)
166 microOps[i++] = new MicroLdrFpUop(machInst, vd++, rn,
167 if (!single)
168 microOps[i++] = new MicroLdrFpUop(machInst, vd++, rn,
167 true, addr + 4);
169 tempUp, addr + 4);
168 } else {
169 microOps[i++] = new MicroStrFpUop(machInst, vd++, rn,
170 } else {
171 microOps[i++] = new MicroStrFpUop(machInst, vd++, rn,
170 true, addr);
172 tempUp, addr);
171 if (!single)
172 microOps[i++] = new MicroStrFpUop(machInst, vd++, rn,
173 if (!single)
174 microOps[i++] = new MicroStrFpUop(machInst, vd++, rn,
173 true, addr + 4);
175 tempUp, addr + 4);
174 }
176 }
175 addr += (single ? 4 : 8);
177 if (!tempUp) {
178 addr -= (single ? 4 : 8);
179 // The microops don't handle negative displacement, so turn if we
180 // hit zero, flip polarity and start adding.
181 if (addr == 0) {
182 tempUp = true;
183 }
184 } else {
185 addr += (single ? 4 : 8);
186 }
176 }
177
178 if (writeback) {
179 if (up) {
180 microOps[i++] =
181 new MicroAddiUop(machInst, rn, rn, 4 * offset);
182 } else {
183 microOps[i++] =
184 new MicroSubiUop(machInst, rn, rn, 4 * offset);
185 }
186 }
187
187 }
188
189 if (writeback) {
190 if (up) {
191 microOps[i++] =
192 new MicroAddiUop(machInst, rn, rn, 4 * offset);
193 } else {
194 microOps[i++] =
195 new MicroSubiUop(machInst, rn, rn, 4 * offset);
196 }
197 }
198
188 numMicroops = i;
189 assert(numMicroops <= maxMicroops);
199 assert(numMicroops == i);
190 microOps[numMicroops - 1]->setLastMicroop();
191}
192
193}
200 microOps[numMicroops - 1]->setLastMicroop();
201}
202
203}