public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/43226] simplify_binary_operation_1 MINUS x const_int issue
[not found] <bug-43226-4@http.gcc.gnu.org/bugzilla/>
@ 2021-08-08 5:49 ` pinskia at gcc dot gnu.org
2023-06-05 7:10 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-08 5:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43226
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This changed over to wide_int (well poly_wide_int but for most targets it is
just wide_int). I have not looked to see if that fixes the issue here though.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug rtl-optimization/43226] simplify_binary_operation_1 MINUS x const_int issue
[not found] <bug-43226-4@http.gcc.gnu.org/bugzilla/>
2021-08-08 5:49 ` [Bug rtl-optimization/43226] simplify_binary_operation_1 MINUS x const_int issue pinskia at gcc dot gnu.org
@ 2023-06-05 7:10 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-05 7:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=43226
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |DUPLICATE
Target Milestone|--- |7.0
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=78546
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The code does this now:
/* Don't let a relocatable value get a negative coeff. */
if (poly_int_rtx_p (op1) && GET_MODE (op0) != VOIDmode)
return simplify_gen_binary (PLUS, mode,
op0,
neg_poly_int_rtx (mode, op1));
Which does:
/* Negate I, which satisfies poly_int_rtx_p. MODE is the mode of I. */
static rtx
neg_poly_int_rtx (machine_mode mode, const_rtx i)
{
return immed_wide_int_const (-wi::to_poly_wide (i, mode), mode);
}
Poly_int's operator- does:
template<unsigned int N, typename Ca>
inline POLY_POLY_RESULT (N, Ca, Ca)
operator - (const poly_int_pod<N, Ca> &a)
{
typedef POLY_CAST (Ca, Ca) NCa;
typedef POLY_POLY_COEFF (Ca, Ca) C;
poly_int<N, C> r;
for (unsigned int i = 0; i < N; i++)
POLY_SET_COEFF (C, r, i, -NCa (a.coeffs[i]));
return r;
}
typedef poly_int<NUM_POLY_INT_COEFFS,
generic_wide_int <wide_int_ref_storage <false, false> > >
rtx_to_poly_wide_ref;
operator- on generic_wide_int calls wi::neg which does:
/* Return -x. */
template <typename T>
inline WI_UNARY_RESULT (T)
wi::neg (const T &x)
{
return sub (0, x);
}
wi::sub only uses `unsigned HOST_WIDE_INT`
r10-3327-g681fc0fa40cc moved it over to poly_int.
But r7-4950-gd057004733e8 (PR 78546) fixed this bug really for the same reason
why it was reported here but for HWI==64 and int128_t.
I am going to mark this as a dup of bug 78546 because the bug is the same.
*** This bug has been marked as a duplicate of bug 78546 ***
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-06-05 7:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-43226-4@http.gcc.gnu.org/bugzilla/>
2021-08-08 5:49 ` [Bug rtl-optimization/43226] simplify_binary_operation_1 MINUS x const_int issue pinskia at gcc dot gnu.org
2023-06-05 7:10 ` pinskia at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).