re PR target/79079 ([6] Wrong code gen for __builtin_mul_overflow when TRULY_NOOP_TRUNCATION (32, 64) == false)
PR target/79079 * internal-fn.c (expand_mul_overflow): Use convert_modes instead of gen_lowpart. Co-Authored-By: Kuan-Lin Chen <kuanlinchentw@gmail.com> From-SVN: r244539
This commit is contained in:
parent
893ffa2c8f
commit
4ed543bcd4
2 changed files with 18 additions and 9 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2017-01-17 Kito Cheng <kito.cheng@gmail.com>
|
||||||
|
Kuan-Lin Chen <kuanlinchentw@gmail.com>
|
||||||
|
|
||||||
|
PR target/79079
|
||||||
|
* internal-fn.c (expand_mul_overflow): Use convert_modes instead of
|
||||||
|
gen_lowpart.
|
||||||
|
|
||||||
2017-01-17 Vladimir Makarov <vmakarov@redhat.com>
|
2017-01-17 Vladimir Makarov <vmakarov@redhat.com>
|
||||||
|
|
||||||
PR target/79058
|
PR target/79058
|
||||||
|
|
|
@ -1483,8 +1483,8 @@ expand_mul_overflow (location_t loc, tree lhs, tree arg0, tree arg1,
|
||||||
res = expand_expr_real_2 (&ops, NULL_RTX, wmode, EXPAND_NORMAL);
|
res = expand_expr_real_2 (&ops, NULL_RTX, wmode, EXPAND_NORMAL);
|
||||||
rtx hipart = expand_shift (RSHIFT_EXPR, wmode, res, prec,
|
rtx hipart = expand_shift (RSHIFT_EXPR, wmode, res, prec,
|
||||||
NULL_RTX, uns);
|
NULL_RTX, uns);
|
||||||
hipart = gen_lowpart (mode, hipart);
|
hipart = convert_modes (mode, wmode, hipart, uns);
|
||||||
res = gen_lowpart (mode, res);
|
res = convert_modes (mode, wmode, res, uns);
|
||||||
if (uns)
|
if (uns)
|
||||||
/* For the unsigned multiplication, there was overflow if
|
/* For the unsigned multiplication, there was overflow if
|
||||||
HIPART is non-zero. */
|
HIPART is non-zero. */
|
||||||
|
@ -1517,16 +1517,16 @@ expand_mul_overflow (location_t loc, tree lhs, tree arg0, tree arg1,
|
||||||
unsigned int hprec = GET_MODE_PRECISION (hmode);
|
unsigned int hprec = GET_MODE_PRECISION (hmode);
|
||||||
rtx hipart0 = expand_shift (RSHIFT_EXPR, mode, op0, hprec,
|
rtx hipart0 = expand_shift (RSHIFT_EXPR, mode, op0, hprec,
|
||||||
NULL_RTX, uns);
|
NULL_RTX, uns);
|
||||||
hipart0 = gen_lowpart (hmode, hipart0);
|
hipart0 = convert_modes (hmode, mode, hipart0, uns);
|
||||||
rtx lopart0 = gen_lowpart (hmode, op0);
|
rtx lopart0 = convert_modes (hmode, mode, op0, uns);
|
||||||
rtx signbit0 = const0_rtx;
|
rtx signbit0 = const0_rtx;
|
||||||
if (!uns)
|
if (!uns)
|
||||||
signbit0 = expand_shift (RSHIFT_EXPR, hmode, lopart0, hprec - 1,
|
signbit0 = expand_shift (RSHIFT_EXPR, hmode, lopart0, hprec - 1,
|
||||||
NULL_RTX, 0);
|
NULL_RTX, 0);
|
||||||
rtx hipart1 = expand_shift (RSHIFT_EXPR, mode, op1, hprec,
|
rtx hipart1 = expand_shift (RSHIFT_EXPR, mode, op1, hprec,
|
||||||
NULL_RTX, uns);
|
NULL_RTX, uns);
|
||||||
hipart1 = gen_lowpart (hmode, hipart1);
|
hipart1 = convert_modes (hmode, mode, hipart1, uns);
|
||||||
rtx lopart1 = gen_lowpart (hmode, op1);
|
rtx lopart1 = convert_modes (hmode, mode, op1, uns);
|
||||||
rtx signbit1 = const0_rtx;
|
rtx signbit1 = const0_rtx;
|
||||||
if (!uns)
|
if (!uns)
|
||||||
signbit1 = expand_shift (RSHIFT_EXPR, hmode, lopart1, hprec - 1,
|
signbit1 = expand_shift (RSHIFT_EXPR, hmode, lopart1, hprec - 1,
|
||||||
|
@ -1717,11 +1717,12 @@ expand_mul_overflow (location_t loc, tree lhs, tree arg0, tree arg1,
|
||||||
if (loxhi >> (bitsize / 2) == 0 (if uns). */
|
if (loxhi >> (bitsize / 2) == 0 (if uns). */
|
||||||
rtx hipartloxhi = expand_shift (RSHIFT_EXPR, mode, loxhi, hprec,
|
rtx hipartloxhi = expand_shift (RSHIFT_EXPR, mode, loxhi, hprec,
|
||||||
NULL_RTX, 0);
|
NULL_RTX, 0);
|
||||||
hipartloxhi = gen_lowpart (hmode, hipartloxhi);
|
hipartloxhi = convert_modes (hmode, mode, hipartloxhi, 0);
|
||||||
rtx signbitloxhi = const0_rtx;
|
rtx signbitloxhi = const0_rtx;
|
||||||
if (!uns)
|
if (!uns)
|
||||||
signbitloxhi = expand_shift (RSHIFT_EXPR, hmode,
|
signbitloxhi = expand_shift (RSHIFT_EXPR, hmode,
|
||||||
gen_lowpart (hmode, loxhi),
|
convert_modes (hmode, mode,
|
||||||
|
loxhi, 0),
|
||||||
hprec - 1, NULL_RTX, 0);
|
hprec - 1, NULL_RTX, 0);
|
||||||
|
|
||||||
do_compare_rtx_and_jump (signbitloxhi, hipartloxhi, NE, true, hmode,
|
do_compare_rtx_and_jump (signbitloxhi, hipartloxhi, NE, true, hmode,
|
||||||
|
@ -1731,7 +1732,8 @@ expand_mul_overflow (location_t loc, tree lhs, tree arg0, tree arg1,
|
||||||
/* res = (loxhi << (bitsize / 2)) | (hmode) lo0xlo1; */
|
/* res = (loxhi << (bitsize / 2)) | (hmode) lo0xlo1; */
|
||||||
rtx loxhishifted = expand_shift (LSHIFT_EXPR, mode, loxhi, hprec,
|
rtx loxhishifted = expand_shift (LSHIFT_EXPR, mode, loxhi, hprec,
|
||||||
NULL_RTX, 1);
|
NULL_RTX, 1);
|
||||||
tem = convert_modes (mode, hmode, gen_lowpart (hmode, lo0xlo1), 1);
|
tem = convert_modes (mode, hmode,
|
||||||
|
convert_modes (hmode, mode, lo0xlo1, 1), 1);
|
||||||
|
|
||||||
tem = expand_simple_binop (mode, IOR, loxhishifted, tem, res,
|
tem = expand_simple_binop (mode, IOR, loxhishifted, tem, res,
|
||||||
1, OPTAB_DIRECT);
|
1, OPTAB_DIRECT);
|
||||||
|
|
Loading…
Add table
Reference in a new issue