| 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 "vm/globals.h" // NOLINT | 5 #include "vm/globals.h" // NOLINT |
| 6 #if defined(TARGET_ARCH_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/cpu.h" | 9 #include "vm/cpu.h" |
| 10 #include "vm/longjump.h" | 10 #include "vm/longjump.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 int count = 0; | 174 int count = 0; |
| 175 do { | 175 do { |
| 176 count++; | 176 count++; |
| 177 } while (value >>= 1); | 177 } while (value >>= 1); |
| 178 return width - count; | 178 return width - count; |
| 179 } | 179 } |
| 180 | 180 |
| 181 | 181 |
| 182 static int CountOneBits(uint64_t value, int width) { | 182 static int CountOneBits(uint64_t value, int width) { |
| 183 // Mask out unused bits to ensure that they are not counted. | 183 // Mask out unused bits to ensure that they are not counted. |
| 184 value &= (0xffffffffffffffffUL >> (64 - width)); | 184 value &= (0xffffffffffffffffULL >> (64 - width)); |
| 185 | 185 |
| 186 value = ((value >> 1) & 0x5555555555555555) + (value & 0x5555555555555555); | 186 value = ((value >> 1) & 0x5555555555555555) + (value & 0x5555555555555555); |
| 187 value = ((value >> 2) & 0x3333333333333333) + (value & 0x3333333333333333); | 187 value = ((value >> 2) & 0x3333333333333333) + (value & 0x3333333333333333); |
| 188 value = ((value >> 4) & 0x0f0f0f0f0f0f0f0f) + (value & 0x0f0f0f0f0f0f0f0f); | 188 value = ((value >> 4) & 0x0f0f0f0f0f0f0f0f) + (value & 0x0f0f0f0f0f0f0f0f); |
| 189 value = ((value >> 8) & 0x00ff00ff00ff00ff) + (value & 0x00ff00ff00ff00ff); | 189 value = ((value >> 8) & 0x00ff00ff00ff00ff) + (value & 0x00ff00ff00ff00ff); |
| 190 value = ((value >> 16) & 0x0000ffff0000ffff) + (value & 0x0000ffff0000ffff); | 190 value = ((value >> 16) & 0x0000ffff0000ffff) + (value & 0x0000ffff0000ffff); |
| 191 value = ((value >> 32) & 0x00000000ffffffff) + (value & 0x00000000ffffffff); | 191 value = ((value >> 32) & 0x00000000ffffffff) + (value & 0x00000000ffffffff); |
| 192 | 192 |
| 193 return value; | 193 return value; |
| 194 } | 194 } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 // 4. If the sum of leading ones, trailing ones and unset bits in the | 275 // 4. If the sum of leading ones, trailing ones and unset bits in the |
| 276 // value is equal to the bit width of the value, it can be encoded. | 276 // value is equal to the bit width of the value, it can be encoded. |
| 277 if (lead_one + trail_one + (width - set_bits) == width) { | 277 if (lead_one + trail_one + (width - set_bits) == width) { |
| 278 *imm_op = Operand(n, imm_s, imm_r); | 278 *imm_op = Operand(n, imm_s, imm_r); |
| 279 return true; | 279 return true; |
| 280 } | 280 } |
| 281 | 281 |
| 282 // 5. If the most-significant half of the bitwise value is equal to the | 282 // 5. If the most-significant half of the bitwise value is equal to the |
| 283 // least-significant half, return to step 2 using the least-significant | 283 // least-significant half, return to step 2 using the least-significant |
| 284 // half of the value. | 284 // half of the value. |
| 285 uint64_t mask = (1UL << (width >> 1)) - 1; | 285 uint64_t mask = (1ULL << (width >> 1)) - 1; |
| 286 if ((value & mask) == ((value >> (width >> 1)) & mask)) { | 286 if ((value & mask) == ((value >> (width >> 1)) & mask)) { |
| 287 width >>= 1; | 287 width >>= 1; |
| 288 set_bits >>= 1; | 288 set_bits >>= 1; |
| 289 imm_s_fixed >>= 1; | 289 imm_s_fixed >>= 1; |
| 290 continue; | 290 continue; |
| 291 } | 291 } |
| 292 | 292 |
| 293 // 6. Otherwise, the value can't be encoded. | 293 // 6. Otherwise, the value can't be encoded. |
| 294 return false; | 294 return false; |
| 295 } | 295 } |
| (...skipping 1275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1571 str(tmp, Address(addr, 7), kUnsignedByte); | 1571 str(tmp, Address(addr, 7), kUnsignedByte); |
| 1572 if (sz == kDoubleWord) { | 1572 if (sz == kDoubleWord) { |
| 1573 return; | 1573 return; |
| 1574 } | 1574 } |
| 1575 UNIMPLEMENTED(); | 1575 UNIMPLEMENTED(); |
| 1576 } | 1576 } |
| 1577 | 1577 |
| 1578 } // namespace dart | 1578 } // namespace dart |
| 1579 | 1579 |
| 1580 #endif // defined TARGET_ARCH_ARM64 | 1580 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |