On Tue, Feb 06, 2018 at 06:42:06AM -0600, Peter Bergner wrote: > On 2/5/18 10:48 PM, David Edelsohn wrote: > > On Mon, Feb 5, 2018 at 9:43 PM, Peter Bergner <berg...@vnet.ibm.com> wrote: > >> I did also try calling expand_divmod() here which did generate correct > >> code, the problem was that it wasn't as clean/optimized as the change > >> to gen_divdi3. > > > > Why not fix it at the site of the call to gen_divdi3 instead of the > > divdi3 pattern? > > Well as I said above, I did try that and we got worse code. That said, > I unconditionally called expand_divmod() instead of calling gen_divdi3() > when we can (TARGET_POWERPC64). Let me retry with that change and see > what kind of code gen we get.
You can make the div<mode>3 define_expand for SDI instead of for GPR (like we do for many other arithmetic and logical operations already) if that is nicer. (And udiv<mode>3, which doesn't have an expander yet). Segher