On Wed, Aug 29, 2018 at 02:08:07PM -0700, Richard Henderson wrote:
> On 08/26/2018 02:18 PM, Stafford Horne wrote:
> > +   .section .init
> > +   .align 4
> > +   .global _init
> > +   .type   _init,@function
> > +_init:
> > +   l.sw    -4(r1), r9
> > +   l.addi  r1,r1,-4
> > +
> > +   .section .fini
> > +   .align  4
> > +   .global _fini
> > +   .type   _fini,@function
> > +_fini:
> > +   l.sw    -4(r1), r9
> > +   l.addi  r1,r1,-4
> 
> I think we should take a page from the RISC-V port and completely
> drop support for DT_INIT and rely exclusively on DT_INITARRAY.
> 
> Which means that we should drop the ctri.S and crtn.S files.

Right, I was thinking about that when I was looking into a but related to the
crti/ctrn linking.  However, after I fixed the bug I moved onto the next thing.

Let me see how easy it is to just remove these are depend on the
init/fini_array.  I remember last time I couldn't quite figure it out, but I
think that was due to the previously mentioned bug. 

> > +__mulsi3:
> > +   l.movhi         r11, 0                  /* initial r */
> > +
> > +   /* Given R = X * Y ... */
> > +1: l.sfeqi         r4, 0                   /* while (y != 0) */
> > +   l.bf            2f
> > +    l.andi         r5, r4, 1               /* if (y & 1) ... */
> > +   l.add           r12, r11, r3
> > +   l.sfnei         r5, 0
> > +   l.cmov          r11, r12, r11           /* ... r += x. */
> 
> Officially l.cmov is optional.  Given that __mulsi3 is only used
> for a stripped down configuration that doesn't have a multiplier,
> we should probably write this for the lowest common denominator.
> 
> > +   /* Shift Y back to the right again, subtracting from X.  */
> > +2: l.add           r7, r11, r6     /* tmp1 = quot + mask */
> > +3: l.srli          r6, r6, 1       /* mask >>= 1 */
> > +   l.sub           r8, r12, r4     /* tmp2 = x - y */
> > +   l.sfleu         r4, r12         /* y <= x */
> > +   l.srli          r4, r4, 1       /* y >>= 1 */
> > +   l.cmov          r11, r7, r11    /* if (y <= x) quot = tmp1 */
> > +   l.cmov          r12, r8, r12    /* if (y <= x) x = tmp2 */
> 
> Likewise for __udivsi3_internal.

Right, as pointed out in the other patch we do pretty much requite l.cmov.  It
has been a optional instruction since ~2001, but I think all core's provide it.
Also, providing it means we get a bit more code compression.

Let me ask this question on the openrisc list.

-Stafford

Reply via email to