(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
i386/
sse2-v1ti-shift-3.c
       1  /* PR target/102986 */
       2  /* { dg-do run { target int128 } } */
       3  /* { dg-options "-O2 -msse2" } */
       4  /* { dg-require-effective-target sse2 } */
       5  
       6  typedef unsigned __int128 uv1ti __attribute__ ((__vector_size__ (16)));
       7  typedef __int128 sv1ti __attribute__ ((__vector_size__ (16)));
       8  typedef __int128 v1ti __attribute__ ((__vector_size__ (16)));
       9  
      10  typedef unsigned __int128 uti;
      11  typedef __int128 sti;
      12  typedef __int128 ti;
      13  
      14  uv1ti ashl_v1ti(uv1ti x, unsigned int i) { return x << i; }
      15  uv1ti lshr_v1ti(uv1ti x, unsigned int i) { return x >> i; }
      16  sv1ti ashr_v1ti(sv1ti x, unsigned int i) { return x >> i; }
      17  uv1ti rotr_v1ti(uv1ti x, unsigned int i) { return (x >> i) | (x << (-i&127)); }
      18  uv1ti rotl_v1ti(uv1ti x, unsigned int i) { return (x << i) | (x >> (-i&127)); }
      19  
      20  uti ashl_ti(uti x, unsigned int i) { return x << i; }
      21  uti lshr_ti(uti x, unsigned int i) { return x >> i; }
      22  sti ashr_ti(sti x, unsigned int i) { return x >> i; }
      23  uti rotr_ti(uti x, unsigned int i) { return (x >> i) | (x << (-i&127)); }
      24  uti rotl_ti(uti x, unsigned int i) { return (x << i) | (x >> (-i&127)); }
      25  
      26  void test(ti x)
      27  {
      28    unsigned int i;
      29    uv1ti ut = (uv1ti)x;
      30    sv1ti st = (sv1ti)x;
      31  
      32    for (i=0; i<128; i++) {
      33      if ((ti)ashl_v1ti(ut,i) != (ti)ashl_ti(x,i))
      34        __builtin_abort();
      35      if ((ti)lshr_v1ti(ut,i) != (ti)lshr_ti(x,i))
      36        __builtin_abort();
      37      if ((ti)ashr_v1ti(st,i) != (ti)ashr_ti(x,i))
      38        __builtin_abort();
      39      if ((ti)rotr_v1ti(ut,i) != (ti)rotr_ti(x,i))
      40        __builtin_abort();
      41      if ((ti)rotl_v1ti(ut,i) != (ti)rotl_ti(x,i))
      42        __builtin_abort();
      43    }
      44  }
      45  
      46  int main()
      47  {
      48    ti x;
      49  
      50    x = ((ti)0x0011223344556677ull)<<64 | 0x8899aabbccddeeffull;
      51    test(x);
      52    x = ((ti)0xffeeddccbbaa9988ull)<<64 | 0x7766554433221100ull;
      53    test(x);
      54    x = ((ti)0x0123456789abcdefull)<<64 | 0x0123456789abcdefull;
      55    test(x);
      56    x = ((ti)0xfedcba9876543210ull)<<64 | 0xfedcba9876543210ull;
      57    test(x);
      58    x = ((ti)0x0123456789abcdefull)<<64 | 0xfedcba9876543210ull;
      59    test(x);
      60    x = ((ti)0xfedcba9876543210ull)<<64 | 0x0123456789abcdefull;
      61    test(x);
      62    x = 0;
      63    test(x);
      64    x = 0xffffffffffffffffull;
      65    test(x);
      66    x = ((ti)0xffffffffffffffffull)<<64;
      67    test(x);
      68    x = ((ti)0xffffffffffffffffull)<<64 | 0xffffffffffffffffull;
      69    test(x);
      70    x = ((ti)0x5a5a5a5a5a5a5a5aull)<<64 | 0x5a5a5a5a5a5a5a5aull;
      71    test(x);
      72    x = ((ti)0xa5a5a5a5a5a5a5a5ull)<<64 | 0xa5a5a5a5a5a5a5a5ull;
      73    test(x);
      74    x = 0xffull;
      75    test(x);
      76    x = 0xff00ull;
      77    test(x);
      78    x = 0xff0000ull;
      79    test(x);
      80    x = 0xff000000ull;
      81    test(x);
      82    x = 0xff00000000ull;
      83    test(x);
      84    x = 0xff0000000000ull;
      85    test(x);
      86    x = 0xff000000000000ull;
      87    test(x);
      88    x = 0xff00000000000000ull;
      89    test(x);
      90    x = ((ti)0xffull)<<64;
      91    test(x);
      92    x = ((ti)0xff00ull)<<64;
      93    test(x);
      94    x = ((ti)0xff0000ull)<<64;
      95    test(x);
      96    x = ((ti)0xff000000ull)<<64;
      97    test(x);
      98    x = ((ti)0xff00000000ull)<<64;
      99    test(x);
     100    x = ((ti)0xff0000000000ull)<<64;
     101    test(x);
     102    x = ((ti)0xff000000000000ull)<<64;
     103    test(x);
     104    x = ((ti)0xff00000000000000ull)<<64;
     105    test(x);
     106    x = 0xdeadbeefcafebabeull;
     107    test(x);
     108    x = ((ti)0xdeadbeefcafebabeull)<<64;
     109    test(x);
     110  
     111    return 0;
     112  }
     113