jdelauney / SIMD-VectorMath-UnitTest

For testing asm SIMD (SSE/SSE 2/SSE 3/SSE 4.x / AVX /AVX 2) vector math library (2f, 4f, matrix, quaternion...) with Lazarus and FreePascal Compiler
Mozilla Public License 2.0
8 stars 0 forks source link

Re Shuflle #15

Closed dicepd closed 6 years ago

dicepd commented 6 years ago

Jerome,

I am thinking about tests for this but currently the pascal code seems to make no sense. I am presuming you want to replicate the SSE shufxx commands. if so I think the pascal should be

Result.X := Self.V[x];

in order that you can select x,y,z,w value into the X part of result. As it is currently written I could set xyzw all to 1 in the parameters and it would try to set self xyzw all to result.x.

dicepd commented 6 years ago

This is how I have written the test so you get what I think you want.

  abf1.Create(1,2,3,4);
  abf3 := abf1.Shuffle(0,0,0,0); //|X|X|X|X|
  AssertEquals('Shuffle:Sub1 X failed ', 1, abf3.X);
  AssertEquals('Shuffle:Sub2 Y failed ', 1, abf3.Y);
  AssertEquals('Shuffle:Sub3 Z failed ', 1, abf3.Z);
  AssertEquals('Shuffle:Sub4 W failed ', 1, abf3.W);
  abf3 := abf1.Shuffle(0,0,3,3); //|X|X|W|W|
  AssertEquals('Shuffle:Sub1 X failed ', 1, abf3.X);
  AssertEquals('Shuffle:Sub2 Y failed ', 1, abf3.Y);
  AssertEquals('Shuffle:Sub3 Z failed ', 4, abf3.Z);
  AssertEquals('Shuffle:Sub4 W failed ', 4, abf3.W);
  abf3 := abf1.Shuffle(1,1,1,3); //|Y|Y|Y|W|
  AssertEquals('Shuffle:Sub1 X failed ', 2, abf3.X);
  AssertEquals('Shuffle:Sub2 Y failed ', 2, abf3.Y);
  AssertEquals('Shuffle:Sub3 Z failed ', 2, abf3.Z);
  AssertEquals('Shuffle:Sub4 W failed ', 4, abf3.W);                
jdelauney commented 6 years ago

am presuming you want to replicate the SSE shufxx

Yes, i see i'v don't take care, i wrote the inverse