OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <assert.h> // For assert | 5 #include <assert.h> // For assert |
6 #include <limits.h> // For LONG_MIN, LONG_MAX. | 6 #include <limits.h> // For LONG_MIN, LONG_MAX. |
7 | 7 |
8 #if V8_TARGET_ARCH_PPC | 8 #if V8_TARGET_ARCH_PPC |
9 | 9 |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 3311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3322 | 3322 |
3323 ShiftRightImm(scratch, length, Operand(kPointerSizeLog2)); | 3323 ShiftRightImm(scratch, length, Operand(kPointerSizeLog2)); |
3324 cmpi(scratch, Operand::Zero()); | 3324 cmpi(scratch, Operand::Zero()); |
3325 beq(&byte_loop); | 3325 beq(&byte_loop); |
3326 | 3326 |
3327 mtctr(scratch); | 3327 mtctr(scratch); |
3328 bind(&word_loop); | 3328 bind(&word_loop); |
3329 LoadP(scratch, MemOperand(src)); | 3329 LoadP(scratch, MemOperand(src)); |
3330 addi(src, src, Operand(kPointerSize)); | 3330 addi(src, src, Operand(kPointerSize)); |
3331 subi(length, length, Operand(kPointerSize)); | 3331 subi(length, length, Operand(kPointerSize)); |
3332 if (CpuFeatures::IsSupported(UNALIGNED_ACCESSES)) { | 3332 |
3333 // currently false for PPC - but possible future opt | 3333 StoreP(scratch, MemOperand(dst)); |
3334 StoreP(scratch, MemOperand(dst)); | 3334 addi(dst, dst, Operand(kPointerSize)); |
3335 addi(dst, dst, Operand(kPointerSize)); | |
3336 } else { | |
3337 #if V8_TARGET_LITTLE_ENDIAN | |
3338 stb(scratch, MemOperand(dst, 0)); | |
3339 ShiftRightImm(scratch, scratch, Operand(8)); | |
3340 stb(scratch, MemOperand(dst, 1)); | |
3341 ShiftRightImm(scratch, scratch, Operand(8)); | |
3342 stb(scratch, MemOperand(dst, 2)); | |
3343 ShiftRightImm(scratch, scratch, Operand(8)); | |
3344 stb(scratch, MemOperand(dst, 3)); | |
3345 #if V8_TARGET_ARCH_PPC64 | |
3346 ShiftRightImm(scratch, scratch, Operand(8)); | |
3347 stb(scratch, MemOperand(dst, 4)); | |
3348 ShiftRightImm(scratch, scratch, Operand(8)); | |
3349 stb(scratch, MemOperand(dst, 5)); | |
3350 ShiftRightImm(scratch, scratch, Operand(8)); | |
3351 stb(scratch, MemOperand(dst, 6)); | |
3352 ShiftRightImm(scratch, scratch, Operand(8)); | |
3353 stb(scratch, MemOperand(dst, 7)); | |
3354 #endif | |
3355 #else | |
3356 #if V8_TARGET_ARCH_PPC64 | |
3357 stb(scratch, MemOperand(dst, 7)); | |
3358 ShiftRightImm(scratch, scratch, Operand(8)); | |
3359 stb(scratch, MemOperand(dst, 6)); | |
3360 ShiftRightImm(scratch, scratch, Operand(8)); | |
3361 stb(scratch, MemOperand(dst, 5)); | |
3362 ShiftRightImm(scratch, scratch, Operand(8)); | |
3363 stb(scratch, MemOperand(dst, 4)); | |
3364 ShiftRightImm(scratch, scratch, Operand(8)); | |
3365 #endif | |
3366 stb(scratch, MemOperand(dst, 3)); | |
3367 ShiftRightImm(scratch, scratch, Operand(8)); | |
3368 stb(scratch, MemOperand(dst, 2)); | |
3369 ShiftRightImm(scratch, scratch, Operand(8)); | |
3370 stb(scratch, MemOperand(dst, 1)); | |
3371 ShiftRightImm(scratch, scratch, Operand(8)); | |
3372 stb(scratch, MemOperand(dst, 0)); | |
3373 #endif | |
3374 addi(dst, dst, Operand(kPointerSize)); | |
3375 } | |
3376 bdnz(&word_loop); | 3335 bdnz(&word_loop); |
3377 | 3336 |
3378 // Copy the last bytes if any left. | 3337 // Copy the last bytes if any left. |
3379 cmpi(length, Operand::Zero()); | 3338 cmpi(length, Operand::Zero()); |
3380 beq(&done); | 3339 beq(&done); |
3381 | 3340 |
3382 bind(&byte_loop); | 3341 bind(&byte_loop); |
3383 mtctr(length); | 3342 mtctr(length); |
3384 bind(&byte_loop_1); | 3343 bind(&byte_loop_1); |
3385 lbz(scratch, MemOperand(src)); | 3344 lbz(scratch, MemOperand(src)); |
(...skipping 1532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4918 } | 4877 } |
4919 if (mag.shift > 0) srawi(result, result, mag.shift); | 4878 if (mag.shift > 0) srawi(result, result, mag.shift); |
4920 ExtractBit(r0, dividend, 31); | 4879 ExtractBit(r0, dividend, 31); |
4921 add(result, result, r0); | 4880 add(result, result, r0); |
4922 } | 4881 } |
4923 | 4882 |
4924 } // namespace internal | 4883 } // namespace internal |
4925 } // namespace v8 | 4884 } // namespace v8 |
4926 | 4885 |
4927 #endif // V8_TARGET_ARCH_PPC | 4886 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |