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

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

Issue 1780283002: PPC: [wasm] Int64Lowering of I64ShrU and I64ShrS. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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/ppc/macro-assembler-ppc.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 813 matching lines...) Expand 10 before | Expand all | Expand 10 after
824 SetRoundingMode(rounding_mode); 824 SetRoundingMode(rounding_mode);
825 fctidu(double_dst, double_input); 825 fctidu(double_dst, double_input);
826 ResetRoundingMode(); 826 ResetRoundingMode();
827 } 827 }
828 828
829 MovDoubleToInt64(dst, double_dst); 829 MovDoubleToInt64(dst, double_dst);
830 } 830 }
831 #endif 831 #endif
832 832
833 #if !V8_TARGET_ARCH_PPC64 833 #if !V8_TARGET_ARCH_PPC64
834 void MacroAssembler::PairShiftLeft(Register dst_low, Register dst_high, 834 void MacroAssembler::ShiftLeftPair(Register dst_low, Register dst_high,
835 Register src_low, Register src_high, 835 Register src_low, Register src_high,
836 Register scratch, Register shift) { 836 Register scratch, Register shift) {
837 DCHECK(!AreAliased(dst_low, src_high, shift)); 837 DCHECK(!AreAliased(dst_low, src_high, shift));
838 DCHECK(!AreAliased(dst_high, src_low, shift)); 838 DCHECK(!AreAliased(dst_high, src_low, shift));
839 Label less_than_32; 839 Label less_than_32;
840 Label done; 840 Label done;
841 cmpi(shift, Operand(32)); 841 cmpi(shift, Operand(32));
842 blt(&less_than_32); 842 blt(&less_than_32);
843 // If shift >= 32 843 // If shift >= 32
844 andi(scratch, shift, Operand(0x1f)); 844 andi(scratch, shift, Operand(0x1f));
845 slw(dst_high, src_low, scratch); 845 slw(dst_high, src_low, scratch);
846 li(dst_low, Operand::Zero()); 846 li(dst_low, Operand::Zero());
847 b(&done); 847 b(&done);
848 bind(&less_than_32); 848 bind(&less_than_32);
849 // If shift < 32 849 // If shift < 32
850 subfic(scratch, shift, Operand(32)); 850 subfic(scratch, shift, Operand(32));
851 slw(dst_high, src_high, shift); 851 slw(dst_high, src_high, shift);
852 srw(scratch, src_low, scratch); 852 srw(scratch, src_low, scratch);
853 orx(dst_high, dst_high, scratch); 853 orx(dst_high, dst_high, scratch);
854 slw(dst_low, src_low, shift); 854 slw(dst_low, src_low, shift);
855 bind(&done); 855 bind(&done);
856 } 856 }
857 857
858 void MacroAssembler::PairShiftLeft(Register dst_low, Register dst_high, 858 void MacroAssembler::ShiftLeftPair(Register dst_low, Register dst_high,
859 Register src_low, Register src_high, 859 Register src_low, Register src_high,
860 uint32_t shift) { 860 uint32_t shift) {
861 DCHECK(!AreAliased(dst_low, src_high)); 861 DCHECK(!AreAliased(dst_low, src_high));
862 DCHECK(!AreAliased(dst_high, src_low)); 862 DCHECK(!AreAliased(dst_high, src_low));
863 Label less_than_32;
864 Label done;
865 if (shift >= 32) { 863 if (shift >= 32) {
866 shift &= 0x1f; 864 shift &= 0x1f;
867 slwi(dst_high, src_low, Operand(shift)); 865 slwi(dst_high, src_low, Operand(shift));
868 li(dst_low, Operand::Zero()); 866 li(dst_low, Operand::Zero());
869 } else if (shift == 0) { 867 } else if (shift == 0) {
870 Move(dst_low, src_low); 868 Move(dst_low, src_low);
871 Move(dst_high, src_high); 869 Move(dst_high, src_high);
872 } else { 870 } else {
873 slwi(dst_high, src_high, Operand(shift)); 871 slwi(dst_high, src_high, Operand(shift));
874 rlwimi(dst_high, src_low, shift, 32 - shift, 31); 872 rlwimi(dst_high, src_low, shift, 32 - shift, 31);
875 slwi(dst_low, src_low, Operand(shift)); 873 slwi(dst_low, src_low, Operand(shift));
876 } 874 }
877 } 875 }
876
877 void MacroAssembler::ShiftRightPair(Register dst_low, Register dst_high,
878 Register src_low, Register src_high,
879 Register scratch, Register shift) {
880 DCHECK(!AreAliased(dst_low, src_high, shift));
881 DCHECK(!AreAliased(dst_high, src_low, shift));
882 Label less_than_32;
883 Label done;
884 cmpi(shift, Operand(32));
885 blt(&less_than_32);
886 // If shift >= 32
887 andi(scratch, shift, Operand(0x1f));
888 srw(dst_low, src_high, scratch);
889 li(dst_high, Operand::Zero());
890 b(&done);
891 bind(&less_than_32);
892 // If shift < 32
893 subfic(scratch, shift, Operand(32));
894 srw(dst_low, src_low, shift);
895 slw(scratch, src_high, scratch);
896 orx(dst_low, dst_low, scratch);
897 srw(dst_high, src_high, shift);
898 bind(&done);
899 }
900
901 void MacroAssembler::ShiftRightPair(Register dst_low, Register dst_high,
902 Register src_low, Register src_high,
903 uint32_t shift) {
904 DCHECK(!AreAliased(dst_low, src_high));
905 DCHECK(!AreAliased(dst_high, src_low));
906 if (shift >= 32) {
907 shift &= 0x1f;
908 srwi(dst_low, src_high, Operand(shift));
909 li(dst_high, Operand::Zero());
910 } else if (shift == 0) {
911 Move(dst_low, src_low);
912 Move(dst_high, src_high);
913 } else {
914 srwi(dst_low, src_low, Operand(shift));
915 rlwimi(dst_low, src_high, 32 - shift, 0, shift - 1);
916 srwi(dst_high, src_high, Operand(shift));
917 }
918 }
919
920 void MacroAssembler::ShiftRightAlgPair(Register dst_low, Register dst_high,
921 Register src_low, Register src_high,
922 Register scratch, Register shift) {
923 DCHECK(!AreAliased(dst_low, src_high, shift));
924 DCHECK(!AreAliased(dst_high, src_low, shift));
925 Label less_than_32;
926 Label done;
927 cmpi(shift, Operand(32));
928 blt(&less_than_32);
929 // If shift >= 32
930 andi(scratch, shift, Operand(0x1f));
931 sraw(dst_low, src_high, scratch);
932 srawi(dst_high, src_high, 31);
933 b(&done);
934 bind(&less_than_32);
935 // If shift < 32
936 subfic(scratch, shift, Operand(32));
937 srw(dst_low, src_low, shift);
938 slw(scratch, src_high, scratch);
939 orx(dst_low, dst_low, scratch);
940 sraw(dst_high, src_high, shift);
941 bind(&done);
942 }
943
944 void MacroAssembler::ShiftRightAlgPair(Register dst_low, Register dst_high,
945 Register src_low, Register src_high,
946 uint32_t shift) {
947 DCHECK(!AreAliased(dst_low, src_high));
948 DCHECK(!AreAliased(dst_high, src_low));
949 if (shift >= 32) {
950 shift &= 0x1f;
951 srawi(dst_low, src_high, shift);
952 srawi(dst_high, src_high, 31);
953 } else if (shift == 0) {
954 Move(dst_low, src_low);
955 Move(dst_high, src_high);
956 } else {
957 srwi(dst_low, src_low, Operand(shift));
958 rlwimi(dst_low, src_high, 32 - shift, 0, shift - 1);
959 srawi(dst_high, src_high, shift);
960 }
961 }
878 #endif 962 #endif
879 963
880 void MacroAssembler::LoadConstantPoolPointerRegisterFromCodeTargetAddress( 964 void MacroAssembler::LoadConstantPoolPointerRegisterFromCodeTargetAddress(
881 Register code_target_address) { 965 Register code_target_address) {
882 lwz(kConstantPoolRegister, 966 lwz(kConstantPoolRegister,
883 MemOperand(code_target_address, 967 MemOperand(code_target_address,
884 Code::kConstantPoolOffset - Code::kHeaderSize)); 968 Code::kConstantPoolOffset - Code::kHeaderSize));
885 add(kConstantPoolRegister, kConstantPoolRegister, code_target_address); 969 add(kConstantPoolRegister, kConstantPoolRegister, code_target_address);
886 } 970 }
887 971
(...skipping 3649 matching lines...) Expand 10 before | Expand all | Expand 10 after
4537 } 4621 }
4538 if (mag.shift > 0) srawi(result, result, mag.shift); 4622 if (mag.shift > 0) srawi(result, result, mag.shift);
4539 ExtractBit(r0, dividend, 31); 4623 ExtractBit(r0, dividend, 31);
4540 add(result, result, r0); 4624 add(result, result, r0);
4541 } 4625 }
4542 4626
4543 } // namespace internal 4627 } // namespace internal
4544 } // namespace v8 4628 } // namespace v8
4545 4629
4546 #endif // V8_TARGET_ARCH_PPC 4630 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « src/ppc/macro-assembler-ppc.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698