(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
powerpc/
builtins-8-p9-runnable.c
       1  /* { dg-do run } */
       2  /* { dg-require-effective-target p9vector_hw } */
       3  /* { dg-options "-mdejagnu-cpu=power9 -O2" } */
       4  
       5  #include <stdint.h>
       6  #include <stdio.h>
       7  #include <altivec.h> // vector
       8  
       9  #ifdef DEBUG
      10  #include <stdio.h>
      11  #endif
      12  
      13  #ifdef DEBUG2
      14  #include <stdio.h>
      15  #endif
      16  
      17  
      18  void abort (void);
      19  
      20  #ifdef DEBUG2
      21  void print_signed_char (char *name, vector signed char src)
      22  {
      23    int i;
      24  
      25    for (i = 0; i < 8; i++)
      26      printf("%s[%d] = %d, ", name, i, src[i]);
      27  
      28    printf("\n");
      29  
      30    for (i = 8; i < 15; i++)
      31      printf("%s[%d] = %d, ", name, i, src[i]);
      32  
      33    printf("%s[%d] = %d\n", name, 15, src[i]);
      34  }
      35  
      36  void print_unsigned_char (char *name, vector unsigned char src)
      37  {
      38    int i;
      39  
      40    for (i = 0; i < 8; i++)
      41      printf("%s[%d] = %d, ", name, i, src[i]);
      42  
      43    printf("\n");
      44  
      45    for (i = 8; i < 15; i++)
      46      printf("%s[%d] = %d, ", name, i, src[i]);
      47  
      48    printf("%s[%d] = %d\n", name, 15, src[i]);
      49  }
      50  
      51  void print_signed_short_int (char *name, vector signed short int src)
      52  {
      53    int i;
      54  
      55    for (i = 0; i < 7; i++)
      56      printf("%s[%d] = %d, ", name, i, src[i]);
      57  
      58    printf("%s[%d] = %d\n", name, 7, src[i]);
      59  }
      60  
      61  void print_unsigned_short_int (char *name, vector unsigned short int src)
      62  {
      63    int i;
      64  
      65    for (i = 0; i < 7; i++)
      66      printf("%s[%d] = %d, ", name, i, src[i]);
      67  
      68    printf("%s[%d] = %d\n", name, 7, src[i]);
      69  }
      70  
      71  void print_signed_int (char *name, vector signed int src)
      72  {
      73    int i;
      74  
      75    for (i = 0; i < 3; i++)
      76      printf("%s[%d] = %d, ", name, i, src[i]);
      77  
      78    printf("%s[%d] = %d\n", name, 3, src[i]);
      79  }
      80  
      81  void print_unsigned_int (char *name, vector unsigned int src)
      82  {
      83    int i;
      84  
      85    for (i = 0; i < 3; i++)
      86      printf("%s[%d] = %d, ", name, i, src[i]);
      87  
      88    printf("%s[%d] = %d\n", name, 3, src[i]);
      89  }
      90  #endif
      91  
      92  int main() {
      93  
      94    vector signed char char_src1, char_src2;
      95    vector unsigned char uchar_src1, uchar_src2;
      96    vector signed short int short_src1, short_src2;
      97    vector unsigned short int ushort_src1, ushort_src2;
      98    vector signed int int_src1, int_src2;
      99    vector unsigned int uint_src1, uint_src2;
     100    unsigned int result, expected_result;
     101  
     102  
     103    /* Tests for: vec_first_match_index()
     104       The element index in natural element order is returned for the
     105       first match or the number of elements if there is no match.  */
     106    /* char */
     107    char_src1 = (vector signed char) { 0x40, 0, 0x40, 0x40,
     108  				     0x40, 0x40, 0x40, 0x40,
     109  				     0x40, 0x40, 0x40, 0x40,
     110  				     0x40, 0x40, 0x40, 0x40 };
     111  				    
     112    char_src2 = (vector signed char) {0, 0, 0, 0, 0, 0, 0, 0,
     113  				    0, 0, 0, 0, 0, 0, 0, 0};
     114    expected_result = 1;
     115  
     116    result = vec_first_match_index (char_src1, char_src2);
     117  
     118  #ifdef DEBUG2
     119    print_signed_char("src1", char_src1);
     120    print_signed_char("src2", char_src2);
     121    printf(" vec_first_match_index = %d\n\n", result);
     122  #endif
     123  
     124    if (result != expected_result)
     125  #ifdef DEBUG
     126      printf("Error: char first match result (%d) does not match expected result (%d)\n",
     127  	   result, expected_result);
     128  #else
     129      abort();
     130  #endif
     131  
     132    char_src1 = (vector signed char) {-1, 2, 3, 4, -5, 6, 7, 8,
     133  				    9, 10, 11, 12, 13, 14, 15, 16};
     134    char_src2 = (vector signed char) {-1, 2, 3, 20, -5, 6, 7, 8,
     135  				    9, 10, 11, 12, 13, 14, 15, 16};
     136    expected_result = 0;
     137  
     138    result = vec_first_match_index (char_src1, char_src2);
     139  
     140  #ifdef DEBUG2
     141    print_signed_char("src1", char_src1);
     142    print_signed_char("src2", char_src2);
     143    printf(" vec_first_match_index = %d\n\n", result);
     144  #endif
     145  
     146    if (result != expected_result)
     147  #ifdef DEBUG
     148      printf("Error: char first match result (%d) does not match expected result (%d)\n",
     149  	   result, expected_result);
     150  #else
     151      abort();
     152  #endif
     153  
     154    char_src1 = (vector signed char) {1, 2, 3, 4, 5, 6, 7, 8,
     155  				    9, 10, 11, 12, 13, 14, 15, 16};
     156    char_src2 = (vector signed char) {-1, -2, -3, -4, -5, -6, -7, -8,
     157  				    -9, -10, -11, -12, -13, -14, -15, -16};
     158    expected_result = 16;
     159  
     160    result = vec_first_match_index (char_src1, char_src2);
     161  
     162  #ifdef DEBUG2
     163    print_signed_char("src1", char_src1);
     164    print_signed_char("src2", char_src2);
     165    printf("vec_first_match_index = %d\n\n", result);
     166  #endif
     167  
     168    if (result != expected_result)
     169  #ifdef DEBUG
     170      printf("Error: char first match result (%d) does not match expected result (%d)\n",
     171  	   result, expected_result);
     172  #else
     173      abort();
     174  #endif
     175  
     176    uchar_src1 = (vector unsigned char) {0, 2, 3, 4, 5, 6, 7, 8,
     177  				       9, 10, 11, 12, 13, 14, 15, 16};
     178    uchar_src2 = (vector unsigned char) {1, 0, 3, 4, 5, 6, 7, 8,
     179  				       9, 10, 11, 12, 13, 14, 15, 16};
     180    expected_result = 2;
     181  
     182    result = vec_first_match_index (uchar_src1, uchar_src2);
     183  
     184  #ifdef DEBUG2
     185    print_unsigned_char("src1", uchar_src1);
     186    print_unsigned_char("src2", uchar_src2);
     187    printf("vec_first_match_index = %d\n\n", result);
     188  #endif
     189  
     190    if (result != expected_result)
     191  #ifdef DEBUG
     192      printf("Error: uchar first match result (%d) does not match expected result (%d)\n",
     193  	   result, expected_result);
     194  #else
     195      abort();
     196  #endif
     197  
     198    uchar_src1 = (vector unsigned char) {2, 3, 4, 5, 6, 7, 8, 9,
     199  				       10, 11, 12, 13, 14, 15, 16, 17};
     200    uchar_src2 = (vector unsigned char) {3, 4, 5, 6, 7, 8, 9, 10,
     201  				       11, 12, 13, 14, 15, 16, 17, 18};
     202    expected_result = 16;
     203  
     204    result = vec_first_match_index (uchar_src1, uchar_src2);
     205  
     206  #ifdef DEBUG2
     207    print_unsigned_char("src1", uchar_src1);
     208    print_unsigned_char("src2", uchar_src2);
     209    printf("vec_first_match_index = %d\n\n", result);
     210  #endif
     211  
     212    if (result != expected_result)
     213  #ifdef DEBUG
     214      printf("Error: uchar first match result (%d) does not match expected result (%d)\n",
     215  	   result, expected_result);
     216  #else
     217      abort();
     218  #endif
     219  
     220    /* short int */
     221    short_src1 = (vector short int) {10, -20, -30, 40, 50, 60, 70, 80};
     222    short_src2 = (vector short int) {-10, 20, 30, 40, 50, 60, 70, 80};
     223  
     224    expected_result = 3;
     225  
     226    result = vec_first_match_index (short_src1, short_src2);
     227  
     228  #ifdef DEBUG2
     229    print_signed_short_int("src1", short_src1);
     230    print_signed_short_int("src2", short_src2);
     231    printf("vec_first_match_index = %d\n\n", result);
     232  #endif
     233  
     234    if (result != expected_result)
     235  #ifdef DEBUG
     236      printf("Error: short int first match result (%d) does not match expected result (%d)\n",
     237  	   result, expected_result);
     238  #else
     239      abort();
     240  #endif
     241  
     242    short_src1 = (vector short int) {10, 20, 30, 40, 50, 60, 70, 80};
     243    short_src2 = (vector short int) {0, 0, 0, 0, 0, 0, 0, 0};
     244  
     245    expected_result = 8;
     246  
     247    result = vec_first_match_index (short_src1, short_src2);
     248  
     249  #ifdef DEBUG2
     250    print_signed_short_int("src1", short_src1);
     251    print_signed_short_int("src2", short_src2);
     252    printf("vec_first_match_index = %d\n\n", result);
     253  #endif
     254  
     255    if (result != expected_result)
     256  #ifdef DEBUG
     257      printf("Error: short int first match result (%d) does not match expected result (%d)\n",
     258  	   result, expected_result);
     259  #else
     260      abort();
     261  #endif
     262  
     263    ushort_src1 = (vector short unsigned int) {0, 0, 0, 0, 0, 60, 70, 0};
     264    ushort_src2 = (vector short unsigned int) {10, 20, 30, 40, 50, 60, 70, 80};
     265  
     266    expected_result = 5;
     267  
     268    result = vec_first_match_index (ushort_src1, ushort_src2);
     269  
     270  #ifdef DEBUG2
     271    print_unsigned_short_int("src1", ushort_src1);
     272    print_unsigned_short_int("src2", ushort_src2);
     273    printf("vec_first_match_index = %d\n\n", result);
     274  #endif
     275  
     276    if (result != expected_result)
     277  #ifdef DEBUG
     278      printf("Error: ushort int first match result (%d) does not match expected result (%d)\n",
     279  	   result, expected_result);
     280  #else
     281      abort();
     282  #endif
     283  
     284    ushort_src1 = (vector short unsigned int) {-20, 30, -40, 50,
     285  					     60, -70, 80, -90};
     286    ushort_src2 = (vector short unsigned int) {20, -30, 40, -50,
     287  					     -60, 70, -80, 90};
     288  
     289    expected_result = 8;
     290  
     291    result = vec_first_match_index (ushort_src1, ushort_src2);
     292  
     293  #ifdef DEBUG2
     294    print_unsigned_short_int("src1", ushort_src1);
     295    print_unsigned_short_int("src2", ushort_src2);
     296    printf("vec_first_match_index = %d\n\n", result);
     297  #endif
     298  
     299    if (result != expected_result)
     300  #ifdef DEBUG
     301      printf("Error: ushort int first match result (%d) does not match expected result (%d)\n",
     302  	   result, expected_result);
     303  #else
     304      abort();
     305  #endif
     306  
     307    /* int */
     308    int_src1 = (vector int) {1, 2, 3, 4};
     309    int_src2 = (vector int) {10, 20, 30, 4};
     310  
     311    expected_result = 3;
     312  
     313    result = vec_first_match_index (int_src1, int_src2);
     314  
     315  #ifdef DEBUG2
     316    print_signed_int("src1", int_src1);
     317    print_signed_int("src2", int_src2);
     318    printf("vec_first_match_index = %d\n\n", result);
     319  #endif
     320  
     321    if (result != expected_result)
     322  #ifdef DEBUG
     323      printf("Error: int first match result (%d) does not match expected result (%d)\n",
     324  	   result, expected_result);
     325  #else
     326      abort();
     327  #endif
     328  
     329    int_src1 = (vector int) {1, 2, 3, 4};
     330    int_src2 = (vector int) {4, 3, 2, 1};
     331  
     332    expected_result = 4;
     333  
     334    result = vec_first_match_index (int_src1, int_src2);
     335  
     336  #ifdef DEBUG2
     337    print_signed_int("src1", int_src1);
     338    print_signed_int("src2", int_src2);
     339    printf("vec_first_match_index = %d\n\n", result);
     340  #endif
     341  
     342    if (result != expected_result)
     343  #ifdef DEBUG
     344      printf("Error: int first match result (%d) does not match expected result (%d)\n",
     345  	   result, expected_result);
     346  #else
     347      abort();
     348  #endif
     349  
     350    uint_src1 = (vector unsigned int) {1, 2, 3, 4};
     351    uint_src2 = (vector unsigned int) {11, 2, 33, 4};
     352  
     353    expected_result = 1;
     354  
     355    result = vec_first_match_index (uint_src1, uint_src2);
     356  
     357  #ifdef DEBUG2
     358    print_unsigned_int("src1", uint_src1);
     359    print_unsigned_int("src2", uint_src2);
     360    printf("vec_first_match_index = %d\n\n", result);
     361  #endif
     362  
     363    if (result != expected_result)
     364  #ifdef DEBUG
     365      printf("Error: uint first match result (%d) does not match expected result (%d)\n",
     366  	   result, expected_result);
     367  #else
     368      abort();
     369  #endif
     370  
     371    uint_src1 = (vector unsigned int) {1, 2, 3, 4};
     372    uint_src2 = (vector unsigned int) {2, 3, 4, 5};
     373  
     374    expected_result = 4;
     375  
     376    result = vec_first_match_index (uint_src1, uint_src2);
     377  
     378  #ifdef DEBUG2
     379    print_unsigned_int("src1", uint_src1);
     380    print_unsigned_int("src2", uint_src2);
     381    printf("vec_first_match_index = %d\n\n", result);
     382  #endif
     383  
     384    if (result != expected_result)
     385  #ifdef DEBUG
     386      printf("Error: uint first match result (%d) does not match expected result (%d)\n",
     387  	   result, expected_result);
     388  #else
     389      abort();
     390  #endif
     391  
     392    /* Tests for: vec_first_mismatch_index()
     393       The element index in BE order is returned for the first mismatch
     394       or the number of elements if there is no match.   */
     395    /* char */
     396    char_src1 = (vector signed char) {1, 2, 0, 4, -5, 6, 7, 8,
     397  				    9, 10, 11, 12, 13, 14, 15, 16};
     398    char_src2 = (vector signed char) {1, 2, 0, 20, -5, 6, 7, 8,
     399  				    9, 10, 11, 12, 13, 14, 15, 16};
     400    expected_result = 3;
     401  
     402    result = vec_first_mismatch_index (char_src1, char_src2);
     403  
     404  #ifdef DEBUG2
     405    print_signed_char("src1", char_src1);
     406    print_signed_char("src2", char_src2);
     407    printf("vec_first_mismatch_index = %d\n\n", result);
     408  #endif
     409  
     410    if (result != expected_result)
     411  #ifdef DEBUG
     412      printf("Error: char first mismatch result (%d) does not match expected result (%d)\n",
     413  	   result, expected_result);
     414  #else
     415      abort();
     416  #endif
     417  
     418    char_src1 = (vector signed char) {0, 2, 3, 4, -5, 6, 7, 8,
     419  				    9, 10, 11, 12, 13, 14, 15, 16};
     420    char_src2 = (vector signed char) {0, 2, 3, 20, -5, 6, 7, 8,
     421  				    9, 10, 11, 12, 13, 14, 15, 16};
     422    expected_result = 3;
     423  
     424    result = vec_first_mismatch_index (char_src1, char_src2);
     425  
     426  #ifdef DEBUG2
     427    print_signed_char("src1", char_src1);
     428    print_signed_char("src2", char_src2);
     429    printf("vec_first_mismatch_index = %d\n\n", result);
     430  #endif
     431  
     432    if (result != expected_result)
     433  #ifdef DEBUG
     434      printf("Error: char first mismatch result (%d) does not match expected result (%d)\n",
     435  	   result, expected_result);
     436  #else
     437      abort();
     438  #endif
     439  
     440    char_src1 = (vector signed char) {-1, 2, 3, 4, -5, 6, 7, 8,
     441  				    9, 10, 11, 12, 13, 14, 15, 16};
     442    char_src2 = (vector signed char) {-1, 2, 3, 20, -5, 6, 7, 8,
     443  				    9, 10, 11, 12, 13, 14, 15, 16};
     444    expected_result = 3;
     445  
     446    result = vec_first_mismatch_index (char_src1, char_src2);
     447  
     448  #ifdef DEBUG2
     449    print_signed_char("src1", char_src1);
     450    print_signed_char("src2", char_src2);
     451    printf("vec_first_mismatch_index = %d\n\n", result);
     452  #endif
     453  
     454    if (result != expected_result)
     455  #ifdef DEBUG
     456      printf("Error: char first mismatch result (%d) does not match expected result (%d)\n",
     457  	   result, expected_result);
     458  #else
     459      abort();
     460  #endif
     461  
     462    char_src1 = (vector signed char) {1, 2, 3, 4, 5, 6, 7, 8,
     463  				    9, 10, 11, 12, 13, 14, 15, 16};
     464    char_src2 = (vector signed char) {1, 2, 3, 4, 5, 6, 7, 8,
     465  				     9, 10, 11, 12, 13, 14, 15, 16};
     466    expected_result = 16;
     467  
     468    result = vec_first_mismatch_index (char_src1, char_src2);
     469  
     470  #ifdef DEBUG2
     471    print_signed_char("src1", char_src1);
     472    print_signed_char("src2", char_src2);
     473    printf("vec_first_mismatch_index = %d\n\n", result);
     474  #endif
     475  
     476    if (result != expected_result)
     477  #ifdef DEBUG
     478      printf("Error: char first mismatch result (%d) does not match expected result (%d)\n",
     479  	   result, expected_result);
     480  #else
     481      abort();
     482  #endif
     483  
     484    uchar_src1 = (vector unsigned char) {1, 2, 3, 4, 5, 6, 7, 8,
     485  				       9, 10, 11, 12, 13, 14, 15, 16};
     486    uchar_src2 = (vector unsigned char) {1, 0, 3, 4, 5, 6, 7, 8,
     487  				       9, 10, 11, 12, 13, 14, 15, 16};
     488    expected_result = 1;
     489  
     490    result = vec_first_mismatch_index (uchar_src1, uchar_src2);
     491  
     492  #ifdef DEBUG2
     493    print_unsigned_char("src1", uchar_src1);
     494    print_unsigned_char("src2", uchar_src2);
     495    printf("vec_first_mismatch_index = %d\n\n", result);
     496  #endif
     497  
     498    if (result != expected_result)
     499  #ifdef DEBUG
     500      printf("Error: uchar first mismatch result (%d) does not match expected result (%d)\n",
     501  	   result, expected_result);
     502  #else
     503      abort();
     504  #endif
     505  
     506    uchar_src1 = (vector unsigned char) {2, 3, 4, 5, 6, 7, 8, 9,
     507  				       10, 11, 12, 13, 14, 15, 16};
     508    uchar_src2 = (vector unsigned char) {2, 3, 4, 5, 6, 7, 8, 9,
     509  				       0, 11, 12, 13, 14, 15, 16};
     510    expected_result = 8;
     511  
     512    result = vec_first_mismatch_index (uchar_src1, uchar_src2);
     513  
     514  #ifdef DEBUG2
     515    print_unsigned_char("src1", uchar_src1);
     516    print_unsigned_char("src2", uchar_src2);
     517    printf("vec_first_mismatch_index = %d\n\n", result);
     518  #endif
     519  
     520    if (result != expected_result)
     521  #ifdef DEBUG
     522      printf("Error: uchar first mismatch result (%d) does not match expected result (%d)\n",
     523  	    result, expected_result);
     524  #else
     525      abort();
     526  #endif
     527  
     528    uchar_src1 = (vector unsigned char) {2, 3, 4, 5, 6, 7, 8, 9,
     529  				       10, 11, 12, 13, 14, 15, 16};
     530    uchar_src2 = (vector unsigned char) {2, 3, 4, 5, 6, 7, 8, 9,
     531  				       10, 11, 12, 13, 14, 15, 16};
     532    expected_result = 16;
     533  
     534    result = vec_first_mismatch_index (uchar_src1, uchar_src2);
     535  
     536  #ifdef DEBUG2
     537    print_unsigned_char("src1", uchar_src1);
     538    print_unsigned_char("src2", uchar_src2);
     539    printf("vec_first_mismatch_index = %d\n\n", result);
     540  #endif
     541  
     542    if (result != expected_result)
     543  #ifdef DEBUG
     544      printf("Error: uchar first mismatch result (%d) does not match expected result (%d)\n",
     545  	   result, expected_result);
     546  #else
     547      abort();
     548  #endif
     549  
     550    /* short int */
     551    short_src1 = (vector short int) {-10, -20, 30, 40, 50, 60, 70, 80};
     552    short_src2 = (vector short int) {-10, 20, 30, 40, 50, 60, 70, 80};
     553  
     554    expected_result = 1;
     555  
     556    result = vec_first_mismatch_index (short_src1, short_src2);
     557  
     558  #ifdef DEBUG2
     559    print_signed_short_int("src1", short_src1);
     560    print_signed_short_int("src2", short_src2);
     561    printf("vec_first_mismatch_index = %d\n\n", result);
     562  #endif
     563  
     564    if (result != expected_result)
     565  #ifdef DEBUG
     566      printf("Error: short int first mismatch result (%d) does not match expected result (%d)\n",
     567  	   result, expected_result);
     568  #else
     569      abort();
     570  #endif
     571  
     572    short_src1 = (vector short int) {10, 20, 30, 40, 50, 60, 70, 80};
     573    short_src2 = (vector short int) {10, 20, 30, 40, 50, 60, 70, 80};
     574  
     575    expected_result = 8;
     576  
     577    result = vec_first_mismatch_index (short_src1, short_src2);
     578  
     579  #ifdef DEBUG2
     580    print_signed_short_int("src1", short_src1);
     581    print_signed_short_int("src2", short_src2);
     582    printf("vec_first_mismatch_index = %d\n\n", result);
     583  #endif
     584  
     585    if (result != expected_result)
     586  #ifdef DEBUG
     587      printf("Error: short int first mismatch result (%d) does not match expected result (%d)\n",
     588  	   result, expected_result);
     589  #else
     590      abort();
     591  #endif
     592  
     593    ushort_src1 = (vector short unsigned int) {10, 20, 30, 40, 50, 60, 70, 0};
     594    ushort_src2 = (vector short unsigned int) {10, 20, 30, 40, 50, 60, 70, 80};
     595  
     596    expected_result = 7;
     597  
     598    result = vec_first_mismatch_index (ushort_src1, ushort_src2);
     599  
     600  #ifdef DEBUG2
     601    print_unsigned_short_int("src1", ushort_src1);
     602    print_unsigned_short_int("src2", ushort_src2);
     603    printf("vec_first_mismatch_index = %d\n\n", result);
     604  #endif
     605  
     606    if (result != expected_result)
     607  #ifdef DEBUG
     608      printf("Error: ushort int first mismatch result (%d) does not match expected result (%d)\n",
     609  	   result, expected_result);
     610  #else
     611      abort();
     612  #endif
     613  
     614    ushort_src1 = (vector short unsigned int) {20, 30, 40, 50, 60, 70, 80, 90};
     615    ushort_src2 = (vector short unsigned int) {20, 30, 40, 50, 60, 70, 80, 90};
     616  
     617    expected_result = 8;
     618  
     619    result = vec_first_mismatch_index (ushort_src1, ushort_src2);
     620  
     621  #ifdef DEBUG2
     622    print_unsigned_short_int("src1", ushort_src1);
     623    print_unsigned_short_int("src2", ushort_src2);
     624    printf("vec_first_mismatch_index = %d\n\n", result);
     625  #endif
     626  
     627    if (result != expected_result)
     628  #ifdef DEBUG
     629      printf("Error: ushort int first mismatch result (%d) does not match expected result (%d)\n",
     630  	   result, expected_result);
     631  #else
     632      abort();
     633  #endif
     634  
     635    /* int */
     636    int_src1 = (vector int) {1, 2, 3, 4};
     637    int_src2 = (vector int) {1, 20, 3, 4};
     638  
     639    expected_result = 1;
     640  
     641    result = vec_first_mismatch_index (int_src1, int_src2);
     642  
     643  #ifdef DEBUG2
     644    print_signed_int("src1", int_src1);
     645    print_signed_int("src2", int_src2);
     646    printf("vec_first_mismatch_index = %d\n\n", result);
     647  #endif
     648  
     649    if (result != expected_result)
     650  #ifdef DEBUG
     651      printf("Error: int first mismatch result (%d) does not match expected result (%d)\n",
     652  	   result, expected_result);
     653  #else
     654      abort();
     655  #endif
     656  
     657    int_src1 = (vector int) {1, 2, 3, 4};
     658    int_src2 = (vector int) {1, 2, 3, 4};
     659  
     660    expected_result = 4;
     661  
     662    result = vec_first_mismatch_index (int_src1, int_src2);
     663  
     664  #ifdef DEBUG2
     665    print_signed_int("src1", int_src1);
     666    print_signed_int("src2", int_src2);
     667    printf("vec_first_mismatch_index = %d\n\n", result);
     668  #endif
     669  
     670    if (result != expected_result)
     671  #ifdef DEBUG
     672      printf("Error: int first mismatch result (%d) does not match expected result (%d)\n",
     673  	   result, expected_result);
     674  #else
     675      abort();
     676  #endif
     677  
     678    int_src1 = (vector int) {1, 0, 3, 4};
     679    int_src2 = (vector int) {1, 2, 3, 4};
     680  
     681    expected_result = 1;
     682  
     683    result = vec_first_mismatch_index (int_src1, int_src2);
     684  
     685  #ifdef DEBUG2
     686    print_signed_int("src1", int_src1);
     687    print_signed_int("src2", int_src2);
     688    printf("vec_first_mismatch_index = %d\n\n", result);
     689  #endif
     690  
     691    if (result != expected_result)
     692  #ifdef DEBUG
     693      printf("Error: int first mismatch result (%d) does not match expected result (%d)\n",
     694  	   result, expected_result);
     695  #else
     696      abort();
     697  #endif
     698  
     699    uint_src1 = (vector unsigned int) {1, 2, 3, 4};
     700    uint_src2 = (vector unsigned int) {11, 2, 33, 4};
     701  
     702    expected_result = 0;
     703  
     704    result = vec_first_mismatch_index (uint_src1, uint_src2);
     705  
     706  #ifdef DEBUG2
     707    print_unsigned_int("src1", uint_src1);
     708    print_unsigned_int("src2", uint_src2);
     709    printf("vec_first_mismatch_index = %d\n\n", result);
     710  #endif
     711  
     712    if (result != expected_result)
     713  #ifdef DEBUG
     714      printf("Error: uint first mismatch result (%d) does not match expected result (%d)\n",
     715  	   result, expected_result);
     716  #else
     717      abort();
     718  #endif
     719  
     720    uint_src1 = (vector unsigned int) {1, 2, 3, 4};
     721    uint_src2 = (vector unsigned int) {1, 2, 3, 4};
     722  
     723    expected_result = 4;
     724  
     725    result = vec_first_mismatch_index (uint_src1, uint_src2);
     726  
     727  #ifdef DEBUG2
     728    print_unsigned_int("src1", uint_src1);
     729    print_unsigned_int("src2", uint_src2);
     730    printf("vec_first_mismatch_index = %d\n\n", result);
     731  #endif
     732  
     733    if (result != expected_result)
     734  
     735  #ifdef DEBUG
     736      printf("Error: uint first mismatch result (%d) does not match expected result (%d)\n",
     737  	   result, expected_result);
     738  #else
     739      abort();
     740  #endif
     741  
     742    /* Tests for: vec_first_match_or_eos_index() 
     743       The element index in BE order is returned for the first match
     744       or the number of elements if there is no match.  */
     745    /* char */
     746    char_src1 = (vector signed char) { 0x40, 0, 0x40, 0x40,
     747  				     0x40, 0x40, 0x40, 0x40,
     748  				     0x40, 0x40, 0x40, 0x40,
     749  				     0x40, 0x40, 0x40, 0x40 };
     750  				    
     751    char_src2 = (vector signed char) { 0x41, 0, 0x43, 0x44,
     752  				     0x45, 0x46, 0x47, 0x40,
     753  				     0x40, 0x40, 0x40, 0x40,
     754  				     0x40, 0x40, 0x40, 0x40 };
     755    expected_result = 1;
     756  
     757    result = vec_first_match_or_eos_index (char_src1, char_src2);
     758  
     759  #ifdef DEBUG2
     760    print_signed_char("src1", char_src1);
     761    print_signed_char("src2", char_src2);
     762    printf("vec_first_match_or_eos_index = %d\n\n", result);
     763  #endif
     764  
     765    if (result != expected_result)
     766  #ifdef DEBUG
     767      printf("Error: char first match result (%d) does not match expected result (%d)\n",
     768  	   result, expected_result);
     769  #else
     770      abort();
     771  #endif
     772  
     773    char_src1 = (vector signed char) {-1, 2, 3, 4, -5, 6, 7, 8,
     774  				    9, 10, 11, 12, 13, 14, 15, 16};
     775    char_src2 = (vector signed char) {-1, 2, 3, 20, -5, 6, 7, 8,
     776  				    9, 10, 11, 12, 13, 14, 15, 16};
     777    expected_result = 0;
     778  
     779    result = vec_first_match_or_eos_index (char_src1, char_src2);
     780  
     781  #ifdef DEBUG2
     782    print_signed_char("src1", char_src1);
     783    print_signed_char("src2", char_src2);
     784    printf("vec_first_match_or_eos_index = %d\n\n", result);
     785  #endif
     786  
     787    if (result != expected_result)
     788  #ifdef DEBUG
     789      printf("Error: char first match result (%d) does not match expected result (%d)\n",
     790  	   result, expected_result);
     791  #else
     792      abort();
     793  #endif
     794  
     795    char_src1 = (vector signed char) {-1, 2, 3, 0, -5, 6, 7, 8,
     796  				    9, 10, 11, 12, 13, 14, 15, 16};
     797    char_src2 = (vector signed char) {2, 3, 20, 0, -5, 6, 7, 8,
     798  				    9, 10, 11, 12, 13, 14, 15, 16};
     799    expected_result = 3;
     800  
     801    result = vec_first_match_or_eos_index (char_src1, char_src2);
     802  
     803  #ifdef DEBUG2
     804    print_signed_char("src1", char_src1);
     805    print_signed_char("src2", char_src2);
     806    printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
     807  #endif
     808  
     809    if (result != expected_result)
     810  #ifdef DEBUG
     811      printf("Error: char first match or EOS result (%d) does not match expected result (%d)\n",
     812  	   result, expected_result);
     813  #else
     814      abort();
     815  #endif
     816  
     817    char_src1 = (vector signed char) {1, 2, 3, 4, 5, 6, 7, 8,
     818  				    9, 10, 11, 12, 13, 14, 15, 16};
     819    char_src2 = (vector signed char) {-1, -2, -3, -4, -5, -6, -7, -8,
     820  				    -9, -10, -11, -12, -13, -14, -15, -16};
     821    expected_result = 16;
     822  
     823    result = vec_first_match_or_eos_index (char_src1, char_src2);
     824  
     825  #ifdef DEBUG2
     826    print_signed_char("src1", char_src1);
     827    print_signed_char("src2", char_src2);
     828    printf("vec_first_match_or_eos_index = %d\n\n", result);
     829  #endif
     830  
     831    if (result != expected_result)
     832  #ifdef DEBUG
     833      printf("Error: char first match or EOS result (%d) does not match expected result (%d)\n",
     834  	   result, expected_result);
     835  #else
     836      abort();
     837  #endif
     838  
     839    uchar_src1 = (vector unsigned char) {1, 2, 3, 4, 5, 6, 7, 8,
     840  				       9, 10, 11, 12, 13, 14, 15, 16};
     841    uchar_src2 = (vector unsigned char) {-1, 0, -3, -4, -5, -6, -7, -8,
     842  				       9, 10, 11, 12, 13, 14, 15, 16};
     843    expected_result = 1;
     844  
     845    result = vec_first_match_or_eos_index (uchar_src1, uchar_src2);
     846  
     847  #ifdef DEBUG2
     848    print_unsigned_char("src1", uchar_src1);
     849    print_unsigned_char("src2", uchar_src2);
     850    printf("vec_first_match_or_eos_index = %d\n\n", result);
     851  #endif
     852  
     853    if (result != expected_result)
     854  #ifdef DEBUG
     855      printf("Error: uchar first match or EOS result (%d) does not match expected result (%d)\n",
     856  	   result, expected_result);
     857  #else
     858      abort();
     859  #endif
     860  
     861    uchar_src1 = (vector unsigned char) {2, 3, 4, 5, 6, 7, 8, 9,
     862  				       10, 11, 12, 13, 14, 15, 16, 17};
     863    uchar_src2 = (vector unsigned char) {3, 4, 5, 6, 7, 8, 9, 10,
     864  				       11, 12, 13, 14, 15, 16, 17, 18};
     865    expected_result = 16;
     866  
     867    result = vec_first_match_or_eos_index (uchar_src1, uchar_src2);
     868  
     869  #ifdef DEBUG2
     870    print_unsigned_char("src1", uchar_src1);
     871    print_unsigned_char("src2", uchar_src2);
     872    printf("vec_first_match_or_eos_index = %d\n\n", result);
     873  #endif
     874  
     875    if (result != expected_result)
     876  #ifdef DEBUG
     877      printf("Error: uchar first match or EOS  result (%d) does not match expected result (%d)\n",
     878  	   result, expected_result);
     879  #else
     880      abort();
     881  #endif
     882  
     883    /* short int */
     884    short_src1 = (vector short int) {10, -20, -30, 40, 50, 60, 70, 80};
     885    short_src2 = (vector short int) {-10, 20, 30, 40, 50, 60, 70, 80};
     886  
     887    expected_result = 3;
     888  
     889    result = vec_first_match_or_eos_index (short_src1, short_src2);
     890  
     891  #ifdef DEBUG2
     892    print_signed_short_int("src1", short_src1);
     893    print_signed_short_int("src2", short_src2);
     894    printf("vec_first_match_or_eos_index = %d\n\n", result);
     895  #endif
     896  
     897    if (result != expected_result)
     898  #ifdef DEBUG
     899      printf("Error: short int first match or EOS result (%d) does not match expected result (%d)\n",
     900  	   result, expected_result);
     901  #else
     902      abort();
     903  #endif
     904  
     905    short_src1 = (vector short int) {1, 20, 30, 40, 50, 60, 70, 80};
     906    short_src2 = (vector short int) {10, 0, 30, 40, 50, 60, 70, 80};
     907  
     908    expected_result = 1;
     909  
     910    result = vec_first_match_or_eos_index (short_src1, short_src2);
     911  
     912  #ifdef DEBUG2
     913    print_signed_short_int("src1", short_src1);
     914    print_signed_short_int("src2", short_src2);
     915    printf("vec_first_match_or_eos_index = %d\n\n", result);
     916  #endif
     917  
     918    if (result != expected_result)
     919  #ifdef DEBUG
     920      printf("Error: short int first match or EOS result (%d) does not match expected result (%d)\n",
     921  	   result, expected_result);
     922  #else
     923      abort();
     924  #endif
     925  
     926    short_src1 = (vector short int) {-10, -20, -30, -40, -50, -60, -70, -80};
     927    short_src2 = (vector short int) {10, 20, 30, 40, 50, 0, 70, 80};
     928  
     929    expected_result = 5;
     930  
     931    result = vec_first_match_or_eos_index (short_src1, short_src2);
     932  
     933  #ifdef DEBUG2
     934    print_signed_short_int("src1", short_src1);
     935    print_signed_short_int("src2", short_src2);
     936    printf("vec_first_match_or_eos_index = %d\n\n", result);
     937  #endif
     938  
     939    if (result != expected_result)
     940  #ifdef DEBUG
     941      printf("Error: short int first match or EOS result (%d) does not match expected result (%d)\n",
     942  	   result, expected_result);
     943  #else
     944      abort();
     945  #endif
     946  
     947    short_src1 = (vector short int) {10, 20, 30, 40, 50, 60, 70, 80};
     948    short_src2 = (vector short int) {0, 0, 0, 0, 0, 0, 0, 0};
     949  
     950    expected_result = 0;
     951  
     952    result = vec_first_match_or_eos_index (short_src1, short_src2);
     953  
     954  #ifdef DEBUG2
     955    print_signed_short_int("src1", short_src1);
     956    print_signed_short_int("src2", short_src2);
     957    printf("vec_first_match_or_eos_index = %d\n\n", result);
     958  #endif
     959  
     960    if (result != expected_result)
     961  #ifdef DEBUG
     962      printf("Error: short int first match or EOS result (%d) does not match expected result (%d)\n",
     963  	   result, expected_result);
     964  #else
     965      abort();
     966  #endif
     967  
     968    ushort_src1 = (vector short unsigned int) {1, 2, 0, 0, 60, 70, 0};
     969    ushort_src2 = (vector short unsigned int) {10, 20, 30, 40, 50, 60, 70, 80};
     970  
     971    expected_result = 2;
     972  
     973    result = vec_first_match_or_eos_index (ushort_src1, ushort_src2);
     974  
     975  #ifdef DEBUG2
     976    print_unsigned_short_int("src1", ushort_src1);
     977    print_unsigned_short_int("src2", ushort_src2);
     978    printf("vec_first_match_or_eos_index = %d\n\n", result);
     979  #endif
     980  
     981    if (result != expected_result)
     982  #ifdef DEBUG
     983      printf("Error: ushort int first match or EOS result (%d) does not match expected result (%d)\n",
     984  	   result, expected_result);
     985  #else
     986      abort();
     987  #endif
     988  
     989    ushort_src1 = (vector short unsigned int) {-20, 30, -40, 50,
     990  					     60, -70, 80, -90};
     991    ushort_src2 = (vector short unsigned int) {20, -30, 40, -50,
     992  					     -60, 70, -80, 90};
     993  
     994    expected_result = 8;
     995  
     996    result = vec_first_match_or_eos_index (ushort_src1, ushort_src2);
     997  
     998  #ifdef DEBUG2
     999    print_unsigned_short_int("src1", ushort_src1);
    1000    print_unsigned_short_int("src2", ushort_src2);
    1001    printf("vec_first_match_or_eos_index = %d\n\n", result);
    1002  #endif
    1003  
    1004    if (result != expected_result)
    1005  #ifdef DEBUG
    1006      printf("Error: ushort int first match or EOS result (%d) does not match expected result (%d)\n",
    1007  	   result, expected_result);
    1008  #else
    1009      abort();
    1010  #endif
    1011    ushort_src1 = (vector short unsigned int) {-20, 30, -40, 50,
    1012  					     60, -70, 80, 0};
    1013    ushort_src2 = (vector short unsigned int) {20, -30, 40, -50,
    1014  					     -60, 70, -80, 90};
    1015  
    1016    expected_result = 7;
    1017  
    1018    result = vec_first_match_or_eos_index (ushort_src1, ushort_src2);
    1019  
    1020  #ifdef DEBUG2
    1021    print_unsigned_short_int("src1", ushort_src1);
    1022    print_unsigned_short_int("src2", ushort_src2);
    1023    printf("vec_first_match_or_eos_index = %d\n\n", result);
    1024  #endif
    1025  
    1026    if (result != expected_result)
    1027  #ifdef DEBUG
    1028      printf("Error: ushort int first match or EOS result (%d) does not match expected result (%d)\n",
    1029  	   result, expected_result);
    1030  #else
    1031      abort();
    1032  #endif
    1033  
    1034    /* int */
    1035    int_src1 = (vector int) {1, 2, 3, 4};
    1036    int_src2 = (vector int) {10, 20, 30, 4};
    1037  
    1038    expected_result = 3;
    1039  
    1040    result = vec_first_match_or_eos_index (int_src1, int_src2);
    1041  
    1042  #ifdef DEBUG2
    1043    print_signed_int("src1", int_src1);
    1044    print_signed_int("src2", int_src2);
    1045    printf("vec_first_match_or_eos_index = %d\n\n", result);
    1046  #endif
    1047  
    1048    if (result != expected_result)
    1049  #ifdef DEBUG
    1050      printf("Error: int first match or EOS result (%d) does not match expected result (%d)\n",
    1051  	   result, expected_result);
    1052  #else
    1053      abort();
    1054  #endif
    1055  
    1056    int_src1 = (vector int) {0, 2, 3, 4};
    1057    int_src2 = (vector int) {4, 3, 2, 1};
    1058  
    1059    expected_result = 0;
    1060  
    1061    result = vec_first_match_or_eos_index (int_src1, int_src2);
    1062  
    1063  #ifdef DEBUG2
    1064    print_signed_int("src1", int_src1);
    1065    print_signed_int("src2", int_src2);
    1066    printf("vec_first_match_or_eos_index = %d\n\n", result);
    1067  #endif
    1068  
    1069    if (result != expected_result)
    1070  #ifdef DEBUG
    1071      printf("Error: int first match or EOS result (%d) does not match expected result (%d)\n",
    1072  	   result, expected_result);
    1073  #else
    1074      abort();
    1075  #endif
    1076  
    1077    int_src1 = (vector int) {1, 2, 3, 4};
    1078    int_src2 = (vector int) {4, 3, 2, 1};
    1079  
    1080    expected_result = 4;
    1081  
    1082    result = vec_first_match_or_eos_index (int_src1, int_src2);
    1083  
    1084  #ifdef DEBUG2
    1085    print_signed_int("src1", int_src1);
    1086    print_signed_int("src2", int_src2);
    1087    printf("vec_first_match_or_eos_index = %d\n\n", result);
    1088  #endif
    1089  
    1090    if (result != expected_result)
    1091  #ifdef DEBUG
    1092      printf("Error: int first match or EOS result (%d) does not match expected result (%d)\n",
    1093  	   result, expected_result);
    1094  #else
    1095      abort();
    1096  #endif
    1097  
    1098    uint_src1 = (vector unsigned int) {1, 2, 3, 4};
    1099    uint_src2 = (vector unsigned int) {11, 2, 33, 4};
    1100  
    1101    expected_result = 1;
    1102  
    1103    result = vec_first_match_or_eos_index (uint_src1, uint_src2);
    1104  
    1105  #ifdef DEBUG2
    1106    print_unsigned_int("src1", uint_src1);
    1107    print_unsigned_int("src2", uint_src2);
    1108    printf("vec_first_match_or_eos_index = %d\n\n", result);
    1109  #endif
    1110  
    1111    if (result != expected_result)
    1112  #ifdef DEBUG
    1113      printf("Error: uint first match or EOS result (%d) does not match expected result (%d)\n",
    1114  	   result, expected_result);
    1115  #else
    1116      abort();
    1117  #endif
    1118  
    1119    uint_src1 = (vector unsigned int) {1, 2, 0, 4};
    1120    uint_src2 = (vector unsigned int) {2, 3, 4, 5};
    1121  
    1122    expected_result = 2;
    1123  
    1124    result = vec_first_match_or_eos_index (uint_src1, uint_src2);
    1125  
    1126  #ifdef DEBUG2
    1127    print_unsigned_int("src1", uint_src1);
    1128    print_unsigned_int("src2", uint_src2);
    1129    printf("vec_first_match_or_eos_index = %d\n\n", result);
    1130  #endif
    1131  
    1132    if (result != expected_result)
    1133  #ifdef DEBUG
    1134      printf("Error: uint first match or EOS result (%d) does not match expected result (%d)\n",
    1135  	   result, expected_result);
    1136  #else
    1137      abort();
    1138  #endif
    1139  
    1140    uint_src1 = (vector unsigned int) {1, 2, 3, 4};
    1141    uint_src2 = (vector unsigned int) {2, 3, 4, 5};
    1142  
    1143    expected_result = 4;
    1144  
    1145    result = vec_first_match_or_eos_index (uint_src1, uint_src2);
    1146  
    1147  #ifdef DEBUG2
    1148    print_unsigned_int("src1", uint_src1);
    1149    print_unsigned_int("src2", uint_src2);
    1150    printf("vec_first_match_or_eos_index = %d\n\n", result);
    1151  #endif
    1152  
    1153    if (result != expected_result)
    1154  #ifdef DEBUG
    1155      printf("Error: uint first match or EOS result (%d) does not match expected result (%d)\n",
    1156  	   result, expected_result);
    1157  #else
    1158      abort();
    1159  #endif
    1160  
    1161    /* Tests for: vec_first_mismatch_or_eos_index()
    1162       The element index in BE order is returned for the first mismatch
    1163       or the number of elements if there is no match.   */
    1164    /* char */
    1165    char_src1 = (vector signed char) {1, 2, 0, 4, -5, 6, 7, 8,
    1166  				    9, 10, 11, 12, 13, 14, 15, 16};
    1167    char_src2 = (vector signed char) {1, 2, 0, 20, -5, 6, 7, 8,
    1168  				    9, 10, 11, 12, 13, 14, 15, 16};
    1169    expected_result = 2;
    1170  
    1171    result = vec_first_mismatch_or_eos_index (char_src1, char_src2);
    1172  
    1173  #ifdef DEBUG2
    1174    print_signed_char("src1", char_src1);
    1175    print_signed_char("src2", char_src2);
    1176    printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
    1177  #endif
    1178  
    1179    if (result != expected_result)
    1180  #ifdef DEBUG
    1181      printf("Error: char first mismatch or EOS result (%d) does not match expected result (%d)\n",
    1182  	   result, expected_result);
    1183  #else
    1184      abort();
    1185  #endif
    1186  
    1187    char_src1 = (vector signed char) {-1, 2, 3, 4, -5, 6, 7, 8,
    1188  				    9, 10, 11, 12, 13, 14, 15, 16};
    1189    char_src2 = (vector signed char) {-1, 2, 3, 20, -5, 6, 7, 8,
    1190  				    9, 10, 11, 12, 13, 14, 15, 16};
    1191    expected_result = 3;
    1192  
    1193    result = vec_first_mismatch_or_eos_index (char_src1, char_src2);
    1194  
    1195  #ifdef DEBUG2
    1196    print_signed_char("src1", char_src1);
    1197    print_signed_char("src2", char_src2);
    1198    printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
    1199  #endif
    1200  
    1201    if (result != expected_result)
    1202  #ifdef DEBUG
    1203      printf("Error: char first mismatch or EOS result (%d) does not match expected result (%d)\n",
    1204  	   result, expected_result);
    1205  #else
    1206      abort();
    1207  #endif
    1208  
    1209    char_src1 = (vector signed char) {1, 2, 0, 4, 5, 6, 7, 8,
    1210  				    9, 10, 11, 12, 13, 14, 15, 16};
    1211    char_src2 = (vector signed char) {1, 2, 0, 4, 5, 6, 7, 8,
    1212  				    9, 10, 11, 12, 13, 14, 15, 16};
    1213    expected_result = 2;
    1214  
    1215    result = vec_first_mismatch_or_eos_index (char_src1, char_src2);
    1216  
    1217  #ifdef DEBUG2
    1218    print_signed_char("src1", char_src1);
    1219    print_signed_char("src2", char_src2);
    1220    printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
    1221  #endif
    1222  
    1223    if (result != expected_result)
    1224  #ifdef DEBUG
    1225      printf("Error: char first mismatch or EOS result (%d) does not match expected result (%d)\n",
    1226  	   result, expected_result);
    1227  #else
    1228      abort();
    1229  #endif
    1230  
    1231    char_src1 = (vector signed char) {1, 2, 3, 4, 5, 6, 7, 8,
    1232  				    9, 10, 11, 12, 13, 14, 15, 16};
    1233    char_src2 = (vector signed char) {1, 2, 3, 4, 5, 6, 7, 8,
    1234  				    9, 10, 11, 12, 13, 14, 15, 16};
    1235    expected_result = 16;
    1236  
    1237    result = vec_first_mismatch_or_eos_index (char_src1, char_src2);
    1238  
    1239  #ifdef DEBUG2
    1240    print_signed_char("src1", char_src1);
    1241    print_signed_char("src2", char_src2);
    1242    printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
    1243  #endif
    1244  
    1245    if (result != expected_result)
    1246  #ifdef DEBUG
    1247      printf("Error: char first mismatch or EOS result (%d) does not match expected result (%d)\n",
    1248  	   result, expected_result);
    1249  #else
    1250      abort();
    1251  #endif
    1252  
    1253    uchar_src1 = (vector unsigned char) {1, 2, 3, 4, 5, 6, 7, 8,
    1254  				       9, 10, 11, 12, 13, 14, 15, 16};
    1255    uchar_src2 = (vector unsigned char) {1, 0, 3, 4, 5, 6, 7, 8,
    1256  				       9, 10, 11, 12, 13, 14, 15, 16};
    1257    expected_result = 1;
    1258  
    1259    result = vec_first_mismatch_or_eos_index (uchar_src1, uchar_src2);
    1260  
    1261  #ifdef DEBUG2
    1262    print_unsigned_char("src1", uchar_src1);
    1263    print_unsigned_char("src2", uchar_src2);
    1264    printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
    1265  #endif
    1266  
    1267    if (result != expected_result)
    1268  #ifdef DEBUG
    1269      printf("Error: uchar first mismatch or EOS result (%d) does not match expected result (%d)\n",
    1270  	   result, expected_result);
    1271  #else
    1272      abort();
    1273  #endif
    1274  
    1275    uchar_src1 = (vector unsigned char) {2, 3, 4, 5, 6, 7, 8, 9,
    1276  				       0, 11, 12, 13, 14, 15, 16};
    1277    uchar_src2 = (vector unsigned char) {2, 3, 4, 5, 6, 7, 8, 9,
    1278  				       0, 11, 12, 13, 14, 15, 16};
    1279    expected_result = 8;
    1280  
    1281    result = vec_first_mismatch_or_eos_index (uchar_src1, uchar_src2);
    1282  
    1283  #ifdef DEBUG2
    1284    print_unsigned_char("src1", uchar_src1);
    1285    print_unsigned_char("src2", uchar_src2);
    1286    printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
    1287  #endif
    1288  
    1289    if (result != expected_result)
    1290  #ifdef DEBUG
    1291      printf("Error: uchar first mismatch or EOS result (%d) does not match expected result (%d)\n",
    1292  	   result, expected_result);
    1293  #else
    1294      abort();
    1295  #endif
    1296  
    1297    uchar_src1 = (vector unsigned char) {2, 3, 4, 5, 6, 7, 8, 9,
    1298  				       10, 11, 12, 13, 14, 15, 16, 17};
    1299    uchar_src2 = (vector unsigned char) {2, 3, 4, 5, 6, 7, 8, 9,
    1300  				       10, 11, 12, 13, 14, 0, 16, 17};
    1301    expected_result = 13;
    1302  
    1303    result = vec_first_mismatch_or_eos_index (uchar_src1, uchar_src2);
    1304  
    1305  #ifdef DEBUG2
    1306    print_unsigned_char("src1", uchar_src1);
    1307    print_unsigned_char("src2", uchar_src2);
    1308    printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
    1309  #endif
    1310  
    1311    if (result != expected_result)
    1312  #ifdef DEBUG
    1313      printf("Error: uchar first mismatch or EOS result (%d) does not match expected result (%d)\n",
    1314  	   result, expected_result);
    1315  #else
    1316      abort();
    1317  #endif
    1318  
    1319    uchar_src1 = (vector unsigned char) {2, 3, 4, 5, 6, 7, 8, 9,
    1320  				       10, 11, 12, 13, 14, 15, 16, 17};
    1321    uchar_src2 = (vector unsigned char) {2, 3, 4, 5, 6, 7, 8, 9,
    1322  				       10, 11, 12, 13, 14, 15, 16, 17};
    1323    expected_result = 16;
    1324  
    1325    result = vec_first_mismatch_or_eos_index (uchar_src1, uchar_src2);
    1326  
    1327  #ifdef DEBUG2
    1328    print_unsigned_char("src1", uchar_src1);
    1329    print_unsigned_char("src2", uchar_src2);
    1330    printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
    1331  #endif
    1332  
    1333    if (result != expected_result)
    1334  #ifdef DEBUG
    1335      printf("Error: uchar first mismatch or EOS result (%d) does not match expected result (%d)\n",
    1336  	   result, expected_result);
    1337  #else
    1338      abort();
    1339  #endif
    1340  
    1341    /* short int */
    1342    short_src1 = (vector short int) {-10, -20, 30, 40, 50, 60, 70, 80};
    1343    short_src2 = (vector short int) {-10, 20, 30, 40, 50, 60, 70, 80};
    1344  
    1345    expected_result = 1;
    1346  
    1347    result = vec_first_mismatch_or_eos_index (short_src1, short_src2);
    1348  
    1349  #ifdef DEBUG2
    1350    print_signed_short_int("src1", short_src1);
    1351    print_signed_short_int("src2", short_src2);
    1352    printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
    1353  #endif
    1354  
    1355    if (result != expected_result)
    1356  #ifdef DEBUG
    1357      printf("Error: short int first mismatch or EOS result (%d) does not match expected result (%d)\n",
    1358  	   result, expected_result);
    1359  #else
    1360      abort();
    1361  #endif
    1362  
    1363    short_src1 = (vector short int) {0, 20, 30, 40, 50, 60, 70, 80};
    1364    short_src2 = (vector short int) {0, 20, 30, 40, 50, 60, 70, 80};
    1365  
    1366    expected_result = 0;
    1367  
    1368    result = vec_first_mismatch_or_eos_index (short_src1, short_src2);
    1369  
    1370  #ifdef DEBUG2
    1371    print_signed_short_int("src1", short_src1);
    1372    print_signed_short_int("src2", short_src2);
    1373    printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
    1374  #endif
    1375  
    1376    if (result != expected_result)
    1377  #ifdef DEBUG
    1378      printf("Error: short int first mismatch or EOS result (%d) does not match expected result (%d)\n",
    1379  	   result, expected_result);
    1380  #else
    1381      abort();
    1382  #endif
    1383  
    1384    short_src1 = (vector short int) {10, 20, 30, 40, 50, 60, 70, 80};
    1385    short_src2 = (vector short int) {10, 20, 30, 40, 50, 60, 70, 80};
    1386  
    1387    expected_result = 8;
    1388  
    1389    result = vec_first_mismatch_or_eos_index (short_src1, short_src2);
    1390  
    1391  #ifdef DEBUG2
    1392    print_signed_short_int("src1", short_src1);
    1393    print_signed_short_int("src2", short_src2);
    1394    printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
    1395  #endif
    1396  
    1397    if (result != expected_result)
    1398  #ifdef DEBUG
    1399      printf("Error: short int first mismatch or EOS result (%d) does not match expected result (%d)\n",
    1400  	   result, expected_result);
    1401  #else
    1402      abort();
    1403  #endif
    1404  
    1405    short_src1 = (vector short int) {10, 0, 30, 40, 50, 60, 70, 80};
    1406    short_src2 = (vector short int) {10, 0, 30, 40, 50, 60, 70, 80};
    1407  
    1408    expected_result = 1;
    1409  
    1410    result = vec_first_mismatch_or_eos_index (short_src1, short_src2);
    1411  
    1412  #ifdef DEBUG2
    1413    print_signed_short_int("src1", short_src1);
    1414    print_signed_short_int("src2", short_src2);
    1415    printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
    1416  #endif
    1417  
    1418    if (result != expected_result)
    1419  #ifdef DEBUG
    1420      printf("Error: short int first mismatch or EOS result (%d) does not match expected result (%d)\n",
    1421  	   result, expected_result);
    1422  #else
    1423      abort();
    1424  #endif
    1425  
    1426    ushort_src1 = (vector short unsigned int) {10, 20, 30, 40, 50, 60, 70, 0};
    1427    ushort_src2 = (vector short unsigned int) {10, 20, 30, 40, 50, 60, 70, 80};
    1428  
    1429    expected_result = 7;
    1430  
    1431    result = vec_first_mismatch_or_eos_index (ushort_src1, ushort_src2);
    1432  
    1433  #ifdef DEBUG2
    1434    print_unsigned_short_int("src1", ushort_src1);
    1435    print_unsigned_short_int("src2", ushort_src2);
    1436    printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
    1437  #endif
    1438  
    1439    if (result != expected_result)
    1440  #ifdef DEBUG
    1441      printf("Error: ushort int first mismatch or EOS result (%d) does not match expected result (%d)\n",
    1442  	   result, expected_result);
    1443  #else
    1444      abort();
    1445  #endif
    1446  
    1447    ushort_src1 = (vector short unsigned int) {20, 0, 40, 50, 60, 70, 80, 90};
    1448    ushort_src2 = (vector short unsigned int) {20, 0, 40, 50, 60, 70, 80, 90};
    1449  
    1450    expected_result = 1;
    1451  
    1452    result = vec_first_mismatch_or_eos_index (ushort_src1, ushort_src2);
    1453  
    1454  #ifdef DEBUG2
    1455    print_unsigned_short_int("src1", ushort_src1);
    1456    print_unsigned_short_int("src2", ushort_src2);
    1457    printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
    1458  #endif
    1459  
    1460    if (result != expected_result)
    1461  #ifdef DEBUG
    1462      printf("Error: ushort int first mismatch or EOS result (%d) does not match expected result (%d)\n",
    1463  	   result, expected_result);
    1464  #else
    1465      abort();
    1466  #endif
    1467  
    1468    ushort_src1 = (vector short unsigned int) {20, 30, 40, 50, 60, 70, 80, 90};
    1469    ushort_src2 = (vector short unsigned int) {20, 30, 40, 50, 60, 70, 80, 90};
    1470  
    1471    expected_result = 8;
    1472  
    1473    result = vec_first_mismatch_or_eos_index (ushort_src1, ushort_src2);
    1474  
    1475  #ifdef DEBUG2
    1476    print_unsigned_short_int("src1", ushort_src1);
    1477    print_unsigned_short_int("src2", ushort_src2);
    1478    printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
    1479  #endif
    1480  
    1481    if (result != expected_result)
    1482  #ifdef DEBUG
    1483      printf("Error: ushort int first mismatch or EOS result (%d) does not match expected result (%d)\n",
    1484  	   result, expected_result);
    1485  #else
    1486      abort();
    1487  #endif
    1488  
    1489    /* int */
    1490    int_src1 = (vector int) {1, 2, 3, 4};
    1491    int_src2 = (vector int) {1, 20, 3, 4};
    1492  
    1493    expected_result = 1;
    1494  
    1495    result = vec_first_mismatch_or_eos_index (int_src1, int_src2);
    1496  
    1497  #ifdef DEBUG2
    1498    print_signed_int("src1", int_src1);
    1499    print_signed_int("src2", int_src2);
    1500    printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
    1501  #endif
    1502  
    1503    if (result != expected_result)
    1504  #ifdef DEBUG
    1505      printf("Error: int first mismatch or EOS result (%d) does not match expected result (%d)\n",
    1506  	   result, expected_result);
    1507  #else
    1508      abort();
    1509  #endif
    1510  
    1511    int_src1 = (vector int) {1, 2, 3, 4};
    1512    int_src2 = (vector int) {1, 2, 3, 4};
    1513  
    1514    expected_result = 4;
    1515  
    1516    result = vec_first_mismatch_or_eos_index (int_src1, int_src2);
    1517  
    1518  #ifdef DEBUG2
    1519    print_signed_int("src1", int_src1);
    1520    print_signed_int("src2", int_src2);
    1521    printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
    1522  #endif
    1523  
    1524    if (result != expected_result)
    1525  #ifdef DEBUG
    1526      printf("Error: int first mismatch result (%d) does not match expected result (%d)\n",
    1527  	   result, expected_result);
    1528  #else
    1529      abort();
    1530  #endif
    1531  
    1532    int_src1 = (vector int) {1, 2, 0, 4};
    1533    int_src2 = (vector int) {1, 2, 0, 4};
    1534  
    1535    expected_result = 2;
    1536  
    1537    result = vec_first_mismatch_or_eos_index (int_src1, int_src2);
    1538  
    1539  #ifdef DEBUG2
    1540    print_signed_int("src1", int_src1);
    1541    print_signed_int("src2", int_src2);
    1542    printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
    1543  #endif
    1544  
    1545    if (result != expected_result)
    1546  #ifdef DEBUG
    1547      printf("Error: int first mismatch result (%d) does not match expected result (%d)\n",
    1548  	   result, expected_result);
    1549  #else
    1550      abort();
    1551  #endif
    1552  
    1553    int_src1 = (vector int) {1, 0, 3, 4};
    1554    int_src2 = (vector int) {1, 2, 3, 4};
    1555  
    1556    expected_result = 1;
    1557  
    1558    result = vec_first_mismatch_or_eos_index (int_src1, int_src2);
    1559  
    1560  #ifdef DEBUG2
    1561    print_signed_int("src1", int_src1);
    1562    print_signed_int("src2", int_src2);
    1563    printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
    1564  #endif
    1565    if (result != expected_result)
    1566  #ifdef DEBUG
    1567      printf("Error: int first mismatch result (%d) does not match expected result (%d)\n",
    1568  	   result, expected_result);
    1569  #else
    1570      abort();
    1571  #endif
    1572  
    1573    uint_src1 = (vector unsigned int) {1, 2, 3, 4};
    1574    uint_src2 = (vector unsigned int) {11, 2, 33, 4};
    1575  
    1576    expected_result = 0;
    1577  
    1578    result = vec_first_mismatch_or_eos_index (uint_src1, uint_src2);
    1579  
    1580  #ifdef DEBUG2
    1581    print_unsigned_int("src1", uint_src1);
    1582    print_unsigned_int("src2", uint_src2);
    1583    printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
    1584  #endif
    1585    if (result != expected_result)
    1586  #ifdef DEBUG
    1587      printf("Error: uint first mismatch or eos index result (%d) does not match expected result (%d)\n",
    1588  	   result, expected_result);
    1589  #else
    1590      abort();
    1591  #endif
    1592  
    1593    uint_src1 = (vector unsigned int) {1, 2, 3, 0};
    1594    uint_src2 = (vector unsigned int) {1, 2, 3, 0};
    1595  
    1596    expected_result = 3;
    1597  
    1598    result = vec_first_mismatch_or_eos_index (uint_src1, uint_src2);
    1599  
    1600  #ifdef DEBUG2
    1601    print_unsigned_int("src1", uint_src1);
    1602    print_unsigned_int("src2", uint_src2);
    1603    printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
    1604  #endif
    1605  
    1606    if (result != expected_result)
    1607  #ifdef DEBUG
    1608      printf("Error: uint first mismatch or eos index result (%d) does not match expected result (%d)\n",
    1609  	   result, expected_result);
    1610  #else
    1611      abort();
    1612  #endif
    1613  
    1614    uint_src1 = (vector unsigned int) {1, 2, 3, 4};
    1615    uint_src2 = (vector unsigned int) {1, 2, 3, 4};
    1616  
    1617    expected_result = 4;
    1618  
    1619    result = vec_first_mismatch_or_eos_index (uint_src1, uint_src2);
    1620  
    1621  #ifdef DEBUG2
    1622    print_unsigned_int("src1", uint_src1);
    1623    print_unsigned_int("src2", uint_src2);
    1624    printf("vec_first_mismatch_or_eos_index = %d\n\n", result);
    1625  #endif
    1626  
    1627    if (result != expected_result)
    1628  #ifdef DEBUG
    1629      printf("Error: uint first mismatch or eos index result (%d) does not match expected result (%d)\n",
    1630  	   result, expected_result);
    1631  #else
    1632      abort();
    1633  #endif
    1634  }