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

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

Issue 267283004: Adds unary double operations to ARM64, enables many tests. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 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_arm64.cc ('k') | runtime/vm/stub_code_arm64.cc » ('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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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_ARM64) 10 #if defined(TARGET_ARCH_ARM64)
(...skipping 1167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1178 arguments.argv_ = reinterpret_cast<RawObject*(*)[]>(get_register(R2)); 1178 arguments.argv_ = reinterpret_cast<RawObject*(*)[]>(get_register(R2));
1179 arguments.retval_ = reinterpret_cast<RawObject**>(get_register(R3)); 1179 arguments.retval_ = reinterpret_cast<RawObject**>(get_register(R3));
1180 SimulatorRuntimeCall target = 1180 SimulatorRuntimeCall target =
1181 reinterpret_cast<SimulatorRuntimeCall>(external); 1181 reinterpret_cast<SimulatorRuntimeCall>(external);
1182 target(arguments); 1182 target(arguments);
1183 set_register(R0, icount_); // Zap result register from void function. 1183 set_register(R0, icount_); // Zap result register from void function.
1184 set_register(R1, icount_); 1184 set_register(R1, icount_);
1185 } else if (redirection->call_kind() == kLeafRuntimeCall) { 1185 } else if (redirection->call_kind() == kLeafRuntimeCall) {
1186 ASSERT((0 <= redirection->argument_count()) && 1186 ASSERT((0 <= redirection->argument_count()) &&
1187 (redirection->argument_count() <= 8)); 1187 (redirection->argument_count() <= 8));
1188 int64_t r0 = get_register(R0);
1189 int64_t r1 = get_register(R1);
1190 int64_t r2 = get_register(R2);
1191 int64_t r3 = get_register(R3);
1192 int64_t r4 = get_register(R4);
1193 int64_t r5 = get_register(R5);
1194 int64_t r6 = get_register(R6);
1195 int64_t r7 = get_register(R7);
1196 SimulatorLeafRuntimeCall target = 1188 SimulatorLeafRuntimeCall target =
1197 reinterpret_cast<SimulatorLeafRuntimeCall>(external); 1189 reinterpret_cast<SimulatorLeafRuntimeCall>(external);
1198 r0 = target(r0, r1, r2, r3, r4, r5, r6, r7); 1190 const int64_t r0 = get_register(R0);
1199 set_register(R0, r0); // Set returned result from function. 1191 const int64_t r1 = get_register(R1);
1192 const int64_t r2 = get_register(R2);
1193 const int64_t r3 = get_register(R3);
1194 const int64_t r4 = get_register(R4);
1195 const int64_t r5 = get_register(R5);
1196 const int64_t r6 = get_register(R6);
1197 const int64_t r7 = get_register(R7);
1198 const int64_t res = target(r0, r1, r2, r3, r4, r5, r6, r7);
1199 set_register(R0, res); // Set returned result from function.
1200 set_register(R1, icount_); // Zap unused result register. 1200 set_register(R1, icount_); // Zap unused result register.
1201 } else if (redirection->call_kind() == kLeafFloatRuntimeCall) { 1201 } else if (redirection->call_kind() == kLeafFloatRuntimeCall) {
1202 // TODO(zra): leaf float runtime calls. 1202 ASSERT((0 <= redirection->argument_count()) &&
1203 UNIMPLEMENTED(); 1203 (redirection->argument_count() <= 8));
1204 SimulatorLeafFloatRuntimeCall target =
1205 reinterpret_cast<SimulatorLeafFloatRuntimeCall>(external);
1206 const double d0 = bit_cast<double, int64_t>(get_vregisterd(V0));
1207 const double d1 = bit_cast<double, int64_t>(get_vregisterd(V1));
1208 const double d2 = bit_cast<double, int64_t>(get_vregisterd(V2));
1209 const double d3 = bit_cast<double, int64_t>(get_vregisterd(V3));
1210 const double d4 = bit_cast<double, int64_t>(get_vregisterd(V4));
1211 const double d5 = bit_cast<double, int64_t>(get_vregisterd(V5));
1212 const double d6 = bit_cast<double, int64_t>(get_vregisterd(V6));
1213 const double d7 = bit_cast<double, int64_t>(get_vregisterd(V7));
1214 const double res = target(d0, d1, d2, d3, d4, d5, d6, d7);
1215 set_vregisterd(V0, bit_cast<int64_t, double>(res));
1204 } else if (redirection->call_kind() == kBootstrapNativeCall) { 1216 } else if (redirection->call_kind() == kBootstrapNativeCall) {
1205 NativeArguments* arguments; 1217 NativeArguments* arguments;
1206 arguments = reinterpret_cast<NativeArguments*>(get_register(R0)); 1218 arguments = reinterpret_cast<NativeArguments*>(get_register(R0));
1207 SimulatorBootstrapNativeCall target = 1219 SimulatorBootstrapNativeCall target =
1208 reinterpret_cast<SimulatorBootstrapNativeCall>(external); 1220 reinterpret_cast<SimulatorBootstrapNativeCall>(external);
1209 target(arguments); 1221 target(arguments);
1210 set_register(R0, icount_); // Zap result register from void function. 1222 set_register(R0, icount_); // Zap result register from void function.
1211 } else { 1223 } else {
1212 ASSERT(redirection->call_kind() == kNativeCall); 1224 ASSERT(redirection->call_kind() == kNativeCall);
1213 NativeArguments* arguments; 1225 NativeArguments* arguments;
(...skipping 855 matching lines...) Expand 10 before | Expand all | Expand 10 after
2069 } else { 2081 } else {
2070 UnimplementedInstruction(instr); 2082 UnimplementedInstruction(instr);
2071 } 2083 }
2072 } 2084 }
2073 2085
2074 2086
2075 void Simulator::DecodeFPOneSource(Instr* instr) { 2087 void Simulator::DecodeFPOneSource(Instr* instr) {
2076 const int opc = instr->Bits(15, 2); 2088 const int opc = instr->Bits(15, 2);
2077 const VRegister vd = instr->VdField(); 2089 const VRegister vd = instr->VdField();
2078 const VRegister vn = instr->VnField(); 2090 const VRegister vn = instr->VnField();
2091 const int64_t vn_val = get_vregisterd(vn);
2092 const double vn_dbl = bit_cast<double, int64_t>(vn_val);
2093
2094 int64_t res_val = 0;
2079 switch (opc) { 2095 switch (opc) {
2080 case 0: 2096 case 0:
2081 // Format("fmovdd 'vd, 'vn"); 2097 // Format("fmovdd 'vd, 'vn");
2082 set_vregisterd(vd, get_vregisterd(vn)); 2098 res_val = get_vregisterd(vn);
2099 break;
2100 case 1:
2101 // Format("fabsd 'vd, 'vn");
2102 res_val = bit_cast<int64_t, double>(fabs(vn_dbl));
2103 break;
2104 case 2:
2105 // Format("fnegd 'vd, 'vn");
2106 res_val = bit_cast<int64_t, double>(-vn_dbl);
2107 break;
2108 case 3:
2109 // Format("fsqrtd 'vd, 'vn");
2110 res_val = bit_cast<int64_t, double>(sqrt(vn_dbl));
2083 break; 2111 break;
2084 default: 2112 default:
2085 UnimplementedInstruction(instr); 2113 UNREACHABLE();
2086 break; 2114 break;
2087 } 2115 }
2116
2117 set_vregisterd(vd, res_val);
2088 } 2118 }
2089 2119
2090 2120
2091 void Simulator::DecodeFPTwoSource(Instr* instr) { 2121 void Simulator::DecodeFPTwoSource(Instr* instr) {
2092 if (instr->Bits(22, 2) != 1) { 2122 if (instr->Bits(22, 2) != 1) {
2093 UnimplementedInstruction(instr); 2123 UnimplementedInstruction(instr);
2094 return; 2124 return;
2095 } 2125 }
2096 const VRegister vd = instr->VdField(); 2126 const VRegister vd = instr->VdField();
2097 const VRegister vn = instr->VnField(); 2127 const VRegister vn = instr->VnField();
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
2381 set_register(kExceptionObjectReg, bit_cast<int64_t>(raw_exception)); 2411 set_register(kExceptionObjectReg, bit_cast<int64_t>(raw_exception));
2382 set_register(kStackTraceObjectReg, bit_cast<int64_t>(raw_stacktrace)); 2412 set_register(kStackTraceObjectReg, bit_cast<int64_t>(raw_stacktrace));
2383 buf->Longjmp(); 2413 buf->Longjmp();
2384 } 2414 }
2385 2415
2386 } // namespace dart 2416 } // namespace dart
2387 2417
2388 #endif // !defined(HOST_ARCH_ARM64) 2418 #endif // !defined(HOST_ARCH_ARM64)
2389 2419
2390 #endif // defined TARGET_ARCH_ARM64 2420 #endif // defined TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_arm64.cc ('k') | runtime/vm/stub_code_arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698