Bug 1238679 - Make inlineSimdLoad/Store take a MIRType argument. r=bbouvier
authorJakob Stoklund Olesen <jolesen@mozilla.com>
Wed, 20 Jan 2016 12:50:07 -0800
changeset 315956 a5d469a2a37fb9f3f8807db603508d01c2ac87f6
parent 315955 01c1a62a453c77b7ba92a48c4398233e749e5dfe
child 315957 02827acc616d26af4adcab766d6cdfe2b354bcf0
push id5703
push userraliiev@mozilla.com
push dateMon, 07 Mar 2016 14:18:41 +0000
treeherdermozilla-beta@31e373ad5b5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbouvier
bugs1238679
milestone46.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 1238679 - Make inlineSimdLoad/Store take a MIRType argument. r=bbouvier Complete the earlier refactoring that got rid of the SimdTypeDescr::Type enums.
js/src/jit/IonBuilder.h
js/src/jit/MCallOptimize.cpp
--- a/js/src/jit/IonBuilder.h
+++ b/js/src/jit/IonBuilder.h
@@ -880,19 +880,19 @@ class IonBuilder
                                      unsigned numVectors, unsigned numLanes);
     InliningStatus inlineSimdCheck(CallInfo& callInfo, JSNative native, MIRType type);
     InliningStatus inlineSimdConvert(CallInfo& callInfo, JSNative native, bool isCast,
                                      MIRType from, MIRType to);
     InliningStatus inlineSimdSelect(CallInfo& callInfo, JSNative native, MIRType type);
 
     bool prepareForSimdLoadStore(CallInfo& callInfo, Scalar::Type simdType, MInstruction** elements,
                                  MDefinition** index, Scalar::Type* arrayType);
