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.

> +__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.


r~

Reply via email to