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

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

Issue 19776007: Enables a SIMD test for ARM. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 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_arm.cc ('k') | tests/lib/lib.status » ('j') | 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 2989 matching lines...) Expand 10 before | Expand all | Expand 10 after
3000 UnimplementedInstruction(instr); 3000 UnimplementedInstruction(instr);
3001 } else { 3001 } else {
3002 UNREACHABLE(); 3002 UNREACHABLE();
3003 } 3003 }
3004 } else if ((instr->Bits(8, 4) == 13) && (instr->Bit(4) == 1) && 3004 } else if ((instr->Bits(8, 4) == 13) && (instr->Bit(4) == 1) &&
3005 (instr->Bits(23, 2) == 2) && (instr->Bit(21) == 0)) { 3005 (instr->Bits(23, 2) == 2) && (instr->Bit(21) == 0)) {
3006 // Format(instr, "vmul.F32 'qd, 'qn, 'qm"); 3006 // Format(instr, "vmul.F32 'qd, 'qn, 'qm");
3007 for (int i = 0; i < 4; i++) { 3007 for (int i = 0; i < 4; i++) {
3008 s8d.data_[i].f = s8n.data_[i].f * s8m.data_[i].f; 3008 s8d.data_[i].f = s8n.data_[i].f * s8m.data_[i].f;
3009 } 3009 }
3010 } else if ((instr->Bits(8, 4) == 1) && (instr->Bit(4) == 1) &&
3011 (instr->Bits(20, 2) == 0) && (instr->Bits(23, 2) == 2)) {
3012 // Format(instr, "veorq 'qd, 'qn, 'qm");
3013 for (int i = 0; i < 4; i++) {
3014 s8d.data_[i].u = s8n.data_[i].u ^ s8m.data_[i].u;
3015 }
3016 } else if ((instr->Bits(8, 4) == 1) && (instr->Bit(4) == 1) &&
3017 (instr->Bits(20, 2) == 2) && (instr->Bits(23, 2) == 0)) {
3018 if (qm == qn) {
3019 // Format(instr, "vmovq 'qd, 'qm");
3020 for (int i = 0; i < 4; i++) {
3021 s8d.data_[i].u = s8m.data_[i].u;
3022 }
3023 } else {
3024 // Format(instr, "vorrq 'qd, 'qm");
3025 for (int i = 0; i < 4; i++) {
3026 s8d.data_[i].u = s8n.data_[i].u | s8m.data_[i].u;
3027 }
3028 }
3029 } else if ((instr->Bits(8, 4) == 12) && (instr->Bit(4) == 0) &&
3030 (instr->Bits(20, 2) == 3) && (instr->Bits(23, 2) == 3) &&
3031 (instr->Bit(7) == 0)) {
3032 DRegister dm = instr->DmField();
3033 int64_t dm_value = get_dregister_bits(dm);
3034 int32_t imm4 = instr->Bits(16, 4);
3035 int32_t idx;
3036 if ((imm4 & 1) != 0) {
3037 // Format(instr, "vdupb 'qd, 'dm['imm4_vdup]");
3038 int8_t* dm_b = reinterpret_cast<int8_t*>(&dm_value);
3039 idx = imm4 >> 1;
3040 for (int i = 0; i < 16; i++) {
3041 s8d_8[i] = dm_b[idx];
3042 }
3043 } else if ((imm4 & 2) != 0) {
3044 // Format(instr, "vduph 'qd, 'dm['imm4_vdup]");
3045 int16_t* dm_h = reinterpret_cast<int16_t*>(&dm_value);
3046 idx = imm4 >> 2;
3047 for (int i = 0; i < 8; i++) {
3048 s8d_16[i] = dm_h[idx];
3049 }
3050 } else if ((imm4 & 4) != 0) {
3051 // Format(instr, "vdupw 'qd, 'dm['imm4_vdup]");
3052 int32_t* dm_w = reinterpret_cast<int32_t*>(&dm_value);
3053 idx = imm4 >> 3;
3054 for (int i = 0; i < 4; i++) {
3055 s8d.data_[i].u = dm_w[idx];
3056 }
3057 } else {
3058 UnimplementedInstruction(instr);
3059 }
3010 } else { 3060 } else {
3011 UnimplementedInstruction(instr); 3061 UnimplementedInstruction(instr);
3012 } 3062 }
3013 3063
3014 set_qregister(qd, s8d); 3064 set_qregister(qd, s8d);
3015 } else { 3065 } else {
3016 // Q == 0, Uses 64-bit D registers. 3066 // Q == 0, Uses 64-bit D registers.
3017 if ((instr->Bits(23, 2) == 3) && (instr->Bits(20, 2) == 3) && 3067 if ((instr->Bits(23, 2) == 3) && (instr->Bits(20, 2) == 3) &&
3018 (instr->Bits(10, 2) == 2) && (instr->Bit(4) == 0)) { 3068 (instr->Bits(10, 2) == 2) && (instr->Bit(4) == 0)) {
3019 // Format(instr, "vtbl 'dd, 'dtbllist, 'dm"); 3069 // Format(instr, "vtbl 'dd, 'dtbllist, 'dm");
3020 DRegister dd = instr->DdField(); 3070 DRegister dd = instr->DdField();
3021 DRegister dm = instr->DmField(); 3071 DRegister dm = instr->DmField();
3022 int reg_count = instr->Bits(8, 2) + 1; 3072 int reg_count = instr->Bits(8, 2) + 1;
3023 int start = (instr->Bit(7) << 4) | instr->Bits(16, 4); 3073 int start = (instr->Bit(7) << 4) | instr->Bits(16, 4);
3024 int64_t table[4]; 3074 int64_t table[4];
3025 3075
3026 for (int i = 0; i < reg_count; i++) { 3076 for (int i = 0; i < reg_count; i++) {
3027 DRegister d = static_cast<DRegister>(start + i); 3077 DRegister d = static_cast<DRegister>(start + i);
3028 table[i] = get_dregister_bits(d); 3078 table[i] = get_dregister_bits(d);
3029 } 3079 }
3030 for (int i = reg_count; i < 4; i++) { 3080 for (int i = reg_count; i < 4; i++) {
3031 table[i] = 0; 3081 table[i] = 0;
3032 } 3082 }
3033 3083
3034
3035 int64_t dm_value = get_dregister_bits(dm); 3084 int64_t dm_value = get_dregister_bits(dm);
3036 int64_t result; 3085 int64_t result;
3037 int8_t* dm_bytes = reinterpret_cast<int8_t*>(&dm_value); 3086 int8_t* dm_bytes = reinterpret_cast<int8_t*>(&dm_value);
3038 int8_t* result_bytes = reinterpret_cast<int8_t*>(&result); 3087 int8_t* result_bytes = reinterpret_cast<int8_t*>(&result);
3039 int8_t* table_bytes = reinterpret_cast<int8_t*>(&table[0]); 3088 int8_t* table_bytes = reinterpret_cast<int8_t*>(&table[0]);
3040 for (int i = 0; i < 8; i++) { 3089 for (int i = 0; i < 8; i++) {
3041 int idx = dm_bytes[i]; 3090 int idx = dm_bytes[i];
3042 if ((idx >= 0) && (idx < 256)) { 3091 if ((idx >= 0) && (idx < 256)) {
3043 result_bytes[i] = table_bytes[idx]; 3092 result_bytes[i] = table_bytes[idx];
3044 } else { 3093 } else {
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
3288 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); 3337 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception));
3289 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); 3338 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace));
3290 buf->Longjmp(); 3339 buf->Longjmp();
3291 } 3340 }
3292 3341
3293 } // namespace dart 3342 } // namespace dart
3294 3343
3295 #endif // !defined(HOST_ARCH_ARM) 3344 #endif // !defined(HOST_ARCH_ARM)
3296 3345
3297 #endif // defined TARGET_ARCH_ARM 3346 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_arm.cc ('k') | tests/lib/lib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698