On Fri, Jan 18, 2019 at 11:03:28PM +1030, Alan Modra wrote: > On Tue, Jan 15, 2019 at 04:48:27PM +0530, kamlesh kumar wrote: > > Hi all, > > > > Analysed it further and find out that > > function ' rs6000_promote_function_mode ' (rs6000.c) needs modifcation. > > """ > > static machine_mode > > rs6000_promote_function_mode (const_tree type ATTRIBUTE_UNUSED, > > machine_mode mode, > > int *punsignedp ATTRIBUTE_UNUSED, > > const_tree, int) > > { > > PROMOTE_MODE (mode, *punsignedp, type); > > return mode; > > } > > """ > > Here, This function is promoting the mode but > > it is not even touching 'punsignedp' and it is always initialized to zero > > by default. > > So in all cases 'punsignedp' remain zero even if it is for unsigned type. > > which cause the sign extension to happen even for unsigned type. > > > > is there any way to set 'punsignedp' appropriately here. > > No. The call to promote_function_mode in emit_library_call_value_1 > does not pass type info (because it isn't available for libcalls).
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 or add a new set of emit_library_call* APIs that would take those triplets. Jakub