Commit 6378f57b authored by bbudge's avatar bbudge Committed by Commit bot

V8: Add SIMD functions for Phase 1.

Float32x4:
  abs, neg, sqrt, reciprocalApproximation, reciprocalSqrtApproximation, add, sub, mul, div,
  min, max, minNum, maxNum, lessThan, lessThanOrEqual, greaterThan, greaterThanOrEqual,
  equal, notEqual, select, swizzle, shuffle, fromInt32x4, fromInt32x4Bits, fromInt16x8Bits,
  fromInt8x16Bits.

Int32x4:
  neg, add, sub, mul, min, max, and, or, xor, not, shiftLeftByScalar, shiftRightLogicalByScalar,
  shiftRightArithmeticByScalar, lessThan, lessThanOrEqual, greaterThan, greaterThanOrEqual,
  equal, notEqual, select, swizzle, shuffle, fromFloat32x4, fromFloat32x4Bits, fromInt16x8Bits,
  fromInt8x16Bits.

Int16x8:
  neg, add, sub, mul, min, max, and, or, xor, not, shiftLeftByScalar, shiftRightLogicalByScalar,
  shiftRightArithmeticByScalar, lessThan, lessThanOrEqual, greaterThan, greaterThanOrEqual,
  equal, notEqual, select, swizzle, shuffle, fromFloat32x4Bits, fromInt32x4Bits, fromInt8x16Bits.

Int8x16:
  neg, add, sub, mul, min, max, and, or, xor, not, shiftLeftByScalar, shiftRightLogicalByScalar,
  shiftRightArithmeticByScalar, lessThan, lessThanOrEqual, greaterThan, greaterThanOrEqual,
  equal, notEqual, select, swizzle, shuffle, fromFloat32x4Bits, fromInt32x4Bits, fromInt16x8Bitss.

Bool32x4, Bool16x8, Bool8x16:
  and, or, not, anyTrue, allTrue, select, swizzle, shuffle.

I might have forgotten a few.

LOG=N
BUG=v8:4124

Review URL: https://codereview.chromium.org/1230343003

