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

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

Issue 885443012: Undo unnecessary changes to ARM assembler. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 10 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
« no previous file with comments | « runtime/vm/assembler_arm.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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" // NOLINT 5 #include "vm/globals.h" // NOLINT
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 2692 matching lines...) Expand 10 before | Expand all | Expand 10 after
2703 } else { 2703 } else {
2704 ASSERT(version == ARMv7); 2704 ASSERT(version == ARMv7);
2705 const uint16_t value_low = Utils::Low16Bits(value); 2705 const uint16_t value_low = Utils::Low16Bits(value);
2706 const uint16_t value_high = Utils::High16Bits(value); 2706 const uint16_t value_high = Utils::High16Bits(value);
2707 movw(rd, value_low, cond); 2707 movw(rd, value_low, cond);
2708 movt(rd, value_high, cond); 2708 movt(rd, value_high, cond);
2709 } 2709 }
2710 } 2710 }
2711 2711
2712 2712
2713 void Assembler::LoadDecodableImmediate(
2714 Register rd, int32_t value, Condition cond) {
2715 const ARMVersion version = TargetCPUFeatures::arm_version();
2716 if ((version == ARMv5TE) || (version == ARMv6)) {
2717 LoadPatchableImmediate(rd, value, cond);
2718 } else {
2719 ASSERT(version == ARMv7);
2720 movw(rd, Utils::Low16Bits(value), cond);
2721 const uint16_t value_high = Utils::High16Bits(value);
2722 if (value_high != 0) {
2723 movt(rd, value_high, cond);
2724 }
2725 }
2726 }
2727
2728
2713 void Assembler::LoadImmediate(Register rd, int32_t value, Condition cond) { 2729 void Assembler::LoadImmediate(Register rd, int32_t value, Condition cond) {
2714 Operand o; 2730 Operand o;
2715 if (Operand::CanHold(value, &o)) { 2731 if (Operand::CanHold(value, &o)) {
2716 mov(rd, o, cond); 2732 mov(rd, o, cond);
2717 } else if (Operand::CanHold(~value, &o)) { 2733 } else if (Operand::CanHold(~value, &o)) {
2718 mvn(rd, o, cond); 2734 mvn(rd, o, cond);
2719 } else { 2735 } else {
2720 LoadPatchableImmediate(rd, value, cond); 2736 LoadDecodableImmediate(rd, value, cond);
2721 } 2737 }
2722 } 2738 }
2723 2739
2724 2740
2725 void Assembler::LoadSImmediate(SRegister sd, float value, Condition cond) { 2741 void Assembler::LoadSImmediate(SRegister sd, float value, Condition cond) {
2726 if (!vmovs(sd, value, cond)) { 2742 if (!vmovs(sd, value, cond)) {
2727 const DRegister dd = static_cast<DRegister>(sd >> 1); 2743 const DRegister dd = static_cast<DRegister>(sd >> 1);
2728 const int index = sd & 1; 2744 const int index = sd & 1;
2729 LoadImmediate(IP, bit_cast<int32_t, float>(value), cond); 2745 LoadImmediate(IP, bit_cast<int32_t, float>(value), cond);
2730 vmovdr(dd, index, IP, cond); 2746 vmovdr(dd, index, IP, cond);
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
2996 sub(rd, rn, o, cond); 3012 sub(rd, rn, o, cond);
2997 } else { 3013 } else {
2998 ASSERT(rn != IP); 3014 ASSERT(rn != IP);
2999 if (Operand::CanHold(~value, &o)) { 3015 if (Operand::CanHold(~value, &o)) {
3000 mvn(IP, o, cond); 3016 mvn(IP, o, cond);
3001 add(rd, rn, Operand(IP), cond); 3017 add(rd, rn, Operand(IP), cond);
3002 } else if (Operand::CanHold(~(-value), &o)) { 3018 } else if (Operand::CanHold(~(-value), &o)) {
3003 mvn(IP, o, cond); 3019 mvn(IP, o, cond);
3004 sub(rd, rn, Operand(IP), cond); 3020 sub(rd, rn, Operand(IP), cond);
3005 } else { 3021 } else {
3006 LoadPatchableImmediate(IP, value, cond); 3022 LoadDecodableImmediate(IP, value, cond);
3007 add(rd, rn, Operand(IP), cond); 3023 add(rd, rn, Operand(IP), cond);
3008 } 3024 }
3009 } 3025 }
3010 } 3026 }
3011 3027
3012 3028
3013 void Assembler::AddImmediateSetFlags(Register rd, Register rn, int32_t value, 3029 void Assembler::AddImmediateSetFlags(Register rd, Register rn, int32_t value,
3014 Condition cond) { 3030 Condition cond) {
3015 Operand o; 3031 Operand o;
3016 if (Operand::CanHold(value, &o)) { 3032 if (Operand::CanHold(value, &o)) {
3017 // Handles value == kMinInt32. 3033 // Handles value == kMinInt32.
3018 adds(rd, rn, o, cond); 3034 adds(rd, rn, o, cond);
3019 } else if (Operand::CanHold(-value, &o)) { 3035 } else if (Operand::CanHold(-value, &o)) {
3020 ASSERT(value != kMinInt32); // Would cause erroneous overflow detection. 3036 ASSERT(value != kMinInt32); // Would cause erroneous overflow detection.
3021 subs(rd, rn, o, cond); 3037 subs(rd, rn, o, cond);
3022 } else { 3038 } else {
3023 ASSERT(rn != IP); 3039 ASSERT(rn != IP);
3024 if (Operand::CanHold(~value, &o)) { 3040 if (Operand::CanHold(~value, &o)) {
3025 mvn(IP, o, cond); 3041 mvn(IP, o, cond);
3026 adds(rd, rn, Operand(IP), cond); 3042 adds(rd, rn, Operand(IP), cond);
3027 } else if (Operand::CanHold(~(-value), &o)) { 3043 } else if (Operand::CanHold(~(-value), &o)) {
3028 ASSERT(value != kMinInt32); // Would cause erroneous overflow detection. 3044 ASSERT(value != kMinInt32); // Would cause erroneous overflow detection.
3029 mvn(IP, o, cond); 3045 mvn(IP, o, cond);
3030 subs(rd, rn, Operand(IP), cond); 3046 subs(rd, rn, Operand(IP), cond);
3031 } else { 3047 } else {
3032 LoadPatchableImmediate(IP, value, cond); 3048 LoadDecodableImmediate(IP, value, cond);
3033 adds(rd, rn, Operand(IP), cond); 3049 adds(rd, rn, Operand(IP), cond);
3034 } 3050 }
3035 } 3051 }
3036 } 3052 }
3037 3053
3038 3054
3039 void Assembler::SubImmediateSetFlags(Register rd, Register rn, int32_t value, 3055 void Assembler::SubImmediateSetFlags(Register rd, Register rn, int32_t value,
3040 Condition cond) { 3056 Condition cond) {
3041 Operand o; 3057 Operand o;
3042 if (Operand::CanHold(value, &o)) { 3058 if (Operand::CanHold(value, &o)) {
3043 // Handles value == kMinInt32. 3059 // Handles value == kMinInt32.
3044 subs(rd, rn, o, cond); 3060 subs(rd, rn, o, cond);
3045 } else if (Operand::CanHold(-value, &o)) { 3061 } else if (Operand::CanHold(-value, &o)) {
3046 ASSERT(value != kMinInt32); // Would cause erroneous overflow detection. 3062 ASSERT(value != kMinInt32); // Would cause erroneous overflow detection.
3047 adds(rd, rn, o, cond); 3063 adds(rd, rn, o, cond);
3048 } else { 3064 } else {
3049 ASSERT(rn != IP); 3065 ASSERT(rn != IP);
3050 if (Operand::CanHold(~value, &o)) { 3066 if (Operand::CanHold(~value, &o)) {
3051 mvn(IP, o, cond); 3067 mvn(IP, o, cond);
3052 subs(rd, rn, Operand(IP), cond); 3068 subs(rd, rn, Operand(IP), cond);
3053 } else if (Operand::CanHold(~(-value), &o)) { 3069 } else if (Operand::CanHold(~(-value), &o)) {
3054 ASSERT(value != kMinInt32); // Would cause erroneous overflow detection. 3070 ASSERT(value != kMinInt32); // Would cause erroneous overflow detection.
3055 mvn(IP, o, cond); 3071 mvn(IP, o, cond);
3056 adds(rd, rn, Operand(IP), cond); 3072 adds(rd, rn, Operand(IP), cond);
3057 } else { 3073 } else {
3058 LoadPatchableImmediate(IP, value, cond); 3074 LoadDecodableImmediate(IP, value, cond);
3059 subs(rd, rn, Operand(IP), cond); 3075 subs(rd, rn, Operand(IP), cond);
3060 } 3076 }
3061 } 3077 }
3062 } 3078 }
3063 3079
3064 3080
3065 void Assembler::AndImmediate(Register rd, Register rs, int32_t imm, 3081 void Assembler::AndImmediate(Register rd, Register rs, int32_t imm,
3066 Condition cond) { 3082 Condition cond) {
3067 Operand o; 3083 Operand o;
3068 if (Operand::CanHold(imm, &o)) { 3084 if (Operand::CanHold(imm, &o)) {
(...skipping 546 matching lines...) Expand 10 before | Expand all | Expand 10 after
3615 3631
3616 3632
3617 const char* Assembler::FpuRegisterName(FpuRegister reg) { 3633 const char* Assembler::FpuRegisterName(FpuRegister reg) {
3618 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); 3634 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters));
3619 return fpu_reg_names[reg]; 3635 return fpu_reg_names[reg];
3620 } 3636 }
3621 3637
3622 } // namespace dart 3638 } // namespace dart
3623 3639
3624 #endif // defined TARGET_ARCH_ARM 3640 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/assembler_arm.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698