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

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

Issue 206503005: Implements unboxed Mints on ARM. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: merge Created 6 years, 9 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/intermediate_language_ia32.cc ('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 <math.h> // for isnan. 5 #include <math.h> // for isnan.
6 #include <setjmp.h> 6 #include <setjmp.h>
7 #include <stdlib.h> 7 #include <stdlib.h>
8 8
9 #include "vm/globals.h" 9 #include "vm/globals.h"
10 #if defined(TARGET_ARCH_ARM) 10 #if defined(TARGET_ARCH_ARM)
(...skipping 3035 matching lines...) Expand 10 before | Expand all | Expand 10 after
3046 const QRegister qm = instr->QmField(); 3046 const QRegister qm = instr->QmField();
3047 simd_value_t s8d; 3047 simd_value_t s8d;
3048 simd_value_t s8n; 3048 simd_value_t s8n;
3049 simd_value_t s8m; 3049 simd_value_t s8m;
3050 3050
3051 get_qregister(qn, &s8n); 3051 get_qregister(qn, &s8n);
3052 get_qregister(qm, &s8m); 3052 get_qregister(qm, &s8m);
3053 int8_t* s8d_8 = reinterpret_cast<int8_t*>(&s8d); 3053 int8_t* s8d_8 = reinterpret_cast<int8_t*>(&s8d);
3054 int8_t* s8n_8 = reinterpret_cast<int8_t*>(&s8n); 3054 int8_t* s8n_8 = reinterpret_cast<int8_t*>(&s8n);
3055 int8_t* s8m_8 = reinterpret_cast<int8_t*>(&s8m); 3055 int8_t* s8m_8 = reinterpret_cast<int8_t*>(&s8m);
3056 uint8_t* s8d_u8 = reinterpret_cast<uint8_t*>(&s8d);
3056 uint8_t* s8n_u8 = reinterpret_cast<uint8_t*>(&s8n); 3057 uint8_t* s8n_u8 = reinterpret_cast<uint8_t*>(&s8n);
3057 uint8_t* s8m_u8 = reinterpret_cast<uint8_t*>(&s8m); 3058 uint8_t* s8m_u8 = reinterpret_cast<uint8_t*>(&s8m);
3058 int16_t* s8d_16 = reinterpret_cast<int16_t*>(&s8d); 3059 int16_t* s8d_16 = reinterpret_cast<int16_t*>(&s8d);
3059 int16_t* s8n_16 = reinterpret_cast<int16_t*>(&s8n); 3060 int16_t* s8n_16 = reinterpret_cast<int16_t*>(&s8n);
3060 int16_t* s8m_16 = reinterpret_cast<int16_t*>(&s8m); 3061 int16_t* s8m_16 = reinterpret_cast<int16_t*>(&s8m);
3062 uint16_t* s8d_u16 = reinterpret_cast<uint16_t*>(&s8d);
3061 uint16_t* s8n_u16 = reinterpret_cast<uint16_t*>(&s8n); 3063 uint16_t* s8n_u16 = reinterpret_cast<uint16_t*>(&s8n);
3062 uint16_t* s8m_u16 = reinterpret_cast<uint16_t*>(&s8m); 3064 uint16_t* s8m_u16 = reinterpret_cast<uint16_t*>(&s8m);
3065 int32_t* s8d_32 = reinterpret_cast<int32_t*>(&s8d);
3063 int32_t* s8n_32 = reinterpret_cast<int32_t*>(&s8n); 3066 int32_t* s8n_32 = reinterpret_cast<int32_t*>(&s8n);
3064 int32_t* s8m_32 = reinterpret_cast<int32_t*>(&s8m); 3067 int32_t* s8m_32 = reinterpret_cast<int32_t*>(&s8m);
3068 uint32_t* s8d_u32 = reinterpret_cast<uint32_t*>(&s8d);
3069 uint32_t* s8m_u32 = reinterpret_cast<uint32_t*>(&s8m);
3065 int64_t* s8d_64 = reinterpret_cast<int64_t*>(&s8d); 3070 int64_t* s8d_64 = reinterpret_cast<int64_t*>(&s8d);
3066 int64_t* s8n_64 = reinterpret_cast<int64_t*>(&s8n); 3071 int64_t* s8n_64 = reinterpret_cast<int64_t*>(&s8n);
3067 int64_t* s8m_64 = reinterpret_cast<int64_t*>(&s8m); 3072 int64_t* s8m_64 = reinterpret_cast<int64_t*>(&s8m);
3073 uint64_t* s8d_u64 = reinterpret_cast<uint64_t*>(&s8d);
3074 uint64_t* s8m_u64 = reinterpret_cast<uint64_t*>(&s8m);
3068 3075
3069 if ((instr->Bits(8, 4) == 8) && (instr->Bit(4) == 0) && 3076 if ((instr->Bits(8, 4) == 8) && (instr->Bit(4) == 0) &&
3070 (instr->Bits(23, 2) == 0)) { 3077 (instr->Bits(23, 2) == 0)) {
3071 // Uses q registers. 3078 // Uses q registers.
3072 // Format(instr, "vadd.'sz 'qd, 'qn, 'qm"); 3079 // Format(instr, "vadd.'sz 'qd, 'qn, 'qm");
3073 const int size = instr->Bits(20, 2); 3080 const int size = instr->Bits(20, 2);
3074 if (size == 0) { 3081 if (size == 0) {
3075 for (int i = 0; i < 16; i++) { 3082 for (int i = 0; i < 16; i++) {
3076 s8d_8[i] = s8n_8[i] + s8m_8[i]; 3083 s8d_8[i] = s8n_8[i] + s8m_8[i];
3077 } 3084 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
3145 UnimplementedInstruction(instr); 3152 UnimplementedInstruction(instr);
3146 } else { 3153 } else {
3147 UNREACHABLE(); 3154 UNREACHABLE();
3148 } 3155 }
3149 } else if ((instr->Bits(8, 4) == 13) && (instr->Bit(4) == 1) && 3156 } else if ((instr->Bits(8, 4) == 13) && (instr->Bit(4) == 1) &&
3150 (instr->Bits(23, 2) == 2) && (instr->Bit(21) == 0)) { 3157 (instr->Bits(23, 2) == 2) && (instr->Bit(21) == 0)) {
3151 // Format(instr, "vmul.F32 'qd, 'qn, 'qm"); 3158 // Format(instr, "vmul.F32 'qd, 'qn, 'qm");
3152 for (int i = 0; i < 4; i++) { 3159 for (int i = 0; i < 4; i++) {
3153 s8d.data_[i].f = s8n.data_[i].f * s8m.data_[i].f; 3160 s8d.data_[i].f = s8n.data_[i].f * s8m.data_[i].f;
3154 } 3161 }
3162 } else if ((instr->Bits(8, 4) == 4) && (instr->Bit(4) == 0) &&
3163 (instr->Bit(23) == 0) && (instr->Bits(25, 3) == 1)) {
3164 // Format(instr, "vshlqu'sz 'qd, 'qm, 'qn");
3165 // Format(instr, "vshlqi'sz 'qd, 'qm, 'qn");
3166 const bool signd = instr->Bit(24) == 0;
3167 const int size = instr->Bits(20, 2);
3168 if (size == 0) {
3169 for (int i = 0; i < 16; i++) {
3170 int8_t shift = s8n_8[i];
3171 if (shift > 0) {
3172 s8d_u8[i] = s8m_u8[i] << shift;
3173 } else if (shift < 0) {
3174 if (signd) {
3175 s8d_8[i] = s8m_8[i] >> (-shift);
3176 } else {
3177 s8d_u8[i] = s8m_u8[i] >> (-shift);
3178 }
3179 }
3180 }
3181 } else if (size == 1) {
3182 for (int i = 0; i < 8; i++) {
3183 int8_t shift = s8n_8[i * 2];
3184 if (shift > 0) {
3185 s8d_u16[i] = s8m_u16[i] << shift;
3186 } else if (shift < 0) {
3187 if (signd) {
3188 s8d_16[i] = s8m_16[i] >> (-shift);
3189 } else {
3190 s8d_u16[i] = s8m_u16[i] >> (-shift);
3191 }
3192 }
3193 }
3194 } else if (size == 2) {
3195 for (int i = 0; i < 4; i++) {
3196 int8_t shift = s8n_8[i * 4];
3197 if (shift > 0) {
3198 s8d_u32[i] = s8m_u32[i] << shift;
3199 } else if (shift < 0) {
3200 if (signd) {
3201 s8d_32[i] = s8m_32[i] >> (-shift);
3202 } else {
3203 s8d_u32[i] = s8m_u32[i] >> (-shift);
3204 }
3205 }
3206 }
3207 } else {
3208 ASSERT(size == 3);
3209 for (int i = 0; i < 2; i++) {
3210 int8_t shift = s8n_8[i * 8];
3211 if (shift > 0) {
3212 s8d_u64[i] = s8m_u64[i] << shift;
3213 } else if (shift < 0) {
3214 if (signd) {
3215 s8d_64[i] = s8m_64[i] >> (-shift);
3216 } else {
3217 s8d_u64[i] = s8m_u64[i] >> (-shift);
3218 }
3219 }
3220 }
3221 }
3155 } else if ((instr->Bits(8, 4) == 1) && (instr->Bit(4) == 1) && 3222 } else if ((instr->Bits(8, 4) == 1) && (instr->Bit(4) == 1) &&
3156 (instr->Bits(20, 2) == 0) && (instr->Bits(23, 2) == 2)) { 3223 (instr->Bits(20, 2) == 0) && (instr->Bits(23, 2) == 2)) {
3157 // Format(instr, "veorq 'qd, 'qn, 'qm"); 3224 // Format(instr, "veorq 'qd, 'qn, 'qm");
3158 for (int i = 0; i < 4; i++) { 3225 for (int i = 0; i < 4; i++) {
3159 s8d.data_[i].u = s8n.data_[i].u ^ s8m.data_[i].u; 3226 s8d.data_[i].u = s8n.data_[i].u ^ s8m.data_[i].u;
3160 } 3227 }
3161 } else if ((instr->Bits(8, 4) == 1) && (instr->Bit(4) == 1) && 3228 } else if ((instr->Bits(8, 4) == 1) && (instr->Bit(4) == 1) &&
3162 (instr->Bits(20, 2) == 3) && (instr->Bits(23, 2) == 0)) { 3229 (instr->Bits(20, 2) == 3) && (instr->Bits(23, 2) == 0)) {
3163 // Format(instr, "vornq 'qd, 'qn, 'qm"); 3230 // Format(instr, "vornq 'qd, 'qn, 'qm");
3164 for (int i = 0; i < 4; i++) { 3231 for (int i = 0; i < 4; i++) {
(...skipping 11 matching lines...) Expand all
3176 for (int i = 0; i < 4; i++) { 3243 for (int i = 0; i < 4; i++) {
3177 s8d.data_[i].u = s8n.data_[i].u | s8m.data_[i].u; 3244 s8d.data_[i].u = s8n.data_[i].u | s8m.data_[i].u;
3178 } 3245 }
3179 } 3246 }
3180 } else if ((instr->Bits(8, 4) == 1) && (instr->Bit(4) == 1) && 3247 } else if ((instr->Bits(8, 4) == 1) && (instr->Bit(4) == 1) &&
3181 (instr->Bits(20, 2) == 0) && (instr->Bits(23, 2) == 0)) { 3248 (instr->Bits(20, 2) == 0) && (instr->Bits(23, 2) == 0)) {
3182 // Format(instr, "vandq 'qd, 'qn, 'qm"); 3249 // Format(instr, "vandq 'qd, 'qn, 'qm");
3183 for (int i = 0; i < 4; i++) { 3250 for (int i = 0; i < 4; i++) {
3184 s8d.data_[i].u = s8n.data_[i].u & s8m.data_[i].u; 3251 s8d.data_[i].u = s8n.data_[i].u & s8m.data_[i].u;
3185 } 3252 }
3253 } else if ((instr->Bits(7, 5) == 11) && (instr->Bit(4) == 0) &&
3254 (instr->Bits(20, 2) == 3) && (instr->Bits(23, 5) == 7) &&
3255 (instr->Bits(16, 4) == 0)) {
3256 // Format(instr, "vmvnq 'qd, 'qm");
3257 for (int i = 0; i < 4; i++) {
3258 s8d.data_[i].u = ~s8m.data_[i].u;
3259 }
3186 } else if ((instr->Bits(8, 4) == 15) && (instr->Bit(4) == 0) && 3260 } else if ((instr->Bits(8, 4) == 15) && (instr->Bit(4) == 0) &&
3187 (instr->Bits(20, 2) == 2) && (instr->Bits(23, 2) == 0)) { 3261 (instr->Bits(20, 2) == 2) && (instr->Bits(23, 2) == 0)) {
3188 // Format(instr, "vminqs 'qd, 'qn, 'qm"); 3262 // Format(instr, "vminqs 'qd, 'qn, 'qm");
3189 for (int i = 0; i < 4; i++) { 3263 for (int i = 0; i < 4; i++) {
3190 s8d.data_[i].f = 3264 s8d.data_[i].f =
3191 s8n.data_[i].f <= s8m.data_[i].f ? s8n.data_[i].f : s8m.data_[i].f; 3265 s8n.data_[i].f <= s8m.data_[i].f ? s8n.data_[i].f : s8m.data_[i].f;
3192 } 3266 }
3193 } else if ((instr->Bits(8, 4) == 15) && (instr->Bit(4) == 0) && 3267 } else if ((instr->Bits(8, 4) == 15) && (instr->Bit(4) == 0) &&
3194 (instr->Bits(20, 2) == 0) && (instr->Bits(23, 2) == 0)) { 3268 (instr->Bits(20, 2) == 0) && (instr->Bits(23, 2) == 0)) {
3195 // Format(instr, "vmaxqs 'qd, 'qn, 'qm"); 3269 // Format(instr, "vmaxqs 'qd, 'qn, 'qm");
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
3725 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); 3799 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception));
3726 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); 3800 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace));
3727 buf->Longjmp(); 3801 buf->Longjmp();
3728 } 3802 }
3729 3803
3730 } // namespace dart 3804 } // namespace dart
3731 3805
3732 #endif // !defined(HOST_ARCH_ARM) 3806 #endif // !defined(HOST_ARCH_ARM)
3733 3807
3734 #endif // defined TARGET_ARCH_ARM 3808 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698