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

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

Issue 19290006: Implements ARM SIMD multiplication and subtraction instructions. (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
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 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 " other variants are:\n" 440 " other variants are:\n"
441 " disasm <address>\n" 441 " disasm <address>\n"
442 " disasm <address> <number_of_instructions>\n" 442 " disasm <address> <number_of_instructions>\n"
443 " by default 10 instrs are disassembled\n" 443 " by default 10 instrs are disassembled\n"
444 "del -- delete breakpoints\n" 444 "del -- delete breakpoints\n"
445 "flags -- print flag values\n" 445 "flags -- print flag values\n"
446 "gdb -- transfer control to gdb\n" 446 "gdb -- transfer control to gdb\n"
447 "h/help -- print this help string\n" 447 "h/help -- print this help string\n"
448 "break <address> -- set break point at specified address\n" 448 "break <address> -- set break point at specified address\n"
449 "p/print <reg or value or *addr> -- print integer value\n" 449 "p/print <reg or value or *addr> -- print integer value\n"
450 "pf/printfloat <sreg or *addr> -- print float value\n" 450 "ps/printsingle <sreg or *addr> -- print float value\n"
451 "pd/printdouble <dreg or *addr> -- print double value\n" 451 "pd/printdouble <dreg or *addr> -- print double value\n"
452 "po/printobject <*reg or *addr> -- print object\n" 452 "po/printobject <*reg or *addr> -- print object\n"
453 "si/stepi -- single step an instruction\n" 453 "si/stepi -- single step an instruction\n"
454 "trace -- toggle execution tracing mode\n" 454 "trace -- toggle execution tracing mode\n"
455 "bt -- print backtrace\n" 455 "bt -- print backtrace\n"
456 "unstop -- if current pc is a stop instr make it a nop\n" 456 "unstop -- if current pc is a stop instr make it a nop\n"
457 "q/quit -- Quit the debugger and exit the program\n"); 457 "q/quit -- Quit the debugger and exit the program\n");
458 } else if ((strcmp(cmd, "quit") == 0) || (strcmp(cmd, "q") == 0)) { 458 } else if ((strcmp(cmd, "quit") == 0) || (strcmp(cmd, "q") == 0)) {
459 OS::Print("Quitting\n"); 459 OS::Print("Quitting\n");
460 OS::Exit(0); 460 OS::Exit(0);
461 } else if ((strcmp(cmd, "si") == 0) || (strcmp(cmd, "stepi") == 0)) { 461 } else if ((strcmp(cmd, "si") == 0) || (strcmp(cmd, "stepi") == 0)) {
462 sim_->InstructionDecode(reinterpret_cast<Instr*>(sim_->get_pc())); 462 sim_->InstructionDecode(reinterpret_cast<Instr*>(sim_->get_pc()));
463 } else if ((strcmp(cmd, "c") == 0) || (strcmp(cmd, "cont") == 0)) { 463 } else if ((strcmp(cmd, "c") == 0) || (strcmp(cmd, "cont") == 0)) {
464 // Execute the one instruction we broke at with breakpoints disabled. 464 // Execute the one instruction we broke at with breakpoints disabled.
465 sim_->InstructionDecode(reinterpret_cast<Instr*>(sim_->get_pc())); 465 sim_->InstructionDecode(reinterpret_cast<Instr*>(sim_->get_pc()));
466 // Leave the debugger shell. 466 // Leave the debugger shell.
467 done = true; 467 done = true;
468 } else if ((strcmp(cmd, "p") == 0) || (strcmp(cmd, "print") == 0)) { 468 } else if ((strcmp(cmd, "p") == 0) || (strcmp(cmd, "print") == 0)) {
469 if (args == 2) { 469 if (args == 2) {
470 uint32_t value; 470 uint32_t value;
471 if (GetValue(arg1, &value)) { 471 if (GetValue(arg1, &value)) {
472 OS::Print("%s: %u 0x%x\n", arg1, value, value); 472 OS::Print("%s: %u 0x%x\n", arg1, value, value);
473 } else { 473 } else {
474 OS::Print("%s unrecognized\n", arg1); 474 OS::Print("%s unrecognized\n", arg1);
475 } 475 }
476 } else { 476 } else {
477 OS::Print("print <reg or value or *addr>\n"); 477 OS::Print("print <reg or value or *addr>\n");
478 } 478 }
479 } else if ((strcmp(cmd, "pf") == 0) || (strcmp(cmd, "printfloat") == 0)) { 479 } else if ((strcmp(cmd, "ps") == 0) ||
480 (strcmp(cmd, "printsingle") == 0)) {
480 if (args == 2) { 481 if (args == 2) {
481 float fvalue; 482 float fvalue;
482 if (GetFValue(arg1, &fvalue)) { 483 if (GetFValue(arg1, &fvalue)) {
483 uint32_t value = bit_cast<uint32_t, float>(fvalue); 484 uint32_t value = bit_cast<uint32_t, float>(fvalue);
484 OS::Print("%s: 0%u 0x%x %.8g\n", arg1, value, value, fvalue); 485 OS::Print("%s: 0%u 0x%x %.8g\n", arg1, value, value, fvalue);
485 } else { 486 } else {
486 OS::Print("%s unrecognized\n", arg1); 487 OS::Print("%s unrecognized\n", arg1);
487 } 488 }
488 } else { 489 } else {
489 OS::Print("printfloat <sreg or *addr>\n"); 490 OS::Print("printfloat <sreg or *addr>\n");
(...skipping 2424 matching lines...) Expand 10 before | Expand all | Expand 10 after
2914 int8_t* s8n_8 = reinterpret_cast<int8_t*>(&s8n); 2915 int8_t* s8n_8 = reinterpret_cast<int8_t*>(&s8n);
2915 int8_t* s8m_8 = reinterpret_cast<int8_t*>(&s8m); 2916 int8_t* s8m_8 = reinterpret_cast<int8_t*>(&s8m);
2916 int16_t* s8d_16 = reinterpret_cast<int16_t*>(&s8d); 2917 int16_t* s8d_16 = reinterpret_cast<int16_t*>(&s8d);
2917 int16_t* s8n_16 = reinterpret_cast<int16_t*>(&s8n); 2918 int16_t* s8n_16 = reinterpret_cast<int16_t*>(&s8n);
2918 int16_t* s8m_16 = reinterpret_cast<int16_t*>(&s8m); 2919 int16_t* s8m_16 = reinterpret_cast<int16_t*>(&s8m);
2919 int64_t* s8d_64 = reinterpret_cast<int64_t*>(&s8d); 2920 int64_t* s8d_64 = reinterpret_cast<int64_t*>(&s8d);
2920 int64_t* s8n_64 = reinterpret_cast<int64_t*>(&s8n); 2921 int64_t* s8n_64 = reinterpret_cast<int64_t*>(&s8n);
2921 int64_t* s8m_64 = reinterpret_cast<int64_t*>(&s8m); 2922 int64_t* s8m_64 = reinterpret_cast<int64_t*>(&s8m);
2922 2923
2923 if ((instr->Bits(8, 4) == 8) && (instr->Bit(4) == 0) && 2924 if ((instr->Bits(8, 4) == 8) && (instr->Bit(4) == 0) &&
2924 (instr->Bit(24) == 0)) { 2925 (instr->Bits(23, 2) == 0)) {
2925 // Uses q registers. 2926 // Uses q registers.
2926 // Format(instr, "vadd.'sz 'qd, 'qn, 'qm"); 2927 // Format(instr, "vadd.'sz 'qd, 'qn, 'qm");
2927 const int size = instr->Bits(20, 2); 2928 const int size = instr->Bits(20, 2);
2928 if (size == 0) { 2929 if (size == 0) {
2929 for (int i = 0; i < 16; i++) { 2930 for (int i = 0; i < 16; i++) {
2930 s8d_8[i] = s8n_8[i] + s8m_8[i]; 2931 s8d_8[i] = s8n_8[i] + s8m_8[i];
2931 } 2932 }
2932 } else if (size == 1) { 2933 } else if (size == 1) {
2933 for (int i = 0; i < 8; i++) { 2934 for (int i = 0; i < 8; i++) {
2934 s8d_16[i] = s8n_16[i] + s8m_16[i]; 2935 s8d_16[i] = s8n_16[i] + s8m_16[i];
2935 } 2936 }
2936 } else if (size == 2) { 2937 } else if (size == 2) {
2937 for (int i = 0; i < 4; i++) { 2938 for (int i = 0; i < 4; i++) {
2938 s8d.data_[i].u = s8n.data_[i].u + s8m.data_[i].u; 2939 s8d.data_[i].u = s8n.data_[i].u + s8m.data_[i].u;
2939 } 2940 }
2940 } else if (size == 3) { 2941 } else if (size == 3) {
2941 for (int i = 0; i < 2; i++) { 2942 for (int i = 0; i < 2; i++) {
2942 s8d_64[i] = s8n_64[i] + s8m_64[i]; 2943 s8d_64[i] = s8n_64[i] + s8m_64[i];
2943 } 2944 }
2944 } else { 2945 } else {
2945 UNREACHABLE(); 2946 UNREACHABLE();
2946 } 2947 }
2947 } else if ((instr->Bits(8, 4) == 13) && (instr->Bit(4) == 0) && 2948 } else if ((instr->Bits(8, 4) == 13) && (instr->Bit(4) == 0) &&
2948 (instr->Bit(24) == 0)) { 2949 (instr->Bits(23, 2) == 0) && (instr->Bit(21) == 0)) {
2949 // Format(instr, "vadd.F32 'qd, 'qn, 'qm"); 2950 // Format(instr, "vadd.F32 'qd, 'qn, 'qm");
2950 for (int i = 0; i < 4; i++) { 2951 for (int i = 0; i < 4; i++) {
2951 s8d.data_[i].f = s8n.data_[i].f + s8m.data_[i].f; 2952 s8d.data_[i].f = s8n.data_[i].f + s8m.data_[i].f;
2952 } 2953 }
2954 } else if ((instr->Bits(8, 4) == 8) && (instr->Bit(4) == 0) &&
2955 (instr->Bits(23, 2) == 2)) {
2956 // Format(instr, "vsub.'sz 'qd, 'qn, 'qm");
2957 const int size = instr->Bits(20, 2);
2958 if (size == 0) {
2959 for (int i = 0; i < 16; i++) {
2960 s8d_8[i] = s8n_8[i] - s8m_8[i];
2961 }
2962 } else if (size == 1) {
2963 for (int i = 0; i < 8; i++) {
2964 s8d_16[i] = s8n_16[i] - s8m_16[i];
2965 }
2966 } else if (size == 2) {
2967 for (int i = 0; i < 4; i++) {
2968 s8d.data_[i].u = s8n.data_[i].u - s8m.data_[i].u;
2969 }
2970 } else if (size == 3) {
2971 for (int i = 0; i < 2; i++) {
2972 s8d_64[i] = s8n_64[i] - s8m_64[i];
2973 }
2974 } else {
2975 UNREACHABLE();
2976 }
2977 } else if ((instr->Bits(8, 4) == 13) && (instr->Bit(4) == 0) &&
2978 (instr->Bits(23, 2) == 0) && (instr->Bit(21) == 1)) {
2979 // Format(instr, "vsub.F32 'qd, 'qn, 'qm");
2980 for (int i = 0; i < 4; i++) {
2981 s8d.data_[i].f = s8n.data_[i].f - s8m.data_[i].f;
2982 }
2983 } else if ((instr->Bits(8, 4) == 9) && (instr->Bit(4) == 1) &&
2984 (instr->Bits(23, 2) == 0)) {
2985 // Format(instr, "vmul.'sz 'qd, 'qn, 'qm");
2986 const int size = instr->Bits(20, 2);
2987 if (size == 0) {
2988 for (int i = 0; i < 16; i++) {
2989 s8d_8[i] = s8n_8[i] * s8m_8[i];
2990 }
2991 } else if (size == 1) {
2992 for (int i = 0; i < 8; i++) {
2993 s8d_16[i] = s8n_16[i] * s8m_16[i];
2994 }
2995 } else if (size == 2) {
2996 for (int i = 0; i < 4; i++) {
2997 s8d.data_[i].u = s8n.data_[i].u * s8m.data_[i].u;
2998 }
2999 } else if (size == 3) {
3000 UnimplementedInstruction(instr);
3001 } else {
3002 UNREACHABLE();
3003 }
3004 } else if ((instr->Bits(8, 4) == 13) && (instr->Bit(4) == 1) &&
3005 (instr->Bits(23, 2) == 2) && (instr->Bit(21) == 0)) {
3006 // Format(instr, "vmul.F32 'qd, 'qn, 'qm");
3007 for (int i = 0; i < 4; i++) {
3008 s8d.data_[i].f = s8n.data_[i].f * s8m.data_[i].f;
3009 }
2953 } else { 3010 } else {
2954 UnimplementedInstruction(instr); 3011 UnimplementedInstruction(instr);
2955 } 3012 }
2956 3013
2957 set_qregister(qd, s8d); 3014 set_qregister(qd, s8d);
2958 } else { 3015 } else {
2959 // Q == 0, Uses 64-bit D registers. 3016 // Q == 0, Uses 64-bit D registers.
2960 UnimplementedInstruction(instr); 3017 UnimplementedInstruction(instr);
2961 } 3018 }
2962 } 3019 }
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
3196 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception)); 3253 set_register(kExceptionObjectReg, bit_cast<int32_t>(raw_exception));
3197 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace)); 3254 set_register(kStackTraceObjectReg, bit_cast<int32_t>(raw_stacktrace));
3198 buf->Longjmp(); 3255 buf->Longjmp();
3199 } 3256 }
3200 3257
3201 } // namespace dart 3258 } // namespace dart
3202 3259
3203 #endif // !defined(HOST_ARCH_ARM) 3260 #endif // !defined(HOST_ARCH_ARM)
3204 3261
3205 #endif // defined TARGET_ARCH_ARM 3262 #endif // defined TARGET_ARCH_ARM
OLDNEW
« runtime/vm/disassembler_arm.cc ('K') | « runtime/vm/disassembler_arm.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698