Fix warning with -Wsign-compare -Wsystem-headers
[official-gcc.git] / gcc / testsuite / gcc.target / visium / overflow16.c
blob223184a2d36dcda1ad16b115d3f52bc800ea753c
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fno-if-conversion" } */
4 #include <stdbool.h>
6 bool my_uadd_overflow (unsigned short a, unsigned short b, unsigned short *res)
8 return __builtin_add_overflow (a, b, res);
11 bool my_usub_overflow (unsigned short a, unsigned short b, unsigned short *res)
13 return __builtin_sub_overflow (a, b, res);
16 bool my_uneg_overflow (unsigned short a, unsigned short *res)
18 return __builtin_sub_overflow (0, a, res);
21 bool my_add_overflow (short a, short b, short *res)
23 return __builtin_add_overflow (a, b, res);
26 bool my_sub_overflow (short a, short b, short *res)
28 return __builtin_sub_overflow (a, b, res);
31 bool my_neg_overflow (short a, short *res)
33 return __builtin_sub_overflow (0, a, res);
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" } } */
39 /* { dg-final { scan-assembler-not "mov.w" } } */