re PR target/66112 (__builtin_mul_overflow for int16_t emits poor code)
PR target/66112 * internal-fn.c (get_min_precision): Use UNSIGNED instead of SIGNED to get precision of non-negative value. * gcc.target/i386/pr66112-1.c: New test. From-SVN: r223115
This commit is contained in:
parent
e9ae68afa0
commit
c1ee2e626e
@ -1,3 +1,9 @@
|
||||
2015-05-13 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR target/66112
|
||||
* internal-fn.c (get_min_precision): Use UNSIGNED instead of
|
||||
SIGNED to get precision of non-negative value.
|
||||
|
||||
2015-05-13 Ilya Enkovich <ilya.enkovich@intel.com>
|
||||
|
||||
PR target/66048
|
||||
|
@ -399,7 +399,7 @@ get_min_precision (tree arg, signop sign)
|
||||
}
|
||||
else if (sign == UNSIGNED && !wi::neg_p (arg_min, SIGNED))
|
||||
{
|
||||
int p = wi::min_precision (arg_max, SIGNED);
|
||||
int p = wi::min_precision (arg_max, UNSIGNED);
|
||||
prec = MIN (prec, p);
|
||||
}
|
||||
return prec + (orig_sign != sign);
|
||||
|
@ -1,3 +1,8 @@
|
||||
2015-05-13 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR target/66112
|
||||
* gcc.target/i386/pr66112-1.c: New test.
|
||||
|
||||
2015-05-13 Ilya Enkovich <ilya.enkovich@intel.com>
|
||||
|
||||
PR target/66048
|
||||
|
16
gcc/testsuite/gcc.target/i386/pr66112-1.c
Normal file
16
gcc/testsuite/gcc.target/i386/pr66112-1.c
Normal file
@ -0,0 +1,16 @@
|
||||
/* PR target/66112 */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2" } */
|
||||
|
||||
unsigned int
|
||||
foo (long long a, long long b)
|
||||
{
|
||||
unsigned int res;
|
||||
a &= ~0U;
|
||||
b &= ~0U;
|
||||
if (__builtin_mul_overflow (a, b, &res))
|
||||
res = 0x123U;
|
||||
return res;
|
||||
}
|
||||
|
||||
/* { dg-final { scan-assembler "jn?o\[ \t\]" } } */
|
Loading…
Reference in New Issue
Block a user