Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(447)

Side by Side Diff: runtime/vm/assembler_arm.cc

Issue 593363003: Expands the use of Immediate and Operand wrappers. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/longjump.h" 10 #include "vm/longjump.h"
(...skipping 2211 matching lines...) Expand 10 before | Expand all | Expand 10 after
2222 } 2222 }
2223 2223
2224 2224
2225 void Assembler::MoveRegister(Register rd, Register rm, Condition cond) { 2225 void Assembler::MoveRegister(Register rd, Register rm, Condition cond) {
2226 if (rd != rm) { 2226 if (rd != rm) {
2227 mov(rd, Operand(rm), cond); 2227 mov(rd, Operand(rm), cond);
2228 } 2228 }
2229 } 2229 }
2230 2230
2231 2231
2232 void Assembler::Lsl(Register rd, Register rm, uint32_t shift_imm, 2232 void Assembler::Lsl(Register rd, Register rm, const Operand& shift_imm,
2233 Condition cond) { 2233 Condition cond) {
2234 ASSERT(shift_imm != 0); // Do not use Lsl if no shift is wanted. 2234 ASSERT(shift_imm.type() == 1);
2235 mov(rd, Operand(rm, LSL, shift_imm), cond); 2235 ASSERT(shift_imm.encoding() != 0); // Do not use Lsl if no shift is wanted.
2236 mov(rd, Operand(rm, LSL, shift_imm.encoding()), cond);
2236 } 2237 }
2237 2238
2238 2239
2239 void Assembler::Lsl(Register rd, Register rm, Register rs, Condition cond) { 2240 void Assembler::Lsl(Register rd, Register rm, Register rs, Condition cond) {
2240 mov(rd, Operand(rm, LSL, rs), cond); 2241 mov(rd, Operand(rm, LSL, rs), cond);
2241 } 2242 }
2242 2243
2243 2244
2244 void Assembler::Lsr(Register rd, Register rm, uint32_t shift_imm, 2245 void Assembler::Lsr(Register rd, Register rm, const Operand& shift_imm,
2245 Condition cond) { 2246 Condition cond) {
2246 ASSERT(shift_imm != 0); // Do not use Lsr if no shift is wanted. 2247 ASSERT(shift_imm.type() == 1);
2247 if (shift_imm == 32) shift_imm = 0; // Comply to UAL syntax. 2248 uint32_t shift = shift_imm.encoding();
2248 mov(rd, Operand(rm, LSR, shift_imm), cond); 2249 ASSERT(shift != 0); // Do not use Lsr if no shift is wanted.
2250 if (shift == 32) {
2251 shift = 0; // Comply to UAL syntax.
2252 }
2253 mov(rd, Operand(rm, LSR, shift), cond);
2249 } 2254 }
2250 2255
2251 2256
2252 void Assembler::Lsr(Register rd, Register rm, Register rs, Condition cond) { 2257 void Assembler::Lsr(Register rd, Register rm, Register rs, Condition cond) {
2253 mov(rd, Operand(rm, LSR, rs), cond); 2258 mov(rd, Operand(rm, LSR, rs), cond);
2254 } 2259 }
2255 2260
2256 2261
2257 void Assembler::Asr(Register rd, Register rm, uint32_t shift_imm, 2262 void Assembler::Asr(Register rd, Register rm, const Operand& shift_imm,
2258 Condition cond) { 2263 Condition cond) {
2259 ASSERT(shift_imm != 0); // Do not use Asr if no shift is wanted. 2264 ASSERT(shift_imm.type() == 1);
2260 if (shift_imm == 32) { 2265 uint32_t shift = shift_imm.encoding();
2261 shift_imm = 0; // Comply to UAL syntax. 2266 ASSERT(shift != 0); // Do not use Asr if no shift is wanted.
2267 if (shift == 32) {
2268 shift = 0; // Comply to UAL syntax.
2262 } 2269 }
2263 mov(rd, Operand(rm, ASR, shift_imm), cond); 2270 mov(rd, Operand(rm, ASR, shift), cond);
2264 } 2271 }
2265 2272
2266 2273
2267 void Assembler::Asrs(Register rd, Register rm, uint32_t shift_imm, 2274 void Assembler::Asrs(Register rd, Register rm, const Operand& shift_imm,
2268 Condition cond) { 2275 Condition cond) {
2269 ASSERT(shift_imm != 0); // Do not use Asr if no shift is wanted. 2276 ASSERT(shift_imm.type() == 1);
2270 if (shift_imm == 32) { 2277 uint32_t shift = shift_imm.encoding();
2271 shift_imm = 0; // Comply to UAL syntax. 2278 ASSERT(shift != 0); // Do not use Asr if no shift is wanted.
2279 if (shift == 32) {
2280 shift = 0; // Comply to UAL syntax.
2272 } 2281 }
2273 movs(rd, Operand(rm, ASR, shift_imm), cond); 2282 movs(rd, Operand(rm, ASR, shift), cond);
2274 } 2283 }
2275 2284
2276 2285
2277 void Assembler::Asr(Register rd, Register rm, Register rs, Condition cond) { 2286 void Assembler::Asr(Register rd, Register rm, Register rs, Condition cond) {
2278 mov(rd, Operand(rm, ASR, rs), cond); 2287 mov(rd, Operand(rm, ASR, rs), cond);
2279 } 2288 }
2280 2289
2281 2290
2282 void Assembler::Ror(Register rd, Register rm, uint32_t shift_imm, 2291 void Assembler::Ror(Register rd, Register rm, const Operand& shift_imm,
2283 Condition cond) { 2292 Condition cond) {
2284 ASSERT(shift_imm != 0); // Use Rrx instruction. 2293 ASSERT(shift_imm.type() == 1);
2285 mov(rd, Operand(rm, ROR, shift_imm), cond); 2294 ASSERT(shift_imm.encoding() != 0); // Use Rrx instruction.
2295 mov(rd, Operand(rm, ROR, shift_imm.encoding()), cond);
2286 } 2296 }
2287 2297
2288 2298
2289 void Assembler::Ror(Register rd, Register rm, Register rs, Condition cond) { 2299 void Assembler::Ror(Register rd, Register rm, Register rs, Condition cond) {
2290 mov(rd, Operand(rm, ROR, rs), cond); 2300 mov(rd, Operand(rm, ROR, rs), cond);
2291 } 2301 }
2292 2302
2293 2303
2294 void Assembler::Rrx(Register rd, Register rm, Condition cond) { 2304 void Assembler::Rrx(Register rd, Register rm, Condition cond) {
2295 mov(rd, Operand(rm, ROR, 0), cond); 2305 mov(rd, Operand(rm, ROR, 0), cond);
2296 } 2306 }
2297 2307
2298 2308
2299 void Assembler::SignFill(Register rd, Register rm, Condition cond) { 2309 void Assembler::SignFill(Register rd, Register rm, Condition cond) {
2300 Asr(rd, rm, 31, cond); 2310 Asr(rd, rm, Operand(31), cond);
2301 } 2311 }
2302 2312
2303 2313
2304 void Assembler::Vreciprocalqs(QRegister qd, QRegister qm) { 2314 void Assembler::Vreciprocalqs(QRegister qd, QRegister qm) {
2305 ASSERT(qm != QTMP); 2315 ASSERT(qm != QTMP);
2306 ASSERT(qd != QTMP); 2316 ASSERT(qd != QTMP);
2307 2317
2308 // Reciprocal estimate. 2318 // Reciprocal estimate.
2309 vrecpeqs(qd, qm); 2319 vrecpeqs(qd, qm);
2310 // 2 Newton-Raphson steps. 2320 // 2 Newton-Raphson steps.
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after
3394 3404
3395 3405
3396 const char* Assembler::FpuRegisterName(FpuRegister reg) { 3406 const char* Assembler::FpuRegisterName(FpuRegister reg) {
3397 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); 3407 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters));
3398 return fpu_reg_names[reg]; 3408 return fpu_reg_names[reg];
3399 } 3409 }
3400 3410
3401 } // namespace dart 3411 } // namespace dart
3402 3412
3403 #endif // defined TARGET_ARCH_ARM 3413 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698