(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
visium/
overflow16.c
       1  /* { dg-do compile } */
       2  /* { dg-options "-O2" } */
       3  
       4  #include <stdbool.h>
       5  
       6  bool my_uadd_overflow (unsigned short a, unsigned short b, unsigned short *res)
       7  {
       8    return __builtin_add_overflow (a, b, res);
       9  }
      10  
      11  bool my_usub_overflow (unsigned short a, unsigned short b, unsigned short *res)
      12  {
      13    return __builtin_sub_overflow (a, b, res);
      14  }
      15  
      16  bool my_uneg_overflow (unsigned short a, unsigned short *res)
      17  {
      18    return __builtin_sub_overflow (0, a, res);
      19  }
      20  
      21  bool my_add_overflow (short a, short b, short *res)
      22  {
      23    return __builtin_add_overflow (a, b, res);
      24  }
      25  
      26  bool my_sub_overflow (short a, short b, short *res)
      27  {
      28    return __builtin_sub_overflow (a, b, res);
      29  }
      30  
      31  bool my_neg_overflow (short a, short *res)
      32  {
      33    return __builtin_sub_overflow (0, a, res);
      34  }
      35  
      36  /* { dg-final { scan-assembler-times "add.w" 2 } } */
      37  /* { dg-final { scan-assembler-times "sub.w" 4 } } */
      38  /* { dg-final { scan-assembler-not "cmp.w" } } */