ARM: Handle signed values in r-byte-mem-add, r-word-mem-add.

* lib/arm-mes/arm.M1 (ldrb___%r0,(%r1)): Delete macro.
(ldrh___%r0,(%r0)): Delete macro.
(ldrsh__%r0,(%r0)): New macro.
(ldrh___%r0,(%r1)): Delete macro.
(ldrsh__%r0,(%r1)): New macro.
(ldrh___%r1,(%r1)): Delete macro.
(ldrsh__%r1,(%r1)): New macro.
(ldrh___%r2,(%r2)): Delete macro.
(ldrsh__%r2,(%r2)): New macro.
(ldrh___%r3,(%r3)): Delete macro.
(ldrsh__%r3,(%r3)): New macro.
(ldrsb__%r0,(%r1)): New macro.
* module/mescc/armv4/as.scm (armv4:r-byte-mem-add): Use ldrsb.
(armv4:r-word-mem-add): Use ldrsh, add____$i32,(%r0).
(armv4:word-mem->r): Use ldrsh.
This commit is contained in:
Danny Milosavljevic 2020-06-18 20:40:38 +02:00
parent 821d1b8fe9
commit d9bda45853
No known key found for this signature in database
GPG key ID: E71A35542C30BAA5
2 changed files with 10 additions and 10 deletions

View file

@ -193,17 +193,17 @@ DEFINE str____%sp,(%fp,-#$i8) d00be5
DEFINE str____%lr,(%fp,-#$i8) e00be5
# Note: Loads INTO register r0 (ARM original operand order)
DEFINE ldrsb__%r0,(%r0) d000d0e1 # ldrsb r0, [r0]
DEFINE ldrsb__%r0,(%r1) d000d1e1 # ldrsb r0, [r1]
DEFINE ldrsb__%r1,(%r1) d010d1e1 # ldrsb r1, [r1]
DEFINE ldrsb__%r2,(%r2) d020d2e1 # ldrsb r2, [r2]
DEFINE ldrsb__%r3,(%r3) d030d3e1 # ldrsb r3, [r3]
DEFINE ldrsb__%r4,(%r4) d040d4e1 # ldrsb r4, [r4]
DEFINE ldrsb__%r5,(%r5) d050d5e1 # ldrsb r5, [r5]
DEFINE ldrb___%r0,(%r1) 0000d1e5 # ldrb r0, [r1]
DEFINE ldrh___%r0,(%r0) b000d0e1 # ldrh r0, [r0]
DEFINE ldrh___%r0,(%r1) b000d1e1 # ldrh r0, [r1]
DEFINE ldrh___%r1,(%r1) b010d1e1 # ldrh r1, [r1]
DEFINE ldrh___%r2,(%r2) b020d2e1 # ldrh r2, [r2]
DEFINE ldrh___%r3,(%r3) b030d3e1 # ldrh r3, [r3]
DEFINE ldrsh__%r0,(%r0) f000d0e1 # ldrsh r0, [r0]
DEFINE ldrsh__%r0,(%r1) f000d1e1 # ldrsh r0, [r1]
DEFINE ldrsh__%r1,(%r1) f010d1e1 # ldrsh r1, [r1]
DEFINE ldrsh__%r2,(%r2) f020d2e1 # ldrsh r2, [r2]
DEFINE ldrsh__%r3,(%r3) f030d3e1 # ldrsh r3, [r3]
DEFINE strb___%r0,(%r0) 0000c0e5 # strb r0, [r0]
DEFINE strb___%r0,(%r1) 0000c1e5 # strb r0, [r1]
DEFINE strb___%r1,(%r1) 0010c1e5 # strb r1, [r1]

View file

@ -148,7 +148,7 @@
(define (armv4:r-byte-mem-add info v)
(let ((r (get-r info)))
`((,(string-append "push___%r0"))
(,(string-append "ldrb___%r0,(%" r ")"))
(,(string-append "ldrsb__%r0,(%" r ")"))
,(optimize-immediate v
`((#:immediate1 ,v) ,(string-append "add____$i8,%r0"))
`((#:immediate1 ,(- v)) ,(string-append "sub____$i8,%r0"))
@ -159,11 +159,11 @@
(define (armv4:r-word-mem-add info v)
(let ((r (get-r info)))
`((,(string-append "push___%r0"))
(,(string-append "ldrh___%r0,(%" r ")"))
(,(string-append "ldrsh__%r0,(%" r ")"))
,(optimize-immediate v
`((#:immediate1 ,v) ,(string-append "add____$i8,%r0"))
`((#:immediate1 ,(- v)) ,(string-append "sub____$i8,%r0"))
(error "armv4:r-word-mem-add got immediate that doesn't fit into 8 bits but that is not implemented."))
`(("add____$i32,(%r0)" (#:immediate ,v))))
(,(string-append "strh___%r0,(%" r ")"))
(,(string-append "pop____%r0")))))
@ -256,7 +256,7 @@
(define (armv4:word-mem->r info)
(let ((r (get-r info)))
`((,(string-append "ldrh___%" r ",(%" r ")")))))
`((,(string-append "ldrsh__%" r ",(%" r ")")))))
(define (armv4:mem->r info)
(let ((r (get-r info)))