[PATCH] AEABI Divmod, take #2

Renato Golin renato.golin at linaro.org
Tue Jul 16 01:34:28 PDT 2013


On 16 July 2013 09:19, Kristof Beyls <kristof.beyls at arm.com> wrote:

> 1.       **Quite a few test cases seem to be computing (a%b)+(a/b)+(b%a).
>
> For these test cases I can see for “GNU” and “DARWIN” that the regression
> tests look for 2 add instructions,
> but for EABI, the tests only look for 1 add instruction.
> I think that the checks should look for 2 add instructions, adding the
> right registers.
>
__aeabi_idivmod returns the remainder in R1, while in GNU and DARWIN the
mod is calculated by calling __modsi3, and that makes the scheduler to
create the sum register by adding the quotient to it first, than adding the
remainder. Since the AEABI call returns both at the same time, it only
needs to add once (or save the value on a scratch register, the mov in the
test).


****
>
> **2.       **On test case longf, there’s a FIXME saying “AEABI is not
> lowering long u/srem into u/ldivmod”, yet there is
> a check for EABI that __aeabi_ldivmod is produced. Is the FIXME comment
> still correct? If the FIXME
> is no longer correct, there probably also should be checks for add
> instructions in this test case?
>
The FIXME is still relevant, since on that function, only the first part
(div + mod) is converted into a divmod call, while the latter (mod) remains
as a call to __modsi3, which shouldn't even appear on AEABI code in the
first place.

That FIXME is my next task, where I'll try to make UREM/SREM calls also
lower to __aeabi_*divmod and move the remainter to the quotient (R1->R0 or
R2,R3->R0,R1) afterwards, hopefully using the same lowering function.



> ****
>
> **3.       **Test case g1: “DARWIB” -> “DARWIN”
>

Fixed.

cheers,
--renato
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130716/bbe076a8/attachment.html>


More information about the llvm-commits mailing list