2008-10-10 Rodrigo Kumpera <rkumpera@novell.com>
[mono.git] / mono / mini / basic-simd.cs
1 using System;
2 using Mono.Simd;
3
4 public class SimdTests {
5         static int test_0_vector8us_pack () {
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.PackWithUnsignedSaturation (a, b);
9
10                 if (c.V0 != 0xFF)
11                         return 1;
12                 if (c.V1 != 1)
13                         return 2;
14                 if (c.V2 != 2)
15                         return 3;
16                 if (c.V8 != 3)
17                         return 4;
18                 if (c.V15 != 10)
19                         return 5;
20                 return 0;
21         }
22
23
24
25         static int test_0_vector8us_sub_sat () {
26                 Vector8us a = new Vector8us (0xF000,1,20,3,4,5,6,7);
27                 Vector8us b = new Vector8us (0xFF00,4,5,6,7,8,9,10);
28                 Vector8us c = Vector8us.SubWithSaturation (a, b);
29
30                 if (c.V0 != 0)
31                         return 1;
32                 if (c.V1 != 0)
33                         return 2;
34                 if (c.V2 != 15)
35                         return 3;
36                 if (c.V3 != 0)
37                         return 4;
38                 if (c.V4 != 0)
39                         return 5;
40                 if (c.V5 != 0)
41                         return 6;
42                 if (c.V6 != 0)
43                         return 7;
44                 if (c.V7 != 0)
45                         return 8;
46                 return 0;
47         }
48
49         static int test_0_vector8us_add_sat () {
50                 Vector8us a = new Vector8us (0xFF00,1,2,3,4,5,6,7);
51                 Vector8us b = new Vector8us (0xFF00,4,5,6,7,8,9,10);
52                 Vector8us c = Vector8us.AddWithSaturation (a, b);
53
54                 if (c.V0 != 0xFFFF)
55                         return 1;
56                 if (c.V1 != 5)
57                         return 2;
58                 if (c.V2 != 7)
59                         return 3;
60                 if (c.V3 != 9)
61                         return 4;
62                 if (c.V4 != 11)
63                         return 5;
64                 if (c.V5 != 13)
65                         return 6;
66                 if (c.V6 != 15)
67                         return 7;
68                 if (c.V7 != 17)
69                         return 8;
70                 return 0;
71         }
72
73         static int test_0_vector8us_unpack_low () {
74                 Vector8us a = new Vector8us (0,1,2,3,4,5,6,7);
75                 Vector8us b = new Vector8us (3,4,5,6,7,8,9,10);
76                 Vector8us c = Vector8us.UnpackLow (a, b);
77
78                 if (c.V0 != 0)
79                         return 1;
80                 if (c.V1 != 3)
81                         return 2;
82                 if (c.V2 != 1)
83                         return 3;
84                 if (c.V3 != 4)
85                         return 4;
86                 if (c.V4 != 2)
87                         return 5;
88                 if (c.V5 != 5)
89                         return 6;
90                 if (c.V6 != 3)
91                         return 7;
92                 if (c.V7 != 6)
93                         return 8;
94                 return 0;
95         }
96
97
98         static int test_0_vector8us_shift_left () {
99                 Vector8us a = new Vector8us (0xFF00,1,2,3,4,5,6,7);
100                 int amt = 2;
101                 Vector8us c = a << amt;
102         
103                 if (c.V0 != 0xFC00)
104                         return 1;
105                 if (c.V1 != 4)
106                         return 2;
107                 if (c.V7 != 28)
108                         return 3;
109                 return 0;
110         }
111         
112         static int test_0_vector8us_shift_right_arithmetic () {
113                 Vector8us a = new Vector8us (0xFF00,1,2,3,4,5,6,7);
114                 int amt = 2;
115                 Vector8us c = Vector8us.ShiftRightArithmetic (a, amt);
116         
117                 if (c.V0 != 0x3FC0)
118                         return 1;
119                 if (c.V1 != 0)
120                         return 2;
121                 if (c.V7 != 1)
122                         return 3;
123                 return 0;
124         }
125
126         static int test_0_vector8us_shift_variable_offset () {
127                 int off = 2;
128                 Vector8us a = new Vector8us (0xF000,1,2,3,4,5,6,7);
129                 Vector8us b = a;
130                 Vector8us c = b >> off;
131                 a = b + b;
132
133                 if (c.V0 != 0x3C00)
134                         return 1;
135                 if (c.V1 != 0)
136                         return 2;
137                 if (c.V7 != 1)
138                         return 3;
139                 if (a.V1 != 2)
140                         return 4;
141                 if (a.V7 != 14)
142                         return 5;
143                 return 0;
144         }
145         
146         
147         static int test_0_vector8us_shift_operand_is_live_after_op () {
148                 Vector8us a = new Vector8us (0xF000,1,2,3,4,5,6,7);
149                 Vector8us b = a;
150                 Vector8us c = b >> 2;
151                 a = b + b;
152
153                 if (c.V0 != 0x3C00)
154                         return 1;
155                 if (c.V1 != 0)
156                         return 2;
157                 if (c.V7 != 1)
158                         return 3;
159                 if (a.V1 != 2)
160                         return 4;
161                 if (a.V7 != 14)
162                         return 5;
163                 return 0;
164         }
165
166         static int test_0_vector8us_shr_constant () {
167                 Vector8us a = new Vector8us (0xF000,1,2,3,4,5,6,7);
168                 Vector8us c = a >> 2;
169
170                 if (c.V0 != 0x3C00)
171                         return 1;
172                 if (c.V1 != 0)
173                         return 2;
174                 if (c.V7 != 1)
175                         return 3;
176                 return 0;
177         }
178
179         static int test_0_vector8us_mul () {
180                 Vector8us a = new Vector8us (0x0F00,4,5,6,7,8,9,10);
181                 Vector8us b = new Vector8us (0x0888,1,2,3,4,5,6,8);
182
183                 Vector8us c = a * b;
184                 if (c.V0 != 63488)
185                         return 1;
186                 if (c.V1 != 4)
187                         return 2;
188                 if (c.V7 != 80)
189                         return 3;
190                 return 0;
191         }
192
193         static int test_0_vector8us_add () {
194                 Vector8us a = new Vector8us (0xFF00,4,5,6,7,8,9,10);
195                 Vector8us b = new Vector8us (0x8888,1,2,3,4,5,6,8);
196
197                 Vector8us c = a + b;
198                 if (c.V0 != 34696)
199                         return 1;
200                 if (c.V1 != 5)
201                         return 2;
202                 if (c.V7 != 18)
203                         return 3;
204                 return 0;
205         }
206
207
208         static int test_0_vector8us_sub () {
209                 Vector8us a = new Vector8us (3,4,5,6,7,8,9,10);
210                 Vector8us b = new Vector8us (10,1,2,3,4,5,6,8);
211
212                 Vector8us c = a - b;
213
214                 if (c.V0 != 65529)
215                         return 1;
216                 if (c.V1 != 3)
217                         return 2;
218                 if (c.V7 != 2)
219                         return 3;
220                 return 0;
221         }
222
223
224         static int test_0_vector8us_accessors () {
225                 Vector8us a = new Vector8us (0,1,2,3,4,5,6,7);
226
227                 if (a.V0 != 0)
228                         return 1;
229                 if (a.V1 != 1)
230                         return 2;
231                 if (a.V2 != 2)
232                         return 3;
233                 if (a.V3 != 3)
234                         return 4;
235                 if (a.V4 != 4)
236                         return 5;
237                 if (a.V5 != 5)
238                         return 6;
239                 if (a.V6 != 6)
240                         return 7;
241                 if (a.V7 != 7)
242                         return 8;
243                 a.V0 = 10;
244                 a.V1 = 20;
245                 a.V2 = 30;
246                 a.V3 = 40;
247                 a.V4 = 50;
248                 a.V5 = 60;
249                 a.V6 = 70;
250                 a.V7 = 80;
251
252                 if (a.V0 != 10)
253                         return 17;
254                 if (a.V1 != 20)
255                         return 18;
256                 if (a.V2 != 30)
257                         return 19;
258                 if (a.V3 != 40)
259                         return 20;
260                 if (a.V4 != 50)
261                         return 21;
262                 if (a.V5 != 60)
263                         return 22;
264                 if (a.V6 != 70)
265                         return 23;
266                 if (a.V7 != 80)
267                         return 24;
268
269                 return 0;
270         }
271
272
273         static int test_0_vector16b_unpack_high () {
274                 Vector16b a = new Vector16b (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
275                 Vector16b b = new Vector16b (9,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8);
276                 Vector16b c = Vector16b.UnpackHigh (a, b);
277
278                 if (c.V0 != 8)
279                         return 1;
280                 if (c.V1 != 1)
281                         return 2;
282                 if (c.V2 != 9)
283                         return 3;
284                 if (c.V3 != 2)
285                         return 4;
286                 if (c.V4 != 10)
287                         return 5;
288                 if (c.V5 != 3)
289                         return 6;
290                 if (c.V14 != 15)
291                         return 7;
292                 if (c.V15 != 8)
293                         return 8;
294                 return 0;
295         }
296
297         static int test_0_vector16b_unpack_low () {
298                 Vector16b a = new Vector16b (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
299                 Vector16b b = new Vector16b (9,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8);
300                 Vector16b c = Vector16b.UnpackLow (a, b);
301
302                 if (c.V0 != 0)
303                         return 1;
304                 if (c.V1 != 9)
305                         return 2;
306                 if (c.V2 != 1)
307                         return 3;
308                 if (c.V3 != 10)
309                         return 4;
310                 if (c.V4 != 2)
311                         return 5;
312                 if (c.V5 != 11)
313                         return 6;
314                 if (c.V14 != 7)
315                         return 7;
316                 if (c.V15 != 0)
317                         return 8;
318                 return 0;
319         }
320
321         static int test_0_vector16b_sub_sat () {
322                 Vector16b a = new Vector16b (100,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8);
323                 Vector16b b = new Vector16b (200,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
324                 Vector16b c = Vector16b.SubWithSaturation (a, b);
325
326                 if (c.V0 != 0)
327                         return 1;
328                 if (c.V1 != 9)
329                         return 2;
330                 if (c.V15 != 0)
331                         return 3;
332                 return 0;
333         }
334         
335         static int test_0_vector16b_add_sat () {
336                 Vector16b a = new Vector16b (200,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
337                 Vector16b b = new Vector16b (200,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8);
338                 Vector16b c = Vector16b.AddWithSaturation (a, b);
339
340                 if (c.V0 != 255)
341                         return 1;
342                 if (c.V1 != 11)
343                         return 2;
344                 if (c.V15 != 23)
345                         return 3;
346                 return 0;
347         }
348
349         static int test_0_vector16b_add_ovf () {
350                 Vector16b a = new Vector16b (200,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
351                 Vector16b b = new Vector16b (200,10,11,12,13,14,15,0,1,2,3,4,5,6,7,8);
352                 Vector16b c = a + b;
353
354                 if (c.V0 != 144)
355                         return 1;
356                 if (c.V1 != 11)
357                         return 2;
358                 if (c.V15 != 23)
359                         return 3;
360                 return 0;
361         }
362
363         static int test_0_vector16b_accessors () {
364                 Vector16b a = new Vector16b (0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15);
365
366                 if (a.V0 != 0)
367                         return 1;
368                 if (a.V1 != 1)
369                         return 2;
370                 if (a.V2 != 2)
371                         return 3;
372                 if (a.V3 != 3)
373                         return 4;
374                 if (a.V4 != 4)
375                         return 5;
376                 if (a.V5 != 5)
377                         return 6;
378                 if (a.V6 != 6)
379                         return 7;
380                 if (a.V7 != 7)
381                         return 8;
382                 if (a.V8 != 8)
383                         return 9;
384                 if (a.V9 != 9)
385                         return 10;
386                 if (a.V10 != 10)
387                         return 11;
388                 if (a.V11 != 11)
389                         return 12;
390                 if (a.V12 != 12)
391                         return 13;
392                 if (a.V13 != 13)
393                         return 14;
394                 if (a.V14 != 14)
395                         return 15;
396                 if (a.V15 != 15)
397                         return 16;
398
399                 a.V0 = 10;
400                 a.V1 = 20;
401                 a.V2 = 30;
402                 a.V3 = 40;
403                 a.V4 = 50;
404                 a.V5 = 60;
405                 a.V6 = 70;
406                 a.V7 = 80;
407                 a.V8 = 90;
408                 a.V9 = 100;
409                 a.V10 = 110;
410                 a.V11 = 120;
411                 a.V12 = 130;
412                 a.V13 = 140;
413                 a.V14 = 150;
414                 a.V15 = 160;
415
416                 if (a.V0 != 10)
417                         return 17;
418                 if (a.V1 != 20)
419                         return 18;
420                 if (a.V2 != 30)
421                         return 19;
422                 if (a.V3 != 40)
423                         return 20;
424                 if (a.V4 != 50)
425                         return 21;
426                 if (a.V5 != 60)
427                         return 22;
428                 if (a.V6 != 70)
429                         return 23;
430                 if (a.V7 != 80)
431                         return 24;
432                 if (a.V8 != 90)
433                         return 25;
434                 if (a.V9 != 100)
435                         return 26;
436                 if (a.V10 != 110)
437                         return 27;
438                 if (a.V11 != 120)
439                         return 28;
440                 if (a.V12 != 130)
441                         return 29;
442                 if (a.V13 != 140)
443                         return 30;
444                 if (a.V14 != 150)
445                         return 31;
446                 if (a.V15 != 160)
447                         return 32;
448                 return 0;
449         }
450
451         public static int test_0_accessors () {
452                 Vector4f a = new Vector4f (1, 2, 3, 4);
453                 if (a.X != 1f)
454                         return 1;
455                 if (a.Y != 2f)
456                         return 2;
457                 if (a.Z != 3f)
458                         return 3;
459                 if (a.W != 4f)
460                         return 4;
461                 return 0;
462         }
463
464         public static int test_0_packed_add_with_stack_tmp () {
465                 Vector4f a = new Vector4f (1, 2, 3, 4);
466                 Vector4f b = new Vector4f (5, 6, 7, 8);
467                 Vector4f c = new Vector4f (-1, -3, -4, -5);
468                 Vector4f d = a + b + c;
469                 if (d.X != 5f)
470                         return 1;
471                 if (d.Y != 5f)
472                         return 2;
473                 if (d.Z != 6f)
474                         return 3;
475                 if (d.W != 7f)
476                         return 4;
477                 return 0;
478         }
479
480         public static int test_0_simple_packed_add () {
481                 Vector4f a = new Vector4f (1, 2, 3, 4);
482                 Vector4f b = new Vector4f (5, 6, 7, 8);
483                 Vector4f c;
484                 c = a + b;
485                 if (c.X != 6f)
486                         return 1;
487                 if (c.Y != 8f)
488                         return 2;
489                 if (c.Z != 10f)
490                         return 3;
491                 if (c.W != 12f)
492                         return 4;
493                 return 0;
494         }
495
496         public static int test_0_simple_packed_sub () {
497                 Vector4f a = new Vector4f (1, 2, 3, 4);
498                 Vector4f b = new Vector4f (5, 6, 7, 8);
499                 Vector4f c = b - a;
500                 if (c.X != 4f)
501                         return 1;
502                 if (c.Y != 4f)
503                         return 2;
504                 if (c.Z != 4f)
505                         return 3;
506                 if (c.W != 4f)
507                         return 4;
508                 return 0;
509         }
510
511         public static int test_0_simple_packed_mul () {
512                 Vector4f a = new Vector4f (1, 2, 3, 4);
513                 Vector4f b = new Vector4f (5, 6, 7, 8);
514                 Vector4f c = b * a;
515                 if (c.X != 5f)
516                         return 1;
517                 if (c.Y != 12f)
518                         return 2;
519                 if (c.Z != 21f)
520                         return 3;
521                 if (c.W != 32f)
522                         return 4;
523                 return 0;
524         }
525
526         public static int test_0_simple_packed_div () {
527                 Vector4f a = new Vector4f (2, 2, 3, 4);
528                 Vector4f b = new Vector4f (20, 10, 33, 12);
529                 Vector4f c = b / a;
530                 if (c.X != 10f)
531                         return 1;
532                 if (c.Y != 5f)
533                         return 2;
534                 if (c.Z != 11f)
535                         return 3;
536                 if (c.W != 3f)
537                         return 4;
538                 return 0;
539         }
540
541         public static int test_0_simple_packed_sqrt () {
542                 Vector4f a = new Vector4f (16, 4, 9, 25);
543                 a = Vector4f.Sqrt (a);
544                 if (a.X != 4f)
545                         return 1;
546                 if (a.Y != 2f)
547                         return 2;
548                 if (a.Z != 3f)
549                         return 3;
550                 if (a.W != 5f)
551                         return 4;
552                 return 0;
553         }
554
555         public static int test_0_simple_packed_invsqrt () {
556                 Vector4f a = new Vector4f (16, 4, 100, 25);
557                 //this function has VERY low precision
558                 a = Vector4f.InvSqrt (a);
559                 if (a.X < (1/4f - 0.01f) || a.X > (1/4f + 0.01f))
560                         return 1;
561                 if (a.Y < (1/2f - 0.01f) || a.Y > (1/2f + 0.01f))
562                         return 2;
563                 if (a.Z < (1/10f - 0.01f) || a.Z > (1/10f + 0.01f))
564                         return 3;
565                 if (a.W < (1/5f - 0.01f) || a.W > (1/5f + 0.01f))
566                         return 4;
567                 return 0;
568         }
569
570         public static int test_0_simple_packed_min () {
571                 Vector4f a = new Vector4f (16, -4, 9, 25);
572                 Vector4f b = new Vector4f (5, 3, 9, 0);
573                 Vector4f c = Vector4f.Min (a, b);
574                 if (c.X != 5f)
575                         return 1;
576                 if (c.Y != -4f)
577                         return 2;
578                 if (c.Z != 9f)
579                         return 3;
580                 if (c.W != 0f)
581                         return 4;
582                 return 0;
583         }
584
585         public static int test_0_simple_packed_max () {
586                 Vector4f a = new Vector4f (16, -4, 9, 25);
587                 Vector4f b = new Vector4f (5, 3, 9, 0);
588                 Vector4f c = Vector4f.Max (a, b);
589                 if (c.X != 16f)
590                         return 1;
591                 if (c.Y != 3f)
592                         return 2;
593                 if (c.Z != 9f)
594                         return 3;
595                 if (c.W != 25f)
596                         return 4;
597                 return 0;
598         }
599
600         public static int test_0_simple_packed_hadd () {
601                 Vector4f a = new Vector4f (5, 5, 6, 6);
602                 Vector4f b = new Vector4f (7, 7, 8, 8);
603                 Vector4f c = Vector4f.HorizontalAdd (a, b);
604                 if (c.X != 10f)
605                         return 1;
606                 if (c.Y != 12f)
607                         return 2;
608                 if (c.Z != 14f)
609                         return 3;
610                 if (c.W != 16f)
611                         return 4;
612                 return 0;
613         }
614
615         public static int test_0_simple_packed_hsub () {
616                 Vector4f a = new Vector4f (5, 2, 6, 1);
617                 Vector4f b = new Vector4f (7, 0, 8, 3);
618                 Vector4f c = Vector4f.HorizontalSub (a, b);
619                 if (c.X != 3f)
620                         return 1;
621                 if (c.Y != 5f)
622                         return 2;
623                 if (c.Z != 7f)
624                         return 3;
625                 if (c.W != 5f)
626                         return 4;
627                 return 0;
628         }
629
630         public static int test_0_simple_packed_addsub () {
631                 Vector4f a = new Vector4f (5, 2, 6, 1);
632                 Vector4f b = new Vector4f (7, 0, 8, 3);
633                 Vector4f c = Vector4f.AddSub (a, b);
634                 if (c.X != -2f)
635                         return 1;
636                 if (c.Y != 2f)
637                         return 2;
638                 if (c.Z != -2f)
639                         return 3;
640                 if (c.W != 4f)
641                         return 4;
642                 return 0;
643         }
644
645         public static int test_0_simple_packed_shuffle () {
646                 Vector4f a = new Vector4f (1, 2, 3, 4);
647                 a = Vector4f.Shuffle(a, ShuffleSel.XFromY | ShuffleSel.YFromW | ShuffleSel.ZFromX | ShuffleSel.WFromZ);
648                 if (a.X != 2f)
649                         return 1;
650                 if (a.Y != 4f)
651                         return 2;
652                 if (a.Z != 1f)
653                         return 3;
654                 if (a.W != 3f)
655                         return 4;
656                 return 0;
657         }
658
659         public static int test_0_packed_shuffle_with_reg_pressure () {
660                 Vector4f v = new Vector4f (1, 2, 3, 4);
661                 Vector4f m0 = v + v, m1 = v - v, m2 = v * v, m3 = v + v + v;
662                 if (ff) v = v + v -v    ;
663
664                 Vector4f r0 = Vector4f.Shuffle (v, ShuffleSel.XFromY | ShuffleSel.YFromW | ShuffleSel.ZFromX | ShuffleSel.WFromZ);
665                 Vector4f r1 = Vector4f.Shuffle (v, ShuffleSel.XFromY | ShuffleSel.YFromW | ShuffleSel.ZFromX | ShuffleSel.WFromZ);
666                 Vector4f x = Vector4f.Shuffle (v, ShuffleSel.XFromY | ShuffleSel.YFromW | ShuffleSel.ZFromX | ShuffleSel.WFromZ);
667                 Vector4f r2 = Vector4f.Shuffle (v, ShuffleSel.XFromY | ShuffleSel.YFromW | ShuffleSel.ZFromX | ShuffleSel.WFromZ);
668                 Vector4f r3 = Vector4f.Shuffle (v, ShuffleSel.XFromY | ShuffleSel.YFromW | ShuffleSel.ZFromX | ShuffleSel.WFromZ);
669                 Vector4f a = x;
670
671                 r0 = r0 * m0 + x;
672                 r1 = r1 * m1 + x;
673                 x = x - v + v;
674                 r2 = r2 * m2 + x;
675                 r3 = r3 * m3 + x;
676                 Vector4f result = r0 + r1 + r2 + r3;
677
678                 if (a.X != 2f)
679                         return 1;
680                 if (a.Y != 4f)
681                         return 2;
682                 if (a.Z != 1f)
683                         return 3;
684                 if (a.W != 3f)
685                         return 4;
686                 if (result.Y != result.Y)
687                         return 0;
688                 return 0;
689         }
690         
691         public static int test_24_regs_pressure_a () {
692                 Vector4f a = new Vector4f (1, 2, 3, 4);
693                 Vector4f b = a + a;
694                 Vector4f c = b * a;
695                 Vector4f d = a - b;
696                 c = a + b + c + d;
697                 return (int)c.Z;
698         }
699
700         public static int test_54_regs_pressure_b () {
701                 Vector4f a = new Vector4f (1, 2, 3, 4);
702                 Vector4f b = a + a;
703                 Vector4f c = b - a;
704                 Vector4f d = c - a;
705                 Vector4f e = a + b + c;
706                 Vector4f f = d - b + a - c;
707                 Vector4f g = a - d * f - c + b;
708                 Vector4f h = a * b - c + e;
709                 Vector4f i = h - g - f - e - d - c - b - a;
710                 Vector4f j = a + b + c + d + e + f + g + h + i;
711                 return (int)j.Z;
712         }
713
714         static bool ff;
715         public static int test_3_single_block_var_is_properly_promoted () {
716                 Vector4f a = new Vector4f (4, 5, 6, 7);
717                 if (ff)
718                         a = a - a;
719                 else {
720                         Vector4f b = new Vector4f (1, 2, 3, 4);
721                         Vector4f c = b;
722                         a = a - b;
723                         if (ff) {
724                                 c = a;
725                                 a = c;
726                         }
727                 }
728                 return (int)a.X;
729         }
730
731         static float float_val = 45f;
732
733         public static int test_0_sse2_opt_and_simd_intrinsic_proper_regalloc () {
734                 Vector4f v = new Vector4f (1, 2, 3, 4);
735                 float f = float_val;
736                 int x = (int)f;
737                 if (v.X != 1f)
738                         return 1;
739                 if (x != 45f)
740                         return 2;
741                 return 0;
742         }
743
744         public static int Main () {
745                 return TestDriver.RunTests (typeof (SimdTests));
746         }
747 }
748