Bug 1229057 - Part 9: Move MacroAssembler::subDouble into generic macro assembler. r=lth
authorTooru Fujisawa <arai_a@mac.com>
Tue, 01 Dec 2015 17:03:15 +0900
changeset 316150 0d087c8f5c73979f28167cd39df8795836c39959
parent 316149 81fddea678a7bfea7225c96d00c25a149f52889e
child 316151 ca2e4823afec2aa986c7ee76705fe365399d1a80
push id8516
push userjlund@mozilla.com
push dateFri, 18 Dec 2015 00:52:34 +0000
reviewerslth
bugs1229057
milestone46.0a1
Bug 1229057 - Part 9: Move MacroAssembler::subDouble into generic macro assembler. r=lth
js/src/jit/MacroAssembler.h
js/src/jit/arm/MacroAssembler-arm-inl.h
js/src/jit/arm/MacroAssembler-arm.cpp
js/src/jit/arm/MacroAssembler-arm.h
js/src/jit/arm64/MacroAssembler-arm64-inl.h
js/src/jit/arm64/MacroAssembler-arm64.h
js/src/jit/mips-shared/MacroAssembler-mips-shared-inl.h
js/src/jit/mips32/MacroAssembler-mips32.cpp
js/src/jit/mips32/MacroAssembler-mips32.h
js/src/jit/mips64/MacroAssembler-mips64.cpp
js/src/jit/mips64/MacroAssembler-mips64.h
js/src/jit/none/MacroAssembler-none.h
js/src/jit/x86-shared/MacroAssembler-x86-shared-inl.h
js/src/jit/x86-shared/MacroAssembler-x86-shared.h
--- a/js/src/jit/MacroAssembler.h
+++ b/js/src/jit/MacroAssembler.h
@@ -758,16 +758,18 @@ class MacroAssembler : public MacroAssem
     inline void sub32(Register src, Register dest) PER_SHARED_ARCH;
     inline void sub32(Imm32 imm, Register dest) PER_SHARED_ARCH;
 
     inline void subPtr(Register src, Register dest) PER_ARCH;
     inline void subPtr(Register src, const Address& dest) DEFINED_ON(mips_shared, arm, arm64, x86, x64);
     inline void subPtr(Imm32 imm, Register dest) PER_ARCH;
     inline void subPtr(const Address& addr, Register dest) DEFINED_ON(mips_shared, arm, arm64, x86, x64);
 
+    inline void subDouble(FloatRegister src, FloatRegister dest) PER_SHARED_ARCH;
+
     // ===============================================================
     // Shift functions
 
     inline void lshiftPtr(Imm32 imm, Register dest) PER_ARCH;
 
     inline void lshift64(Imm32 imm, Register64 dest) PER_ARCH;
 
     inline void rshiftPtr(Imm32 imm, Register dest) PER_ARCH;
