OLD | NEW |
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 <setjmp.h> // NOLINT | 5 #include <setjmp.h> // NOLINT |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 | 7 |
8 #include "vm/globals.h" | 8 #include "vm/globals.h" |
9 #if defined(TARGET_ARCH_ARM64) | 9 #if defined(TARGET_ARCH_ARM64) |
10 | 10 |
(...skipping 3233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3244 } | 3244 } |
3245 } | 3245 } |
3246 | 3246 |
3247 | 3247 |
3248 void Simulator::DecodeFPIntCvt(Instr* instr) { | 3248 void Simulator::DecodeFPIntCvt(Instr* instr) { |
3249 const VRegister vd = instr->VdField(); | 3249 const VRegister vd = instr->VdField(); |
3250 const VRegister vn = instr->VnField(); | 3250 const VRegister vn = instr->VnField(); |
3251 const Register rd = instr->RdField(); | 3251 const Register rd = instr->RdField(); |
3252 const Register rn = instr->RnField(); | 3252 const Register rn = instr->RnField(); |
3253 | 3253 |
3254 if ((instr->Bit(29) != 0) || (instr->Bits(22, 2) != 1) || | 3254 if (instr->Bit(29) != 0) { |
3255 ((instr->SFField() == 0) && (instr->Bits(16, 5) != 2))) { | |
3256 UnimplementedInstruction(instr); | 3255 UnimplementedInstruction(instr); |
3257 return; | 3256 return; |
3258 } | 3257 } |
3259 if (instr->Bits(16, 5) == 2) { | 3258 |
3260 // Format(instr, "scvtfd'sf 'vd, 'rn"); | 3259 if ((instr->SFField() == 0) && (instr->Bits(22, 2) == 0)) { |
3261 const int64_t rn_val64 = get_register(rn, instr->RnMode()); | 3260 if (instr->Bits(16, 5) == 6) { |
3262 const int32_t rn_val32 = get_wregister(rn, instr->RnMode()); | 3261 // Format(instr, "fmovrs'sf 'rd, 'vn"); |
3263 const double vn_dbl = (instr->SFField() == 1) | 3262 const int32_t vn_val = get_vregisters(vn, 0); |
3264 ? static_cast<double>(rn_val64) | 3263 set_wregister(rd, vn_val, R31IsZR); |
3265 : static_cast<double>(rn_val32); | 3264 } else if (instr->Bits(16, 5) == 7) { |
3266 set_vregisterd(vd, 0, bit_cast<int64_t, double>(vn_dbl)); | 3265 // Format(instr, "fmovsr'sf 'vd, 'rn"); |
3267 set_vregisterd(vd, 1, 0); | 3266 const int32_t rn_val = get_wregister(rn, R31IsZR); |
3268 } else if (instr->Bits(16, 5) == 6) { | 3267 set_vregisters(vd, 0, rn_val); |
3269 // Format(instr, "fmovrd'sf 'rd, 'vn"); | 3268 set_vregisters(vd, 1, 0); |
3270 const int64_t vn_val = get_vregisterd(vn, 0); | 3269 set_vregisters(vd, 2, 0); |
3271 set_register(instr, rd, vn_val, R31IsZR); | 3270 set_vregisters(vd, 3, 0); |
3272 } else if (instr->Bits(16, 5) == 7) { | 3271 } else { |
3273 // Format(instr, "fmovdr'sf 'vd, 'rn"); | 3272 UnimplementedInstruction(instr); |
3274 const int64_t rn_val = get_register(rn, R31IsZR); | 3273 } |
3275 set_vregisterd(vd, 0, rn_val); | 3274 } else if (instr->Bits(22, 2) == 1) { |
3276 set_vregisterd(vd, 1, 0); | 3275 if (instr->Bits(16, 5) == 2) { |
3277 } else if (instr->Bits(16, 5) == 24) { | 3276 // Format(instr, "scvtfd'sf 'vd, 'rn"); |
3278 // Format(instr, "fcvtzds'sf 'rd, 'vn"); | 3277 const int64_t rn_val64 = get_register(rn, instr->RnMode()); |
3279 const double vn_val = bit_cast<double, int64_t>(get_vregisterd(vn, 0)); | 3278 const int32_t rn_val32 = get_wregister(rn, instr->RnMode()); |
3280 set_register(instr, rd, static_cast<int64_t>(vn_val), instr->RdMode()); | 3279 const double vn_dbl = (instr->SFField() == 1) |
| 3280 ? static_cast<double>(rn_val64) |
| 3281 : static_cast<double>(rn_val32); |
| 3282 set_vregisterd(vd, 0, bit_cast<int64_t, double>(vn_dbl)); |
| 3283 set_vregisterd(vd, 1, 0); |
| 3284 } else if (instr->Bits(16, 5) == 6) { |
| 3285 // Format(instr, "fmovrd'sf 'rd, 'vn"); |
| 3286 const int64_t vn_val = get_vregisterd(vn, 0); |
| 3287 set_register(instr, rd, vn_val, R31IsZR); |
| 3288 } else if (instr->Bits(16, 5) == 7) { |
| 3289 // Format(instr, "fmovdr'sf 'vd, 'rn"); |
| 3290 const int64_t rn_val = get_register(rn, R31IsZR); |
| 3291 set_vregisterd(vd, 0, rn_val); |
| 3292 set_vregisterd(vd, 1, 0); |
| 3293 } else if (instr->Bits(16, 5) == 24) { |
| 3294 // Format(instr, "fcvtzds'sf 'rd, 'vn"); |
| 3295 const double vn_val = bit_cast<double, int64_t>(get_vregisterd(vn, 0)); |
| 3296 set_register(instr, rd, static_cast<int64_t>(vn_val), instr->RdMode()); |
| 3297 } else { |
| 3298 UnimplementedInstruction(instr); |
| 3299 } |
3281 } else { | 3300 } else { |
3282 UnimplementedInstruction(instr); | 3301 UnimplementedInstruction(instr); |
3283 } | 3302 } |
3284 } | 3303 } |
3285 | 3304 |
3286 | 3305 |
3287 void Simulator::DecodeFPOneSource(Instr* instr) { | 3306 void Simulator::DecodeFPOneSource(Instr* instr) { |
3288 const int opc = instr->Bits(15, 6); | 3307 const int opc = instr->Bits(15, 6); |
3289 const VRegister vd = instr->VdField(); | 3308 const VRegister vd = instr->VdField(); |
3290 const VRegister vn = instr->VnField(); | 3309 const VRegister vn = instr->VnField(); |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3648 set_register(NULL, CODE_REG, code); | 3667 set_register(NULL, CODE_REG, code); |
3649 set_register(NULL, PP, pp); | 3668 set_register(NULL, PP, pp); |
3650 buf->Longjmp(); | 3669 buf->Longjmp(); |
3651 } | 3670 } |
3652 | 3671 |
3653 } // namespace dart | 3672 } // namespace dart |
3654 | 3673 |
3655 #endif // !defined(USING_SIMULATOR) | 3674 #endif // !defined(USING_SIMULATOR) |
3656 | 3675 |
3657 #endif // defined TARGET_ARCH_ARM64 | 3676 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |