OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // | 2 // |
3 // Redistribution and use in source and binary forms, with or without | 3 // Redistribution and use in source and binary forms, with or without |
4 // modification, are permitted provided that the following conditions are | 4 // modification, are permitted provided that the following conditions are |
5 // met: | 5 // met: |
6 // | 6 // |
7 // * Redistributions of source code must retain the above copyright | 7 // * Redistributions of source code must retain the above copyright |
8 // notice, this list of conditions and the following disclaimer. | 8 // notice, this list of conditions and the following disclaimer. |
9 // * Redistributions in binary form must reproduce the above | 9 // * Redistributions in binary form must reproduce the above |
10 // copyright notice, this list of conditions and the following | 10 // copyright notice, this list of conditions and the following |
(...skipping 2437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2448 | 2448 |
2449 bool Assembler::IsImmAddSub(int64_t immediate) { | 2449 bool Assembler::IsImmAddSub(int64_t immediate) { |
2450 return is_uint12(immediate) || | 2450 return is_uint12(immediate) || |
2451 (is_uint12(immediate >> 12) && ((immediate & 0xfff) == 0)); | 2451 (is_uint12(immediate >> 12) && ((immediate & 0xfff) == 0)); |
2452 } | 2452 } |
2453 | 2453 |
2454 void Assembler::LoadStore(const CPURegister& rt, | 2454 void Assembler::LoadStore(const CPURegister& rt, |
2455 const MemOperand& addr, | 2455 const MemOperand& addr, |
2456 LoadStoreOp op) { | 2456 LoadStoreOp op) { |
2457 Instr memop = op | Rt(rt) | RnSP(addr.base()); | 2457 Instr memop = op | Rt(rt) | RnSP(addr.base()); |
2458 ptrdiff_t offset = addr.offset(); | 2458 int64_t offset = addr.offset(); |
2459 | 2459 |
2460 if (addr.IsImmediateOffset()) { | 2460 if (addr.IsImmediateOffset()) { |
2461 LSDataSize size = CalcLSDataSize(op); | 2461 LSDataSize size = CalcLSDataSize(op); |
2462 if (IsImmLSScaled(offset, size)) { | 2462 if (IsImmLSScaled(offset, size)) { |
2463 // Use the scaled addressing mode. | 2463 // Use the scaled addressing mode. |
2464 Emit(LoadStoreUnsignedOffsetFixed | memop | | 2464 Emit(LoadStoreUnsignedOffsetFixed | memop | |
2465 ImmLSUnsigned(offset >> size)); | 2465 ImmLSUnsigned(offset >> size)); |
2466 } else if (IsImmLSUnscaled(offset)) { | 2466 } else if (IsImmLSUnscaled(offset)) { |
2467 // Use the unscaled addressing mode. | 2467 // Use the unscaled addressing mode. |
2468 Emit(LoadStoreUnscaledOffsetFixed | memop | ImmLS(offset)); | 2468 Emit(LoadStoreUnscaledOffsetFixed | memop | ImmLS(offset)); |
(...skipping 28 matching lines...) Expand all Loading... |
2497 Emit(LoadStorePostIndexFixed | memop | ImmLS(offset)); | 2497 Emit(LoadStorePostIndexFixed | memop | ImmLS(offset)); |
2498 } | 2498 } |
2499 } else { | 2499 } else { |
2500 // This case is handled in the macro assembler. | 2500 // This case is handled in the macro assembler. |
2501 UNREACHABLE(); | 2501 UNREACHABLE(); |
2502 } | 2502 } |
2503 } | 2503 } |
2504 } | 2504 } |
2505 | 2505 |
2506 | 2506 |
2507 bool Assembler::IsImmLSUnscaled(ptrdiff_t offset) { | 2507 bool Assembler::IsImmLSUnscaled(int64_t offset) { |
2508 return is_int9(offset); | 2508 return is_int9(offset); |
2509 } | 2509 } |
2510 | 2510 |
2511 | 2511 |
2512 bool Assembler::IsImmLSScaled(ptrdiff_t offset, LSDataSize size) { | 2512 bool Assembler::IsImmLSScaled(int64_t offset, LSDataSize size) { |
2513 bool offset_is_size_multiple = (((offset >> size) << size) == offset); | 2513 bool offset_is_size_multiple = (((offset >> size) << size) == offset); |
2514 return offset_is_size_multiple && is_uint12(offset >> size); | 2514 return offset_is_size_multiple && is_uint12(offset >> size); |
2515 } | 2515 } |
2516 | 2516 |
2517 | 2517 |
2518 bool Assembler::IsImmLSPair(ptrdiff_t offset, LSDataSize size) { | 2518 bool Assembler::IsImmLSPair(int64_t offset, LSDataSize size) { |
2519 bool offset_is_size_multiple = (((offset >> size) << size) == offset); | 2519 bool offset_is_size_multiple = (((offset >> size) << size) == offset); |
2520 return offset_is_size_multiple && is_int7(offset >> size); | 2520 return offset_is_size_multiple && is_int7(offset >> size); |
2521 } | 2521 } |
2522 | 2522 |
2523 | 2523 |
2524 // Test if a given value can be encoded in the immediate field of a logical | 2524 // Test if a given value can be encoded in the immediate field of a logical |
2525 // instruction. | 2525 // instruction. |
2526 // If it can be encoded, the function returns true, and values pointed to by n, | 2526 // If it can be encoded, the function returns true, and values pointed to by n, |
2527 // imm_s and imm_r are updated with immediates encoded in the format required | 2527 // imm_s and imm_r are updated with immediates encoded in the format required |
2528 // by the corresponding fields in the logical instruction. | 2528 // by the corresponding fields in the logical instruction. |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3096 } | 3096 } |
3097 | 3097 |
3098 | 3098 |
3099 void Assembler::PopulateConstantPool(ConstantPoolArray* constant_pool) { | 3099 void Assembler::PopulateConstantPool(ConstantPoolArray* constant_pool) { |
3100 // No out-of-line constant pool support. | 3100 // No out-of-line constant pool support. |
3101 DCHECK(!FLAG_enable_ool_constant_pool); | 3101 DCHECK(!FLAG_enable_ool_constant_pool); |
3102 return; | 3102 return; |
3103 } | 3103 } |
3104 | 3104 |
3105 | 3105 |
3106 void PatchingAssembler::PatchAdrFar(ptrdiff_t target_offset) { | 3106 void PatchingAssembler::PatchAdrFar(int64_t target_offset) { |
3107 // The code at the current instruction should be: | 3107 // The code at the current instruction should be: |
3108 // adr rd, 0 | 3108 // adr rd, 0 |
3109 // nop (adr_far) | 3109 // nop (adr_far) |
3110 // nop (adr_far) | 3110 // nop (adr_far) |
3111 // movz scratch, 0 | 3111 // movz scratch, 0 |
3112 | 3112 |
3113 // Verify the expected code. | 3113 // Verify the expected code. |
3114 Instruction* expected_adr = InstructionAt(0); | 3114 Instruction* expected_adr = InstructionAt(0); |
3115 CHECK(expected_adr->IsAdr() && (expected_adr->ImmPCRel() == 0)); | 3115 CHECK(expected_adr->IsAdr() && (expected_adr->ImmPCRel() == 0)); |
3116 int rd_code = expected_adr->Rd(); | 3116 int rd_code = expected_adr->Rd(); |
(...skipping 15 matching lines...) Expand all Loading... |
3132 movz(scratch, (target_offset >> 16) & 0xFFFF, 16); | 3132 movz(scratch, (target_offset >> 16) & 0xFFFF, 16); |
3133 movk(scratch, (target_offset >> 32) & 0xFFFF, 32); | 3133 movk(scratch, (target_offset >> 32) & 0xFFFF, 32); |
3134 DCHECK((target_offset >> 48) == 0); | 3134 DCHECK((target_offset >> 48) == 0); |
3135 add(rd, rd, scratch); | 3135 add(rd, rd, scratch); |
3136 } | 3136 } |
3137 | 3137 |
3138 | 3138 |
3139 } } // namespace v8::internal | 3139 } } // namespace v8::internal |
3140 | 3140 |
3141 #endif // V8_TARGET_ARCH_ARM64 | 3141 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |