OLD | NEW |
---|---|
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 "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
7 | 7 |
8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
9 | 9 |
10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
(...skipping 4913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4924 const int32_t shift = | 4924 const int32_t shift = |
4925 reinterpret_cast<int32_t>(locs()->in(1).constant().raw()) >> 1; | 4925 reinterpret_cast<int32_t>(locs()->in(1).constant().raw()) >> 1; |
4926 switch (op_kind()) { | 4926 switch (op_kind()) { |
4927 case Token::kSHR: { | 4927 case Token::kSHR: { |
4928 if (shift < 32) { | 4928 if (shift < 32) { |
4929 __ sll(out_lo, left_hi, 32 - shift); | 4929 __ sll(out_lo, left_hi, 32 - shift); |
4930 __ srl(TMP, left_lo, shift); | 4930 __ srl(TMP, left_lo, shift); |
4931 __ or_(out_lo, out_lo, TMP); | 4931 __ or_(out_lo, out_lo, TMP); |
4932 __ sra(out_hi, left_hi, shift); | 4932 __ sra(out_hi, left_hi, shift); |
4933 } else { | 4933 } else { |
4934 __ sra(out_lo, left_hi, shift - 32); | 4934 if (shift == 32) { |
4935 __ mov(out_lo, left_hi); | |
4936 } else if (shift < 64) { | |
4937 __ sra(out_lo, left_hi, shift - 32); | |
4938 } else { | |
4939 __ sra(out_lo, left_hi, 31); | |
4940 } | |
4935 __ sra(out_hi, left_hi, 31); | 4941 __ sra(out_hi, left_hi, 31); |
4936 } | 4942 } |
4937 break; | 4943 break; |
4938 } | 4944 } |
4939 case Token::kSHL: { | 4945 case Token::kSHL: { |
4940 if (shift < 32) { | 4946 if (shift < 32) { |
4941 __ srl(out_hi, left_lo, 32 - shift); | 4947 __ srl(out_hi, left_lo, 32 - shift); |
4942 __ sll(TMP, left_hi, shift); | 4948 __ sll(TMP, left_hi, shift); |
4943 __ or_(out_hi, out_hi, TMP); | 4949 __ or_(out_hi, out_hi, TMP); |
4944 __ sll(out_lo, left_lo, shift); | 4950 __ sll(out_lo, left_lo, shift); |
4945 } else { | 4951 } else { |
4946 __ sll(out_hi, left_lo, shift - 32); | 4952 __ sll(out_hi, left_lo, shift - 32); |
regis
2015/10/06 17:37:24
ditto
| |
4947 __ mov(out_lo, ZR); | 4953 __ mov(out_lo, ZR); |
4948 } | 4954 } |
4949 // Check for overflow. | 4955 // Check for overflow. |
4950 if (can_overflow()) { | 4956 if (can_overflow()) { |
4951 // Compare high word from input with shifted high word from output. | 4957 // Compare high word from input with shifted high word from output. |
4952 // Overflow if they aren't equal. | 4958 // Overflow if they aren't equal. |
4953 // If shift > 32, also compare low word from input with high word from | 4959 // If shift > 32, also compare low word from input with high word from |
4954 // output shifted back shift - 32. | 4960 // output shifted back shift - 32. |
4955 if (shift > 32) { | 4961 if (shift > 32) { |
4956 __ sra(TMP, out_hi, shift - 32); | 4962 __ sra(TMP, out_hi, shift - 32); |
regis
2015/10/06 17:37:24
ditto
| |
4957 __ bne(left_lo, TMP, deopt); | 4963 __ bne(left_lo, TMP, deopt); |
4958 __ delay_slot()->sra(TMP, out_hi, 31); | 4964 __ delay_slot()->sra(TMP, out_hi, 31); |
4959 } else if (shift == 32) { | 4965 } else if (shift == 32) { |
4960 __ sra(TMP, out_hi, 31); | 4966 __ sra(TMP, out_hi, 31); |
4961 } else { | 4967 } else { |
4962 __ sra(TMP, out_hi, shift); | 4968 __ sra(TMP, out_hi, shift); |
4963 } | 4969 } |
4964 __ bne(left_hi, TMP, deopt); | 4970 __ bne(left_hi, TMP, deopt); |
4965 } | 4971 } |
4966 break; | 4972 break; |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5596 1, | 5602 1, |
5597 locs()); | 5603 locs()); |
5598 __ lw(result, Address(SP, 1 * kWordSize)); | 5604 __ lw(result, Address(SP, 1 * kWordSize)); |
5599 __ addiu(SP, SP, Immediate(2 * kWordSize)); | 5605 __ addiu(SP, SP, Immediate(2 * kWordSize)); |
5600 } | 5606 } |
5601 | 5607 |
5602 | 5608 |
5603 } // namespace dart | 5609 } // namespace dart |
5604 | 5610 |
5605 #endif // defined TARGET_ARCH_MIPS | 5611 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |