Thanks for working on this. Kamlesh Kumar via Gcc-patches <gcc-patches@gcc.gnu.org> writes: > Here is a discussion we did some time ago regarding the defect. > https://gcc.gnu.org/pipermail/gcc/2019-January/227834.html > please see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88877 for testcase > behavior. > > We incorporating below Jakub's suggestion in this patch series. > > Jakub wrote: > "" > Yeah, all the callers of emit_library_call* would need to be changed to pass > triplets rtx, machine_mode, int/bool /*unsignedp*/, instead of just > rtx_mode_t pair. > "" > > > In this patch series trying to address same by creating a struct Tuple > which bundles existing rtx and machine_mode and added one more > bool member which store unsigned_p which by default is false. > This patch does not change underlying behavior yet. This will be done in > follow up patches. > > ChangeLog Entry: > > 2020-05-24 Kamlesh Kumar <kamleshbha...@gmail.com> > > * rtl.h (Tuple): Defined and typedefed to rtx_mode_t. > (emit_library_call): Added default arg unsigned_p. > (emit_library_call_value): Added default arg unsigned_p. > --- > gcc/rtl.h | 26 ++++++++++++++++++-------- > 1 file changed, 18 insertions(+), 8 deletions(-) > > diff --git a/gcc/rtl.h b/gcc/rtl.h > index b0b1aac..ee42de7 100644 > --- a/gcc/rtl.h > +++ b/gcc/rtl.h > @@ -2238,10 +2238,20 @@ struct address_info { > enum rtx_code base_outer_code; > }; > > -/* This is used to bundle an rtx and a mode together so that the pair > - can be used with the wi:: routines. If we ever put modes into rtx > - integer constants, this should go away and then just pass an rtx in. */ > -typedef std::pair <rtx, machine_mode> rtx_mode_t; > +/* This is used to bundle an rtx and a mode and unsignedness together so > + that the tuple can be used with the wi:: routines. If we ever put modes > + into rtx integer constants, this should go away and then just pass an rtx > in. */ > +typedef struct Tuple { > + rtx first; > + machine_mode second; > + /* unsigned_p */ > + bool third; > + Tuple (rtx f, machine_mode s, bool t = false) { > + first = f; > + second = s; > + third = t; > + } > +} rtx_mode_t; >
I think rtx_mode_t should continue to be what it is now: an rtx and a mode only. That's all that most rtl code cares about, since in rtl signedness is a property of an operation (where necessary) instead of an operand. (FWIW, the type was originally added to enable wide-int operators to be applied to rtx constants, to get around the fact that CONST_INT & co. don't store a mode. We should continue not to have signedness information in that situation.) I think instead we should make emit_library_call operate on a new and differently-named type that contains the three pieces of information. Thanks, Richard