1  /* PR target/95950 */
       2  /* { dg-do compile } */
       3  /* { dg-options "-O2 -mtune=generic" } */
       4  /* { dg-final { scan-assembler-times "\tset\[ab]\t" 4 } } */
       5  /* { dg-final { scan-assembler-times "\tseto\t" 16 } } */
       6  /* { dg-final { scan-assembler-times "\tsetc\t" 4 } } */
       7  /* { dg-final { scan-assembler-not "\tjn?\[ab]\t" } } */
       8  /* { dg-final { scan-assembler-not "\tjn?o\t" } } */
       9  /* { dg-final { scan-assembler-not "\tjn?c\t" } } */
      10  
      11  char
      12  f1 (short a, short b)
      13  {
      14    return __builtin_mul_overflow_p (a, b, (short) 0);
      15  }
      16  
      17  char
      18  f2 (short a, short b)
      19  {
      20    return __builtin_add_overflow_p (a, b, (short) 0);
      21  }
      22  
      23  char
      24  f3 (short a, short b)
      25  {
      26    return __builtin_sub_overflow_p (a, b, (short) 0);
      27  }
      28  
      29  char
      30  f4 (unsigned short a, unsigned short b)
      31  {
      32    return __builtin_mul_overflow_p (a, b, (unsigned short) 0);
      33  }
      34  
      35  char
      36  f5 (unsigned short a, unsigned short b)
      37  {
      38    return __builtin_add_overflow_p (a, b, (unsigned short) 0);
      39  }
      40  
      41  char
      42  f6 (unsigned short a, unsigned short b)
      43  {
      44    return __builtin_sub_overflow_p (a, b, (unsigned short) 0);
      45  }
      46  
      47  char
      48  f7 (short a, short b)
      49  {
      50    return __builtin_mul_overflow_p (a, b, (short) 0);
      51  }
      52  
      53  char
      54  f8 (short a, short b)
      55  {
      56    return __builtin_add_overflow_p (a, b, (short) 0);
      57  }
      58  
      59  char
      60  f9 (short a, short b)
      61  {
      62    return __builtin_sub_overflow_p (a, b, (short) 0);
      63  }
      64  
      65  char
      66  f10 (unsigned short a, unsigned short b)
      67  {
      68    return __builtin_mul_overflow_p (a, b, (unsigned short) 0);
      69  }
      70  
      71  char
      72  f11 (unsigned short a, unsigned short b)
      73  {
      74    return __builtin_add_overflow_p (a, b, (unsigned short) 0);
      75  }
      76  
      77  char
      78  f12 (unsigned short a, unsigned short b)
      79  {
      80    return __builtin_sub_overflow_p (a, b, (unsigned short) 0);
      81  }
      82  
      83  unsigned short
      84  f13 (short a, short b)
      85  {
      86    return __builtin_mul_overflow_p (a, b, (short) 0);
      87  }
      88  
      89  unsigned short
      90  f14 (short a, short b)
      91  {
      92    return __builtin_add_overflow_p (a, b, (short) 0);
      93  }
      94  
      95  unsigned short
      96  f15 (short a, short b)
      97  {
      98    return __builtin_sub_overflow_p (a, b, (short) 0);
      99  }
     100  
     101  unsigned short
     102  f16 (unsigned short a, unsigned short b)
     103  {
     104    return __builtin_mul_overflow_p (a, b, (unsigned short) 0);
     105  }
     106  
     107  unsigned short
     108  f17 (unsigned short a, unsigned short b)
     109  {
     110    return __builtin_add_overflow_p (a, b, (unsigned short) 0);
     111  }
     112  
     113  unsigned short
     114  f18 (unsigned short a, unsigned short b)
     115  {
     116    return __builtin_sub_overflow_p (a, b, (unsigned short) 0);
     117  }
     118  
     119  unsigned short
     120  f19 (short a, short b)
     121  {
     122    return __builtin_mul_overflow_p (a, b, (short) 0);
     123  }
     124  
     125  unsigned short
     126  f20 (short a, short b)
     127  {
     128    return __builtin_add_overflow_p (a, b, (short) 0);
     129  }
     130  
     131  unsigned short
     132  f21 (short a, short b)
     133  {
     134    return __builtin_sub_overflow_p (a, b, (short) 0);
     135  }
     136  
     137  unsigned short
     138  f22 (unsigned short a, unsigned short b)
     139  {
     140    return __builtin_mul_overflow_p (a, b, (unsigned short) 0);
     141  }
     142  
     143  unsigned short
     144  f23 (unsigned short a, unsigned short b)
     145  {
     146    return __builtin_add_overflow_p (a, b, (unsigned short) 0);
     147  }
     148  
     149  unsigned short
     150  f24 (unsigned short a, unsigned short b)
     151  {
     152    return __builtin_sub_overflow_p (a, b, (unsigned short) 0);
     153  }