Raymond Toy pushed to branch arm64-dev-1 at cmucl / cmucl
Commits:
-
8c41e73d
by Raymond Toy at 2026-03-26T17:37:22-07:00
-
a5e7fa24
by Raymond Toy at 2026-03-26T18:53:21-07:00
-
84f4fab4
by Raymond Toy at 2026-03-26T18:54:47-07:00
-
438feef1
by Raymond Toy at 2026-03-26T19:11:10-07:00
-
374362c8
by Raymond Toy at 2026-03-26T19:24:00-07:00
-
28aca3d4
by Raymond Toy at 2026-03-26T19:35:05-07:00
-
4d3ed443
by Raymond Toy at 2026-03-26T20:31:14-07:00
-
2fe09d0e
by Raymond Toy at 2026-03-26T20:33:56-07:00
8 changed files:
- bin/clean-target.sh
- src/assembly/arm64/arith.lisp
- src/assembly/arm64/assem-rtns.lisp
- src/compiler/arm64/call.lisp
- src/compiler/arm64/vm.lisp
- src/tools/cross-scripts/cross-x86-arm64.lisp
- src/tools/worldbuild.lisp
- src/tools/worldcom.lisp
Changes:
| ... | ... | @@ -58,6 +58,7 @@ if [ -n "$KEEP" ]; then |
| 58 | 58 | fi
|
| 59 | 59 |
|
| 60 | 60 | find $TARGET -name "*.bytef" -o -name "*.lbytef" -o -name "*.assem" \
|
| 61 | + -o -name "*.arm64f" \
|
|
| 61 | 62 | -o -name "*.armf" \
|
| 62 | 63 | -o -name "*.axpf" \
|
| 63 | 64 | -o -name "*.hpf" \
|
| ... | ... | @@ -25,7 +25,7 @@ |
| 25 | 25 | ;;; (inst b :lt/:le/:gt/:ge lbl) (inst b :lt/:le/:gt/:ge lbl)
|
| 26 | 26 | ;;; (inst addcc dst a b) (inst adds dst a b)
|
| 27 | 27 | ;;; (inst subcc dst a b) (inst subs dst a b)
|
| 28 | -;;; (inst xorcc dst a b) (inst eors dst a b) ; sets flags
|
|
| 28 | +;;; (inst xorcc dst a b) (inst eor dst a b) ; then CBZ/CBNZ to branch on zero
|
|
| 29 | 29 | ;;; (inst sra dst src n) (inst asr dst src n)
|
| 30 | 30 | ;;; (inst srl dst src n) (inst lsr dst src n)
|
| 31 | 31 | ;;; (inst sll dst src n) (inst lsl dst src n)
|
| ... | ... | @@ -80,11 +80,13 @@ |
| 80 | 80 | |
| 81 | 81 | DO-STATIC-FUN
|
| 82 | 82 | ;; At least one arg is not a fixnum. Tail-call the generic function.
|
| 83 | - (loadw code-tn null-tn (static-function-offset 'two-arg-+))
|
|
| 83 | + ;; Pass TEMP so loadw can materialise the large static-function offset
|
|
| 84 | + ;; via LI + LDR rather than attempting a bare LDUR with imm9.
|
|
| 85 | + (loadw code-tn null-tn (static-function-offset 'two-arg-+) 0 temp)
|
|
| 84 | 86 | (inst li nargs (fixnumize 2))
|
| 85 | 87 | (move ocfp cfp-tn)
|
| 86 | - (lisp-jump code-tn)
|
|
| 87 | 88 | (move cfp-tn csp-tn)
|
| 89 | + (lisp-jump code-tn)
|
|
| 88 | 90 | |
| 89 | 91 | DONE
|
| 90 | 92 | (move res temp))
|
| ... | ... | @@ -124,11 +126,11 @@ |
| 124 | 126 | (lisp-return lra :offset 2)
|
| 125 | 127 | |
| 126 | 128 | DO-STATIC-FUN
|
| 127 | - (loadw code-tn null-tn (static-function-offset 'two-arg--))
|
|
| 129 | + (loadw code-tn null-tn (static-function-offset 'two-arg--) 0 temp)
|
|
| 128 | 130 | (inst li nargs (fixnumize 2))
|
| 129 | 131 | (move ocfp cfp-tn)
|
| 130 | - (lisp-jump code-tn)
|
|
| 131 | 132 | (move cfp-tn csp-tn)
|
| 133 | + (lisp-jump code-tn)
|
|
| 132 | 134 | |
| 133 | 135 | DONE
|
| 134 | 136 | (move res temp))
|
| ... | ... | @@ -170,10 +172,11 @@ |
| 170 | 172 | |
| 171 | 173 | ;; Check whether the result fits in a fixnum.
|
| 172 | 174 | ;; It fits iff the high word is just the sign-extension of the low word,
|
| 173 | - ;; i.e. (ASR lo 63) == hi. Use EORS to test and set flags.
|
|
| 175 | + ;; i.e. (ASR lo 63) == hi. EOR leaves zero in temp iff equal; CBZ
|
|
| 176 | + ;; branches without disturbing the condition flags.
|
|
| 174 | 177 | (inst asr temp lo 63)
|
| 175 | - (inst eors temp temp hi) ; temp = 0 iff hi == sign-ext(lo)
|
|
| 176 | - (inst b :eq LOW-FITS-IN-FIXNUM)
|
|
| 178 | + (inst eor temp temp hi)
|
|
| 179 | + (inst cbz temp LOW-FITS-IN-FIXNUM)
|
|
| 177 | 180 | |
| 178 | 181 | ;; Result needs a bignum. Shift the double-word hi:lo right by
|
| 179 | 182 | ;; fixnum-tag-bits to remove the fixnum tag contributed by y.
|
| ... | ... | @@ -190,8 +193,8 @@ |
| 190 | 193 | (let ((one-word (gen-label)))
|
| 191 | 194 | ;; Re-check: does the result actually fit in one bignum digit?
|
| 192 | 195 | (inst asr temp lo 63)
|
| 193 | - (inst eors temp temp hi)
|
|
| 194 | - (inst b :eq one-word)
|
|
| 196 | + (inst eor temp temp hi)
|
|
| 197 | + (inst cbz temp one-word)
|
|
| 195 | 198 | ;; Need 2 digits: write the header for a 2-word bignum...
|
| 196 | 199 | (inst li temp (logior (ash 2 type-bits) bignum-type))
|
| 197 | 200 | (storew hi res (1+ bignum-digits-offset) other-pointer-type)
|
| ... | ... | @@ -203,11 +206,11 @@ |
| 203 | 206 | (lisp-return lra :offset 2)
|
| 204 | 207 | |
| 205 | 208 | DO-STATIC-FUN
|
| 206 | - (loadw code-tn null-tn (static-function-offset 'two-arg-*))
|
|
| 209 | + (loadw code-tn null-tn (static-function-offset 'two-arg-*) 0 temp)
|
|
| 207 | 210 | (inst li nargs (fixnumize 2))
|
| 208 | 211 | (move ocfp cfp-tn)
|
| 209 | - (lisp-jump code-tn)
|
|
| 210 | 212 | (move cfp-tn csp-tn)
|
| 213 | + (lisp-jump code-tn)
|
|
| 211 | 214 | |
| 212 | 215 | LOW-FITS-IN-FIXNUM
|
| 213 | 216 | (move res lo))
|
| ... | ... | @@ -228,6 +231,7 @@ |
| 228 | 231 | |
| 229 | 232 | (:res res descriptor-reg a0-offset)
|
| 230 | 233 | |
| 234 | + (:temp temp non-descriptor-reg nl0-offset)
|
|
| 231 | 235 | (:temp nargs any-reg nargs-offset)
|
| 232 | 236 | (:temp ocfp any-reg ocfp-offset))
|
| 233 | 237 | ;; If x is not a fixnum, go straight to the static function.
|
| ... | ... | @@ -240,11 +244,11 @@ |
| 240 | 244 | (inst cmp x y) ; (pre-load flags for DO-COMPARE)
|
| 241 | 245 | |
| 242 | 246 | DO-STATIC-FN
|
| 243 | - (loadw code-tn null-tn (static-function-offset ',static-fn))
|
|
| 247 | + (loadw code-tn null-tn (static-function-offset ',static-fn) 0 temp)
|
|
| 244 | 248 | (inst li nargs (fixnumize 2))
|
| 245 | 249 | (move ocfp cfp-tn)
|
| 246 | - (lisp-jump code-tn)
|
|
| 247 | 250 | (move cfp-tn csp-tn)
|
| 251 | + (lisp-jump code-tn)
|
|
| 248 | 252 | |
| 249 | 253 | DO-COMPARE
|
| 250 | 254 | ;; CMP has already been executed above (in the fall-through path
|
| ... | ... | @@ -272,6 +276,7 @@ |
| 272 | 276 | |
| 273 | 277 | (:res res descriptor-reg a0-offset)
|
| 274 | 278 | |
| 279 | + (:temp temp non-descriptor-reg nl0-offset)
|
|
| 275 | 280 | (:temp lra descriptor-reg lra-offset)
|
| 276 | 281 | (:temp nargs any-reg nargs-offset)
|
| 277 | 282 | (:temp ocfp any-reg ocfp-offset))
|
| ... | ... | @@ -290,11 +295,11 @@ |
| 290 | 295 | (lisp-return lra :offset 2)
|
| 291 | 296 | |
| 292 | 297 | DO-STATIC-FN
|
| 293 | - (loadw code-tn null-tn (static-function-offset 'eql))
|
|
| 298 | + (loadw code-tn null-tn (static-function-offset 'eql) 0 temp)
|
|
| 294 | 299 | (inst li nargs (fixnumize 2))
|
| 295 | 300 | (move ocfp cfp-tn)
|
| 296 | - (lisp-jump code-tn)
|
|
| 297 | 301 | (move cfp-tn csp-tn)
|
| 302 | + (lisp-jump code-tn)
|
|
| 298 | 303 | |
| 299 | 304 | RETURN-T
|
| 300 | 305 | (load-symbol res t))
|
| ... | ... | @@ -311,6 +316,7 @@ |
| 311 | 316 | |
| 312 | 317 | (:res res descriptor-reg a0-offset)
|
| 313 | 318 | |
| 319 | + (:temp temp non-descriptor-reg nl0-offset)
|
|
| 314 | 320 | (:temp lra descriptor-reg lra-offset)
|
| 315 | 321 | (:temp nargs any-reg nargs-offset)
|
| 316 | 322 | (:temp ocfp any-reg ocfp-offset))
|
| ... | ... | @@ -326,11 +332,11 @@ |
| 326 | 332 | (lisp-return lra :offset 2)
|
| 327 | 333 | |
| 328 | 334 | DO-STATIC-FN
|
| 329 | - (loadw code-tn null-tn (static-function-offset 'two-arg-=))
|
|
| 335 | + (loadw code-tn null-tn (static-function-offset 'two-arg-=) 0 temp)
|
|
| 330 | 336 | (inst li nargs (fixnumize 2))
|
| 331 | 337 | (move ocfp cfp-tn)
|
| 332 | - (lisp-jump code-tn)
|
|
| 333 | 338 | (move cfp-tn csp-tn)
|
| 339 | + (lisp-jump code-tn)
|
|
| 334 | 340 | |
| 335 | 341 | RETURN-T
|
| 336 | 342 | (load-symbol res t))
|
| ... | ... | @@ -347,6 +353,7 @@ |
| 347 | 353 | |
| 348 | 354 | (:res res descriptor-reg a0-offset)
|
| 349 | 355 | |
| 356 | + (:temp temp non-descriptor-reg nl0-offset)
|
|
| 350 | 357 | (:temp lra descriptor-reg lra-offset)
|
| 351 | 358 | (:temp nargs any-reg nargs-offset)
|
| 352 | 359 | (:temp ocfp any-reg ocfp-offset))
|
| ... | ... | @@ -365,11 +372,11 @@ |
| 365 | 372 | |
| 366 | 373 | DO-STATIC-FN
|
| 367 | 374 | ;; Note: SPARC original calls 'two-arg-= here; preserved for fidelity.
|
| 368 | - (loadw code-tn null-tn (static-function-offset 'two-arg-=))
|
|
| 375 | + (loadw code-tn null-tn (static-function-offset 'two-arg-=) 0 temp)
|
|
| 369 | 376 | (inst li nargs (fixnumize 2))
|
| 370 | 377 | (move ocfp cfp-tn)
|
| 371 | - (lisp-jump code-tn)
|
|
| 372 | 378 | (move cfp-tn csp-tn)
|
| 379 | + (lisp-jump code-tn)
|
|
| 373 | 380 | |
| 374 | 381 | RETURN-NIL
|
| 375 | 382 | (move res null-tn)) |
| ... | ... | @@ -201,14 +201,17 @@ |
| 201 | 201 | (:temp lra descriptor-reg lra-offset)
|
| 202 | 202 | (:temp cur-uwp any-reg nl0-offset)
|
| 203 | 203 | (:temp next-uwp any-reg nl1-offset)
|
| 204 | - (:temp target-uwp any-reg nl2-offset))
|
|
| 204 | + (:temp target-uwp any-reg nl2-offset)
|
|
| 205 | + ;; Scratch for load/store-symbol-value address materialisation.
|
|
| 206 | + ;; Must be non-descriptor: LI writes a raw pointer into it.
|
|
| 207 | + (:temp sym-temp non-descriptor-reg nl3-offset))
|
|
| 205 | 208 | (declare (ignore start count))
|
| 206 | 209 | |
| 207 | 210 | (let ((error (generate-error-code nil invalid-unwind-error)))
|
| 208 | 211 | (inst cmp block 0)
|
| 209 | 212 | (inst b.eq error))
|
| 210 | 213 | |
| 211 | - (load-symbol-value cur-uwp lisp::*current-unwind-protect-block*)
|
|
| 214 | + (load-symbol-value cur-uwp lisp::*current-unwind-protect-block* sym-temp)
|
|
| 212 | 215 | (loadw target-uwp block vm:unwind-block-current-uwp-slot)
|
| 213 | 216 | (inst cmp cur-uwp target-uwp)
|
| 214 | 217 | (inst b.ne do-uwp)
|
| ... | ... | @@ -226,7 +229,7 @@ |
| 226 | 229 | |
| 227 | 230 | (loadw next-uwp cur-uwp vm:unwind-block-current-uwp-slot)
|
| 228 | 231 | (inst b do-exit)
|
| 229 | - (store-symbol-value next-uwp lisp::*current-unwind-protect-block*))
|
|
| 232 | + (store-symbol-value next-uwp lisp::*current-unwind-protect-block* sym-temp))
|
|
| 230 | 233 | |
| 231 | 234 | |
| 232 | 235 | (define-assembly-routine (throw
|
| ... | ... | @@ -240,7 +243,9 @@ |
| 240 | 243 | |
| 241 | 244 | (declare (ignore start count))
|
| 242 | 245 | |
| 243 | - (load-symbol-value catch lisp::*current-catch-block*)
|
|
| 246 | + ;; temp (nl0) is non-descriptor-reg — safe to pass as scratch to
|
|
| 247 | + ;; load-symbol-value for large static-symbol offset materialisation.
|
|
| 248 | + (load-symbol-value catch lisp::*current-catch-block* temp)
|
|
| 244 | 249 | |
| 245 | 250 | LOOP
|
| 246 | 251 |
| ... | ... | @@ -435,7 +435,7 @@ |
| 435 | 435 | (do ((arg register-arg-tns (rest arg))
|
| 436 | 436 | (i 0 (1+ i)))
|
| 437 | 437 | ((null arg))
|
| 438 | - (storew (first arg) args i temp))
|
|
| 438 | + (storew (first arg) args i 0 temp))
|
|
| 439 | 439 | (move start args)
|
| 440 | 440 | (move count nargs)
|
| 441 | 441 | (inst b done)
|
| ... | ... | @@ -364,6 +364,12 @@ |
| 364 | 364 | (defregtn csp any-reg)
|
| 365 | 365 | (defregtn cfp any-reg)
|
| 366 | 366 | (defregtn ocfp any-reg)
|
| 367 | +(defregtn nfp any-reg)
|
|
| 368 | +(defregtn cfunc any-reg)
|
|
| 369 | + |
|
| 370 | +(defregtn lexenv descriptor-reg)
|
|
| 371 | +(defregtn cname descriptor-reg)
|
|
| 372 | +(defregtn lra descriptor-reg)
|
|
| 367 | 373 | |
| 368 | 374 | |
| 369 | 375 |
| ... | ... | @@ -52,7 +52,6 @@ |
| 52 | 52 | ;; Not implemented yet
|
| 53 | 53 | :complex-fp-vops
|
| 54 | 54 | :alien-callback
|
| 55 | - :linkage-table
|
|
| 56 | 55 | :random-mt19937
|
| 57 | 56 | ))
|
| 58 | 57 |
| ... | ... | @@ -72,7 +72,11 @@ |
| 72 | 72 | "target:assembly/arm/array.assem"
|
| 73 | 73 | "target:assembly/arm/arith.assem"
|
| 74 | 74 | "target:assembly/arm/alloc.assem"))
|
| 75 | -
|
|
| 75 | + ,@(when (c:backend-featurep :arm64)
|
|
| 76 | + '("target:assembly/arm64/assem-rtns.assem"
|
|
| 77 | + "target:assembly/arm64/array.assem"
|
|
| 78 | + "target:assembly/arm64/arith.assem"
|
|
| 79 | + "target:assembly/arm64/alloc.assem"))
|
|
| 76 | 80 | |
| 77 | 81 | "target:code/type-boot"
|
| 78 | 82 | "target:code/fdefinition"
|
| ... | ... | @@ -184,6 +188,9 @@ |
| 184 | 188 | '("target:code/sgi-vm"))
|
| 185 | 189 | ,@(when (c:backend-featurep :ppc)
|
| 186 | 190 | '("target:code/ppc-vm"))
|
| 191 | +;; ,@(when (c:backend-featurep :arm64)
|
|
| 192 | +;; '("target:code/arm64-vm"))
|
|
| 193 | + |
|
| 187 | 194 | |
| 188 | 195 | "target:code/signal"
|
| 189 | 196 | "target:code/interr"
|
| ... | ... | @@ -112,6 +112,11 @@ |
| 112 | 112 | (comf "target:assembly/arm/arith" :assem t)
|
| 113 | 113 | (comf "target:assembly/arm/alloc" :assem t))
|
| 114 | 114 | |
| 115 | +(when (c:backend-featurep :arm64)
|
|
| 116 | + (comf "target:assembly/arm64/assem-rtns" :assem t)
|
|
| 117 | + (comf "target:assembly/arm64/array" :assem t)
|
|
| 118 | + (comf "target:assembly/arm64/arith" :assem t)
|
|
| 119 | + (comf "target:assembly/arm64/alloc" :assem t))
|
|
| 115 | 120 | |
| 116 | 121 | ;;; these guys can supposedly come in any order, but not really.
|
| 117 | 122 | ;;; some are put at the end so macros don't run interpreted and stuff.
|