(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.c-torture/
compile/
sync-2.c
       1  /* { dg-message "note: '__sync_fetch_and_nand' changed semantics in GCC 4.4" "" { target *-*-* } 0 } */
       2  /* { dg-options "-ffat-lto-objects" } */
       3  
       4  /* Validate that each of the __sync builtins compiles.  This won't 
       5     necessarily link, since the target might not support the builtin,
       6     so this may result in external library calls.  */
       7  
       8  signed char sc;
       9  unsigned char uc;
      10  signed short ss;
      11  unsigned short us;
      12  signed int si;
      13  unsigned int ui;
      14  signed long sl;
      15  unsigned long ul;
      16  signed long long sll;
      17  unsigned long long ull;
      18  
      19  void test_op_ignore (void)
      20  {
      21    (void) __sync_fetch_and_add (&sc, -1);
      22    (void) __sync_fetch_and_add (&uc, -1);
      23    (void) __sync_fetch_and_add (&ss, -1);
      24    (void) __sync_fetch_and_add (&us, -1);
      25    (void) __sync_fetch_and_add (&si, -1);
      26    (void) __sync_fetch_and_add (&ui, -1);
      27    (void) __sync_fetch_and_add (&sl, -1);
      28    (void) __sync_fetch_and_add (&ul, -1);
      29    (void) __sync_fetch_and_add (&sll, -1);
      30    (void) __sync_fetch_and_add (&ull, -1);
      31  
      32    (void) __sync_fetch_and_sub (&sc, -1);
      33    (void) __sync_fetch_and_sub (&uc, -1);
      34    (void) __sync_fetch_and_sub (&ss, -1);
      35    (void) __sync_fetch_and_sub (&us, -1);
      36    (void) __sync_fetch_and_sub (&si, -1);
      37    (void) __sync_fetch_and_sub (&ui, -1);
      38    (void) __sync_fetch_and_sub (&sl, -1);
      39    (void) __sync_fetch_and_sub (&ul, -1);
      40    (void) __sync_fetch_and_sub (&sll, -1);
      41    (void) __sync_fetch_and_sub (&ull, -1);
      42  
      43    (void) __sync_fetch_and_or (&sc, -1);
      44    (void) __sync_fetch_and_or (&uc, -1);
      45    (void) __sync_fetch_and_or (&ss, -1);
      46    (void) __sync_fetch_and_or (&us, -1);
      47    (void) __sync_fetch_and_or (&si, -1);
      48    (void) __sync_fetch_and_or (&ui, -1);
      49    (void) __sync_fetch_and_or (&sl, -1);
      50    (void) __sync_fetch_and_or (&ul, -1);
      51    (void) __sync_fetch_and_or (&sll, -1);
      52    (void) __sync_fetch_and_or (&ull, -1);
      53  
      54    (void) __sync_fetch_and_xor (&sc, -1);
      55    (void) __sync_fetch_and_xor (&uc, -1);
      56    (void) __sync_fetch_and_xor (&ss, -1);
      57    (void) __sync_fetch_and_xor (&us, -1);
      58    (void) __sync_fetch_and_xor (&si, -1);
      59    (void) __sync_fetch_and_xor (&ui, -1);
      60    (void) __sync_fetch_and_xor (&sl, -1);
      61    (void) __sync_fetch_and_xor (&ul, -1);
      62    (void) __sync_fetch_and_xor (&sll, -1);
      63    (void) __sync_fetch_and_xor (&ull, -1);
      64  
      65    (void) __sync_fetch_and_and (&sc, -1);
      66    (void) __sync_fetch_and_and (&uc, -1);
      67    (void) __sync_fetch_and_and (&ss, -1);
      68    (void) __sync_fetch_and_and (&us, -1);
      69    (void) __sync_fetch_and_and (&si, -1);
      70    (void) __sync_fetch_and_and (&ui, -1);
      71    (void) __sync_fetch_and_and (&sl, -1);
      72    (void) __sync_fetch_and_and (&ul, -1);
      73    (void) __sync_fetch_and_and (&sll, -1);
      74    (void) __sync_fetch_and_and (&ull, -1);
      75  
      76    (void) __sync_fetch_and_nand (&sc, -1);
      77    (void) __sync_fetch_and_nand (&uc, -1);
      78    (void) __sync_fetch_and_nand (&ss, -1);
      79    (void) __sync_fetch_and_nand (&us, -1);
      80    (void) __sync_fetch_and_nand (&si, -1);
      81    (void) __sync_fetch_and_nand (&ui, -1);
      82    (void) __sync_fetch_and_nand (&sl, -1);
      83    (void) __sync_fetch_and_nand (&ul, -1);
      84    (void) __sync_fetch_and_nand (&sll, -1);
      85    (void) __sync_fetch_and_nand (&ull, -1);
      86  }
      87  
      88  void test_fetch_and_op (void)
      89  {
      90    sc = __sync_fetch_and_add (&sc, -11);
      91    uc = __sync_fetch_and_add (&uc, -11);
      92    ss = __sync_fetch_and_add (&ss, -11);
      93    us = __sync_fetch_and_add (&us, -11);
      94    si = __sync_fetch_and_add (&si, -11);
      95    ui = __sync_fetch_and_add (&ui, -11);
      96    sl = __sync_fetch_and_add (&sl, -11);
      97    ul = __sync_fetch_and_add (&ul, -11);
      98    sll = __sync_fetch_and_add (&sll, -11);
      99    ull = __sync_fetch_and_add (&ull, -11);
     100  
     101    sc = __sync_fetch_and_sub (&sc, -11);
     102    uc = __sync_fetch_and_sub (&uc, -11);
     103    ss = __sync_fetch_and_sub (&ss, -11);
     104    us = __sync_fetch_and_sub (&us, -11);
     105    si = __sync_fetch_and_sub (&si, -11);
     106    ui = __sync_fetch_and_sub (&ui, -11);
     107    sl = __sync_fetch_and_sub (&sl, -11);
     108    ul = __sync_fetch_and_sub (&ul, -11);
     109    sll = __sync_fetch_and_sub (&sll, -11);
     110    ull = __sync_fetch_and_sub (&ull, -11);
     111  
     112    sc = __sync_fetch_and_or (&sc, -11);
     113    uc = __sync_fetch_and_or (&uc, -11);
     114    ss = __sync_fetch_and_or (&ss, -11);
     115    us = __sync_fetch_and_or (&us, -11);
     116    si = __sync_fetch_and_or (&si, -11);
     117    ui = __sync_fetch_and_or (&ui, -11);
     118    sl = __sync_fetch_and_or (&sl, -11);
     119    ul = __sync_fetch_and_or (&ul, -11);
     120    sll = __sync_fetch_and_or (&sll, -11);
     121    ull = __sync_fetch_and_or (&ull, -11);
     122  
     123    sc = __sync_fetch_and_xor (&sc, -11);
     124    uc = __sync_fetch_and_xor (&uc, -11);
     125    ss = __sync_fetch_and_xor (&ss, -11);
     126    us = __sync_fetch_and_xor (&us, -11);
     127    si = __sync_fetch_and_xor (&si, -11);
     128    ui = __sync_fetch_and_xor (&ui, -11);
     129    sl = __sync_fetch_and_xor (&sl, -11);
     130    ul = __sync_fetch_and_xor (&ul, -11);
     131    sll = __sync_fetch_and_xor (&sll, -11);
     132    ull = __sync_fetch_and_xor (&ull, -11);
     133  
     134    sc = __sync_fetch_and_and (&sc, -11);
     135    uc = __sync_fetch_and_and (&uc, -11);
     136    ss = __sync_fetch_and_and (&ss, -11);
     137    us = __sync_fetch_and_and (&us, -11);
     138    si = __sync_fetch_and_and (&si, -11);
     139    ui = __sync_fetch_and_and (&ui, -11);
     140    sl = __sync_fetch_and_and (&sl, -11);
     141    ul = __sync_fetch_and_and (&ul, -11);
     142    sll = __sync_fetch_and_and (&sll, -11);
     143    ull = __sync_fetch_and_and (&ull, -11);
     144  
     145    sc = __sync_fetch_and_nand (&sc, -11);
     146    uc = __sync_fetch_and_nand (&uc, -11);
     147    ss = __sync_fetch_and_nand (&ss, -11);
     148    us = __sync_fetch_and_nand (&us, -11);
     149    si = __sync_fetch_and_nand (&si, -11);
     150    ui = __sync_fetch_and_nand (&ui, -11);
     151    sl = __sync_fetch_and_nand (&sl, -11);
     152    ul = __sync_fetch_and_nand (&ul, -11);
     153    sll = __sync_fetch_and_nand (&sll, -11);
     154    ull = __sync_fetch_and_nand (&ull, -11);
     155  }
     156  
     157  void test_lock (void)
     158  {
     159    sc = __sync_lock_test_and_set (&sc, -1);
     160    uc = __sync_lock_test_and_set (&uc, -1);
     161    ss = __sync_lock_test_and_set (&ss, -1);
     162    us = __sync_lock_test_and_set (&us, -1);
     163    si = __sync_lock_test_and_set (&si, -1);
     164    ui = __sync_lock_test_and_set (&ui, -1);
     165    sl = __sync_lock_test_and_set (&sl, -1);
     166    ul = __sync_lock_test_and_set (&ul, -1);
     167    sll = __sync_lock_test_and_set (&sll, -1);
     168    ull = __sync_lock_test_and_set (&ull, -1);
     169  }