(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
tree-ssa/
vrp98-1.c
       1  /* { dg-do compile } */
       2  /* { dg-require-effective-target int128 } */
       3  /* { dg-options "-Os -fdump-tree-evrp-details" } */
       4  
       5  #include <stdint.h>
       6  #include <limits.h>
       7  
       8  typedef unsigned int word __attribute__((mode(word)));
       9  typedef unsigned __int128 bigger_than_word;
      10  
      11  int
      12  foo (bigger_than_word a, word b, uint8_t c)
      13  {
      14    /* Must fold use of t1 into use of b, as b is no wider than word_mode. */
      15    const uint8_t t1 = b % UCHAR_MAX;
      16  
      17    /* Must NOT fold use of t2 into use of a, as a is wider than word_mode. */
      18    const uint8_t t2 = a % UCHAR_MAX;
      19  
      20    /* Must fold use of t3 into use of c, as c is narrower than t3. */
      21    const uint32_t t3 = (const uint32_t)(c >> 1);
      22  
      23    uint16_t ret = 0;
      24  
      25    if (t1 == 1)
      26      ret = 20;
      27    else if (t2 == 2)
      28      ret = 30;
      29    else if (t3 == 3)
      30      ret = 40;
      31    /* Th extra condition below is necessary to prevent a prior pass from
      32       folding away the cast. Ignored in scan-tree-dump. */
      33    else if (t3 == 4)
      34      ret = 50;
      35  
      36    return ret;
      37  }
      38  
      39  /* { dg-final { scan-tree-dump "Folded into: if \\(_\[0-9\]+ == 1\\)" "evrp" } } */
      40  /* { dg-final { scan-tree-dump-not "Folded into: if \\(_\[0-9\]+ == 2\\)" "evrp" } } */
      41  /* { dg-final { scan-tree-dump "Folded into: if \\(_\[0-9\]+ == 3\\)" "evrp" } } */