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

Side by Side Diff: src/s390/macro-assembler-s390.h

Issue 2761953002: s390: improve floating point and integer convertion (Closed)
Patch Set: Created 3 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/s390/code-stubs-s390.cc ('k') | src/s390/macro-assembler-s390.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 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 #ifndef V8_S390_MACRO_ASSEMBLER_S390_H_ 5 #ifndef V8_S390_MACRO_ASSEMBLER_S390_H_
6 #define V8_S390_MACRO_ASSEMBLER_S390_H_ 6 #define V8_S390_MACRO_ASSEMBLER_S390_H_
7 7
8 #include "src/assembler.h" 8 #include "src/assembler.h"
9 #include "src/bailout-reason.h" 9 #include "src/bailout-reason.h"
10 #include "src/frames.h" 10 #include "src/frames.h"
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 void FlushICache(Register address, size_t size, Register scratch); 728 void FlushICache(Register address, size_t size, Register scratch);
729 729
730 // If the value is a NaN, canonicalize the value else, do nothing. 730 // If the value is a NaN, canonicalize the value else, do nothing.
731 void CanonicalizeNaN(const DoubleRegister dst, const DoubleRegister src); 731 void CanonicalizeNaN(const DoubleRegister dst, const DoubleRegister src);
732 void CanonicalizeNaN(const DoubleRegister value) { 732 void CanonicalizeNaN(const DoubleRegister value) {
733 CanonicalizeNaN(value, value); 733 CanonicalizeNaN(value, value);
734 } 734 }
735 735
736 // Converts the integer (untagged smi) in |src| to a double, storing 736 // Converts the integer (untagged smi) in |src| to a double, storing
737 // the result to |dst| 737 // the result to |dst|
738 void ConvertIntToDouble(Register src, DoubleRegister dst); 738 void ConvertIntToDouble(DoubleRegister dst, Register src);
739 739
740 // Converts the unsigned integer (untagged smi) in |src| to 740 // Converts the unsigned integer (untagged smi) in |src| to
741 // a double, storing the result to |dst| 741 // a double, storing the result to |dst|
742 void ConvertUnsignedIntToDouble(Register src, DoubleRegister dst); 742 void ConvertUnsignedIntToDouble(DoubleRegister dst, Register src);
743 743
744 // Converts the integer (untagged smi) in |src| to 744 // Converts the integer (untagged smi) in |src| to
745 // a float, storing the result in |dst| 745 // a float, storing the result in |dst|
746 void ConvertIntToFloat(Register src, DoubleRegister dst); 746 void ConvertIntToFloat(DoubleRegister dst, Register src);
747 747
748 // Converts the unsigned integer (untagged smi) in |src| to 748 // Converts the unsigned integer (untagged smi) in |src| to
749 // a float, storing the result in |dst| 749 // a float, storing the result in |dst|
750 void ConvertUnsignedIntToFloat(Register src, DoubleRegister dst); 750 void ConvertUnsignedIntToFloat(DoubleRegister dst, Register src);
751 751
752 #if V8_TARGET_ARCH_S390X 752 void ConvertInt64ToFloat(DoubleRegister double_dst, Register src);
753 void ConvertInt64ToFloat(Register src, DoubleRegister double_dst); 753 void ConvertInt64ToDouble(DoubleRegister double_dst, Register src);
754 void ConvertInt64ToDouble(Register src, DoubleRegister double_dst); 754 void ConvertUnsignedInt64ToFloat(DoubleRegister double_dst, Register src);
755 void ConvertUnsignedInt64ToFloat(Register src, DoubleRegister double_dst); 755 void ConvertUnsignedInt64ToDouble(DoubleRegister double_dst, Register src);
756 void ConvertUnsignedInt64ToDouble(Register src, DoubleRegister double_dst);
757 #endif
758 756
759 void MovIntToFloat(DoubleRegister dst, Register src); 757 void MovIntToFloat(DoubleRegister dst, Register src);
760 void MovFloatToInt(Register dst, DoubleRegister src); 758 void MovFloatToInt(Register dst, DoubleRegister src);
761 void MovDoubleToInt64(Register dst, DoubleRegister src); 759 void MovDoubleToInt64(Register dst, DoubleRegister src);
762 void MovInt64ToDouble(DoubleRegister dst, Register src); 760 void MovInt64ToDouble(DoubleRegister dst, Register src);
763 // Converts the double_input to an integer. Note that, upon return, 761 // Converts the double_input to an integer. Note that, upon return,
764 // the contents of double_dst will also hold the fixed point representation. 762 // the contents of double_dst will also hold the fixed point representation.
765 void ConvertFloat32ToInt64(const DoubleRegister double_input, 763 void ConvertFloat32ToInt64(const Register dst,
766 #if !V8_TARGET_ARCH_S390X 764 const DoubleRegister double_input,
767 const Register dst_hi,
768 #endif
769 const Register dst,
770 const DoubleRegister double_dst,
771 FPRoundingMode rounding_mode = kRoundToZero); 765 FPRoundingMode rounding_mode = kRoundToZero);
772 766
773 // Converts the double_input to an integer. Note that, upon return, 767 // Converts the double_input to an integer. Note that, upon return,
774 // the contents of double_dst will also hold the fixed point representation. 768 // the contents of double_dst will also hold the fixed point representation.
775 void ConvertDoubleToInt64(const DoubleRegister double_input, 769 void ConvertDoubleToInt64(const Register dst,
776 #if !V8_TARGET_ARCH_S390X 770 const DoubleRegister double_input,
777 const Register dst_hi, 771 FPRoundingMode rounding_mode = kRoundToZero);
778 #endif 772 void ConvertDoubleToInt32(const Register dst,
779 const Register dst, const DoubleRegister double_dst, 773 const DoubleRegister double_input,
780 FPRoundingMode rounding_mode = kRoundToZero); 774 FPRoundingMode rounding_mode = kRoundToZero);
781 775
782 void ConvertFloat32ToInt32(const DoubleRegister double_input, 776 void ConvertFloat32ToInt32(const Register result,
783 const Register dst, 777 const DoubleRegister double_input,
784 const DoubleRegister double_dst,
785 FPRoundingMode rounding_mode); 778 FPRoundingMode rounding_mode);
786 void ConvertFloat32ToUnsignedInt32( 779 void ConvertFloat32ToUnsignedInt32(
787 const DoubleRegister double_input, const Register dst, 780 const Register result, const DoubleRegister double_input,
788 const DoubleRegister double_dst,
789 FPRoundingMode rounding_mode = kRoundToZero); 781 FPRoundingMode rounding_mode = kRoundToZero);
790 #if V8_TARGET_ARCH_S390X
791 // Converts the double_input to an unsigned integer. Note that, upon return, 782 // Converts the double_input to an unsigned integer. Note that, upon return,
792 // the contents of double_dst will also hold the fixed point representation. 783 // the contents of double_dst will also hold the fixed point representation.
793 void ConvertDoubleToUnsignedInt64( 784 void ConvertDoubleToUnsignedInt64(
794 const DoubleRegister double_input, const Register dst, 785 const Register dst, const DoubleRegister double_input,
795 const DoubleRegister double_dst, 786 FPRoundingMode rounding_mode = kRoundToZero);
787 void ConvertDoubleToUnsignedInt32(
788 const Register dst, const DoubleRegister double_input,
796 FPRoundingMode rounding_mode = kRoundToZero); 789 FPRoundingMode rounding_mode = kRoundToZero);
797 void ConvertFloat32ToUnsignedInt64( 790 void ConvertFloat32ToUnsignedInt64(
798 const DoubleRegister double_input, const Register dst, 791 const Register result, const DoubleRegister double_input,
799 const DoubleRegister double_dst,
800 FPRoundingMode rounding_mode = kRoundToZero); 792 FPRoundingMode rounding_mode = kRoundToZero);
801 #endif
802 793
803 #if !V8_TARGET_ARCH_S390X 794 #if !V8_TARGET_ARCH_S390X
804 void ShiftLeftPair(Register dst_low, Register dst_high, Register src_low, 795 void ShiftLeftPair(Register dst_low, Register dst_high, Register src_low,
805 Register src_high, Register scratch, Register shift); 796 Register src_high, Register scratch, Register shift);
806 void ShiftLeftPair(Register dst_low, Register dst_high, Register src_low, 797 void ShiftLeftPair(Register dst_low, Register dst_high, Register src_low,
807 Register src_high, uint32_t shift); 798 Register src_high, uint32_t shift);
808 void ShiftRightPair(Register dst_low, Register dst_high, Register src_low, 799 void ShiftRightPair(Register dst_low, Register dst_high, Register src_low,
809 Register src_high, Register scratch, Register shift); 800 Register src_high, Register scratch, Register shift);
810 void ShiftRightPair(Register dst_low, Register dst_high, Register src_low, 801 void ShiftRightPair(Register dst_low, Register dst_high, Register src_low,
811 Register src_high, uint32_t shift); 802 Register src_high, uint32_t shift);
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
1618 // Jump if either of the registers contain a smi. 1609 // Jump if either of the registers contain a smi.
1619 void JumpIfEitherSmi(Register reg1, Register reg2, Label* on_either_smi); 1610 void JumpIfEitherSmi(Register reg1, Register reg2, Label* on_either_smi);
1620 1611
1621 // Abort execution if argument is a number, enabled via --debug-code. 1612 // Abort execution if argument is a number, enabled via --debug-code.
1622 void AssertNotNumber(Register object); 1613 void AssertNotNumber(Register object);
1623 1614
1624 // Abort execution if argument is a smi, enabled via --debug-code. 1615 // Abort execution if argument is a smi, enabled via --debug-code.
1625 void AssertNotSmi(Register object); 1616 void AssertNotSmi(Register object);
1626 void AssertSmi(Register object); 1617 void AssertSmi(Register object);
1627 1618
1628 #if V8_TARGET_ARCH_S390X 1619 inline void TestIfInt32(Register value) {
1629 inline void TestIfInt32(Register value, Register scratch) {
1630 // High bits must be identical to fit into an 32-bit integer 1620 // High bits must be identical to fit into an 32-bit integer
1631 lgfr(scratch, value); 1621 cgfr(value, value);
1632 CmpP(scratch, value);
1633 } 1622 }
1634 #else
1635 inline void TestIfInt32(Register hi_word, Register lo_word,
1636 Register scratch) {
1637 // High bits must be identical to fit into an 32-bit integer
1638 ShiftRightArith(scratch, lo_word, Operand(31));
1639 CmpP(scratch, hi_word);
1640 }
1641 #endif
1642 1623
1643 #if V8_TARGET_ARCH_S390X 1624 #if V8_TARGET_ARCH_S390X
1644 // Ensure it is permissable to read/write int value directly from 1625 // Ensure it is permissable to read/write int value directly from
1645 // upper half of the smi. 1626 // upper half of the smi.
1646 STATIC_ASSERT(kSmiTag == 0); 1627 STATIC_ASSERT(kSmiTag == 0);
1647 STATIC_ASSERT(kSmiTagSize + kSmiShiftSize == 32); 1628 STATIC_ASSERT(kSmiTagSize + kSmiShiftSize == 32);
1648 #endif 1629 #endif
1649 #if V8_TARGET_LITTLE_ENDIAN 1630 #if V8_TARGET_LITTLE_ENDIAN
1650 #define SmiWordOffset(offset) (offset + kPointerSize / 2) 1631 #define SmiWordOffset(offset) (offset + kPointerSize / 2)
1651 #else 1632 #else
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
1859 inline MemOperand NativeContextMemOperand() { 1840 inline MemOperand NativeContextMemOperand() {
1860 return ContextMemOperand(cp, Context::NATIVE_CONTEXT_INDEX); 1841 return ContextMemOperand(cp, Context::NATIVE_CONTEXT_INDEX);
1861 } 1842 }
1862 1843
1863 #define ACCESS_MASM(masm) masm-> 1844 #define ACCESS_MASM(masm) masm->
1864 1845
1865 } // namespace internal 1846 } // namespace internal
1866 } // namespace v8 1847 } // namespace v8
1867 1848
1868 #endif // V8_S390_MACRO_ASSEMBLER_S390_H_ 1849 #endif // V8_S390_MACRO_ASSEMBLER_S390_H_
OLDNEW
« no previous file with comments | « src/s390/code-stubs-s390.cc ('k') | src/s390/macro-assembler-s390.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698