Bug 1023404: Implement SIMD types helpers; r=sunfish

This commit is contained in:
Benjamin Bouvier 2014-08-07 16:55:26 +02:00
Родитель 9de8117656
Коммит 2228ebf96d
1 изменённых файлов: 35 добавлений и 0 удалений

Просмотреть файл

@ -412,6 +412,41 @@ IsNullOrUndefined(MIRType type)
return type == MIRType_Null || type == MIRType_Undefined;
}
static inline bool
IsSimdType(MIRType type)
{
return type == MIRType_Int32x4 || type == MIRType_Float32x4;
};
// Returns the number of vector elements (hereby called "length") for a given
// SIMD kind. It is the Y part of the name "Foo x Y".
static inline unsigned
SimdTypeToLength(MIRType type)
{
JS_ASSERT(IsSimdType(type));
switch (type) {
case MIRType_Int32x4:
case MIRType_Float32x4:
return 4;
default: break;
}
MOZ_ASSUME_UNREACHABLE("unexpected SIMD kind");
}
static inline MIRType
SimdTypeToScalarType(MIRType type)
{
JS_ASSERT(IsSimdType(type));
switch (type) {
case MIRType_Int32x4:
return MIRType_Int32;
case MIRType_Float32x4:
return MIRType_Float32;
default: break;
}
MOZ_ASSUME_UNREACHABLE("unexpected SIMD kind");
}
#ifdef DEBUG
// Track the pipeline of opcodes which has produced a snapshot.