Cr-Commit-Position: refs/heads/master@{#30051}
parent 5202facf
This diff is collapsed.
......@@ -45,12 +45,28 @@ var StringCharAt;
var StringIndexOf;
var StringSubstring;
var Float32x4ToString;
var Int32x4ToString;
var Bool32x4ToString;
var Int16x8ToString;
var Bool16x8ToString;
var Int8x16ToString;
var Bool8x16ToString;
utils.Import(function(from) {
ArrayJoin = from.ArrayJoin;
ObjectToString = from.ObjectToString;
StringCharAt = from.StringCharAt;
StringIndexOf = from.StringIndexOf;
StringSubstring = from.StringSubstring;
Float32x4ToString = from.Float32x4ToString;
Int32x4ToString = from.Int32x4ToString;
Bool32x4ToString = from.Bool32x4ToString;
Int16x8ToString = from.Int16x8ToString;
Bool16x8ToString = from.Bool16x8ToString;
Int8x16ToString = from.Int8x16ToString;
Bool8x16ToString = from.Bool8x16ToString;
});
// -------------------------------------------------------------------
......@@ -88,13 +104,13 @@ function NoSideEffectToString(obj) {
if (IS_SYMBOL(obj)) return %_CallFunction(obj, $symbolToString);
if (IS_SIMD_VALUE(obj)) {
switch (typeof(obj)) {
case 'float32x4': return %_CallFunction(obj, $float32x4ToString);
case 'int32x4': return %_CallFunction(obj, $int32x4ToString);
case 'bool32x4': return %_CallFunction(obj, $bool32x4ToString);
case 'int16x8': return %_CallFunction(obj, $int16x8ToString);
case 'bool16x8': return %_CallFunction(obj, $bool16x8ToString);
case 'int16x8': return %_CallFunction(obj, $int16x8ToString);
case 'bool16x8': return %_CallFunction(obj, $bool16x8ToString);
case 'float32x4': return %_CallFunction(obj, Float32x4ToString);
case 'int32x4': return %_CallFunction(obj, Int32x4ToString);
case 'bool32x4': return %_CallFunction(obj, Bool32x4ToString);
case 'int16x8': return %_CallFunction(obj, Int16x8ToString);
case 'bool16x8': return %_CallFunction(obj, Bool16x8ToString);
case 'int16x8': return %_CallFunction(obj, Int16x8ToString);
case 'bool16x8': return %_CallFunction(obj, Bool16x8ToString);
}
}
if (IS_OBJECT(obj)
......
......@@ -1634,6 +1634,9 @@ void HeapNumber::HeapNumberPrint(std::ostream& os) { // NOLINT
#define READ_INT64_FIELD(p, offset) \
(*reinterpret_cast<const int64_t*>(FIELD_ADDR_CONST(p, offset)))
#define READ_BYTE_FIELD(p, offset) \
(*reinterpret_cast<const byte*>(FIELD_ADDR_CONST(p, offset)))
bool Simd128Value::BitwiseEquals(const Simd128Value* other) const {
return READ_INT64_FIELD(this, kValueOffset) ==
......@@ -1657,6 +1660,11 @@ uint32_t Simd128Value::Hash() const {
}
void Simd128Value::CopyBits(void* destination) const {
memcpy(destination, &READ_BYTE_FIELD(this, kValueOffset), kSimd128Size);
}
String* JSReceiver::class_name() {
if (IsJSFunction() || IsJSFunctionProxy()) {
return GetHeap()->Function_string();
......
......@@ -1611,6 +1611,8 @@ class Simd128Value : public HeapObject {
bool BitwiseEquals(const Simd128Value* other) const;
// Computes a hash from the 128 bit value, viewed as 4 32-bit integers.
uint32_t Hash() const;
// Copies the 16 bytes of SIMD data to the destination address.
void CopyBits(void* destination) const;
// Layout description.
static const int kValueOffset = HeapObject::kHeaderSize;
......
This diff is collapsed.
......@@ -562,42 +562,178 @@ namespace internal {
F(Arguments, 1, 1)
#define FOR_EACH_INTRINSIC_SIMD(F) \
F(IsSimdValue, 1, 1) \
F(SimdToObject, 1, 1) \
F(SimdEquals, 2, 1) \
F(SimdSameValue, 2, 1) \
F(SimdSameValueZero, 2, 1) \
F(CreateFloat32x4, 4, 1) \
F(CreateInt32x4, 4, 1) \
F(CreateBool32x4, 4, 1) \
F(CreateInt16x8, 8, 1) \
F(CreateBool16x8, 8, 1) \
F(CreateInt8x16, 16, 1) \
F(CreateBool8x16, 16, 1) \
F(Float32x4Check, 1, 1) \
F(Int32x4Check, 1, 1) \
F(Bool32x4Check, 1, 1) \
F(Int16x8Check, 1, 1) \
F(Bool16x8Check, 1, 1) \
F(Int8x16Check, 1, 1) \
F(Bool8x16Check, 1, 1) \
F(Float32x4ExtractLane, 2, 1) \
F(Int32x4ExtractLane, 2, 1) \
F(Bool32x4ExtractLane, 2, 1) \
F(Int16x8ExtractLane, 2, 1) \
F(Int16x8UnsignedExtractLane, 2, 1) \
F(Bool16x8ExtractLane, 2, 1) \
F(Int8x16ExtractLane, 2, 1) \
F(Int8x16UnsignedExtractLane, 2, 1) \
F(Bool8x16ExtractLane, 2, 1) \
F(Float32x4ReplaceLane, 3, 1) \
F(Int32x4ReplaceLane, 3, 1) \
F(Bool32x4ReplaceLane, 3, 1) \
F(Int16x8ReplaceLane, 3, 1) \
F(Bool16x8ReplaceLane, 3, 1) \
F(Int8x16ReplaceLane, 3, 1) \
F(Bool8x16ReplaceLane, 3, 1)
#define FOR_EACH_INTRINSIC_SIMD(F) \
F(IsSimdValue, 1, 1) \
F(SimdToObject, 1, 1) \
F(SimdEquals, 2, 1) \
F(SimdSameValue, 2, 1) \
F(SimdSameValueZero, 2, 1) \
F(CreateFloat32x4, 4, 1) \
F(CreateInt32x4, 4, 1) \
F(CreateBool32x4, 4, 1) \
F(CreateInt16x8, 8, 1) \
F(CreateBool16x8, 8, 1) \
F(CreateInt8x16, 16, 1) \
F(CreateBool8x16, 16, 1) \
F(Float32x4Check, 1, 1) \
F(Float32x4ExtractLane, 2, 1) \
F(Float32x4ReplaceLane, 3, 1) \
F(Float32x4Abs, 1, 1) \
F(Float32x4Neg, 1, 1) \
F(Float32x4Sqrt, 1, 1) \
F(Float32x4RecipApprox, 1, 1) \
F(Float32x4RecipSqrtApprox, 1, 1) \
F(Float32x4Add, 2, 1) \
F(Float32x4Sub, 2, 1) \
F(Float32x4Mul, 2, 1) \
F(Float32x4Div, 2, 1) \
F(Float32x4Min, 2, 1) \
F(Float32x4Max, 2, 1) \
F(Float32x4MinNum, 2, 1) \
F(Float32x4MaxNum, 2, 1) \
F(Float32x4LessThan, 2, 1) \
F(Float32x4LessThanOrEqual, 2, 1) \
F(Float32x4GreaterThan, 2, 1) \
F(Float32x4GreaterThanOrEqual, 2, 1) \
F(Float32x4Equal, 2, 1) \
F(Float32x4NotEqual, 2, 1) \
F(Float32x4Select, 3, 1) \
F(Float32x4Swizzle, 5, 1) \
F(Float32x4Shuffle, 6, 1) \
F(Float32x4FromInt32x4, 1, 1) \
F(Float32x4FromInt32x4Bits, 1, 1) \
F(Float32x4FromInt16x8Bits, 1, 1) \
F(Float32x4FromInt8x16Bits, 1, 1) \
F(Int32x4Check, 1, 1) \
F(Int32x4ExtractLane, 2, 1) \
F(Int32x4ReplaceLane, 3, 1) \
F(Int32x4Neg, 1, 1) \
F(Int32x4Add, 2, 1) \
F(Int32x4Sub, 2, 1) \
F(Int32x4Mul, 2, 1) \
F(Int32x4Min, 2, 1) \
F(Int32x4Max, 2, 1) \
F(Int32x4And, 2, 1) \
F(Int32x4Or, 2, 1) \
F(Int32x4Xor, 2, 1) \
F(Int32x4Not, 1, 1) \
F(Int32x4ShiftLeftByScalar, 2, 1) \
F(Int32x4ShiftRightLogicalByScalar, 2, 1) \
F(Int32x4ShiftRightArithmeticByScalar, 2, 1) \
F(Int32x4LessThan, 2, 1) \
F(Int32x4LessThanOrEqual, 2, 1) \
F(Int32x4GreaterThan, 2, 1) \
F(Int32x4GreaterThanOrEqual, 2, 1) \
F(Int32x4Equal, 2, 1) \
F(Int32x4NotEqual, 2, 1) \
F(Int32x4Select, 3, 1) \
F(Int32x4Swizzle, 5, 1) \
F(Int32x4Shuffle, 6, 1) \
F(Int32x4FromFloat32x4, 1, 1) \
F(Int32x4FromFloat32x4Bits, 1, 1) \
F(Int32x4FromInt16x8Bits, 1, 1) \
F(Int32x4FromInt8x16Bits, 1, 1) \
F(Bool32x4Check, 1, 1) \
F(Bool32x4ExtractLane, 2, 1) \
F(Bool32x4ReplaceLane, 3, 1) \
F(Bool32x4And, 2, 1) \
F(Bool32x4Or, 2, 1) \
F(Bool32x4Xor, 2, 1) \
F(Bool32x4Not, 1, 1) \
F(Bool32x4AnyTrue, 1, 1) \
F(Bool32x4AllTrue, 1, 1) \
F(Bool32x4Equal, 2, 1) \
F(Bool32x4NotEqual, 2, 1) \
F(Bool32x4Swizzle, 5, 1) \
F(Bool32x4Shuffle, 6, 1) \
F(Int16x8Check, 1, 1) \
F(Int16x8ExtractLane, 2, 1) \
F(Int16x8UnsignedExtractLane, 2, 1) \
F(Int16x8ReplaceLane, 3, 1) \
F(Int16x8Neg, 1, 1) \
F(Int16x8Add, 2, 1) \
F(Int16x8AddSaturate, 2, 1) \
F(Int16x8Sub, 2, 1) \
F(Int16x8SubSaturate, 2, 1) \
F(Int16x8Mul, 2, 1) \
F(Int16x8Min, 2, 1) \
F(Int16x8Max, 2, 1) \
F(Int16x8And, 2, 1) \
F(Int16x8Or, 2, 1) \
F(Int16x8Xor, 2, 1) \
F(Int16x8Not, 1, 1) \
F(Int16x8ShiftLeftByScalar, 2, 1) \
F(Int16x8ShiftRightLogicalByScalar, 2, 1) \
F(Int16x8ShiftRightArithmeticByScalar, 2, 1) \
F(Int16x8LessThan, 2, 1) \
F(Int16x8LessThanOrEqual, 2, 1) \
F(Int16x8GreaterThan, 2, 1) \
F(Int16x8GreaterThanOrEqual, 2, 1) \
F(Int16x8Equal, 2, 1) \
F(Int16x8NotEqual, 2, 1) \
F(Int16x8Select, 3, 1) \
F(Int16x8Swizzle, 9, 1) \
F(Int16x8Shuffle, 10, 1) \
F(Int16x8FromFloat32x4Bits, 1, 1) \
F(Int16x8FromInt32x4Bits, 1, 1) \
F(Int16x8FromInt8x16Bits, 1, 1) \
F(Bool16x8Check, 1, 1) \
F(Bool16x8ExtractLane, 2, 1) \
F(Bool16x8ReplaceLane, 3, 1) \
F(Bool16x8And, 2, 1) \
F(Bool16x8Or, 2, 1) \
F(Bool16x8Xor, 2, 1) \
F(Bool16x8Not, 1, 1) \
F(Bool16x8AnyTrue, 1, 1) \
F(Bool16x8AllTrue, 1, 1) \
F(Bool16x8Equal, 2, 1) \
F(Bool16x8NotEqual, 2, 1) \
F(Bool16x8Swizzle, 9, 1) \
F(Bool16x8Shuffle, 10, 1) \
F(Int8x16Check, 1, 1) \
F(Int8x16ExtractLane, 2, 1) \
F(Int8x16UnsignedExtractLane, 2, 1) \
F(Int8x16ReplaceLane, 3, 1) \
F(Int8x16Neg, 1, 1) \
F(Int8x16Add, 2, 1) \
F(Int8x16AddSaturate, 2, 1) \
F(Int8x16Sub, 2, 1) \
F(Int8x16SubSaturate, 2, 1) \
F(Int8x16Mul, 2, 1) \
F(Int8x16Min, 2, 1) \
F(Int8x16Max, 2, 1) \
F(Int8x16And, 2, 1) \
F(Int8x16Or, 2, 1) \
F(Int8x16Xor, 2, 1) \
F(Int8x16Not, 1, 1) \
F(Int8x16ShiftLeftByScalar, 2, 1) \
F(Int8x16ShiftRightLogicalByScalar, 2, 1) \
F(Int8x16ShiftRightArithmeticByScalar, 2, 1) \
F(Int8x16LessThan, 2, 1) \
F(Int8x16LessThanOrEqual, 2, 1) \
F(Int8x16GreaterThan, 2, 1) \
F(Int8x16GreaterThanOrEqual, 2, 1) \
F(Int8x16Equal, 2, 1) \
F(Int8x16NotEqual, 2, 1) \
F(Int8x16Select, 3, 1) \
F(Int8x16Swizzle, 17, 1) \
F(Int8x16Shuffle, 18, 1) \
F(Int8x16FromFloat32x4Bits, 1, 1) \
F(Int8x16FromInt32x4Bits, 1, 1) \
F(Int8x16FromInt16x8Bits, 1, 1) \
F(Bool8x16Check, 1, 1) \
F(Bool8x16ExtractLane, 2, 1) \
F(Bool8x16ReplaceLane, 3, 1) \
F(Bool8x16And, 2, 1) \
F(Bool8x16Or, 2, 1) \
F(Bool8x16Xor, 2, 1) \
F(Bool8x16Not, 1, 1) \
F(Bool8x16AnyTrue, 1, 1) \
F(Bool8x16AllTrue, 1, 1) \
F(Bool8x16Equal, 2, 1) \
F(Bool8x16NotEqual, 2, 1) \
F(Bool8x16Swizzle, 17, 1) \
F(Bool8x16Shuffle, 18, 1)
#define FOR_EACH_INTRINSIC_STRINGS(F) \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment