(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
aarch64/
sve/
reduc_14_run.c
       1  /* { dg-do run { target aarch64_sve256_hw } } */
       2  /* { dg-options "-O3 -msve-vector-bits=256 --param vect-partial-vector-usage=1" } */
       3  
       4  #define N 0x1100
       5  
       6  #include "reduc_14.c"
       7  
       8  int
       9  main (void)
      10  {
      11    unsigned int x[N];
      12    for (int i = 0; i < N; ++i)
      13      x[i] = ((i + 1) * (i + 2)) & 0xfffff;
      14  
      15    unsigned int add_res1[2] = { 11, 22 };
      16    add_loop (x, 0, add_res1);
      17    if (add_res1[0] != 11
      18        || add_res1[1] != 22)
      19      __builtin_abort ();
      20  
      21    unsigned int add_res2[2] = { 10, 20 };
      22    add_loop (x, 11, add_res2);
      23    if (add_res2[0] != 1902
      24        || add_res2[1] != 2176)
      25      __builtin_abort ();
      26  
      27    unsigned int add_res3[2] = { 15, 30 };
      28    add_loop (x, 0x100, add_res3);
      29    if (add_res3[0] != 22435087
      30        || add_res3[1] != 22566686)
      31      __builtin_abort ();
      32  
      33    unsigned int add_res4[2] = { 100, 200 };
      34    add_loop (x, 0x11f, add_res4);
      35    if (add_res4[0] != 31602244
      36        || add_res4[1] != 31767656)
      37      __builtin_abort ();
      38  
      39    unsigned int max_res1[2] = { 461, 500 };
      40    max_loop (x, 11, max_res1);
      41    if (max_res1[0] != 462
      42        || max_res1[1] != 506)
      43      __builtin_abort ();
      44  
      45    unsigned int max_res2[2] = { 463, 507 };
      46    max_loop (x, 11, max_res2);
      47    if (max_res2[0] != 463
      48        || max_res2[1] != 507)
      49      __builtin_abort ();
      50  
      51    unsigned int max_res3[2] = { 1000000, 1000000 };
      52    max_loop (x, 0x200, max_res3);
      53    if (max_res3[0] != 1047552
      54        || max_res3[1] != 1045506)
      55      __builtin_abort ();
      56  
      57    unsigned int max_res4[2] = { 1047553, 1045507 };
      58    max_loop (x, 0x200, max_res4);
      59    if (max_res4[0] != 1047553
      60        || max_res4[1] != 1045507)
      61      __builtin_abort ();
      62  
      63    unsigned int max_res5[2] = { 300000, 30000 };
      64    max_loop (x, 0x11f, max_res5);
      65    if (max_res5[0] != 328902
      66        || max_res5[1] != 330050)
      67      __builtin_abort ();
      68  
      69    unsigned int max_res6[2] = { 328903, 330051 };
      70    max_loop (x, 0x11f, max_res6);
      71    if (max_res6[0] != 328903
      72        || max_res6[1] != 330051)
      73      __builtin_abort ();
      74  
      75    unsigned int or_res1[2] = { 11, 22 };
      76    or_loop (x, 0, or_res1);
      77    if (or_res1[0] != 11
      78        || or_res1[1] != 22)
      79      __builtin_abort ();
      80  
      81    unsigned int or_res2[2] = { 0x200000, 0xe00000 };
      82    or_loop (x, 11, or_res2);
      83    if (or_res2[0] != 0x2001fe
      84        || or_res2[1] != 0xe001fe)
      85      __builtin_abort ();
      86  
      87    unsigned int or_res3[2] = { 0x800000, 0x700000 };
      88    or_loop (x, 0x40, or_res3);
      89    if (or_res3[0] != 0x803ffe
      90        || or_res3[1] != 0x707ffe)
      91      __builtin_abort ();
      92  
      93    unsigned int or_res4[2] = { 0x100001, 0x300000 };
      94    or_loop (x, 0x4f, or_res4);
      95    if (or_res4[0] != 0x107fff
      96        || or_res4[1] != 0x307ffe)
      97      __builtin_abort ();
      98  
      99    unsigned int eor_res1[2] = { 11, 22 };
     100    eor_loop (x, 0, eor_res1);
     101    if (eor_res1[0] != 11
     102        || eor_res1[1] != 22)
     103      __builtin_abort ();
     104  
     105    unsigned int eor_res2[2] = { 0x2000ff, 0xe000ff };
     106    eor_loop (x, 11, eor_res2);
     107    if (eor_res2[0] != 0x2001cf
     108        || eor_res2[1] != 0xe000b7)
     109      __builtin_abort ();
     110  
     111    unsigned int eor_res3[2] = { 0x805000, 0x70f000 };
     112    eor_loop (x, 0x100, eor_res3);
     113    if (eor_res3[0] != 0x824200
     114        || eor_res3[1] != 0x77dc00)
     115      __builtin_abort ();
     116  
     117    unsigned int eor_res4[2] = { 0x101201, 0x300f00 };
     118    eor_loop (x, 0x11f, eor_res4);
     119    if (eor_res4[0] != 0x178801
     120        || eor_res4[1] != 0x337240)
     121      __builtin_abort ();
     122  
     123    for (int i = 0; i < N; ++i)
     124      x[i] = ~x[i] & 0xfffff;
     125  
     126    unsigned int min_res1[2] = { 1048200, 1048100 };
     127    min_loop (x, 11, min_res1);
     128    if (min_res1[0] != 1048113
     129        || min_res1[1] != 1048069)
     130      __builtin_abort ();
     131  
     132    unsigned int min_res2[2] = { 1048112, 1048068 };
     133    min_loop (x, 11, min_res2);
     134    if (min_res2[0] != 1048112
     135        || min_res2[1] != 1048068)
     136      __builtin_abort ();
     137  
     138    unsigned int min_res3[2] = { 10000, 10000 };
     139    min_loop (x, 0x200, min_res3);
     140    if (min_res3[0] != 1023
     141        || min_res3[1] != 3069)
     142      __builtin_abort ();
     143  
     144    unsigned int min_res4[2] = { 1022, 3068 };
     145    min_loop (x, 0x200, min_res4);
     146    if (min_res4[0] != 1022
     147        || min_res4[1] != 3068)
     148      __builtin_abort ();
     149  
     150    unsigned int min_res5[2] = { 719680, 718530 };
     151    min_loop (x, 0x11f, min_res5);
     152    if (min_res5[0] != 719673
     153        || min_res5[1] != 718525)
     154      __builtin_abort ();
     155  
     156    unsigned int min_res6[2] = { 719672, 718524 };
     157    min_loop (x, 0x11f, min_res6);
     158    if (min_res6[0] != 719672
     159        || min_res6[1] != 718524)
     160      __builtin_abort ();
     161  
     162    unsigned int and_res1[2] = { 11, 22 };
     163    and_loop (x, 0, and_res1);
     164    if (and_res1[0] != 11
     165        || and_res1[1] != 22)
     166      __builtin_abort ();
     167  
     168    unsigned int and_res2[2] = { 0xf5cff, 0xf78ff };
     169    and_loop (x, 11, and_res2);
     170    if (and_res2[0] != 0xf5c01
     171        || and_res2[1] != 0xf7801)
     172      __builtin_abort ();
     173  
     174    unsigned int and_res3[2] = { 0x7efff, 0xecfff };
     175    and_loop (x, 0x40, and_res3);
     176    if (and_res3[0] != 0x7c001
     177        || and_res3[1] != 0xe8001)
     178      __builtin_abort ();
     179  
     180    unsigned int and_res4[2] = { 0xffffff, 0xffffff };
     181    and_loop (x, 0x4f, and_res4);
     182    if (and_res4[0] != 0xf8001
     183        || and_res4[1] != 0xf8001)
     184      __builtin_abort ();
     185  
     186    return 0;
     187  }