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

Side by Side Diff: src/arm/simulator-arm.cc

Issue 6905098: ARM: Support hardfloat in SCons build and make it a build time setting (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added CAN_USE_VFP_INSTRUCTIONS when hardfloat is used Created 9 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 | « src/arm/simulator-arm.h ('k') | src/flag-definitions.h » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 994 matching lines...) Expand 10 before | Expand all | Expand 10 after
1005 char buffer[2 * sizeof(vfp_register[0])]; 1005 char buffer[2 * sizeof(vfp_register[0])];
1006 memcpy(buffer, &vfp_register[2 * dreg], 2 * sizeof(vfp_register[0])); 1006 memcpy(buffer, &vfp_register[2 * dreg], 2 * sizeof(vfp_register[0]));
1007 memcpy(&dm_val, buffer, 2 * sizeof(vfp_register[0])); 1007 memcpy(&dm_val, buffer, 2 * sizeof(vfp_register[0]));
1008 return(dm_val); 1008 return(dm_val);
1009 } 1009 }
1010 1010
1011 1011
1012 // For use in calls that take two double values, constructed either 1012 // For use in calls that take two double values, constructed either
1013 // from r0-r3 or d0 and d1. 1013 // from r0-r3 or d0 and d1.
1014 void Simulator::GetFpArgs(double* x, double* y) { 1014 void Simulator::GetFpArgs(double* x, double* y) {
1015 if (FLAG_hardfloat) { 1015 if (use_eabi_hardfloat()) {
1016 *x = vfp_register[0]; 1016 *x = vfp_register[0];
1017 *y = vfp_register[1]; 1017 *y = vfp_register[1];
1018 } else { 1018 } else {
1019 // We use a char buffer to get around the strict-aliasing rules which 1019 // We use a char buffer to get around the strict-aliasing rules which
1020 // otherwise allow the compiler to optimize away the copy. 1020 // otherwise allow the compiler to optimize away the copy.
1021 char buffer[2 * sizeof(registers_[0])]; 1021 char buffer[2 * sizeof(registers_[0])];
1022 // Registers 0 and 1 -> x. 1022 // Registers 0 and 1 -> x.
1023 memcpy(buffer, registers_, sizeof(buffer)); 1023 memcpy(buffer, registers_, sizeof(buffer));
1024 memcpy(x, buffer, sizeof(buffer)); 1024 memcpy(x, buffer, sizeof(buffer));
1025 // Registers 2 and 3 -> y. 1025 // Registers 2 and 3 -> y.
1026 memcpy(buffer, registers_ + 2, sizeof(buffer)); 1026 memcpy(buffer, registers_ + 2, sizeof(buffer));
1027 memcpy(y, buffer, sizeof(buffer)); 1027 memcpy(y, buffer, sizeof(buffer));
1028 } 1028 }
1029 } 1029 }
1030 1030
1031 // For use in calls that take one double value, constructed either 1031 // For use in calls that take one double value, constructed either
1032 // from r0 and r1 or d0. 1032 // from r0 and r1 or d0.
1033 void Simulator::GetFpArgs(double* x) { 1033 void Simulator::GetFpArgs(double* x) {
1034 if (FLAG_hardfloat) { 1034 if (use_eabi_hardfloat()) {
1035 *x = vfp_register[0]; 1035 *x = vfp_register[0];
1036 } else { 1036 } else {
1037 // We use a char buffer to get around the strict-aliasing rules which 1037 // We use a char buffer to get around the strict-aliasing rules which
1038 // otherwise allow the compiler to optimize away the copy. 1038 // otherwise allow the compiler to optimize away the copy.
1039 char buffer[2 * sizeof(registers_[0])]; 1039 char buffer[2 * sizeof(registers_[0])];
1040 // Registers 0 and 1 -> x. 1040 // Registers 0 and 1 -> x.
1041 memcpy(buffer, registers_, sizeof(buffer)); 1041 memcpy(buffer, registers_, sizeof(buffer));
1042 memcpy(x, buffer, sizeof(buffer)); 1042 memcpy(x, buffer, sizeof(buffer));
1043 } 1043 }
1044 } 1044 }
1045 1045
1046 1046
1047 // For use in calls that take two double values, constructed either 1047 // For use in calls that take two double values, constructed either
1048 // from r0-r3 or d0 and d1. 1048 // from r0-r3 or d0 and d1.
1049 void Simulator::GetFpArgs(double* x, int32_t* y) { 1049 void Simulator::GetFpArgs(double* x, int32_t* y) {
1050 if (FLAG_hardfloat) { 1050 if (use_eabi_hardfloat()) {
1051 *x = vfp_register[0]; 1051 *x = vfp_register[0];
1052 *y = registers_[1]; 1052 *y = registers_[1];
1053 } else { 1053 } else {
1054 // We use a char buffer to get around the strict-aliasing rules which 1054 // We use a char buffer to get around the strict-aliasing rules which
1055 // otherwise allow the compiler to optimize away the copy. 1055 // otherwise allow the compiler to optimize away the copy.
1056 char buffer[2 * sizeof(registers_[0])]; 1056 char buffer[2 * sizeof(registers_[0])];
1057 // Registers 0 and 1 -> x. 1057 // Registers 0 and 1 -> x.
1058 memcpy(buffer, registers_, sizeof(buffer)); 1058 memcpy(buffer, registers_, sizeof(buffer));
1059 memcpy(x, buffer, sizeof(buffer)); 1059 memcpy(x, buffer, sizeof(buffer));
1060 // Registers 2 and 3 -> y. 1060 // Registers 2 and 3 -> y.
1061 memcpy(buffer, registers_ + 2, sizeof(buffer)); 1061 memcpy(buffer, registers_ + 2, sizeof(buffer));
1062 memcpy(y, buffer, sizeof(buffer)); 1062 memcpy(y, buffer, sizeof(buffer));
1063 } 1063 }
1064 } 1064 }
1065 1065
1066 1066
1067 // The return value is either in r0/r1 or d0. 1067 // The return value is either in r0/r1 or d0.
1068 void Simulator::SetFpResult(const double& result) { 1068 void Simulator::SetFpResult(const double& result) {
1069 if (FLAG_hardfloat) { 1069 if (use_eabi_hardfloat()) {
1070 char buffer[2 * sizeof(vfp_register[0])]; 1070 char buffer[2 * sizeof(vfp_register[0])];
1071 memcpy(buffer, &result, sizeof(buffer)); 1071 memcpy(buffer, &result, sizeof(buffer));
1072 // Copy result to d0. 1072 // Copy result to d0.
1073 memcpy(vfp_register, buffer, sizeof(buffer)); 1073 memcpy(vfp_register, buffer, sizeof(buffer));
1074 } else { 1074 } else {
1075 char buffer[2 * sizeof(registers_[0])]; 1075 char buffer[2 * sizeof(registers_[0])];
1076 memcpy(buffer, &result, sizeof(buffer)); 1076 memcpy(buffer, &result, sizeof(buffer));
1077 // Copy result to r0 and r1. 1077 // Copy result to r0 and r1.
1078 memcpy(registers_, buffer, sizeof(buffer)); 1078 memcpy(registers_, buffer, sizeof(buffer));
1079 } 1079 }
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
1731 int32_t arg2 = get_register(r2); 1731 int32_t arg2 = get_register(r2);
1732 int32_t arg3 = get_register(r3); 1732 int32_t arg3 = get_register(r3);
1733 int32_t* stack_pointer = reinterpret_cast<int32_t*>(get_register(sp)); 1733 int32_t* stack_pointer = reinterpret_cast<int32_t*>(get_register(sp));
1734 int32_t arg4 = stack_pointer[0]; 1734 int32_t arg4 = stack_pointer[0];
1735 int32_t arg5 = stack_pointer[1]; 1735 int32_t arg5 = stack_pointer[1];
1736 bool fp_call = 1736 bool fp_call =
1737 (redirection->type() == ExternalReference::BUILTIN_FP_FP_CALL) || 1737 (redirection->type() == ExternalReference::BUILTIN_FP_FP_CALL) ||
1738 (redirection->type() == ExternalReference::BUILTIN_COMPARE_CALL) || 1738 (redirection->type() == ExternalReference::BUILTIN_COMPARE_CALL) ||
1739 (redirection->type() == ExternalReference::BUILTIN_FP_CALL) || 1739 (redirection->type() == ExternalReference::BUILTIN_FP_CALL) ||
1740 (redirection->type() == ExternalReference::BUILTIN_FP_INT_CALL); 1740 (redirection->type() == ExternalReference::BUILTIN_FP_INT_CALL);
1741 if (FLAG_hardfloat) { 1741 if (use_eabi_hardfloat()) {
1742 // With the hard floating point calling convention, double 1742 // With the hard floating point calling convention, double
1743 // arguments are passed in VFP registers. Fetch the arguments 1743 // arguments are passed in VFP registers. Fetch the arguments
1744 // from there and call the builtin using soft floating point 1744 // from there and call the builtin using soft floating point
1745 // convention. 1745 // convention.
1746 switch (redirection->type()) { 1746 switch (redirection->type()) {
1747 case ExternalReference::BUILTIN_FP_FP_CALL: 1747 case ExternalReference::BUILTIN_FP_FP_CALL:
1748 case ExternalReference::BUILTIN_COMPARE_CALL: 1748 case ExternalReference::BUILTIN_COMPARE_CALL:
1749 arg0 = vfp_register[0]; 1749 arg0 = vfp_register[0];
1750 arg1 = vfp_register[1]; 1750 arg1 = vfp_register[1];
1751 arg2 = vfp_register[2]; 1751 arg2 = vfp_register[2];
(...skipping 1653 matching lines...) Expand 10 before | Expand all | Expand 10 after
3405 uintptr_t address = *stack_slot; 3405 uintptr_t address = *stack_slot;
3406 set_register(sp, current_sp + sizeof(uintptr_t)); 3406 set_register(sp, current_sp + sizeof(uintptr_t));
3407 return address; 3407 return address;
3408 } 3408 }
3409 3409
3410 } } // namespace v8::internal 3410 } } // namespace v8::internal
3411 3411
3412 #endif // USE_SIMULATOR 3412 #endif // USE_SIMULATOR
3413 3413
3414 #endif // V8_TARGET_ARCH_ARM 3414 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/simulator-arm.h ('k') | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698