On 12 August 2016 at 12:47, Richard Biener <rguent...@suse.de> wrote: > On Thu, 11 Aug 2016, Jeff Law wrote: > >> On 08/09/2016 04:58 AM, Prathamesh Kulkarni wrote: >> > ping https://gcc.gnu.org/ml/gcc-patches/2016-07/msg01869.html >> This seems to be dependent upon other patches, this is not OK until all >> prereqs are resolved. >> >> You're using SI/DI in the descriptions, but then using more traditional C >> types like int, unsigned, long long in the actual test. >> >> If you intent is really to nail down SI/DI mode testing, then the way to go >> will be to define typedefs that correspond directly to SI and DI modes: >> >> typedef unsigned int u32 __attribute__((mode(SI))); >> typedef signed int s32 __attribute__((mode(SI))); >> >> You can do something similar for DImode. >> >> It may not matter because of your effective-target {divmod,divmod_simode} >> selectors, but it still seems cleaner. >> >> With that change, this is OK when its prereqs are resolved. > > Note that for the main patch I don't like the current state of the > divmod libcall issue. I think we need to solve this in a more > reasonable manner and not expose this oddness to a GIMPLE level pass. > > Any ideas welcome - I don't have a very good one :/ > > The best idea I have is to not lie about libfunc availability in > the optab handler. Hi, In the attached patch I set libfunc entry for sdivmod_optab to NULL and verified that optab_libfunc (sdivmod_optab, DImode) returns NULL_RTX if it's not overriden by the target.
AFAIU this issue could be latent in expand_twoval_binop_libfunc, and apparently never got triggered for the default case, where target doesn't override optab_libfunc (sdivmod_optab, DImode) else it could have generated call to __divmoddi4() which doesn't exist Bootstrapped and tested on ppc64le-linux-gnu, Cross-tested on arm*-*-*, aarch64*-*-*. Bootstrap+test in progress on x86_64-unknown-linux-gnu. OK to commit if passes ? Thanks, Prathamesh > > Richard.
diff --git a/gcc/optabs.def b/gcc/optabs.def index 8875e30..305f8c0 100644 --- a/gcc/optabs.def +++ b/gcc/optabs.def @@ -116,7 +116,7 @@ OPTAB_NL(ssdiv_optab, "ssdiv$Q$a3", SS_DIV, "ssdiv", '3', gen_signed_fixed_libfu OPTAB_NL(udiv_optab, "udiv$I$a3", UDIV, "udiv", '3', gen_int_unsigned_fixed_libfunc) OPTAB_NX(udiv_optab, "udiv$Q$a3") OPTAB_NL(usdiv_optab, "usdiv$Q$a3", US_DIV, "usdiv", '3', gen_unsigned_fixed_libfunc) -OPTAB_NL(sdivmod_optab, "divmod$a4", UNKNOWN, "divmod", '4', gen_int_libfunc) +OPTAB_NL(sdivmod_optab, "divmod$a4", UNKNOWN, "divmod", '4', NULL) OPTAB_NL(udivmod_optab, "udivmod$a4", UNKNOWN, "udivmod", '4', gen_int_libfunc) OPTAB_NL(smod_optab, "mod$a3", MOD, "mod", '3', gen_int_libfunc) OPTAB_NL(umod_optab, "umod$a3", UMOD, "umod", '3', gen_int_libfunc)