Bug 1637506 - Move allTrue porting interfaces to x86_shared. r=rhunt
authorLars T Hansen <lhansen@mozilla.com>
Thu, 14 May 2020 07:38:15 +0000
changeset 529805 1120db775f13ecc813430c05f7133beb8539fb6c
parent 529804 c34dc29a11895ac248978b5c23756cf0fbe67755
child 529806 bcca4b48fc21c84e61d8f4a18089e6faae704226
push id37416
push usercsabou@mozilla.com
push dateThu, 14 May 2020 16:15:31 +0000
treeherdermozilla-central@80ba3f3cfaf9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrhunt
bugs1637506
milestone78.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1637506 - Move allTrue porting interfaces to x86_shared. r=rhunt This is pure refactoring in preparation for further SIMD work, these functions were always x86_shared compatible but ended up in x64 code by mistake. Differential Revision: https://phabricator.services.mozilla.com/D75120
js/src/jit/MacroAssembler.h
js/src/jit/x64/MacroAssembler-x64-inl.h
js/src/jit/x86-shared/MacroAssembler-x86-shared-inl.h
--- a/js/src/jit/MacroAssembler.h
+++ b/js/src/jit/MacroAssembler.h
@@ -2112,21 +2112,24 @@ class MacroAssembler : public MacroAssem
                                    FloatRegister temp) DEFINED_ON(x86_shared);
 
   // Any lane true, ie, any bit set
 
   inline void anyTrueSimd128(FloatRegister src, Register dest) DEFINED_ON(x64);
 
   // All lanes true
 