-    InliningStatus inlineSimdLoad(CallInfo& callInfo, JSNative native, SimdTypeDescr::Type type,
+    InliningStatus inlineSimdLoad(CallInfo& callInfo, JSNative native, MIRType type,
                                   unsigned numElems);
-    InliningStatus inlineSimdStore(CallInfo& callInfo, JSNative native, SimdTypeDescr::Type type,
+    InliningStatus inlineSimdStore(CallInfo& callInfo, JSNative native, MIRType type,
                                    unsigned numElems);
 
     InliningStatus inlineSimdAnyAllTrue(CallInfo& callInfo, bool IsAllTrue, JSNative native);
 
     // Utility intrinsics.
     InliningStatus inlineIsCallable(CallInfo& callInfo);
     InliningStatus inlineIsObject(CallInfo& callInfo);
     InliningStatus inlineToObject(CallInfo& callInfo);
--- a/js/src/jit/MCallOptimize.cpp
+++ b/js/src/jit/MCallOptimize.cpp
@@ -3149,32 +3149,32 @@ IonBuilder::inlineSimdInt32x4(CallInfo& 
         return inlineSimdSelect(callInfo, native, MIRType_Int32x4);
 
     if (native == js::simd_int32x4_swizzle)
         return inlineSimdShuffle(callInfo, native, MIRType_Int32x4, 1, 4);
     if (native == js::simd_int32x4_shuffle)
         return inlineSimdShuffle(callInfo, native, MIRType_Int32x4, 2, 4);
 
     if (native == js::simd_int32x4_load)
-        return inlineSimdLoad(callInfo, native, SimdTypeDescr::Int32x4, 4);
+        return inlineSimdLoad(callInfo, native, MIRType_Int32x4, 4);
     if (native == js::simd_int32x4_load1)
-        return inlineSimdLoad(callInfo, native, SimdTypeDescr::Int32x4, 1);
+        return inlineSimdLoad(callInfo, native, MIRType_Int32x4, 1);
     if (native == js::simd_int32x4_load2)
-        return inlineSimdLoad(callInfo, native, SimdTypeDescr::Int32x4, 2);
+        return inlineSimdLoad(callInfo, native, MIRType_Int32x4, 2);
     if (native == js::simd_int32x4_load3)
-        return inlineSimdLoad(callInfo, native, SimdTypeDescr::Int32x4, 3);
+        return inlineSimdLoad(callInfo, native, MIRType_Int32x4, 3);
 
     if (native == js::simd_int32x4_store)
-        return inlineSimdStore(callInfo, native, SimdTypeDescr::Int32x4, 4);
+        return inlineSimdStore(callInfo, native, MIRType_Int32x4, 4);
     if (native == js::simd_int32x4_store1)
-        return inlineSimdStore(callInfo, native, SimdTypeDescr::Int32x4, 1);
+        return inlineSimdStore(callInfo, native, MIRType_Int32x4, 1);
     if (native == js::simd_int32x4_store2)
-        return inlineSimdStore(callInfo, native, SimdTypeDescr::Int32x4, 2);
+        return inlineSimdStore(callInfo, native, MIRType_Int32x4, 2);
     if (native == js::simd_int32x4_store3)
-        return inlineSimdStore(callInfo, native, SimdTypeDescr::Int32x4, 3);
+        return inlineSimdStore(callInfo, native, MIRType_Int32x4, 3);
 
     return InliningStatus_NotInlined;
 }
 
 IonBuilder::InliningStatus
 IonBuilder::inlineSimdFloat32x4(CallInfo& callInfo, JSNative native)
 {
     // Simd functions
@@ -3223,32 +3223,32 @@ IonBuilder::inlineSimdFloat32x4(CallInfo
         return inlineSimdSelect(callInfo, native, MIRType_Float32x4);
 
     if (native == js::simd_float32x4_swizzle)
         return inlineSimdShuffle(callInfo, native, MIRType_Float32x4, 1, 4);
     if (native == js::simd_float32x4_shuffle)
         return inlineSimdShuffle(callInfo, native, MIRType_Float32x4, 2, 4);
 
     if (native == js::simd_float32x4_load)
-        return inlineSimdLoad(callInfo, native, SimdTypeDescr::Float32x4, 4);
+        return inlineSimdLoad(callInfo, native, MIRType_Float32x4, 4);
     if (native == js::simd_float32x4_load1)
-        return inlineSimdLoad(callInfo, native, SimdTypeDescr::Float32x4, 1);
+        return inlineSimdLoad(callInfo, native, MIRType_Float32x4, 1);
     if (native == js::simd_float32x4_load2)
-        return inlineSimdLoad(callInfo, native, SimdTypeDescr::Float32x4, 2);
+        return inlineSimdLoad(callInfo, native, MIRType_Float32x4, 2);
     if (native == js::simd_float32x4_load3)
-        return inlineSimdLoad(callInfo, native, SimdTypeDescr::Float32x4, 3);
+        return inlineSimdLoad(callInfo, native, MIRType_Float32x4, 3);
 
     if (native == js::simd_float32x4_store)
-        return inlineSimdStore(callInfo, native, SimdTypeDescr::Float32x4, 4);
+        return inlineSimdStore(callInfo, native, MIRType_Float32x4, 4);
     if (native == js::simd_float32x4_store1)
-        return inlineSimdStore(callInfo, native, SimdTypeDescr::Float32x4, 1);
+        return inlineSimdStore(callInfo, native, MIRType_Float32x4, 1);
     if (native == js::simd_float32x4_store2)
-        return inlineSimdStore(callInfo, native, SimdTypeDescr::Float32x4, 2);
+        return inlineSimdStore(callInfo, native, MIRType_Float32x4, 2);
     if (native == js::simd_float32x4_store3)
-        return inlineSimdStore(callInfo, native, SimdTypeDescr::Float32x4, 3);
+        return inlineSimdStore(callInfo, native, MIRType_Float32x4, 3);
 
     return InliningStatus_NotInlined;
 }
 
 // The representation of boolean SIMD vectors is the same as the corresponding
 // integer SIMD vectors with -1 lanes meaning true and 0 lanes meaning false.
 //
 // Functions that set the value of a boolean vector lane work by applying
@@ -3569,35 +3569,23 @@ IonBuilder::inlineSimdAnyAllTrue(CallInf
     current->push(ins);
     callInfo.setImplicitlyUsedUnchecked();
     return InliningStatus_Inlined;
 }
 
 // Get the typed array element type corresponding to the lanes in a SIMD vector type.
 // This only applies to SIMD types that can be loaded and stored to a typed array.
 static Scalar::Type
-SimdTypeToArrayElementType(SimdTypeDescr::Type type)
+SimdTypeToArrayElementType(MIRType type)
 {
     switch (type) {
-      case SimdTypeDescr::Float32x4: return Scalar::Float32x4;
-      case SimdTypeDescr::Int32x4:   return Scalar::Int32x4;
-      // Bool vectors don't have load/store operations.
-      case SimdTypeDescr::Bool8x16:
-      case SimdTypeDescr::Bool16x8:
-      case SimdTypeDescr::Bool32x4:
-      case SimdTypeDescr::Bool64x2: break;
-      // Not yet implemented.
-      case SimdTypeDescr::Int8x16:
-      case SimdTypeDescr::Int16x8:
-      case SimdTypeDescr::Uint8x16:
-      case SimdTypeDescr::Uint16x8:
-      case SimdTypeDescr::Uint32x4:
-      case SimdTypeDescr::Float64x2: break;
+      case MIRType_Float32x4: return Scalar::Float32x4;
+      case MIRType_Int32x4:   return Scalar::Int32x4;
+      default:                MOZ_CRASH("unexpected simd type");
     }
-    MOZ_CRASH("unexpected simd type");
 }
 
 bool
 IonBuilder::prepareForSimdLoadStore(CallInfo& callInfo, Scalar::Type simdType, MInstruction** elements,
                                     MDefinition** index, Scalar::Type* arrayType)
 {
     MDefinition* array = callInfo.getArg(0);
     *index = callInfo.getArg(1);
@@ -3635,59 +3623,57 @@ IonBuilder::prepareForSimdLoadStore(Call
     current->add(positiveCheck);
 
     MInstruction* fullCheck = MBoundsCheck::New(alloc(), indexForBoundsCheck, length);
     current->add(fullCheck);
     return true;
 }
 
 IonBuilder::InliningStatus
-IonBuilder::inlineSimdLoad(CallInfo& callInfo, JSNative native, SimdTypeDescr::Type type,
-                           unsigned numElems)
+IonBuilder::inlineSimdLoad(CallInfo& callInfo, JSNative native, MIRType type, unsigned numElems)
 {
     InlineTypedObject* templateObj = nullptr;
     if (!canInlineSimd(callInfo, native, 2, &templateObj))
         return InliningStatus_NotInlined;
 
-    Scalar::Type simdType = SimdTypeToArrayElementType(type);
+    Scalar::Type elemType = SimdTypeToArrayElementType(type);
 
     MDefinition* index = nullptr;
     MInstruction* elements = nullptr;
     Scalar::Type arrayType;
-    if (!prepareForSimdLoadStore(callInfo, simdType, &elements, &index, &arrayType))
+    if (!prepareForSimdLoadStore(callInfo, elemType, &elements, &index, &arrayType))
         return InliningStatus_NotInlined;
 
     MLoadUnboxedScalar* load = MLoadUnboxedScalar::New(alloc(), elements, index, arrayType);
-    load->setResultType(SimdTypeDescrToMIRType(type));
-    load->setSimdRead(simdType, numElems);
+    load->setResultType(type);
+    load->setSimdRead(elemType, numElems);
 
     return boxSimd(callInfo, load, templateObj);
 }
 
 IonBuilder::InliningStatus
-IonBuilder::inlineSimdStore(CallInfo& callInfo, JSNative native, SimdTypeDescr::Type type,
-                            unsigned numElems)
+IonBuilder::inlineSimdStore(CallInfo& callInfo, JSNative native, MIRType type, unsigned numElems)
 {
     InlineTypedObject* templateObj = nullptr;
     if (!canInlineSimd(callInfo, native, 3, &templateObj))
         return InliningStatus_NotInlined;
 
-    Scalar::Type simdType = SimdTypeToArrayElementType(type);
+    Scalar::Type elemType = SimdTypeToArrayElementType(type);
 
     MDefinition* index = nullptr;
     MInstruction* elements = nullptr;
     Scalar::Type arrayType;
-    if (!prepareForSimdLoadStore(callInfo, simdType, &elements, &index, &arrayType))
+    if (!prepareForSimdLoadStore(callInfo, elemType, &elements, &index, &arrayType))
         return InliningStatus_NotInlined;
 
     MDefinition* valueToWrite = callInfo.getArg(2);
     MStoreUnboxedScalar* store = MStoreUnboxedScalar::New(alloc(), elements, index,
                                                           valueToWrite, arrayType,
                                                           MStoreUnboxedScalar::TruncateInput);
-    store->setSimdWrite(simdType, numElems);
+    store->setSimdWrite(elemType, numElems);
 
     current->add(store);
     current->push(valueToWrite);
 
     callInfo.setImplicitlyUsedUnchecked();
 
     if (!resumeAfter(store))
         return InliningStatus_Error;