From f1e4dab946fc1f83ba3acb87e3507812c1e58c27 Mon Sep 17 00:00:00 2001 From: Douglas Crosher Date: Wed, 18 Feb 2015 20:29:51 +1100 Subject: [PATCH] Bug 1130827 - Odin: Use SIMD load/store for the fbird test now that they are implemented. r=bbouvier --- js/src/jit-test/tests/asm.js/simd-fbirds.js | 30 ++++++--------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/js/src/jit-test/tests/asm.js/simd-fbirds.js b/js/src/jit-test/tests/asm.js/simd-fbirds.js index 6ef528ef2c7..8dc9e7a21a5 100644 --- a/js/src/jit-test/tests/asm.js/simd-fbirds.js +++ b/js/src/jit-test/tests/asm.js/simd-fbirds.js @@ -44,15 +44,13 @@ function getActualBirds() { var code = ` "use asm"; var toF = global.Math.fround; + var u8 = new global.Uint8Array(buffer); var f32 = new global.Float32Array(buffer); const maxBirds = 100000; const maxBirdsx4 = 400000; - const maxBirdsx4Plus4 = 400004; - const maxBirdsx4Plus8 = 400008; - const maxBirdsx4Plus12 = 400012; const maxBirdsx8 = 800000; const accelMask = 0x3c; - const mk2 = 0x000ffffc; + const mk4 = 0x000ffff0; const getMaxPos = 1000.0; const getAccelDataSteps = imp.accelDataSteps | 0; @@ -68,6 +66,8 @@ var code = ` var f4mul = f4.mul; var f4greaterThan = f4.greaterThan; var f4splat = f4.splat; + var f4load = f4.load; + var f4store = f4.store; const zerox4 = f4(0.0,0.0,0.0,0.0); @@ -110,15 +110,8 @@ var code = ` for (i = 0; (i | 0) < (len | 0); i = (i + 16) | 0) { accelIndex = 0; - // Work around unimplemented Float32x4Array - newPosx4 = f4(toF(f32[(i & mk2) >> 2]), - toF(f32[(i & mk2) + 4 >> 2]), - toF(f32[(i & mk2) + 8 >> 2]), - toF(f32[(i & mk2) + 12 >> 2])); - newVelx4 = f4(toF(f32[(i & mk2) + maxBirdsx4 >> 2]), - toF(f32[(i & mk2) + maxBirdsx4Plus4 >> 2]), - toF(f32[(i & mk2) + maxBirdsx4Plus8 >> 2]), - toF(f32[(i & mk2) + maxBirdsx4Plus12 >> 2])); + newPosx4 = f4load(u8, i & mk4); + newVelx4 = f4load(u8, (i & mk4) + maxBirdsx4); for (a = 0; (a | 0) < (steps | 0); a = (a + 1) | 0) { accel = toF(f32[(accelIndex & accelMask) + maxBirdsx8 >> 2]); accelx4 = f4splat(accel); @@ -135,15 +128,8 @@ var code = ` newVelx4 = f4select(cmpx4, newVelTruex4, newVelx4); } } - // Work around unimplemented Float32x4Array - f32[(i & mk2) >> 2] = newPosx4.x; - f32[(i & mk2) + 4 >> 2] = newPosx4.y; - f32[(i & mk2) + 8 >> 2] = newPosx4.z; - f32[(i & mk2) + 12 >> 2] = newPosx4.w; - f32[(i & mk2) + maxBirdsx4 >> 2] = newVelx4.x; - f32[(i & mk2) + maxBirdsx4Plus4 >> 2] = newVelx4.y; - f32[(i & mk2) + maxBirdsx4Plus8 >> 2] = newVelx4.z; - f32[(i & mk2) + maxBirdsx4Plus12 >> 2] = newVelx4.w; + f4store(u8, i & mk4, newPosx4); + f4store(u8, (i & mk4) + maxBirdsx4, newVelx4); } }