(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
tree-ssa/
pr89475.c
       1  /* PR tree-optimization/89475 */
       2  /* { dg-do compile { target { ilp32 || lp64 } } } */
       3  /* { dg-options "-O2 -fdump-tree-optimized" } */
       4  /* { dg-final { scan-tree-dump-not "link_error " "optimized" } } */
       5  
       6  void link_error (void);
       7  
       8  unsigned short
       9  f0 (unsigned short x)
      10  {
      11    x &= 0xaa55;
      12    x = __builtin_bswap16 (x);
      13    if (x & 0xaa55)
      14      link_error ();
      15    return x;
      16  }
      17  
      18  unsigned short
      19  f1 (unsigned short x)
      20  {
      21    x &= 0x55aa;
      22    x = __builtin_bswap16 (x);
      23    if (x & 0x55aa)
      24      link_error ();
      25    return x;
      26  }
      27  
      28  unsigned int
      29  f2 (unsigned int x)
      30  {
      31    x &= 0x55aa5aa5U;
      32    x = __builtin_bswap32 (x);
      33    if (x & 0x5aa555aaU)
      34      link_error ();
      35    return x;
      36  }
      37  
      38  unsigned long long int
      39  f3 (unsigned long long int x)
      40  {
      41    x &= 0x55aa5aa544cc2211ULL;
      42    x = __builtin_bswap64 (x);
      43    if (x & 0xeedd33bb5aa555aaULL)
      44      link_error ();
      45    return x;
      46  }
      47  
      48  unsigned short
      49  f4 (unsigned short x)
      50  {
      51    x = __builtin_bswap32 (x);
      52    if (x != 0)
      53      link_error ();
      54    return x;
      55  }
      56  
      57  unsigned int
      58  f5 (unsigned int x)
      59  {
      60    x = __builtin_bswap64 (x);
      61    if (x != 0)
      62      link_error ();
      63    return x;
      64  }
      65  
      66  unsigned short
      67  f6 (unsigned short x)
      68  {
      69    x |= 0xaa55;
      70    x = __builtin_bswap16 (x);
      71    if ((x | 0xaa55) != 0xffff)
      72      link_error ();
      73    return x;
      74  }
      75  
      76  unsigned short
      77  f7 (unsigned short x)
      78  {
      79    x |= 0x55aa;
      80    x = __builtin_bswap16 (x);
      81    if ((x | 0x55aa) != 0xffff)
      82      link_error ();
      83    return x;
      84  }
      85  
      86  unsigned int
      87  f8 (unsigned int x)
      88  {
      89    x |= 0x55aa5aa5U;
      90    x = __builtin_bswap32 (x);
      91    if ((x | 0x5aa555aaU) != 0xffffffffU)
      92      link_error ();
      93    return x;
      94  }
      95  
      96  unsigned long long int
      97  f9 (unsigned long long int x)
      98  {
      99    x |= 0x55aa5aa544cc2211ULL;
     100    x = __builtin_bswap64 (x);
     101    if ((x | 0xeedd33bb5aa555aaULL) != 0xffffffffffffffffULL)
     102      link_error ();
     103    return x;
     104  }