fix ftype-lock! for arm32le

original commit: 16af3430e0f677de8de4af6b8828b9fde7a60243
This commit is contained in:
Matthew Flatt 2020-06-06 15:02:58 -06:00
parent bbbd5a76ac
commit e8a52e23a9

View File

@ -943,14 +943,16 @@
; NB: compiler ipmlements init-lock! and unlock! as 32-bit store of zero ; NB: compiler ipmlements init-lock! and unlock! as 32-bit store of zero
(define-instruction pred (lock!) (define-instruction pred (lock!)
[(op (x ur) (y ur) (w funky12)) [(op (x ur) (y ur) (w funky12))
(let ([u (make-tmp 'u)]) (let ([u (make-tmp 'u)]
[u2 (make-tmp 'u2)])
(values (values
(lea->reg x y w (lea->reg x y w
(lambda (r) (lambda (r)
(with-output-language (L15d Effect) (with-output-language (L15d Effect)
(seq (seq
`(set! ,(make-live-info) ,u (asm ,null-info ,asm-kill)) `(set! ,(make-live-info) ,u (asm ,null-info ,asm-kill))
`(asm ,null-info ,asm-lock ,r ,u))))) `(set! ,(make-live-info) ,u2 (asm ,null-info ,asm-kill))
`(asm ,null-info ,asm-lock ,r ,u ,u2)))))
`(asm ,info-cc-eq ,asm-eq ,u (immediate 0))))]) `(asm ,info-cc-eq ,asm-eq ,u (immediate 0))))])
(define-instruction effect (locked-incr! locked-decr!) (define-instruction effect (locked-incr! locked-decr!)
[(op (x ur) (y ur) (w funky12)) [(op (x ur) (y ur) (w funky12))
@ -2117,19 +2119,19 @@
[else (sorry! who "unexpected asm-swap type argument ~s" type)])))))) [else (sorry! who "unexpected asm-swap type argument ~s" type)]))))))
(define asm-lock (define asm-lock
; tmp = ldrex src ; tmp2 = ldrex src
; cmp tmp, 0 ; cmp tmp2, 0
; bne L1 (+2) ; bne L1 (+2)
; tmp = 1 ; tmp2 = 1
; tmp = strex tmp, src ; tmp = strex tmp2, src
;L1: ;L1:
(lambda (code* src tmp) (lambda (code* src tmp tmp2)
(Trivit (src tmp) (Trivit (src tmp tmp2)
(emit ldrex tmp src (emit ldrex tmp2 src
(emit cmpi tmp 0 (emit cmpi tmp2 0
(emit bnei 1 (emit bnei 1
(emit movi1 tmp 1 (emit movi1 tmp2 1
(emit strex tmp tmp src code*)))))))) (emit strex tmp tmp2 src code*))))))))
(define-who asm-lock+/- (define-who asm-lock+/-
; L: ; L: