diff options
Diffstat (limited to 'gcc/optabs.c')
-rw-r--r-- | gcc/optabs.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gcc/optabs.c b/gcc/optabs.c index c4540f8856c..54f07ab02b9 100644 --- a/gcc/optabs.c +++ b/gcc/optabs.c @@ -3384,7 +3384,8 @@ expand_abs_nojump (enum machine_mode mode, rtx op0, rtx target, { rtx temp; - if (! flag_trapv) + if (GET_MODE_CLASS (mode) != MODE_INT + || ! flag_trapv) result_unsignedp = 1; /* First try to do it with a special abs instruction. */ @@ -3407,7 +3408,8 @@ expand_abs_nojump (enum machine_mode mode, rtx op0, rtx target, { rtx last = get_last_insn (); - temp = expand_unop (mode, neg_optab, op0, NULL_RTX, 0); + temp = expand_unop (mode, result_unsignedp ? neg_optab : negv_optab, + op0, NULL_RTX, 0); if (temp != 0) temp = expand_binop (mode, smax_optab, op0, temp, target, 0, OPTAB_WIDEN); @@ -3449,7 +3451,8 @@ expand_abs (enum machine_mode mode, rtx op0, rtx target, { rtx temp, op1; - if (! flag_trapv) + if (GET_MODE_CLASS (mode) != MODE_INT + || ! flag_trapv) result_unsignedp = 1; temp = expand_abs_nojump (mode, op0, target, result_unsignedp); |