2016-12-21 Vladimir Makarov <vmakarov@redhat.com>
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / pr66112-2.c
blob7fc18811638adadb447d3f5e1b9a520b63a2ec21
1 /* PR target/66112 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2" } */
5 unsigned short int
6 foo (int a, int b)
8 unsigned short int res;
9 a &= 0xffff;
10 b &= 0xffff;
11 if (__builtin_mul_overflow (a, b, &res))
12 res = 0x123;
13 return res;
16 short int
17 bar (int a, int b)
19 short int res;
20 a = (short int) a;
21 b = (short int) b;
22 if (__builtin_mul_overflow (a, b, &res))
23 res = 0x123;
24 return res;
27 /* { dg-final { scan-assembler-times "jn?o\[ \t\]" 2 } } */
28 /* { dg-final { scan-assembler-times "mulw\[ \t\]" 2 } } */
29 /* { dg-final { scan-assembler-times "imulw\[ \t\]" 1 } } */