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

Side by Side Diff: src/ia32/macro-assembler-ia32.cc

Issue 1768233002: [wasm] Int64Lowering of I64ShrU and I64ShrS on ia32. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase. Created 4 years, 9 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
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | test/cctest/test-disasm-ia32.cc » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #if V8_TARGET_ARCH_IA32 5 #if V8_TARGET_ARCH_IA32
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/base/division-by-constant.h" 8 #include "src/base/division-by-constant.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 mov(tmp, src); 699 mov(tmp, src);
700 shr(src, 1); 700 shr(src, 1);
701 // Recover the least significant bit to avoid rounding errors. 701 // Recover the least significant bit to avoid rounding errors.
702 and_(tmp, Immediate(1)); 702 and_(tmp, Immediate(1));
703 or_(src, tmp); 703 or_(src, tmp);
704 cvtsi2ss(dst, src); 704 cvtsi2ss(dst, src);
705 addss(dst, dst); 705 addss(dst, dst);
706 bind(&jmp_return); 706 bind(&jmp_return);
707 } 707 }
708 708
709 void MacroAssembler::PairShl(Register dst, Register src, uint8_t shift) { 709 void MacroAssembler::ShlPair(Register high, Register low, uint8_t shift) {
710 if (shift >= 32) { 710 if (shift >= 32) {
711 mov(dst, src); 711 mov(high, low);
712 shl(dst, shift - 32); 712 shl(high, shift - 32);
713 xor_(src, src); 713 xor_(low, low);
714 } else { 714 } else {
715 shld(dst, src, shift); 715 shld(high, low, shift);
716 shl(src, shift); 716 shl(low, shift);
717 } 717 }
718 } 718 }
719 719
720 void MacroAssembler::PairShl_cl(Register dst, Register src) { 720 void MacroAssembler::ShlPair_cl(Register high, Register low) {
721 shld_cl(dst, src); 721 shld_cl(high, low);
722 shl_cl(src); 722 shl_cl(low);
723 Label done; 723 Label done;
724 test(ecx, Immediate(0x20)); 724 test(ecx, Immediate(0x20));
725 j(equal, &done, Label::kNear); 725 j(equal, &done, Label::kNear);
726 mov(dst, src); 726 mov(high, low);
727 xor_(src, src); 727 xor_(low, low);
728 bind(&done); 728 bind(&done);
729 } 729 }
730 730
731 void MacroAssembler::ShrPair(Register high, Register low, uint8_t shift) {
732 if (shift >= 32) {
733 mov(low, high);
734 shr(low, shift - 32);
735 xor_(high, high);
736 } else {
737 shrd(high, low, shift);
738 shr(high, shift);
739 }
740 }
741
742 void MacroAssembler::ShrPair_cl(Register high, Register low) {
743 shrd_cl(low, high);
744 shr_cl(high);
745 Label done;
746 test(ecx, Immediate(0x20));
747 j(equal, &done, Label::kNear);
748 mov(low, high);
749 xor_(high, high);
750 bind(&done);
751 }
752
753 void MacroAssembler::SarPair(Register high, Register low, uint8_t shift) {
754 if (shift >= 32) {
755 mov(low, high);
756 sar(low, shift - 32);
757 sar(high, 31);
758 } else {
759 shrd(high, low, shift);
760 sar(high, shift);
761 }
762 }
763
764 void MacroAssembler::SarPair_cl(Register high, Register low) {
765 shrd_cl(low, high);
766 sar_cl(high);
767 Label done;
768 test(ecx, Immediate(0x20));
769 j(equal, &done, Label::kNear);
770 mov(low, high);
771 sar(high, 31);
772 bind(&done);
773 }
774
731 bool MacroAssembler::IsUnsafeImmediate(const Immediate& x) { 775 bool MacroAssembler::IsUnsafeImmediate(const Immediate& x) {
732 static const int kMaxImmediateBits = 17; 776 static const int kMaxImmediateBits = 17;
733 if (!RelocInfo::IsNone(x.rmode_)) return false; 777 if (!RelocInfo::IsNone(x.rmode_)) return false;
734 return !is_intn(x.x_, kMaxImmediateBits); 778 return !is_intn(x.x_, kMaxImmediateBits);
735 } 779 }
736 780
737 781
738 void MacroAssembler::SafeMove(Register dst, const Immediate& x) { 782 void MacroAssembler::SafeMove(Register dst, const Immediate& x) {
739 if (IsUnsafeImmediate(x) && jit_cookie() != 0) { 783 if (IsUnsafeImmediate(x) && jit_cookie() != 0) {
740 Move(dst, Immediate(x.x_ ^ jit_cookie())); 784 Move(dst, Immediate(x.x_ ^ jit_cookie()));
(...skipping 2600 matching lines...) Expand 10 before | Expand all | Expand 10 after
3341 mov(eax, dividend); 3385 mov(eax, dividend);
3342 shr(eax, 31); 3386 shr(eax, 31);
3343 add(edx, eax); 3387 add(edx, eax);
3344 } 3388 }
3345 3389
3346 3390
3347 } // namespace internal 3391 } // namespace internal
3348 } // namespace v8 3392 } // namespace v8
3349 3393
3350 #endif // V8_TARGET_ARCH_IA32 3394 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | test/cctest/test-disasm-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698