4 public class SimdTests {
5 public static int test_0_vector8us_pack_with_sat () {
6 Vector8us a = new Vector8us (0xFF00,1,2,3,4,5,6,7);
7 Vector8us b = new Vector8us (3,4,5,6,7,8,9,10);
8 Vector16b c = Vector8us.SignedPackWithUnsignedSaturation (a, b);
20 Console.WriteLine ("--OK");
24 public static int test_0_vector8us_mul_high () {
25 Vector8us a = new Vector8us (0xFF00, 2, 3, 0, 5, 6, 5, 4);
26 Vector8us b = new Vector8us (0xFF00, 2, 1, 2, 3, 6, 5, 6);
27 Vector8us c = Vector8us.MultiplyStoreHigh (a, b);
48 public static int test_0_vector8us_cmpeq () {
49 Vector8us a = new Vector8us (1, 2, 3, 0, 5, 6, 5, 4);
50 Vector8us b = new Vector8us (9, 2, 1, 2, 3, 6, 5, 6);
51 Vector8us c = Vector8us.CompareEqual (a, b);
73 public static int test_0_vector4ui_cmpeq () {
74 Vector4ui a = new Vector4ui (6,1,6,3);
75 Vector4ui b = new Vector4ui (3,4,6,7);
76 Vector4ui c = Vector4ui.CompareEqual (a, b);
82 if (c.Z != 0xFFFFFFFF)
89 public static int test_0_vector4ui_shuffle () {
90 Vector4ui a = new Vector4ui (1,2,3,4);
91 Vector4ui c = Vector4ui.Shuffle (a, ShuffleSel.XFromY | ShuffleSel.YFromW | ShuffleSel.ZFromX | ShuffleSel.WFromZ);
104 public static int test_0_vector4ui_extract_mask () {
105 Vector4ui a = new Vector4ui (0xFF00FF00,0x0F0FAA99,0,0);
106 int c = Vector4ui.ExtractByteMask (a);
113 public static int test_0_vector4ui_min () {
114 Vector4ui a = new Vector4ui (6,1,6,3);
115 Vector4ui b = new Vector4ui (3,4,6,7);
116 Vector4ui c = Vector4ui.Min (a, b);
129 public static int test_0_vector4ui_max () {
130 Vector4ui a = new Vector4ui (6,1,6,3);
131 Vector4ui b = new Vector4ui (3,4,6,7);
132 Vector4ui c = Vector4ui.Max (a, b);
145 public static int vector16b_cmpeq () {
146 Vector16b a = new Vector16b (1,0,9,0,0,0,0,0,0,0,0,0,0,0,0,1);
147 Vector16b b = new Vector16b (0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
148 Vector16b c = Vector16b.CompareEqual (a, b);
186 public static int vector16b_sum_abs_diff () {
187 Vector16b a = new Vector16b (100,20,20,20,0,0,0,0,0,0,0,0,0,0, 0, 0);
188 Vector16b b = new Vector16b (0, 10,10,10,0,0,0,0,0,0,0,0,0,0,10,10);
189 Vector8us c = Vector16b.SumOfAbsoluteDifferences (a, b);
211 public static int test_0_vector16b_extract_mask () {
212 Vector16b a = new Vector16b (0xF0,0,0xF0,0,0,0,0xF0,0xAA,0x0F,0,0xFF,0,0,0,0,0);
213 int c = Vector16b.ExtractByteMask (a);
220 public static int test_0_vector16b_min () {
221 Vector16b a = new Vector16b (0,12,20,12,4,5,6,7,8,9,10,11,12,13,14,15);
222 Vector16b b = new Vector16b (9,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8);
223 Vector16b c = Vector16b.Min (a, b);
260 public static int test_0_vector16b_max () {
261 Vector16b a = new Vector16b (0,12,20,12,4,5,6,7,8,9,10,11,12,13,14,15);
262 Vector16b b = new Vector16b (9,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8);
263 Vector16b c = Vector16b.Max (a, b);
299 public static int test_0_vector16b_avg () {
300 Vector16b a = new Vector16b (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
301 Vector16b b = new Vector16b (9,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8);
302 Vector16b c = Vector16b.Average (a, b);
340 static unsafe Vector8us bad_method_regression_2 (Vector16b va, Vector16b vb) {
341 Vector8us res = new Vector8us ();
342 byte *a = (byte*)&va;
343 byte *b = (byte*)&vb;
346 for (int i = 0; i < 8; ++i)
347 tmp += System.Math.Abs ((int)*a++ - (int)*b++);
348 res.V0 = (ushort)tmp;
351 for (int i = 0; i < 8; ++i)
352 tmp += System.Math.Abs ((int)*a++ - (int)*b++);
353 res.V4 = (ushort)tmp;
357 /*This bug was caused the simplifier not taking notice of LDADDR on the remaining blocks.*/
358 public static int test_2_local_simplifier_regression_other_blocks () {
359 Vector16b a = new Vector16b (1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1);
360 Vector16b b = new Vector16b (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
361 Vector8us res = bad_method_regression_2 (a,b);
362 return (int)res.V0 + res.V4;
365 static unsafe Vector8us bad_method_regression (Vector16b va, Vector16b vb) {
366 Vector8us res = new Vector8us ();
367 byte *a = (byte*)&va;
368 byte *b = (byte*)&vb;
369 *((ushort*)&res) = 10;
380 /*This bug was caused the simplifier not taking notice of LDADDR on the first block.*/
381 public static int test_10_local_simplifier_regression_first_block () {
382 Vector16b a = new Vector16b ();
383 Vector16b b = new Vector16b ();
384 Vector8us res = bad_method_regression (a,b);
389 public static int test_0_vecto8us_extract_mask () {
390 Vector8us a = new Vector8us (0xF0F0, 0x700F, 0xAABB, 0x0000, 0x00F0, 0xF0F0, 0, 0);
391 int c = Vector8us.ExtractByteMask (a);
398 public static int test_0_vecto8us_shuffle_low () {
399 Vector8us a = new Vector8us (1, 2, 3, 4, 5, 6, 7, 8);
400 Vector8us c = Vector8us.ShuffleLow (a, ShuffleSel.XFromY | ShuffleSel.YFromW | ShuffleSel.ZFromX | ShuffleSel.WFromZ);
421 public static int test_0_vecto8us_shuffle_high () {
422 Vector8us a = new Vector8us (1, 2, 3, 4, 5, 6, 7, 8);
423 Vector8us c = Vector8us.ShuffleHigh (a, ShuffleSel.XFromY | ShuffleSel.YFromW | ShuffleSel.ZFromX | ShuffleSel.WFromZ);
445 public static int test_0_vecto8us_max () {
446 Vector8us a = new Vector8us (1, 2, 3, 4, 5, 6, 7, 8);
447 Vector8us b = new Vector8us (9, 1, 1, 2, 9, 6, 5, 1000);
448 Vector8us c = Vector8us.Max (a, b);
470 public static int test_0_vecto8us_min () {
471 Vector8us a = new Vector8us (1, 2, 3, 0, 5, 6, 5, 4);
472 Vector8us b = new Vector8us (9, 1, 1, 2, 3, 4, 5, 6);
473 Vector8us c = Vector8us.Min (a, b);
494 public static int test_0_vecto8us_avg () {
495 Vector8us a = new Vector8us (1, 2, 3, 4, 5, 6, 7, 8);
496 Vector8us b = new Vector8us (9, 1, 1, 2, 3, 4, 5, 6);
497 Vector8us c = Vector8us.Average (a, b);
518 static void store_helper (ref Vector4f x) {
520 k = new Vector4f(9,9,9,9);
524 public static int test_0_vector4f_byref_store ()
527 k = new Vector4f(1,2,3,4);
528 store_helper (ref k);
534 public static int test_0_vector4f_init_array_element ()
536 Vector4f[] v = new Vector4f[1];
537 v[0] = new Vector4f(9,9,9,9);
543 public static int test_0_vector4f_dup_high () {
544 Vector4f a = new Vector4f (1, 2, 3, 4);
545 Vector4f c = Vector4f.DuplicateHigh(a);
558 public static int test_0_vector4f_dup_low () {
559 Vector4f a = new Vector4f (1, 2, 3, 4);
560 Vector4f c = Vector4f.DuplicateLow (a);
574 public static int test_0_vector4f_interleave_high () {
575 Vector4f a = new Vector4f (1, 2, 3, 4);
576 Vector4f b = new Vector4f (5, 6, 7, 8);
577 Vector4f c = Vector4f.InterleaveHigh (a, b);
590 public static int test_0_vector4f_interleave_low () {
591 Vector4f a = new Vector4f (1, 2, 3, 4);
592 Vector4f b = new Vector4f (5, 6, 7, 8);
593 Vector4f c = Vector4f.InterleaveLow (a, b);
606 public static int test_0_vector4f_rcp () {
607 Vector4f a = new Vector4f (1, 2, 4, 8);
608 Vector4f c = Vector4f.Reciprocal (a);
610 //Test with ranges due to the terrible precision.
611 if (c.X < (1 - 0.01f) || c.X > (1 + 0.01f))
613 if (c.Y < (0.5 - 0.01f) || c.Y > (0.5 + 0.01f))
615 if (c.Z < (0.25 - 0.01f) || c.Z > (0.25 + 0.01f))
617 if (c.W < (0.125 - 0.01f) || c.W > (0.125 + 0.01f))
622 public static int test_0_vector4f_xor () {
623 Vector4f a = new Vector4f (1, 2, 3, 4);
624 Vector4f b = new Vector4f (1, 3, 3, 8);
627 if (((Vector4ui)c).X != 0)
629 if (((Vector4ui)c).Y != 0x400000)
631 if (((Vector4ui)c).Z != 0)
633 if (((Vector4ui)c).W != 0x1800000)
638 public static int test_0_vector4f_or () {
639 Vector4f a = new Vector4f (1, 2, 3, 4);
640 Vector4f b = new Vector4f (1, 3, 3, 8);
643 if (((Vector4ui)c).X != 0x3F800000)
645 if (((Vector4ui)c).Y != 0x40400000)
647 if (((Vector4ui)c).Z != 0x40400000)
649 if (((Vector4ui)c).W != 0x41800000)
653 public static int test_0_vector4f_andn () {
654 Vector4f a = new Vector4f (1, 2, 3, 4);
655 Vector4f b = new Vector4f (1, 3, 3, 8);
656 Vector4f c = Vector4f.AndNot (a ,b);
658 if (((Vector4ui)c).X != 0)
660 if (((Vector4ui)c).Y != 0x400000)
662 if (((Vector4ui)c).Z != 0)
664 if (((Vector4ui)c).W != 0x1000000)
669 public static int test_0_vector4f_and () {
670 Vector4f a = new Vector4f (1, 2, 3, 4);
671 Vector4f b = new Vector4f (1, 3, 3, 8);
674 if (((Vector4ui)c).X != 0x3F800000)
676 if (((Vector4ui)c).Y != 0x40000000)
678 if (((Vector4ui)c).Z != 0x40400000)
680 if (((Vector4ui)c).W != 0x40000000)
685 public static int test_0_vector4f_cmpord () {
686 Vector4f a = new Vector4f (float.NaN, 2, 3, 4);
687 Vector4f b = new Vector4f (1, float.NaN, 3, 6);
688 Vector4f c = Vector4f.CompareOrdered (a, b);
690 if (((Vector4ui)c).X != 0)
692 if (((Vector4ui)c).Y != 0)
694 if (((Vector4ui)c).Z != 0xFFFFFFFF)
696 if (((Vector4ui)c).W != 0xFFFFFFFF)
701 public static int test_0_vector4f_cmpnle () {
702 Vector4f a = new Vector4f (float.NaN, 2, 3, 4);
703 Vector4f b = new Vector4f (1, float.NaN, 3, 6);
704 Vector4f c = Vector4f.CompareNotLessEqual (a, b);
706 if (((Vector4ui)c).X != 0xFFFFFFFF)
708 if (((Vector4ui)c).Y != 0xFFFFFFFF)
710 if (((Vector4ui)c).Z != 0)
712 if (((Vector4ui)c).W != 0)
717 public static int test_0_vector4f_cmpnlt () {
718 Vector4f a = new Vector4f (float.NaN, 2, 3, 4);
719 Vector4f b = new Vector4f (1, float.NaN, 3, 6);
720 Vector4f c = Vector4f.CompareNotLessThan (a, b);
722 if (((Vector4ui)c).X != 0xFFFFFFFF)
724 if (((Vector4ui)c).Y != 0xFFFFFFFF)
726 if (((Vector4ui)c).Z != 0xFFFFFFFF)
728 if (((Vector4ui)c).W != 0)
733 public static int test_0_vector4f_cmpneq () {
734 Vector4f a = new Vector4f (float.NaN, 2, 3, 4);
735 Vector4f b = new Vector4f (1, float.NaN, 3, 6);
736 Vector4f c = Vector4f.CompareNotEqual (a, b);
738 if (((Vector4ui)c).X != 0xFFFFFFFF)
740 if (((Vector4ui)c).Y != 0xFFFFFFFF)
742 if (((Vector4ui)c).Z != 0)
744 if (((Vector4ui)c).W != 0xFFFFFFFF)
749 public static int test_0_vector4f_cmpunord () {
750 Vector4f a = new Vector4f (float.NaN, 2, 3, 4);
751 Vector4f b = new Vector4f (1, float.NaN, 3, 6);
752 Vector4f c = Vector4f.CompareUnordered (a, b);
754 if (((Vector4ui)c).X != 0xFFFFFFFF)
756 if (((Vector4ui)c).Y != 0xFFFFFFFF)
758 if (((Vector4ui)c).Z != 0)
760 if (((Vector4ui)c).W != 0)
765 public static int test_0_vector4f_cmple () {
766 Vector4f a = new Vector4f (float.NaN, 2, 3, 4);
767 Vector4f b = new Vector4f (1, float.NaN, 3, 6);
768 Vector4f c = Vector4f.CompareLessEqual (a, b);
770 if (((Vector4ui)c).X != 0)
772 if (((Vector4ui)c).Y != 0)
774 if (((Vector4ui)c).Z != 0xFFFFFFFF)
776 if (((Vector4ui)c).W != 0xFFFFFFFF)
781 public static int test_0_vector4f_cmplt () {
782 Vector4f a = new Vector4f (float.NaN, 2, 3, 4);
783 Vector4f b = new Vector4f (1, float.NaN, 3, 6);
784 Vector4f c = Vector4f.CompareLessThan (a, b);
786 if (((Vector4ui)c).X != 0)
788 if (((Vector4ui)c).Y != 0)
790 if (((Vector4ui)c).Z != 0)
792 if (((Vector4ui)c).W != 0xFFFFFFFF)
797 public static int test_0_vector4f_cmpeq () {
798 Vector4f a = new Vector4f (float.NaN, 2, 3, 6);
799 Vector4f b = new Vector4f (1, float.NaN, 3, 4);
800 Vector4f c = Vector4f.CompareEquals (a, b);
802 if (((Vector4ui)c).X != 0)
804 if (((Vector4ui)c).Y != 0)
806 if (((Vector4ui)c).Z != 0xFFFFFFFF)
808 if (((Vector4ui)c).W != 0)
813 public static int test_0_vector4ui_sar () {
814 Vector4ui a = new Vector4ui (0xF0000000u,20,3,40);
816 Vector4ui c = Vector4ui.ShiftRightArithmetic (a, 2);
818 if (c.X != 0xFC000000)
829 public static int test_0_vector4ui_unpack_high () {
830 Vector4ui a = new Vector4ui (1,2,3,4);
831 Vector4ui b = new Vector4ui (5,6,7,8);
833 Vector4ui c = Vector4ui.UnpackHigh(a, b);
846 public static int test_0_vector4ui_unpack_low () {
847 Vector4ui a = new Vector4ui (1,2,3,4);
848 Vector4ui b = new Vector4ui (5,6,7,8);
850 Vector4ui c = Vector4ui.UnpackLow (a, b);
863 public static int test_0_vector4ui_xor () {
864 Vector4ui a = new Vector4ui (1,2,3,4);
865 Vector4ui b = new Vector4ui (7,5,3,1);
880 public static int test_0_vector4ui_or () {
881 Vector4ui a = new Vector4ui (1,2,3,4);
882 Vector4ui b = new Vector4ui (7,5,3,1);
896 public static int test_0_vector4ui_and () {
897 Vector4ui a = new Vector4ui (1,2,3,4);
898 Vector4ui b = new Vector4ui (7,5,3,1);
913 public static int test_0_vector4ui_shr () {
914 Vector4ui a = new Vector4ui (0xF0000000u,20,3,40);
916 Vector4ui c = a >> 2;
918 if (c.X != 0x3C000000)
929 public static int test_0_vector4ui_shl () {
930 Vector4ui a = new Vector4ui (10,20,3,40);
932 Vector4ui c = a << 2;
945 public static int test_0_vector4ui_mul () {
946 Vector4ui a = new Vector4ui (0x8888,20,3,40);
947 Vector4ui b = new Vector4ui (0xFF00FF00u,2,3,4);
951 if (c.X != 0xffff7800)
961 public static int test_0_vector4ui_sub () {
962 Vector4ui a = new Vector4ui (1,20,3,40);
963 Vector4ui b = new Vector4ui (0xFF00FF00u,2,3,4);
978 public static int test_0_vector4ui_add () {
979 Vector4ui a = new Vector4ui (0xFF00FF00u,2,3,4);
980 Vector4ui b = new Vector4ui (0xFF00FF00u,2,3,4);
984 if (c.X != 0xfe01fe00)
996 static int test_0_vector4ui_accessors () {
997 Vector4ui a = new Vector4ui (1,2,3,4);
1023 static int test_0_vector8us_sub_sat () {
1024 Vector8us a = new Vector8us (0xF000,1,20,3,4,5,6,7);
1025 Vector8us b = new Vector8us (0xFF00,4,5,6,7,8,9,10);
1026 Vector8us c = Vector8us.SubWithSaturation (a, b);
1047 static int test_0_vector8us_add_sat () {
1048 Vector8us a = new Vector8us (0xFF00,1,2,3,4,5,6,7);
1049 Vector8us b = new Vector8us (0xFF00,4,5,6,7,8,9,10);
1050 Vector8us c = Vector8us.AddWithSaturation (a, b);
1071 static int test_0_vector8us_unpack_low () {
1072 Vector8us a = new Vector8us (0,1,2,3,4,5,6,7);
1073 Vector8us b = new Vector8us (3,4,5,6,7,8,9,10);
1074 Vector8us c = Vector8us.UnpackLow (a, b);
1096 static int test_0_vector8us_shift_left () {
1097 Vector8us a = new Vector8us (0xFF00,1,2,3,4,5,6,7);
1099 Vector8us c = a << amt;
1110 static int test_0_vector8us_shift_right_arithmetic () {
1111 Vector8us a = new Vector8us (0xFF00,1,2,3,4,5,6,7);
1113 Vector8us c = Vector8us.ShiftRightArithmetic (a, amt);
1124 static int test_0_vector8us_shift_variable_offset () {
1126 Vector8us a = new Vector8us (0xF000,1,2,3,4,5,6,7);
1128 Vector8us c = b >> off;
1145 static int test_0_vector8us_shift_operand_is_live_after_op () {
1146 Vector8us a = new Vector8us (0xF000,1,2,3,4,5,6,7);
1148 Vector8us c = b >> 2;
1164 static int test_0_vector8us_shr_constant () {
1165 Vector8us a = new Vector8us (0xF000,1,2,3,4,5,6,7);
1166 Vector8us c = a >> 2;
1177 static int test_0_vector8us_mul () {
1178 Vector8us a = new Vector8us (0x0F00,4,5,6,7,8,9,10);
1179 Vector8us b = new Vector8us (0x0888,1,2,3,4,5,6,8);
1181 Vector8us c = a * b;
1191 static int test_0_vector8us_add () {
1192 Vector8us a = new Vector8us (0xFF00,4,5,6,7,8,9,10);
1193 Vector8us b = new Vector8us (0x8888,1,2,3,4,5,6,8);
1195 Vector8us c = a + b;
1206 static int test_0_vector8us_sub () {
1207 Vector8us a = new Vector8us (3,4,5,6,7,8,9,10);
1208 Vector8us b = new Vector8us (10,1,2,3,4,5,6,8);
1210 Vector8us c = a - b;
1222 static int test_0_vector8us_accessors () {
1223 Vector8us a = new Vector8us (0,1,2,3,4,5,6,7);
1271 static int test_0_vector16b_unpack_high () {
1272 Vector16b a = new Vector16b (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
1273 Vector16b b = new Vector16b (9,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8);
1274 Vector16b c = Vector16b.UnpackHigh (a, b);
1295 static int test_0_vector16b_unpack_low () {
1296 Vector16b a = new Vector16b (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
1297 Vector16b b = new Vector16b (9,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8);
1298 Vector16b c = Vector16b.UnpackLow (a, b);
1319 static int test_0_vector16b_sar () {
1320 Vector16b a = new Vector16b (0xF0,20,3,40,0,0,0,0,0,0,0,0,0,0,0,0);
1322 Vector16b c = Vector16b.ShiftRightArithmetic (a, 2);
1334 static int test_0_vector16b_sub_sat () {
1335 Vector16b a = new Vector16b (100,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8);
1336 Vector16b b = new Vector16b (200,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
1337 Vector16b c = Vector16b.SubWithSaturation (a, b);
1348 static int test_0_vector16b_add_sat () {
1349 Vector16b a = new Vector16b (200,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
1350 Vector16b b = new Vector16b (200,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8);
1351 Vector16b c = Vector16b.AddWithSaturation (a, b);
1362 static int test_0_vector16b_add_ovf () {
1363 Vector16b a = new Vector16b (200,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
1364 Vector16b b = new Vector16b (200,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8);
1365 Vector16b c = a + b;
1376 static int test_0_vector16b_accessors () {
1377 Vector16b a = new Vector16b (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
1464 public static int test_0_accessors () {
1465 Vector4f a = new Vector4f (1, 2, 3, 4);
1477 public static int test_0_packed_add_with_stack_tmp () {
1478 Vector4f a = new Vector4f (1, 2, 3, 4);
1479 Vector4f b = new Vector4f (5, 6, 7, 8);
1480 Vector4f c = new Vector4f (-1, -3, -4, -5);
1481 Vector4f d = a + b + c;
1493 public static int test_0_simple_packed_add () {
1494 Vector4f a = new Vector4f (1, 2, 3, 4);
1495 Vector4f b = new Vector4f (5, 6, 7, 8);
1509 public static int test_0_simple_packed_sub () {
1510 Vector4f a = new Vector4f (1, 2, 3, 4);
1511 Vector4f b = new Vector4f (5, 6, 7, 8);
1524 public static int test_0_simple_packed_mul () {
1525 Vector4f a = new Vector4f (1, 2, 3, 4);
1526 Vector4f b = new Vector4f (5, 6, 7, 8);
1539 public static int test_0_simple_packed_div () {
1540 Vector4f a = new Vector4f (2, 2, 3, 4);
1541 Vector4f b = new Vector4f (20, 10, 33, 12);
1554 public static int test_0_simple_packed_sqrt () {
1555 Vector4f a = new Vector4f (16, 4, 9, 25);
1556 a = Vector4f.Sqrt (a);
1568 public static int test_0_simple_packed_invsqrt () {
1569 Vector4f a = new Vector4f (16, 4, 100, 25);
1570 //this function has VERY low precision
1571 a = Vector4f.InvSqrt (a);
1572 if (a.X < (1/4f - 0.01f) || a.X > (1/4f + 0.01f))
1574 if (a.Y < (1/2f - 0.01f) || a.Y > (1/2f + 0.01f))
1576 if (a.Z < (1/10f - 0.01f) || a.Z > (1/10f + 0.01f))
1578 if (a.W < (1/5f - 0.01f) || a.W > (1/5f + 0.01f))
1583 public static int test_0_simple_packed_min () {
1584 Vector4f a = new Vector4f (16, -4, 9, 25);
1585 Vector4f b = new Vector4f (5, 3, 9, 0);
1586 Vector4f c = Vector4f.Min (a, b);
1598 public static int test_0_simple_packed_max () {
1599 Vector4f a = new Vector4f (16, -4, 9, 25);
1600 Vector4f b = new Vector4f (5, 3, 9, 0);
1601 Vector4f c = Vector4f.Max (a, b);
1613 public static int test_0_simple_packed_hadd () {
1614 Vector4f a = new Vector4f (5, 5, 6, 6);
1615 Vector4f b = new Vector4f (7, 7, 8, 8);
1616 Vector4f c = Vector4f.HorizontalAdd (a, b);
1628 public static int test_0_simple_packed_hsub () {
1629 Vector4f a = new Vector4f (5, 2, 6, 1);
1630 Vector4f b = new Vector4f (7, 0, 8, 3);
1631 Vector4f c = Vector4f.HorizontalSub (a, b);
1643 public static int test_0_simple_packed_addsub () {
1644 Vector4f a = new Vector4f (5, 2, 6, 1);
1645 Vector4f b = new Vector4f (7, 0, 8, 3);
1646 Vector4f c = Vector4f.AddSub (a, b);
1658 public static int test_0_simple_packed_shuffle () {
1659 Vector4f a = new Vector4f (1, 2, 3, 4);
1660 a = Vector4f.Shuffle(a, ShuffleSel.XFromY | ShuffleSel.YFromW | ShuffleSel.ZFromX | ShuffleSel.WFromZ);
1672 public static int test_0_packed_shuffle_with_reg_pressure () {
1673 Vector4f v = new Vector4f (1, 2, 3, 4);
1674 Vector4f m0 = v + v, m1 = v - v, m2 = v * v, m3 = v + v + v;
1675 if (ff) v = v + v -v ;
1677 Vector4f r0 = Vector4f.Shuffle (v, ShuffleSel.XFromY | ShuffleSel.YFromW | ShuffleSel.ZFromX | ShuffleSel.WFromZ);
1678 Vector4f r1 = Vector4f.Shuffle (v, ShuffleSel.XFromY | ShuffleSel.YFromW | ShuffleSel.ZFromX | ShuffleSel.WFromZ);
1679 Vector4f x = Vector4f.Shuffle (v, ShuffleSel.XFromY | ShuffleSel.YFromW | ShuffleSel.ZFromX | ShuffleSel.WFromZ);
1680 Vector4f r2 = Vector4f.Shuffle (v, ShuffleSel.XFromY | ShuffleSel.YFromW | ShuffleSel.ZFromX | ShuffleSel.WFromZ);
1681 Vector4f r3 = Vector4f.Shuffle (v, ShuffleSel.XFromY | ShuffleSel.YFromW | ShuffleSel.ZFromX | ShuffleSel.WFromZ);
1689 Vector4f result = r0 + r1 + r2 + r3;
1699 if (result.Y != result.Y)
1704 public static int test_24_regs_pressure_a () {
1705 Vector4f a = new Vector4f (1, 2, 3, 4);
1713 public static int test_54_regs_pressure_b () {
1714 Vector4f a = new Vector4f (1, 2, 3, 4);
1718 Vector4f e = a + b + c;
1719 Vector4f f = d - b + a - c;
1720 Vector4f g = a - d * f - c + b;
1721 Vector4f h = a * b - c + e;
1722 Vector4f i = h - g - f - e - d - c - b - a;
1723 Vector4f j = a + b + c + d + e + f + g + h + i;
1728 public static int test_3_single_block_var_is_properly_promoted () {
1729 Vector4f a = new Vector4f (4, 5, 6, 7);
1733 Vector4f b = new Vector4f (1, 2, 3, 4);
1744 static float float_val = 45f;
1746 public static int test_0_sse2_opt_and_simd_intrinsic_proper_regalloc () {
1747 Vector4f v = new Vector4f (1, 2, 3, 4);
1748 float f = float_val;
1757 public static int Main () {
1758 return TestDriver.RunTests (typeof (SimdTests));