--- a/js/src/jit/arm/MacroAssembler-arm-inl.h
+++ b/js/src/jit/arm/MacroAssembler-arm-inl.h
@@ -258,16 +258,22 @@ MacroAssembler::subPtr(Imm32 imm, Regist
 void
 MacroAssembler::subPtr(const Address& addr, Register dest)
 {
     ScratchRegisterScope scratch(*this);
     loadPtr(addr, scratch);
     ma_sub(scratch, dest);
 }
 
+void
+MacroAssembler::subDouble(FloatRegister src, FloatRegister dest)
+{
+    ma_vsub(dest, src, dest);
+}
+
 // ===============================================================
 // Shift functions
 
 void
 MacroAssembler::lshiftPtr(Imm32 imm, Register dest)
 {
     ma_lsl(imm, dest, dest);
 }
--- a/js/src/jit/arm/MacroAssembler-arm.cpp
+++ b/js/src/jit/arm/MacroAssembler-arm.cpp
@@ -242,22 +242,16 @@ void
 MacroAssemblerARM::convertInt32ToFloat32(const Address& src, FloatRegister dest)
 {
     ScratchFloat32Scope scratch(asMasm());
     ma_vldr(src, scratch);
     as_vcvt(dest, VFPRegister(scratch).sintOverlay());
 }
 
 void
-MacroAssemblerARM::subDouble(FloatRegister src, FloatRegister dest)
-{
-    ma_vsub(dest, src, dest);
-}
-
-void
 MacroAssemblerARM::mulDouble(FloatRegister src, FloatRegister dest)
 {
     ma_vmul(dest, src, dest);
 }
 
 void
 MacroAssemblerARM::divDouble(FloatRegister src, FloatRegister dest)
 {
--- a/js/src/jit/arm/MacroAssembler-arm.h
+++ b/js/src/jit/arm/MacroAssembler-arm.h
@@ -92,17 +92,16 @@ class MacroAssemblerARM : public Assembl
     void convertFloat32ToInt32(FloatRegister src, Register dest, Label* fail,
                                bool negativeZeroCheck = true);
 
     void convertFloat32ToDouble(FloatRegister src, FloatRegister dest);
     void branchTruncateFloat32(FloatRegister src, Register dest, Label* fail);
     void convertInt32ToFloat32(Register src, FloatRegister dest);
     void convertInt32ToFloat32(const Address& src, FloatRegister dest);
 
-    void subDouble(FloatRegister src, FloatRegister dest);
     void mulDouble(FloatRegister src, FloatRegister dest);
     void divDouble(FloatRegister src, FloatRegister dest);
 
     void negateDouble(FloatRegister reg);
     void inc64(AbsoluteAddress dest);
 
     // Somewhat direct wrappers for the low-level assembler funcitons
     // bitops. Attempt to encode a virtual alu instruction using two real
--- a/js/src/jit/arm64/MacroAssembler-arm64-inl.h
+++ b/js/src/jit/arm64/MacroAssembler-arm64-inl.h
@@ -297,16 +297,22 @@ MacroAssembler::subPtr(const Address& ad
     vixl::UseScratchRegisterScope temps(this);
     const ARMRegister scratch64 = temps.AcquireX();
     MOZ_ASSERT(scratch64.asUnsized() != addr.base);
 
     Ldr(scratch64, MemOperand(ARMRegister(addr.base, 64), addr.offset));
     Sub(ARMRegister(dest, 64), ARMRegister(dest, 64), Operand(scratch64));
 }
 
+void
+MacroAssembler::subDouble(FloatRegister src, FloatRegister dest)
+{
+    fsub(ARMFPRegister(dest, 64), ARMFPRegister(dest, 64), ARMFPRegister(src, 64));
+}
+
 // ===============================================================
 // Shift functions
 
 void
 MacroAssembler::lshiftPtr(Imm32 imm, Register dest)
 {
     Lsl(ARMRegister(dest, 64), ARMRegister(dest, 64), imm.value);
 }
--- a/js/src/jit/arm64/MacroAssembler-arm64.h
+++ b/js/src/jit/arm64/MacroAssembler-arm64.h
@@ -1231,19 +1231,16 @@ class MacroAssemblerCompat : public vixl
         fmov(ARMFPRegister(reg, 32), vixl::wzr);
     }
     void negateDouble(FloatRegister reg) {
         fneg(ARMFPRegister(reg, 64), ARMFPRegister(reg, 64));
     }
     void negateFloat(FloatRegister reg) {
         fneg(ARMFPRegister(reg, 32), ARMFPRegister(reg, 32));
     }
-    void subDouble(FloatRegister src, FloatRegister dest) {
-        fsub(ARMFPRegister(dest, 64), ARMFPRegister(dest, 64), ARMFPRegister(src, 64));
-    }
     void mulDouble(FloatRegister src, FloatRegister dest) {
         fmul(ARMFPRegister(dest, 64), ARMFPRegister(dest, 64), ARMFPRegister(src, 64));
     }
     void divDouble(FloatRegister src, FloatRegister dest) {
         fdiv(ARMFPRegister(dest, 64), ARMFPRegister(dest, 64), ARMFPRegister(src, 64));
     }
 
     void moveFloat32(FloatRegister src, FloatRegister dest) {
--- a/js/src/jit/mips-shared/MacroAssembler-mips-shared-inl.h
+++ b/js/src/jit/mips-shared/MacroAssembler-mips-shared-inl.h
@@ -148,15 +148,21 @@ MacroAssembler::subPtr(Register src, con
 
 void
 MacroAssembler::subPtr(const Address& addr, Register dest)
 {
     loadPtr(addr, SecondScratchReg);
     subPtr(SecondScratchReg, dest);
 }
 
+void
+MacroAssembler::subDouble(FloatRegister src, FloatRegister dest)
+{
+    as_subd(dest, dest, src);
+}
+
 //}}} check_macroassembler_style
 // ===============================================================
 
 } // namespace jit
 } // namespace js
 
 #endif /* jit_mips_shared_MacroAssembler_mips_shared_inl_h */
--- a/js/src/jit/mips32/MacroAssembler-mips32.cpp
+++ b/js/src/jit/mips32/MacroAssembler-mips32.cpp
@@ -259,22 +259,16 @@ MacroAssemblerMIPSCompat::convertInt32To
 void
 MacroAssemblerMIPSCompat::convertInt32ToFloat32(const Address& src, FloatRegister dest)
 {
     ma_ls(dest, src);
     as_cvtsw(dest, dest);
 }
 
 void
-MacroAssemblerMIPSCompat::subDouble(FloatRegister src, FloatRegister dest)
-{
-    as_subd(dest, dest, src);
-}
-
-void
 MacroAssemblerMIPSCompat::mulDouble(FloatRegister src, FloatRegister dest)
 {
     as_muld(dest, dest, src);
 }
 
 void
 MacroAssemblerMIPSCompat::divDouble(FloatRegister src, FloatRegister dest)
 {
--- a/js/src/jit/mips32/MacroAssembler-mips32.h
+++ b/js/src/jit/mips32/MacroAssembler-mips32.h
@@ -170,17 +170,16 @@ class MacroAssemblerMIPSCompat : public 
     void convertFloat32ToInt32(FloatRegister src, Register dest, Label* fail,
                                bool negativeZeroCheck = true);
 
     void convertFloat32ToDouble(FloatRegister src, FloatRegister dest);
     void branchTruncateFloat32(FloatRegister src, Register dest, Label* fail);
     void convertInt32ToFloat32(Register src, FloatRegister dest);
     void convertInt32ToFloat32(const Address& src, FloatRegister dest);
 
-    void subDouble(FloatRegister src, FloatRegister dest);
     void mulDouble(FloatRegister src, FloatRegister dest);
     void divDouble(FloatRegister src, FloatRegister dest);
 
     void negateDouble(FloatRegister reg);
     void inc64(AbsoluteAddress dest);
 
     void computeScaledAddress(const BaseIndex& address, Register dest);
 
--- a/js/src/jit/mips64/MacroAssembler-mips64.cpp
+++ b/js/src/jit/mips64/MacroAssembler-mips64.cpp
@@ -223,22 +223,16 @@ MacroAssemblerMIPS64Compat::convertInt32
 void
 MacroAssemblerMIPS64Compat::convertInt32ToFloat32(const Address& src, FloatRegister dest)
 {
     ma_ls(dest, src);
     as_cvtsw(dest, dest);
 }
 
 void
-MacroAssemblerMIPS64Compat::subDouble(FloatRegister src, FloatRegister dest)
-{
-    as_subd(dest, dest, src);
-}
-
-void
 MacroAssemblerMIPS64Compat::mulDouble(FloatRegister src, FloatRegister dest)
 {
     as_muld(dest, dest, src);
 }
 
 void
 MacroAssemblerMIPS64Compat::divDouble(FloatRegister src, FloatRegister dest)
 {
--- a/js/src/jit/mips64/MacroAssembler-mips64.h
+++ b/js/src/jit/mips64/MacroAssembler-mips64.h
@@ -180,17 +180,16 @@ class MacroAssemblerMIPS64Compat : publi
     void convertFloat32ToInt32(FloatRegister src, Register dest, Label* fail,
                                bool negativeZeroCheck = true);
 
     void convertFloat32ToDouble(FloatRegister src, FloatRegister dest);
     void branchTruncateFloat32(FloatRegister src, Register dest, Label* fail);
     void convertInt32ToFloat32(Register src, FloatRegister dest);
     void convertInt32ToFloat32(const Address& src, FloatRegister dest);
 
-    void subDouble(FloatRegister src, FloatRegister dest);
     void mulDouble(FloatRegister src, FloatRegister dest);
     void divDouble(FloatRegister src, FloatRegister dest);
 
     void negateDouble(FloatRegister reg);
     void inc64(AbsoluteAddress dest);
 
     void movq(Register rs, Register rd);
 
--- a/js/src/jit/none/MacroAssembler-none.h
+++ b/js/src/jit/none/MacroAssembler-none.h
@@ -234,17 +234,16 @@ class MacroAssemblerNone : public Assemb
     template <typename T, typename S> void cmpPtrSet(Condition, T, S, Register) { MOZ_CRASH(); }
     template <typename T, typename S> void cmp32Set(Condition, T, S, Register) { MOZ_CRASH(); }
 
     void neg32(Register) { MOZ_CRASH(); }
     void mulBy3(Register, Register) { MOZ_CRASH(); }
     void mul64(Imm64, const Register64&) { MOZ_CRASH(); }
 
     void negateDouble(FloatRegister) { MOZ_CRASH(); }
-    void subDouble(FloatRegister, FloatRegister) { MOZ_CRASH(); }
     void mulDouble(FloatRegister, FloatRegister) { MOZ_CRASH(); }
     void divDouble(FloatRegister, FloatRegister) { MOZ_CRASH(); }
 
     template <typename T, typename S> void branch32(Condition, T, S, Label*) { MOZ_CRASH(); }
     template <typename T, typename S> void branchTest32(Condition, T, S, Label*) { MOZ_CRASH(); }
     template <typename T, typename S> void branchAdd32(Condition, T, S, Label*) { MOZ_CRASH(); }
     template <typename T, typename S> void branchSub32(Condition, T, S, Label*) { MOZ_CRASH(); }
     template <typename T, typename S> void branchPtr(Condition, T, S, Label*) { MOZ_CRASH(); }
--- a/js/src/jit/x86-shared/MacroAssembler-x86-shared-inl.h
+++ b/js/src/jit/x86-shared/MacroAssembler-x86-shared-inl.h
@@ -128,15 +128,21 @@ MacroAssembler::sub32(Imm32 imm, Registe
 }
 
 void
 MacroAssembler::sub32(const Address& src, Register dest)
 {
     subl(Operand(src), dest);
 }
 
+void
+MacroAssembler::subDouble(FloatRegister src, FloatRegister dest)
+{
+    vsubsd(src, dest, dest);
+}
+
 //}}} check_macroassembler_style
 // ===============================================================
 
 } // namespace jit
 } // namespace js
 
 #endif /* jit_x86_shared_MacroAssembler_x86_shared_inl_h */
--- a/js/src/jit/x86-shared/MacroAssembler-x86-shared.h
+++ b/js/src/jit/x86-shared/MacroAssembler-x86-shared.h
@@ -917,19 +917,16 @@ class MacroAssemblerX86Shared : public A
     void negateFloat(FloatRegister reg) {
         ScratchFloat32Scope scratch(asMasm());
         vpcmpeqw(scratch, scratch, scratch);
         vpsllq(Imm32(31), scratch, scratch);
 
         // XOR the float in a float register with -0.0.
         vxorps(scratch, reg, reg); // s ^ 0x80000000
     }
-    void subDouble(FloatRegister src, FloatRegister dest) {
-        vsubsd(src, dest, dest);
-    }
     void mulDouble(FloatRegister src, FloatRegister dest) {
         vmulsd(src, dest, dest);
     }
     void divDouble(FloatRegister src, FloatRegister dest) {
         vdivsd(src, dest, dest);
     }
     void convertFloat32ToDouble(FloatRegister src, FloatRegister dest) {
         vcvtss2sd(src, dest, dest);