Re: [PATCH 2/2, i386]: Implement TARGET_EXPAND_DIVMOD_LIBFUNC

2016-11-03 Thread Prathamesh Kulkarni
On 3 November 2016 at 18:36, Uros Bizjak wrote: > On Thu, Nov 3, 2016 at 1:58 PM, Eric Botcazou wrote: >>> libfunc, as in "__{,u}divmod{di,ti}4 library function" is already >>> implemented in libgcc. But the enablement of this function inside the >>>

Re: [PATCH 2/2, i386]: Implement TARGET_EXPAND_DIVMOD_LIBFUNC

2016-11-03 Thread Eric Botcazou
> I guess it can be done. Currently the expander goes: > > --cut here-- > /* Check if optab_handler exists for divmod_optab for given mode. */ > if (optab_handler (tab, mode) != CODE_FOR_nothing) > { > quotient = gen_reg_rtx (mode); > remainder = gen_reg_rtx (mode); >

Re: [PATCH 2/2, i386]: Implement TARGET_EXPAND_DIVMOD_LIBFUNC

2016-11-03 Thread Uros Bizjak
On Thu, Nov 3, 2016 at 1:58 PM, Eric Botcazou wrote: >> libfunc, as in "__{,u}divmod{di,ti}4 library function" is already >> implemented in libgcc. But the enablement of this function inside the >> compiler has to be performed by each target. > > So can we do it generically

Re: [PATCH 2/2, i386]: Implement TARGET_EXPAND_DIVMOD_LIBFUNC

2016-11-03 Thread Eric Botcazou
> libfunc, as in "__{,u}divmod{di,ti}4 library function" is already > implemented in libgcc. But the enablement of this function inside the > compiler has to be performed by each target. So can we do it generically instead of duplicating it ~50 times? -- Eric Botcazou

Re: [PATCH 2/2, i386]: Implement TARGET_EXPAND_DIVMOD_LIBFUNC

2016-11-03 Thread Uros Bizjak
On Thu, Nov 3, 2016 at 1:18 PM, Eric Botcazou wrote: >> libfunc is already implemented for all targets to use, there is also: >> >> OPTAB_NC(sdivmod_optab, "divmod$a4", UNKNOWN) >> OPTAB_NC(udivmod_optab, "udivmod$a4", UNKNOWN) >> >> in optabs.def that can probably be

Re: [PATCH 2/2, i386]: Implement TARGET_EXPAND_DIVMOD_LIBFUNC

2016-11-03 Thread Eric Botcazou
> libfunc is already implemented for all targets to use, there is also: > > OPTAB_NC(sdivmod_optab, "divmod$a4", UNKNOWN) > OPTAB_NC(udivmod_optab, "udivmod$a4", UNKNOWN) > > in optabs.def that can probably be changed for generic expansion. So what's the purpose of ix86_init_libfuncs if the

Re: [PATCH 2/2, i386]: Implement TARGET_EXPAND_DIVMOD_LIBFUNC

2016-11-03 Thread Uros Bizjak
On Thu, Nov 3, 2016 at 12:29 PM, Eric Botcazou wrote: >> The same approach can also be used on other targets without hardware >> divmod insn. > > This should be made generic instead: can't we automatically create a divmod > libfunc for double-word mode & define a default

Re: [PATCH 2/2, i386]: Implement TARGET_EXPAND_DIVMOD_LIBFUNC

2016-11-03 Thread Eric Botcazou
> The same approach can also be used on other targets without hardware > divmod insn. This should be made generic instead: can't we automatically create a divmod libfunc for double-word mode & define a default TARGET_EXPAND_DIVMOD_LIBFUNC? This would save the code duplication in the ~50

[PATCH 2/2, i386]: Implement TARGET_EXPAND_DIVMOD_LIBFUNC

2016-10-31 Thread Uros Bizjak
Attached patch builds on previous libgcc patch and implements TARGET_EXPAND_DIVMOD_LIBFUNC target hook. The same approach can also be used on other targets without hardware divmod insn. Patch also fixes several gcc.dg/divmod-?.c testsuite failures for x86_64 multilibs. 2016-10-31 Uros Bizjak