Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
Merge pull request #73 from huningxin/xwalk-3117
Browse files Browse the repository at this point in the history
[SIMD.js] Rename the shift operations to include "ByScalar"
  • Loading branch information
rakuco committed Jan 16, 2015
2 parents 2fcc9f4 + 61c20fc commit f9f8dea
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
10 changes: 6 additions & 4 deletions src/objects.h
Original file line number Diff line number Diff line change
Expand Up @@ -6836,10 +6836,12 @@ class Script: public Struct {
V(SIMD.int32x4, greaterThan, Int32x4GreaterThan, Int32x4, Int32x4, Int32x4) \
V(SIMD.int32x4, equal, Int32x4Equal, Int32x4, Int32x4, Int32x4) \
V(SIMD.int32x4, lessThan, Int32x4LessThan, Int32x4, Int32x4, Int32x4) \
V(SIMD.int32x4, shiftLeft, Int32x4ShiftLeft, Int32x4, Int32x4, Integer32) \
V(SIMD.int32x4, shiftRight, Int32x4ShiftRight, Int32x4, Int32x4, Integer32) \
V(SIMD.int32x4, shiftRightArithmetic, Int32x4ShiftRightArithmetic, Int32x4, \
Int32x4, Integer32)
V(SIMD.int32x4, shiftLeftByScalar, Int32x4ShiftLeft, Int32x4, Int32x4, \
Integer32) \
V(SIMD.int32x4, shiftRightLogicalByScalar, Int32x4ShiftRight, Int32x4, \
Int32x4, Integer32) \
V(SIMD.int32x4, shiftRightArithmeticByScalar, Int32x4ShiftRightArithmetic, \
Int32x4, Int32x4, Integer32)

#define SIMD_TERNARY_OPERATIONS(V) \
V(SIMD.float32x4, clamp, Float32x4Clamp, Float32x4, Float32x4, Float32x4, \
Expand Down
12 changes: 6 additions & 6 deletions src/simd128.js
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ function Int32x4SelectJS(x4, trueValue, falseValue) {
return %Int32x4Select(x4, trueValue, falseValue);
}

function Int32x4ShiftLeftJS(t, s) {
function Int32x4ShiftLeftByScalarJS(t, s) {
CheckInt32x4(t);
s = TO_NUMBER_INLINE(s);
var x = t.x << s;
Expand All @@ -475,7 +475,7 @@ function Int32x4ShiftLeftJS(t, s) {
return %CreateInt32x4(x, y, z, w);
}

function Int32x4ShiftRightJS(t, s) {
function Int32x4ShiftRightLogicalByScalarJS(t, s) {
CheckInt32x4(t);
s = TO_NUMBER_INLINE(s);
var x = t.x >>> s;
Expand All @@ -485,7 +485,7 @@ function Int32x4ShiftRightJS(t, s) {
return %CreateInt32x4(x, y, z, w);
}

function Int32x4ShiftRightArithmeticJS(t, s) {
function Int32x4ShiftRightArithmeticByScalarJS(t, s) {
CheckInt32x4(t);
s = TO_NUMBER_INLINE(s);
var x = t.x >> s;
Expand Down Expand Up @@ -618,9 +618,9 @@ function SetUpSIMD() {
"greaterThan", Int32x4GreaterThanJS,
"equal", Int32x4EqualJS,
"lessThan", Int32x4LessThanJS,
"shiftLeft", Int32x4ShiftLeftJS,
"shiftRight", Int32x4ShiftRightJS,
"shiftRightArithmetic", Int32x4ShiftRightArithmeticJS,
"shiftLeftByScalar", Int32x4ShiftLeftByScalarJS,
"shiftRightLogicalByScalar", Int32x4ShiftRightLogicalByScalarJS,
"shiftRightArithmeticByScalar", Int32x4ShiftRightArithmeticByScalarJS,
// Ternary
"select", Int32x4SelectJS,
// Quinary
Expand Down
6 changes: 3 additions & 3 deletions test/mjsunit/simd/int32x4.js
Original file line number Diff line number Diff line change
Expand Up @@ -649,21 +649,21 @@ testSIMDComparisons();
function testSIMDShift() {
var m = SIMD.int32x4(1, 2, 100, 0);

var a = SIMD.int32x4.shiftLeft(m, 2);
var a = SIMD.int32x4.shiftLeftByScalar(m, 2);
assertEquals(4, a.x);
assertEquals(8, a.y);
assertEquals(400, a.z);
assertEquals(0, a.w);

var b = SIMD.int32x4.shiftRight(a, 2);
var b = SIMD.int32x4.shiftRightLogicalByScalar(a, 2);
assertEquals(1, b.x);
assertEquals(2, b.y);
assertEquals(100, b.z);
assertEquals(0, b.w);

var n = SIMD.int32x4(-8, 2, 1, 100);

var c = SIMD.int32x4.shiftRightArithmetic(n, 2);
var c = SIMD.int32x4.shiftRightArithmeticByScalar(n, 2);
assertEquals(-2, c.x);
assertEquals(0, c.y);
assertEquals(0, c.z);
Expand Down

0 comments on commit f9f8dea

Please sign in to comment.