(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
pr66299-1.c
       1  /* PR tree-optimization/66299 */
       2  /* { dg-do run } */
       3  /* { dg-options "-fdump-tree-original" } */
       4  /* { dg-require-effective-target int32plus } */
       5  
       6  void
       7  test1 (int x)
       8  {
       9    if ((0 << x) != 0
      10        || (1 << x) != 2
      11        || (2 << x) != 4
      12        || (3 << x) != 6
      13        || (4 << x) != 8
      14        || (5 << x) != 10
      15        || (6 << x) != 12
      16        || (7 << x) != 14
      17        || (8 << x) != 16
      18        || (9 << x) != 18
      19        || (10 << x) != 20)
      20      __builtin_abort ();
      21  }
      22  
      23  void
      24  test2 (int x)
      25  {
      26    if (!((0 << x) == 0
      27  	&& (1 << x) == 4
      28  	&& (2 << x) == 8
      29  	&& (3 << x) == 12
      30  	&& (4 << x) == 16
      31  	&& (5 << x) == 20
      32  	&& (6 << x) == 24
      33  	&& (7 << x) == 28
      34  	&& (8 << x) == 32
      35  	&& (9 << x) == 36
      36  	&& (10 << x) == 40))
      37      __builtin_abort ();
      38  }
      39  
      40  void
      41  test3 (unsigned int x)
      42  {
      43    if ((0U << x) != 0U
      44        || (1U << x) != 16U
      45        || (2U << x) != 32U
      46        || (3U << x) != 48U
      47        || (4U << x) != 64U
      48        || (5U << x) != 80U
      49        || (6U << x) != 96U
      50        || (7U << x) != 112U
      51        || (8U << x) != 128U
      52        || (9U << x) != 144U
      53        || (10U << x) != 160U)
      54      __builtin_abort ();
      55  }
      56  
      57  void
      58  test4 (unsigned int x)
      59  {
      60    if (!((0U << x) == 0U
      61  	|| (1U << x) == 8U
      62  	|| (2U << x) == 16U
      63  	|| (3U << x) == 24U
      64  	|| (4U << x) == 32U
      65  	|| (5U << x) == 40U
      66  	|| (6U << x) == 48U
      67  	|| (7U << x) == 56U
      68  	|| (8U << x) == 64U
      69  	|| (9U << x) == 72U
      70  	|| (10U << x) == 80U))
      71      __builtin_abort ();
      72  }
      73  
      74  void
      75  test5 (int x)
      76  {
      77    if ((0 << x) == 1
      78        || (0 << x) != 0
      79        || (0x8001U << x) != 0x20000U)
      80      __builtin_abort ();
      81  }
      82  
      83  int
      84  main (void)
      85  {
      86    test1 (1);
      87    test2 (2);
      88    test3 (4U);
      89    test4 (3U);
      90    test5 (17);
      91  }
      92  
      93  /* { dg-final { scan-tree-dump-not "<<" "original" } } */