4 public class SimdTests {
6 public static int test_0_vector4ui_cmpeq () {
7 Vector4ui a = new Vector4ui (6,1,6,3);
8 Vector4ui b = new Vector4ui (3,4,6,7);
9 Vector4ui c = Vector4ui.CompareEqual (a, b);
15 if (c.Z != 0xFFFFFFFF)
22 public static int test_0_vector4ui_shuffle () {
23 Vector4ui a = new Vector4ui (1,2,3,4);
24 Vector4ui c = Vector4ui.Shuffle (a, ShuffleSel.XFromY | ShuffleSel.YFromW | ShuffleSel.ZFromX | ShuffleSel.WFromZ);
37 public static int test_0_vector4ui_extract_mask () {
38 Vector4ui a = new Vector4ui (0xFF00FF00,0x0F0FAA99,0,0);
39 int c = Vector4ui.ExtractByteMask (a);
46 public static int test_0_vector4ui_min () {
47 Vector4ui a = new Vector4ui (6,1,6,3);
48 Vector4ui b = new Vector4ui (3,4,6,7);
49 Vector4ui c = Vector4ui.Min (a, b);
62 public static int test_0_vector4ui_max () {
63 Vector4ui a = new Vector4ui (6,1,6,3);
64 Vector4ui b = new Vector4ui (3,4,6,7);
65 Vector4ui c = Vector4ui.Max (a, b);
78 public static int vector16b_cmpeq () {
79 Vector16b a = new Vector16b (1,0,9,0,0,0,0,0,0,0,0,0,0,0,0,1);
80 Vector16b b = new Vector16b (0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
81 Vector16b c = Vector16b.CompareEqual (a, b);
119 public static int vector16b_sum_abs_diff () {
120 Vector16b a = new Vector16b (100,20,20,20,0,0,0,0,0,0,0,0,0,0, 0, 0);
121 Vector16b b = new Vector16b (0, 10,10,10,0,0,0,0,0,0,0,0,0,0,10,10);
122 Vector8us c = Vector16b.SumOfAbsoluteDifferences (a, b);
144 public static int test_0_vector16b_extract_mask () {
145 Vector16b a = new Vector16b (0xF0,0,0xF0,0,0,0,0xF0,0xAA,0x0F,0,0xFF,0,0,0,0,0);
146 int c = Vector16b.ExtractByteMask (a);
153 public static int test_0_vector16b_min () {
154 Vector16b a = new Vector16b (0,12,20,12,4,5,6,7,8,9,10,11,12,13,14,15);
155 Vector16b b = new Vector16b (9,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8);
156 Vector16b c = Vector16b.Min (a, b);
193 public static int test_0_vector16b_max () {
194 Vector16b a = new Vector16b (0,12,20,12,4,5,6,7,8,9,10,11,12,13,14,15);
195 Vector16b b = new Vector16b (9,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8);
196 Vector16b c = Vector16b.Max (a, b);
232 public static int test_0_vector16b_avg () {
233 Vector16b a = new Vector16b (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
234 Vector16b b = new Vector16b (9,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8);
235 Vector16b c = Vector16b.Average (a, b);
273 static unsafe Vector8us bad_method_regression_2 (Vector16b va, Vector16b vb) {
274 Vector8us res = new Vector8us ();
275 byte *a = (byte*)&va;
276 byte *b = (byte*)&vb;
279 for (int i = 0; i < 8; ++i)
280 tmp += System.Math.Abs ((int)*a++ - (int)*b++);
281 res.V0 = (ushort)tmp;
284 for (int i = 0; i < 8; ++i)
285 tmp += System.Math.Abs ((int)*a++ - (int)*b++);
286 res.V4 = (ushort)tmp;
290 /*This bug was caused the simplifier not taking notice of LDADDR on the remaining blocks.*/
291 public static int test_2_local_simplifier_regression_other_blocks () {
292 Vector16b a = new Vector16b (1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1);
293 Vector16b b = new Vector16b (0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
294 Vector8us res = bad_method_regression_2 (a,b);
295 return (int)res.V0 + res.V4;
298 static unsafe Vector8us bad_method_regression (Vector16b va, Vector16b vb) {
299 Vector8us res = new Vector8us ();
300 byte *a = (byte*)&va;
301 byte *b = (byte*)&vb;
302 *((ushort*)&res) = 10;
313 /*This bug was caused the simplifier not taking notice of LDADDR on the first block.*/
314 public static int test_10_local_simplifier_regression_first_block () {
315 Vector16b a = new Vector16b ();
316 Vector16b b = new Vector16b ();
317 Vector8us res = bad_method_regression (a,b);
322 public static int test_0_vecto8us_extract_mask () {
323 Vector8us a = new Vector8us (0xF0F0, 0x700F, 0xAABB, 0x0000, 0x00F0, 0xF0F0, 0, 0);
324 int c = Vector8us.ExtractByteMask (a);
331 public static int test_0_vecto8us_shuffle_low () {
332 Vector8us a = new Vector8us (1, 2, 3, 4, 5, 6, 7, 8);
333 Vector8us c = Vector8us.ShuffleLow (a, ShuffleSel.XFromY | ShuffleSel.YFromW | ShuffleSel.ZFromX | ShuffleSel.WFromZ);
354 public static int test_0_vecto8us_shuffle_high () {
355 Vector8us a = new Vector8us (1, 2, 3, 4, 5, 6, 7, 8);
356 Vector8us c = Vector8us.ShuffleHigh (a, ShuffleSel.XFromY | ShuffleSel.YFromW | ShuffleSel.ZFromX | ShuffleSel.WFromZ);
378 public static int test_0_vecto8us_max () {
379 Vector8us a = new Vector8us (1, 2, 3, 4, 5, 6, 7, 8);
380 Vector8us b = new Vector8us (9, 1, 1, 2, 9, 6, 5, 1000);
381 Vector8us c = Vector8us.Max (a, b);
403 public static int test_0_vecto8us_min () {
404 Vector8us a = new Vector8us (1, 2, 3, 0, 5, 6, 5, 4);
405 Vector8us b = new Vector8us (9, 1, 1, 2, 3, 4, 5, 6);
406 Vector8us c = Vector8us.Min (a, b);
427 public static int test_0_vecto8us_avg () {
428 Vector8us a = new Vector8us (1, 2, 3, 4, 5, 6, 7, 8);
429 Vector8us b = new Vector8us (9, 1, 1, 2, 3, 4, 5, 6);
430 Vector8us c = Vector8us.Average (a, b);
451 static void store_helper (ref Vector4f x) {
453 k = new Vector4f(9,9,9,9);
457 public static int test_0_vector4f_byref_store ()
460 k = new Vector4f(1,2,3,4);
461 store_helper (ref k);
467 public static int test_0_vector4f_init_array_element ()
469 Vector4f[] v = new Vector4f[1];
470 v[0] = new Vector4f(9,9,9,9);
476 public static int test_0_vector4f_dup_high () {
477 Vector4f a = new Vector4f (1, 2, 3, 4);
478 Vector4f c = Vector4f.DuplicateHigh(a);
491 public static int test_0_vector4f_dup_low () {
492 Vector4f a = new Vector4f (1, 2, 3, 4);
493 Vector4f c = Vector4f.DuplicateLow (a);
507 public static int test_0_vector4f_interleave_high () {
508 Vector4f a = new Vector4f (1, 2, 3, 4);
509 Vector4f b = new Vector4f (5, 6, 7, 8);
510 Vector4f c = Vector4f.InterleaveHigh (a, b);
523 public static int test_0_vector4f_interleave_low () {
524 Vector4f a = new Vector4f (1, 2, 3, 4);
525 Vector4f b = new Vector4f (5, 6, 7, 8);
526 Vector4f c = Vector4f.InterleaveLow (a, b);
539 public static int test_0_vector4f_rcp () {
540 Vector4f a = new Vector4f (1, 2, 4, 8);
541 Vector4f c = Vector4f.Reciprocal (a);
543 //Test with ranges due to the terrible precision.
544 if (c.X < (1 - 0.01f) || c.X > (1 + 0.01f))
546 if (c.Y < (0.5 - 0.01f) || c.Y > (0.5 + 0.01f))
548 if (c.Z < (0.25 - 0.01f) || c.Z > (0.25 + 0.01f))
550 if (c.W < (0.125 - 0.01f) || c.W > (0.125 + 0.01f))
555 public static int test_0_vector4f_xor () {
556 Vector4f a = new Vector4f (1, 2, 3, 4);
557 Vector4f b = new Vector4f (1, 3, 3, 8);
560 if (((Vector4ui)c).X != 0)
562 if (((Vector4ui)c).Y != 0x400000)
564 if (((Vector4ui)c).Z != 0)
566 if (((Vector4ui)c).W != 0x1800000)
571 public static int test_0_vector4f_or () {
572 Vector4f a = new Vector4f (1, 2, 3, 4);
573 Vector4f b = new Vector4f (1, 3, 3, 8);
576 if (((Vector4ui)c).X != 0x3F800000)
578 if (((Vector4ui)c).Y != 0x40400000)
580 if (((Vector4ui)c).Z != 0x40400000)
582 if (((Vector4ui)c).W != 0x41800000)
586 public static int test_0_vector4f_andn () {
587 Vector4f a = new Vector4f (1, 2, 3, 4);
588 Vector4f b = new Vector4f (1, 3, 3, 8);
589 Vector4f c = Vector4f.AndNot (a ,b);
591 if (((Vector4ui)c).X != 0)
593 if (((Vector4ui)c).Y != 0x400000)
595 if (((Vector4ui)c).Z != 0)
597 if (((Vector4ui)c).W != 0x1000000)
602 public static int test_0_vector4f_and () {
603 Vector4f a = new Vector4f (1, 2, 3, 4);
604 Vector4f b = new Vector4f (1, 3, 3, 8);
607 if (((Vector4ui)c).X != 0x3F800000)
609 if (((Vector4ui)c).Y != 0x40000000)
611 if (((Vector4ui)c).Z != 0x40400000)
613 if (((Vector4ui)c).W != 0x40000000)
618 public static int test_0_vector4f_cmpord () {
619 Vector4f a = new Vector4f (float.NaN, 2, 3, 4);
620 Vector4f b = new Vector4f (1, float.NaN, 3, 6);
621 Vector4f c = Vector4f.CompareOrdered (a, b);
623 if (((Vector4ui)c).X != 0)
625 if (((Vector4ui)c).Y != 0)
627 if (((Vector4ui)c).Z != 0xFFFFFFFF)
629 if (((Vector4ui)c).W != 0xFFFFFFFF)
634 public static int test_0_vector4f_cmpnle () {
635 Vector4f a = new Vector4f (float.NaN, 2, 3, 4);
636 Vector4f b = new Vector4f (1, float.NaN, 3, 6);
637 Vector4f c = Vector4f.CompareNotLessEqual (a, b);
639 if (((Vector4ui)c).X != 0xFFFFFFFF)
641 if (((Vector4ui)c).Y != 0xFFFFFFFF)
643 if (((Vector4ui)c).Z != 0)
645 if (((Vector4ui)c).W != 0)
650 public static int test_0_vector4f_cmpnlt () {
651 Vector4f a = new Vector4f (float.NaN, 2, 3, 4);
652 Vector4f b = new Vector4f (1, float.NaN, 3, 6);
653 Vector4f c = Vector4f.CompareNotLessThan (a, b);
655 if (((Vector4ui)c).X != 0xFFFFFFFF)
657 if (((Vector4ui)c).Y != 0xFFFFFFFF)
659 if (((Vector4ui)c).Z != 0xFFFFFFFF)
661 if (((Vector4ui)c).W != 0)
666 public static int test_0_vector4f_cmpneq () {
667 Vector4f a = new Vector4f (float.NaN, 2, 3, 4);
668 Vector4f b = new Vector4f (1, float.NaN, 3, 6);
669 Vector4f c = Vector4f.CompareNotEqual (a, b);
671 if (((Vector4ui)c).X != 0xFFFFFFFF)
673 if (((Vector4ui)c).Y != 0xFFFFFFFF)
675 if (((Vector4ui)c).Z != 0)
677 if (((Vector4ui)c).W != 0xFFFFFFFF)
682 public static int test_0_vector4f_cmpunord () {
683 Vector4f a = new Vector4f (float.NaN, 2, 3, 4);
684 Vector4f b = new Vector4f (1, float.NaN, 3, 6);
685 Vector4f c = Vector4f.CompareUnordered (a, b);
687 if (((Vector4ui)c).X != 0xFFFFFFFF)
689 if (((Vector4ui)c).Y != 0xFFFFFFFF)
691 if (((Vector4ui)c).Z != 0)
693 if (((Vector4ui)c).W != 0)
698 public static int test_0_vector4f_cmple () {
699 Vector4f a = new Vector4f (float.NaN, 2, 3, 4);
700 Vector4f b = new Vector4f (1, float.NaN, 3, 6);
701 Vector4f c = Vector4f.CompareLessEqual (a, b);
703 if (((Vector4ui)c).X != 0)
705 if (((Vector4ui)c).Y != 0)
707 if (((Vector4ui)c).Z != 0xFFFFFFFF)
709 if (((Vector4ui)c).W != 0xFFFFFFFF)
714 public static int test_0_vector4f_cmplt () {
715 Vector4f a = new Vector4f (float.NaN, 2, 3, 4);
716 Vector4f b = new Vector4f (1, float.NaN, 3, 6);
717 Vector4f c = Vector4f.CompareLessThan (a, b);
719 if (((Vector4ui)c).X != 0)
721 if (((Vector4ui)c).Y != 0)
723 if (((Vector4ui)c).Z != 0)
725 if (((Vector4ui)c).W != 0xFFFFFFFF)
730 public static int test_0_vector4f_cmpeq () {
731 Vector4f a = new Vector4f (float.NaN, 2, 3, 6);
732 Vector4f b = new Vector4f (1, float.NaN, 3, 4);
733 Vector4f c = Vector4f.CompareEquals (a, b);
735 if (((Vector4ui)c).X != 0)
737 if (((Vector4ui)c).Y != 0)
739 if (((Vector4ui)c).Z != 0xFFFFFFFF)
741 if (((Vector4ui)c).W != 0)
746 public static int test_0_vector4ui_sar () {
747 Vector4ui a = new Vector4ui (0xF0000000u,20,3,40);
749 Vector4ui c = Vector4ui.ShiftRightArithmetic (a, 2);
751 if (c.X != 0xFC000000)
762 public static int test_0_vector4ui_unpack_high () {
763 Vector4ui a = new Vector4ui (1,2,3,4);
764 Vector4ui b = new Vector4ui (5,6,7,8);
766 Vector4ui c = Vector4ui.UnpackHigh(a, b);
779 public static int test_0_vector4ui_unpack_low () {
780 Vector4ui a = new Vector4ui (1,2,3,4);
781 Vector4ui b = new Vector4ui (5,6,7,8);
783 Vector4ui c = Vector4ui.UnpackLow (a, b);
796 public static int test_0_vector4ui_xor () {
797 Vector4ui a = new Vector4ui (1,2,3,4);
798 Vector4ui b = new Vector4ui (7,5,3,1);
813 public static int test_0_vector4ui_or () {
814 Vector4ui a = new Vector4ui (1,2,3,4);
815 Vector4ui b = new Vector4ui (7,5,3,1);
829 public static int test_0_vector4ui_and () {
830 Vector4ui a = new Vector4ui (1,2,3,4);
831 Vector4ui b = new Vector4ui (7,5,3,1);
846 public static int test_0_vector4ui_shr () {
847 Vector4ui a = new Vector4ui (0xF0000000u,20,3,40);
849 Vector4ui c = a >> 2;
851 if (c.X != 0x3C000000)
862 public static int test_0_vector4ui_shl () {
863 Vector4ui a = new Vector4ui (10,20,3,40);
865 Vector4ui c = a << 2;
878 public static int test_0_vector4ui_mul () {
879 Vector4ui a = new Vector4ui (0x8888,20,3,40);
880 Vector4ui b = new Vector4ui (0xFF00FF00u,2,3,4);
884 if (c.X != 0xffff7800)
894 public static int test_0_vector4ui_sub () {
895 Vector4ui a = new Vector4ui (1,20,3,40);
896 Vector4ui b = new Vector4ui (0xFF00FF00u,2,3,4);
911 public static int test_0_vector4ui_add () {
912 Vector4ui a = new Vector4ui (0xFF00FF00u,2,3,4);
913 Vector4ui b = new Vector4ui (0xFF00FF00u,2,3,4);
917 if (c.X != 0xfe01fe00)
929 static int test_0_vector4ui_accessors () {
930 Vector4ui a = new Vector4ui (1,2,3,4);
956 static int test_0_vector8us_sub_sat () {
957 Vector8us a = new Vector8us (0xF000,1,20,3,4,5,6,7);
958 Vector8us b = new Vector8us (0xFF00,4,5,6,7,8,9,10);
959 Vector8us c = Vector8us.SubWithSaturation (a, b);
980 static int test_0_vector8us_add_sat () {
981 Vector8us a = new Vector8us (0xFF00,1,2,3,4,5,6,7);
982 Vector8us b = new Vector8us (0xFF00,4,5,6,7,8,9,10);
983 Vector8us c = Vector8us.AddWithSaturation (a, b);
1004 static int test_0_vector8us_unpack_low () {
1005 Vector8us a = new Vector8us (0,1,2,3,4,5,6,7);
1006 Vector8us b = new Vector8us (3,4,5,6,7,8,9,10);
1007 Vector8us c = Vector8us.UnpackLow (a, b);
1029 static int test_0_vector8us_shift_left () {
1030 Vector8us a = new Vector8us (0xFF00,1,2,3,4,5,6,7);
1032 Vector8us c = a << amt;
1043 static int test_0_vector8us_shift_right_arithmetic () {
1044 Vector8us a = new Vector8us (0xFF00,1,2,3,4,5,6,7);
1046 Vector8us c = Vector8us.ShiftRightArithmetic (a, amt);
1057 static int test_0_vector8us_shift_variable_offset () {
1059 Vector8us a = new Vector8us (0xF000,1,2,3,4,5,6,7);
1061 Vector8us c = b >> off;
1078 static int test_0_vector8us_shift_operand_is_live_after_op () {
1079 Vector8us a = new Vector8us (0xF000,1,2,3,4,5,6,7);
1081 Vector8us c = b >> 2;
1097 static int test_0_vector8us_shr_constant () {
1098 Vector8us a = new Vector8us (0xF000,1,2,3,4,5,6,7);
1099 Vector8us c = a >> 2;
1110 static int test_0_vector8us_mul () {
1111 Vector8us a = new Vector8us (0x0F00,4,5,6,7,8,9,10);
1112 Vector8us b = new Vector8us (0x0888,1,2,3,4,5,6,8);
1114 Vector8us c = a * b;
1124 static int test_0_vector8us_add () {
1125 Vector8us a = new Vector8us (0xFF00,4,5,6,7,8,9,10);
1126 Vector8us b = new Vector8us (0x8888,1,2,3,4,5,6,8);
1128 Vector8us c = a + b;
1139 static int test_0_vector8us_sub () {
1140 Vector8us a = new Vector8us (3,4,5,6,7,8,9,10);
1141 Vector8us b = new Vector8us (10,1,2,3,4,5,6,8);
1143 Vector8us c = a - b;
1155 static int test_0_vector8us_accessors () {
1156 Vector8us a = new Vector8us (0,1,2,3,4,5,6,7);
1204 static int test_0_vector16b_unpack_high () {
1205 Vector16b a = new Vector16b (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
1206 Vector16b b = new Vector16b (9,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8);
1207 Vector16b c = Vector16b.UnpackHigh (a, b);
1228 static int test_0_vector16b_unpack_low () {
1229 Vector16b a = new Vector16b (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
1230 Vector16b b = new Vector16b (9,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8);
1231 Vector16b c = Vector16b.UnpackLow (a, b);
1252 static int test_0_vector16b_sar () {
1253 Vector16b a = new Vector16b (0xF0,20,3,40,0,0,0,0,0,0,0,0,0,0,0,0);
1255 Vector16b c = Vector16b.ShiftRightArithmetic (a, 2);
1267 static int test_0_vector16b_sub_sat () {
1268 Vector16b a = new Vector16b (100,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8);
1269 Vector16b b = new Vector16b (200,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
1270 Vector16b c = Vector16b.SubWithSaturation (a, b);
1281 static int test_0_vector16b_add_sat () {
1282 Vector16b a = new Vector16b (200,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
1283 Vector16b b = new Vector16b (200,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8);
1284 Vector16b c = Vector16b.AddWithSaturation (a, b);
1295 static int test_0_vector16b_add_ovf () {
1296 Vector16b a = new Vector16b (200,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
1297 Vector16b b = new Vector16b (200,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8);
1298 Vector16b c = a + b;
1309 static int test_0_vector16b_accessors () {
1310 Vector16b a = new Vector16b (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
1397 public static int test_0_accessors () {
1398 Vector4f a = new Vector4f (1, 2, 3, 4);
1410 public static int test_0_packed_add_with_stack_tmp () {
1411 Vector4f a = new Vector4f (1, 2, 3, 4);
1412 Vector4f b = new Vector4f (5, 6, 7, 8);
1413 Vector4f c = new Vector4f (-1, -3, -4, -5);
1414 Vector4f d = a + b + c;
1426 public static int test_0_simple_packed_add () {
1427 Vector4f a = new Vector4f (1, 2, 3, 4);
1428 Vector4f b = new Vector4f (5, 6, 7, 8);
1442 public static int test_0_simple_packed_sub () {
1443 Vector4f a = new Vector4f (1, 2, 3, 4);
1444 Vector4f b = new Vector4f (5, 6, 7, 8);
1457 public static int test_0_simple_packed_mul () {
1458 Vector4f a = new Vector4f (1, 2, 3, 4);
1459 Vector4f b = new Vector4f (5, 6, 7, 8);
1472 public static int test_0_simple_packed_div () {
1473 Vector4f a = new Vector4f (2, 2, 3, 4);
1474 Vector4f b = new Vector4f (20, 10, 33, 12);
1487 public static int test_0_simple_packed_sqrt () {
1488 Vector4f a = new Vector4f (16, 4, 9, 25);
1489 a = Vector4f.Sqrt (a);
1501 public static int test_0_simple_packed_invsqrt () {
1502 Vector4f a = new Vector4f (16, 4, 100, 25);
1503 //this function has VERY low precision
1504 a = Vector4f.InvSqrt (a);
1505 if (a.X < (1/4f - 0.01f) || a.X > (1/4f + 0.01f))
1507 if (a.Y < (1/2f - 0.01f) || a.Y > (1/2f + 0.01f))
1509 if (a.Z < (1/10f - 0.01f) || a.Z > (1/10f + 0.01f))
1511 if (a.W < (1/5f - 0.01f) || a.W > (1/5f + 0.01f))
1516 public static int test_0_simple_packed_min () {
1517 Vector4f a = new Vector4f (16, -4, 9, 25);
1518 Vector4f b = new Vector4f (5, 3, 9, 0);
1519 Vector4f c = Vector4f.Min (a, b);
1531 public static int test_0_simple_packed_max () {
1532 Vector4f a = new Vector4f (16, -4, 9, 25);
1533 Vector4f b = new Vector4f (5, 3, 9, 0);
1534 Vector4f c = Vector4f.Max (a, b);
1546 public static int test_0_simple_packed_hadd () {
1547 Vector4f a = new Vector4f (5, 5, 6, 6);
1548 Vector4f b = new Vector4f (7, 7, 8, 8);
1549 Vector4f c = Vector4f.HorizontalAdd (a, b);
1561 public static int test_0_simple_packed_hsub () {
1562 Vector4f a = new Vector4f (5, 2, 6, 1);
1563 Vector4f b = new Vector4f (7, 0, 8, 3);
1564 Vector4f c = Vector4f.HorizontalSub (a, b);
1576 public static int test_0_simple_packed_addsub () {
1577 Vector4f a = new Vector4f (5, 2, 6, 1);
1578 Vector4f b = new Vector4f (7, 0, 8, 3);
1579 Vector4f c = Vector4f.AddSub (a, b);
1591 public static int test_0_simple_packed_shuffle () {
1592 Vector4f a = new Vector4f (1, 2, 3, 4);
1593 a = Vector4f.Shuffle(a, ShuffleSel.XFromY | ShuffleSel.YFromW | ShuffleSel.ZFromX | ShuffleSel.WFromZ);
1605 public static int test_0_packed_shuffle_with_reg_pressure () {
1606 Vector4f v = new Vector4f (1, 2, 3, 4);
1607 Vector4f m0 = v + v, m1 = v - v, m2 = v * v, m3 = v + v + v;
1608 if (ff) v = v + v -v ;
1610 Vector4f r0 = Vector4f.Shuffle (v, ShuffleSel.XFromY | ShuffleSel.YFromW | ShuffleSel.ZFromX | ShuffleSel.WFromZ);
1611 Vector4f r1 = Vector4f.Shuffle (v, ShuffleSel.XFromY | ShuffleSel.YFromW | ShuffleSel.ZFromX | ShuffleSel.WFromZ);
1612 Vector4f x = Vector4f.Shuffle (v, ShuffleSel.XFromY | ShuffleSel.YFromW | ShuffleSel.ZFromX | ShuffleSel.WFromZ);
1613 Vector4f r2 = Vector4f.Shuffle (v, ShuffleSel.XFromY | ShuffleSel.YFromW | ShuffleSel.ZFromX | ShuffleSel.WFromZ);
1614 Vector4f r3 = Vector4f.Shuffle (v, ShuffleSel.XFromY | ShuffleSel.YFromW | ShuffleSel.ZFromX | ShuffleSel.WFromZ);
1622 Vector4f result = r0 + r1 + r2 + r3;
1632 if (result.Y != result.Y)
1637 public static int test_24_regs_pressure_a () {
1638 Vector4f a = new Vector4f (1, 2, 3, 4);
1646 public static int test_54_regs_pressure_b () {
1647 Vector4f a = new Vector4f (1, 2, 3, 4);
1651 Vector4f e = a + b + c;
1652 Vector4f f = d - b + a - c;
1653 Vector4f g = a - d * f - c + b;
1654 Vector4f h = a * b - c + e;
1655 Vector4f i = h - g - f - e - d - c - b - a;
1656 Vector4f j = a + b + c + d + e + f + g + h + i;
1661 public static int test_3_single_block_var_is_properly_promoted () {
1662 Vector4f a = new Vector4f (4, 5, 6, 7);
1666 Vector4f b = new Vector4f (1, 2, 3, 4);
1677 static float float_val = 45f;
1679 public static int test_0_sse2_opt_and_simd_intrinsic_proper_regalloc () {
1680 Vector4f v = new Vector4f (1, 2, 3, 4);
1681 float f = float_val;
1690 public static int Main () {
1691 return TestDriver.RunTests (typeof (SimdTests));