ARM: Fix unsigned modulo.

* lib/arm-mes/arm.M1 (mov____%esp,%r3): New macro.
* module/mescc/armv4/as.scm (armv4:r0%r1): Use it to avoid overwriting
%r0 before caling __mesabi_uldiv.
This commit is contained in:
Jan (janneke) Nieuwenhuizen 2022-09-12 09:47:28 +02:00
parent dbec0c3845
commit eee5398f3b
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273
2 changed files with 5 additions and 4 deletions

View file

@ -1,5 +1,5 @@
### GNU Mes --- Maxwell Equations of Software
### Copyright © 2017,2018,2020 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
### Copyright © 2017,2018,2020,2022 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
### Copyright © 2019,2020 Danny Milosavljevic <dannym@scratchpost.org>
###
### This file is part of GNU Mes.
@ -91,6 +91,7 @@ DEFINE mov____%r0,(%r1) 000081e5
DEFINE mov____%r1,%r0 0100a0e1
DEFINE mov____%r1,%r2 0120a0e1
DEFINE mov____%esp,%r0 0d00a0e1
DEFINE mov____%esp,%r3 0d30a0e1
# e59f9004 ldr r9, [pc, #4] ; <L1>
# e5890000 str r0, [r9]

View file

@ -383,9 +383,9 @@
`(,(string-append "push___%" r0))
(armv4:call-label #f "__mesabi_imod" 2))
;; __mesabi_uldiv(a, b, remainderp)
(append `(("push___%r0") ; slot for remainder
("mov____%esp,%r0")
("push___%r0") ; pointer to remainder
(append `(("push___%r3") ; slot for remainder
("mov____%esp,%r3")
("push___%r3") ; pointer to remainder
(,(string-append "push___%" r1))
(,(string-append "push___%" r0)))
(armv4:call-label #f "__mesabi_uldiv" 3)