-  inline void allTrueInt8x16(FloatRegister src, Register dest) DEFINED_ON(x64);
-
-  inline void allTrueInt16x8(FloatRegister src, Register dest) DEFINED_ON(x64);
-
-  inline void allTrueInt32x4(FloatRegister src, Register dest) DEFINED_ON(x64);
+  inline void allTrueInt8x16(FloatRegister src, Register dest)
+      DEFINED_ON(x86_shared);
+
+  inline void allTrueInt16x8(FloatRegister src, Register dest)
+      DEFINED_ON(x86_shared);
+
+  inline void allTrueInt32x4(FloatRegister src, Register dest)
+      DEFINED_ON(x86_shared);
 
   // Comparisons (integer and floating-point)
 
   inline void compareInt8x16(Assembler::Condition cond, FloatRegister rhs,
                              FloatRegister lhsDest) DEFINED_ON(x86_shared);
 
   inline void unsignedCompareInt8x16(Assembler::Condition cond,
                                      FloatRegister rhs, FloatRegister lhsDest,
--- a/js/src/jit/x64/MacroAssembler-x64-inl.h
+++ b/js/src/jit/x64/MacroAssembler-x64-inl.h
@@ -754,63 +754,16 @@ void MacroAssembler::spectreBoundsCheck3
 void MacroAssembler::anyTrueSimd128(FloatRegister src, Register dest) {
   ScratchRegisterScope one(*this);
   movl(Imm32(1), one);
   movl(Imm32(0), dest);
   vptest(src, src);  // SSE4.1
   cmovCCl(NonZero, one, dest);
 }
 
-// All lanes true
-
-void MacroAssembler::allTrueInt8x16(FloatRegister src, Register dest) {
-  ScratchSimd128Scope xtmp(*this);
-  // xtmp is all-00h
-  vpxor(xtmp, xtmp, xtmp);
-  // Set FFh if byte==0 otherwise 00h
-  // Operand ordering constraint: lhs==output
-  vpcmpeqb(Operand(src), xtmp, xtmp);
-  // Get all bytes' high bits
-  vpmovmskb(xtmp, dest);
-  // Now set dest to 1 if it is zero, otherwise to zero.
-  testl(dest, dest);
-  setCC(Zero, dest);
-  movzbl(dest, dest);
-}
-
-void MacroAssembler::allTrueInt16x8(FloatRegister src, Register dest) {
-  ScratchSimd128Scope xtmp(*this);
-  // xtmp is all-00h
-  vpxor(xtmp, xtmp, xtmp);
-  // Set FFFFh if byte==0 otherwise 0000h
-  // Operand ordering constraint: lhs==output
-  vpcmpeqw(Operand(src), xtmp, xtmp);
-  // Get all bytes' high bits
-  vpmovmskb(xtmp, dest);
-  // Now set dest to 1 if it is zero, otherwise to zero.
-  testl(dest, dest);
-  setCC(Zero, dest);
-  movzbl(dest, dest);
-}
-
-void MacroAssembler::allTrueInt32x4(FloatRegister src, Register dest) {
-  ScratchSimd128Scope xtmp(*this);
-  // xtmp is all-00h
-  vpxor(xtmp, xtmp, xtmp);
-  // Set FFFFFFFFh if byte==0 otherwise 00000000h
-  // Operand ordering constraint: lhs==output
-  vpcmpeqd(Operand(src), xtmp, xtmp);
-  // Get all bytes' high bits
-  vpmovmskb(xtmp, dest);
-  // Now set dest to 1 if it is zero, otherwise to zero.
-  testl(dest, dest);
-  setCC(Zero, dest);
-  movzbl(dest, dest);
-}
-
 void MacroAssembler::mulInt64x2(FloatRegister rhs, FloatRegister lhsDest,
                                 Register64 temp) {
   ScratchRegisterScope t1(*this);
   Register t2 = temp.reg;
   vpextrq(0, lhsDest, t1);
   vpextrq(0, rhs, t2);
   imulq(t2, t1);
   vpinsrq(0, t1, lhsDest, lhsDest);
--- a/js/src/jit/x86-shared/MacroAssembler-x86-shared-inl.h
+++ b/js/src/jit/x86-shared/MacroAssembler-x86-shared-inl.h
@@ -1205,16 +1205,63 @@ void MacroAssembler::replaceLaneFloat64x
 // Shuffle - permute with immediate indices
 
 void MacroAssembler::shuffleInt8x16(uint8_t lanes[16], FloatRegister rhs,
                                     FloatRegister lhsDest, FloatRegister temp) {
   MacroAssemblerX86Shared::shuffleInt8x16(
       lhsDest, rhs, lhsDest, mozilla::Some(temp), mozilla::Nothing(), lanes);
 }
 
+// All lanes true
+
+void MacroAssembler::allTrueInt8x16(FloatRegister src, Register dest) {
+  ScratchSimd128Scope xtmp(*this);
+  // xtmp is all-00h
+  vpxor(xtmp, xtmp, xtmp);
+  // Set FFh if byte==0 otherwise 00h
+  // Operand ordering constraint: lhs==output
+  vpcmpeqb(Operand(src), xtmp, xtmp);
+  // Get all bytes' high bits
+  vpmovmskb(xtmp, dest);
+  // Now set dest to 1 if it is zero, otherwise to zero.
+  testl(dest, dest);
+  setCC(Zero, dest);
+  movzbl(dest, dest);
+}
+
+void MacroAssembler::allTrueInt16x8(FloatRegister src, Register dest) {
+  ScratchSimd128Scope xtmp(*this);
+  // xtmp is all-00h
+  vpxor(xtmp, xtmp, xtmp);
+  // Set FFFFh if byte==0 otherwise 0000h
+  // Operand ordering constraint: lhs==output
+  vpcmpeqw(Operand(src), xtmp, xtmp);
+  // Get all bytes' high bits
+  vpmovmskb(xtmp, dest);
+  // Now set dest to 1 if it is zero, otherwise to zero.
+  testl(dest, dest);
+  setCC(Zero, dest);
+  movzbl(dest, dest);
+}
+
+void MacroAssembler::allTrueInt32x4(FloatRegister src, Register dest) {
+  ScratchSimd128Scope xtmp(*this);
+  // xtmp is all-00h
+  vpxor(xtmp, xtmp, xtmp);
+  // Set FFFFFFFFh if byte==0 otherwise 00000000h
+  // Operand ordering constraint: lhs==output
+  vpcmpeqd(Operand(src), xtmp, xtmp);
+  // Get all bytes' high bits
+  vpmovmskb(xtmp, dest);
+  // Now set dest to 1 if it is zero, otherwise to zero.
+  testl(dest, dest);
+  setCC(Zero, dest);
+  movzbl(dest, dest);
+}
+
 // Swizzle - permute with variable indices
 
 void MacroAssembler::swizzleInt8x16(FloatRegister rhs, FloatRegister lhsDest,
                                     FloatRegister temp) {
   ScratchSimd128Scope scratch(*this);
   loadConstantSimd128Int(SimdConstant::SplatX16(15), scratch);
   vmovapd(rhs, temp);
   vpcmpgtb(Operand(scratch), temp, temp);  // set high bit