Changeset 8367
- Timestamp:
- Jan 29, 2008, 5:35:40 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ia32/compiler/X86/X8632/x8632-vinsns.lisp
r8349 r8367 210 210 211 211 (define-x8632-vinsn set-nargs (() 212 ((n :s16const))) 213 ((:pred = n 0) 214 (xorw (:%w x8632::nargs ) (:%w x8632::nargs ))) 215 ((:not (:pred = n 0)) 216 (movw (:$w (:apply ash n x8632::fixnum-shift)) (:%w x8632::nargs )))) 212 ((n :u16const))) 213 ((:pred < n 32) 214 (xorl (:%l x8632::nargs) (:%l x8632::nargs)) 215 ((:pred > n 0) 216 (addl (:$b (:apply ash n x8632::fixnumshift)) (:%l x8632::nargs)))) 217 ((:pred >= n 32) 218 (movl (:$l (:apply ash n x8632::fixnumshift)) (:%l x8632::nargs)))) 217 219 218 220 (define-x8632-vinsn check-exact-nargs (() 219 221 ((n :u16const))) 220 222 ((:pred = n 0) 221 (testw (:%w x8632::nargs) (:%w x8632::nargs))) 222 ((:not (:pred = n 0)) 223 (cmpw (:$w (:apply ash n x8632::fixnum-shift)) (:%w x8632::nargs))) 223 (testl (:%l x8632::nargs) (:%l x8632::nargs))) 224 ((:and (:pred > n 0) (:pred < n 32)) 225 (cmpl (:$b (:apply ash n x8632::fixnumshift)) (:%l x8632::nargs))) 226 ((:pred >= n 32)) 227 (cmpl (:$l (:apply ash n x8632::fixnumshift)) (:%l x8632::nargs)) 224 228 (jz.pt :ok) 225 229 (uuo-error-wrong-number-of-args) … … 227 231 228 232 (define-x8632-vinsn check-min-nargs (() 229 ((n :u16const))) 230 (rcmpw (:%w x8632::nargs) (:$w (:apply ash n x8632::fixnum-shift))) 233 ((min :u16const))) 234 ((:pred = min 1) 235 (testl (:%l x8632::nargs) (:%l x8632::nargs)) 236 (jnz :ok)) 237 ((:and (:pred > min 1) (:pred < min 32)) 238 (rcmpl (:%l x8632::nargs) (:$b (:apply ash min x8632::fixnumshift)))) 239 ((:pred >= min 32) 240 (rcmpl (:%l x8632::nargs) (:$l (:apply ash min x8632::fixnumshift)))) 231 241 (jae.pt :ok) 232 242 (uuo-error-too-few-args) … … 234 244 235 245 (define-x8632-vinsn check-max-nargs (() 236 ((n :u16const))) 237 (rcmpw (:%w x8632::nargs) (:$w (:apply ash n x8632::fixnum-shift))) 246 ((n :u16const))) 247 ((:pred < n 32) 248 (rcmpl (:%l x8632::nargs) (:$b (:apply ash n x8632::fixnumshift)))) 249 ((:pred >= n 32) 250 (rcmpl (:%l x8632::nargs) (:$l (:apply ash n x8632::fixnumshift)))) 238 251 (jbe.pt :ok) 239 252 (uuo-error-too-many-args) … … 242 255 (define-x8632-vinsn default-1-arg (() 243 256 ((min :u16const))) 244 (rcmpw (:%w x8632::nargs) (:$w (:apply ash min x8632::word-shift))) 257 ((:pred < min 32) 258 (rcmpl (:%l x8632::nargs) (:$b (:apply ash min x8632::fixnumshift)))) 259 ((:pred >= min 32) 260 (rcmpl (:%l x8632::nargs) (:$l (:apply ash min x8632::fixnumshift)))) 245 261 (jne :done) 246 262 ((:pred >= min 2) … … 253 269 (define-x8632-vinsn default-2-args (() 254 270 ((min :u16const))) 255 (rcmpw (:%w x8632::nargs ) (:$w (:apply ash (:apply 1+ min) x8632::word-shift))) 271 ((:pred < (:apply 1+ min) 32) 272 (rcmpl (:%l x8632::nargs) (:$b (:apply ash (:apply 1+ min) x8632::fixnumshift)))) 273 ((:pred >= (:apply 1+ min) 32) 274 (rcmpl (:%l x8632::nargs) (:$l (:apply ash (:apply 1+ min) x8632::fixnumshift)))) 256 275 (ja :done) 257 276 (je :one) … … 275 294 ((n :u16const)) 276 295 ((temp :imm))) 277 (rcmpw (:%w x8632::nargs) (:$w (:apply ash n x8632::word-shift))) 278 (movw (:%w x8632::nargs) (:%w temp)) 296 ((:pred < n 32) 297 (rcmpl (:%l x8632::nargs) (:$b (:apply ash n x8632::fixnumshift)))) 298 ((:pred >= n 32) 299 (rcmpl (:%l x8632::nargs) (:$l (:apply ash n x8632::fixnumshift)))) 300 (movl (:%l x8632::nargs) (:%l temp)) 279 301 (jae :done) 280 302 :loop 281 (add w (:$w x8632::fixnumone) (:%wtemp))303 (addl (:$b x8632::fixnumone) (:%l temp)) 282 304 (pushl (:$l x8632::nil-value)) 283 (cmpw (:$w (:apply ash n x8632::word-shift)) (:%w temp)) 305 ((:pred < n 32) 306 (cmpl (:$b (:apply ash n x8632::fixnumshift)) (:%l temp))) 307 ((:pred >= n 32) 308 (cmpl (:$l (:apply ash n x8632::fixnumshift)) (:%l temp))) 284 309 (jne :loop) 285 310 :done) … … 299 324 () 300 325 ((temp :u32))) 301 (mov zwl (:%wx8632::nargs) (:%l temp))326 (movl (:%l x8632::nargs) (:%l temp)) 302 327 (subl (:$b (* $numx8632argregs x8632::node-size)) (:%l temp)) 303 328 (jle :push) … … 316 341 () 317 342 ((temp :u32))) 318 (mov zwl (:%wx8632::nargs) (:%l temp))343 (movl (:%l x8632::nargs) (:%l temp)) 319 344 (subl (:$b (* $numx8632argregs x8632::node-size)) (:%l temp)) 320 345 (movl (:%l x8632::ebp) (:@ x8632::node-size (:%l x8632::esp) (:%l temp))) … … 454 479 (define-x8632-vinsn trap-unless-cons (() 455 480 ((object :lisp)) 456 ((tag :u 16)))457 ;; check for NIL481 ((tag :u8))) 482 ;; special check for NIL (which is a distinguished CONS on x8632) 458 483 (cmpl (:$l x8632::nil-value) (:%l object)) 459 484 (je.pn :bad) 460 (mov w (:%w object) (:%wtag))461 (and w (:$w x8632::fulltagmask) (:%wtag))462 (cmp w (:$w x8632::fulltag-cons) (:%wtag))485 (movl (:%l object) (:%l tag)) 486 (andl (:$b x8632::fulltagmask) (:%l tag)) 487 (cmpl (:$b x8632::fulltag-cons) (:%l tag)) 463 488 (je.pt :ok) 464 489 :bad … … 468 493 (define-x8632-vinsn trap-unless-uvector (() 469 494 ((object :lisp)) 470 ((tag :u 16)))471 (mov w (:%w object) (:%wtag))472 (and w (:$w x8632::tagmask) (:%wtag))473 (cmp w (:$w x8632::tag-misc) (:%wtag))495 ((tag :u8))) 496 (movl (:%l object) (:%l tag)) 497 (andl (:$b x8632::tagmask) (:%l tag)) 498 (cmpl (:$b x8632::tag-misc) (:%l tag)) 474 499 (jz.pt :ok) 475 500 (uuo-error-reg-not-tag (:%l object) (:$ub x8632::tag-misc)) … … 477 502 478 503 (define-x8632-vinsn trap-unless-character (() 479 ((object :lisp))) 480 (cmpw (:$w x8632::subtag-character) (:%w object)) 504 ((object :lisp)) 505 ((tag :u8))) 506 ;; xxx can't be sure that object will be in a byte-accessible register 507 (movl (:%l object) (:%l tag)) 508 (cmpb (:$b x8632::subtag-character) (:%b tag)) 481 509 (je.pt :ok) 482 510 (uuo-error-reg-not-tag (:%l object) (:$ub x8632::subtag-character)) … … 486 514 ((object :lisp)) 487 515 ()) 488 (test w (:$w x8632::tagmask) (:%wobject))516 (testl (:$l x8632::tagmask) (:%l object)) 489 517 (je.pt :ok) 490 518 (uuo-error-reg-not-fixnum (:%l object)) … … 493 521 (define-x8632-vinsn set-flags-from-lisptag (() 494 522 ((reg :lisp))) 495 (test w (:$w x8632::tagmask) (:%wreg)))523 (testl (:$l x8632::tagmask) (:%l reg))) 496 524 497 525 (define-x8632-vinsn trap-unless-typecode= (() … … 517 545 (define-x8632-vinsn trap-unless-single-float (() 518 546 ((object :lisp)) 519 ((tag :u 16)))520 (mov w (:%w object) (:%wtag))521 (and w (:$w x8632::tagmask) (:%wtag))522 (cmp w (:$w x8632::tag-misc) (:%wtag))547 ((tag :u8))) 548 (movl (:%l object) (:%l tag)) 549 (andl (:$b x8632::tagmask) (:%l tag)) 550 (cmpl (:$b x8632::tag-misc) (:%l tag)) 523 551 (jne :have-tag) 524 (movw (:@ x8632::misc-subtag-offset (:%l object)) (:%w tag)) 552 ;; xxx tag might not be byte-accessible 553 (movb (:@ x8632::misc-subtag-offset (:%l object)) (:%b tag)) 525 554 :have-tag 526 (cmp w (:$w x8632::subtag-single-float) (:%wtag))555 (cmpl (:$b x8632::subtag-single-float) (:%l tag)) 527 556 (je.pt :ok) 528 (uuo-error-reg-not-tag (:% wobject) (:$ub x8632::subtag-single-float))557 (uuo-error-reg-not-tag (:%l object) (:$ub x8632::subtag-single-float)) 529 558 :ok) 530 559 531 560 (define-x8632-vinsn trap-unless-double-float (() 532 561 ((object :lisp)) 533 ((tag :u 16)))534 (mov w (:%w object) (:%wtag))535 (and w (:$w x8632::tagmask) (:%wtag))536 (cmp w (:$w x8632::tag-misc) (:%wtag))562 ((tag :u8))) 563 (movl (:%l object) (:%l tag)) 564 (andl (:$b x8632::tagmask) (:%l tag)) 565 (cmpl (:$b x8632::tag-misc) (:%l tag)) 537 566 (jne :have-tag) 538 (movw (:@ x8632::misc-subtag-offset (:%l object)) (:%w tag)) 567 ;; xxx tag might not be byte-accessible 568 (movb (:@ x8632::misc-subtag-offset (:%l object)) (:%b tag)) 539 569 :have-tag 540 (cmp w (:$w x8632::subtag-double-float) (:%wtag))570 (cmpl (:$b x8632::subtag-double-float) (:%l tag)) 541 571 (je.pt :ok) 542 (uuo-error-reg-not-tag (:% wobject) (:$ub x8632::subtag-double-float))572 (uuo-error-reg-not-tag (:%l object) (:$ub x8632::subtag-double-float)) 543 573 :ok) 544 574 545 575 (define-x8632-vinsn trap-unless-macptr (() 546 576 ((object :lisp)) 547 ((tag :u 16)))548 (mov w (:%w object) (:%wtag))549 (and w (:$w x8632::tagmask) (:%wtag))550 (cmp w (:$w x8632::tag-misc) (:%wtag))577 ((tag :u8))) 578 (movl (:%l object) (:%l tag)) 579 (andl (:$b x8632::tagmask) (:%l tag)) 580 (cmpl (:$b x8632::tag-misc) (:%l tag)) 551 581 (jne :have-tag) 552 (movw (:@ x8632::misc-subtag-offset (:%l object)) (:%w tag)) 582 ;; xxx tag might not be byte-accessible 583 (movb (:@ x8632::misc-subtag-offset (:%l object)) (:%b tag)) 553 584 :have-tag 554 (cmp w (:$w x8632::subtag-macptr) (:%wtag))585 (cmpl (:$b x8632::subtag-macptr) (:%l tag)) 555 586 (je.pt :ok) 556 587 (uuo-error-reg-not-tag (:%l object) (:$ub x8632::subtag-macptr)) … … 630 661 (define-x8632-vinsn extract-tag-fixnum (((tag :imm)) 631 662 ((object :lisp))) 632 (leal (:@ (:%l object) 4) (:%l tag)) 633 (andw (:$w (ash x8632::tagmask x8632::fixnumshift)) (:%w tag))) 663 ((:pred = 664 (:apply %hard-regspec-value tag) 665 (:apply %hard-regspec-value object)) 666 (shll (:$ub x8632::fixnumshift) (:%l object))) 667 ((:not (:pred = 668 (:apply %hard-regspec-value tag) 669 (:apply %hard-regspec-value object))) 670 (imull (:$b x8632::fixnumone) (:%l object) (:%l tag))) 671 (andl (:$b (ash x8632::tagmask x8632::fixnumshift)) (:%l tag))) 634 672 635 673 (define-x8632-vinsn extract-fulltag (((tag :u8)) 636 674 ((object :lisp))) 637 675 (movl (:%l object) (:%l tag)) 638 (and w (:$w x8632::fulltagmask) (:%wtag)))676 (andl (:$b x8632::fulltagmask) (:%l tag))) 639 677 640 678 (define-x8632-vinsn extract-fulltag-fixnum (((tag :imm)) 641 679 ((object :lisp))) 642 (leal (:@ (:%l object) 4) (:%l tag)) 643 (andw (:$w (ash x8632::fulltagmask x8632::fixnumshift)) (:%w tag))) 680 ((:pred = 681 (:apply %hard-regspec-value tag) 682 (:apply %hard-regspec-value object)) 683 (shll (:$ub x8632::fixnumshift) (:%l object))) 684 ((:not (:pred = 685 (:apply %hard-regspec-value tag) 686 (:apply %hard-regspec-value object))) 687 (imull (:$b x8632::fixnumone) (:%l object) (:%l tag))) 688 (andl (:$b (ash x8632::fulltagmask x8632::fixnumshift)) (:%l tag))) 644 689 645 690 (define-x8632-vinsn extract-typecode (((tag :imm)) … … 752 797 (cmpl (:%l src) (:%l dest)) 753 798 (jne.pn :bad) 754 (test w (:$w x8632::fixnummask) (:%wdest))799 (testl (:$l x8632::fixnummask) (:%l dest)) 755 800 (jne.pn :bad) 756 801 (sarl (:$ub x8632::fixnumshift) (:%l dest)) … … 781 826 (cmpl (:%l src) (:%l dest)) 782 827 (jne.pn :bad) 783 (test w (:$w x8632::fixnummask) (:%wdest))828 (testl (:$l x8632::fixnummask) (:%l dest)) 784 829 (je.pt :got-it) 785 830 :bad … … 803 848 (jmp :done) 804 849 :maybe-bignum 805 (and w (:$w x8632::tagmask) (:%wdest))806 (cmp w (:$w x8632::tag-misc) (:%wdest))850 (andl (:$b x8632::tagmask) (:%l dest)) 851 (cmpl (:$b x8632::tag-misc) (:%l dest)) 807 852 (jne :have-tag) 808 (mov w (:@ x8632::misc-subtag-offset (:%l src)) (:%wdest))809 (and w (:$w #xff) (:%wdest))853 (movb (:@ x8632::misc-subtag-offset (:%l src)) (:%b dest)) 854 (andl (:$l #xff) (:%l dest)) 810 855 :have-tag 811 (cmp w (:$w x8632::subtag-bignum) (:%wdest))856 (cmpl (:$b x8632::subtag-bignum) (:%l dest)) 812 857 (jne :bad) 813 858 (movl (:@ x8632::misc-header-offset (:%l src)) (:%l dest)) … … 834 879 (sarl (:$ub x8632::fixnumshift) (:%l dest)) 835 880 ;; Was it a fixnum ? 836 (test w (:$w x8632::fixnummask) (:%wsrc))881 (testl (:$l x8632::fixnummask) (:%l src)) 837 882 (je :done) 838 883 ;; May be a 2-digit bignum 839 (mov w (:%w src) (:%wdest))840 (and w (:$w x8632::tagmask) (:%wdest))841 (cmp w (:$w x8632::tag-misc) (:%wdest))884 (movl (:%l src) (:%l dest)) 885 (andl (:$b x8632::tagmask) (:%l dest)) 886 (cmpl (:$b x8632::tag-misc) (:%l dest)) 842 887 (jne :bad) 843 888 (cmpl (:$l x8632::two-digit-bignum-header) (:@ x8632::misc-header-offset (:%l src))) … … 1120 1165 1121 1166 (define-x8632-vinsn (push-argregs :push :node :vsp) (() 1122 ())1123 (rcmp w (:%w x8632::nargs) (:$w(* 1 x8632::node-size)))1167 ()) 1168 (rcmpl (:%l x8632::nargs) (:$b (* 1 x8632::node-size))) 1124 1169 (jb :done) 1125 1170 (je :one) … … 1132 1177 ((max :u32const))) 1133 1178 ((:pred >= max 2) 1134 (rcmp w (:%w x8632::nargs) (:$w(* 1 x8632::node-size)))1179 (rcmpl (:%l x8632::nargs) (:$b (* 1 x8632::node-size))) 1135 1180 (jb :done) 1136 1181 (je :one) … … 1140 1185 :done) 1141 1186 ((:pred = max 1) 1142 (test w (:%w x8632::nargs) (:%wx8632::nargs))1187 (testl (:%l x8632::nargs) (:%l x8632::nargs)) 1143 1188 (je :done) 1144 1189 (pushl (:%l x8632::arg_z)) … … 1322 1367 (define-x8632-vinsn fitvals (() 1323 1368 ((n :u16const)) 1324 ((imm :u 16)))1369 ((imm :u32))) 1325 1370 ((:pred = n 0) 1326 1371 (xorl (:%l imm) (:%l imm))) 1327 1372 ((:not (:pred = n 0)) 1328 (mov w (:$w (:apply ash n x8632::fixnumshift)) (:%wimm)))1329 (sub w (:%w x8632::nargs) (:%wimm))1373 (movl (:$l (:apply ash n x8632::fixnumshift)) (:%l imm))) 1374 (subl (:%l x8632::nargs) (:%l imm)) 1330 1375 (jae :push-more) 1331 (movswl (:%w imm) (:%l imm))1332 1376 (subl (:%l imm) (:%l x8632::esp)) 1333 1377 (jmp :done) 1334 1378 :push-loop 1335 1379 (pushl (:$l x8632::nil-value)) 1336 (add w (:$b x8632::node-size) (:%wx8632::nargs))1337 (sub w (:$b x8632::node-size) (:%wimm))1380 (addl (:$b x8632::node-size) (:%l x8632::nargs)) 1381 (subl (:$b x8632::node-size) (:%l imm)) 1338 1382 :push-more 1339 1383 (jne :push-loop) … … 2945 2989 () 2946 2990 ((tag :u8))) 2947 (pushl (:%l x8632::nargs .l))2991 (pushl (:%l x8632::nargs)) 2948 2992 (movl (:%l x8632::temp0) (:%l tag)) 2949 2993 ((:pred = (:apply %hard-regspec-value tag) x8632::eax) … … 2962 3006 (jne :bad) 2963 3007 :go 2964 (popl (:%l x8632::nargs .l))3008 (popl (:%l x8632::nargs)) 2965 3009 (jmp (:%l x8632::xfn)) 2966 3010 :bad … … 3074 3118 (pushl (:%l x8632::arg_z))) 3075 3119 ((:pred = min-fixed 1) ; at least one arg 3076 (rcmp w (:%w x8632::nargs) (:$w(ash 1 x8632::word-shift)))3120 (rcmpl (:%l x8632::nargs) (:$b (ash 1 x8632::word-shift))) 3077 3121 (je :z1) ;skip arg_y if exactly 1 3078 3122 (pushl (:%l x8632::arg_y)) … … 3080 3124 (pushl (:%l x8632::arg_z))) 3081 3125 ((:pred = min-fixed 0) 3082 (rcmp w (:%w x8632::nargs) (:$w(ash 1 x8632::word-shift)))3126 (rcmpl (:%l x8632::nargs) (:$b (ash 1 x8632::word-shift))) 3083 3127 (je :z0) ;exactly one 3084 3128 (jl :none) ;none … … 3089 3133 :none 3090 3134 ) 3091 (movzwl (:%w x8632::nargs) (:%l x8632::nargs))3092 3135 ((:not (:pred = min-fixed 0)) 3093 3136 (leal (:@ (:apply - (:apply ash min-fixed x8632::word-shift)) (:%l x8632::nargs)) … … 3160 3203 (define-x8632-vinsn pop-argument-registers (() 3161 3204 ()) 3162 (test w (:%w x8632::nargs) (:%wx8632::nargs))3205 (testl (:%l x8632::nargs) (:%l x8632::nargs)) 3163 3206 (je :done) 3164 (rcmp w (:%w x8632::nargs) (:$w(ash 1 x8632::word-shift)))3207 (rcmpl (:%l x8632::nargs) (:$l (ash 1 x8632::word-shift))) 3165 3208 (popl (:%l x8632::arg_z)) 3166 3209 (je :done) … … 3187 3230 (index :s32))) 3188 3231 (movss (:@ (:%l src) (:%l index)) (:%xmm dest))) 3189 3190 (define-x8632-vinsn zero-extend-nargs (()3191 ())3192 (movzwl (:%w x8632::nargs) (:%l x8632::nargs)))3193 3232 3194 3233 (define-x8632-vinsn load-adl (() … … 3333 3372 () 3334 3373 ((temp :imm))) 3335 (movzwl (:%w x8632::nargs) (:%l x8632::nargs))3336 3374 (leal (:@ (:%l x8632::esp) (:%l x8632::nargs)) (:%l temp)) 3337 3375 (subl (:@ (:%l temp)) (:%l x8632::nargs)) … … 3454 3492 ((nfixed :s16const))) 3455 3493 ((:pred > nfixed 0) 3456 (addw (:$w (:apply - (:apply ash nfixed x8632::word-shift))) (:%w x8632::nargs)))) 3457 3494 ((:pred < nfixed 32) 3495 (subl (:$b (:apply ash nfixed x8632::word-shift)) (:%l x8632::nargs))) 3496 ((:pred >= nfixed 32) 3497 (subl (:$l (:apply ash nfixed x8632::word-shift)) (:%l x8632::nargs))))) 3458 3498 3459 3499 ;; num-opt in arg_z 3460 3500 (define-x8632-vinsn opt-supplied-p (() 3461 3501 ()) 3462 (sub w (:%w x8632::nargs) (:%wx8632::arg_z))3502 (subl (:%l x8632::nargs) (:%l x8632::arg_z)) 3463 3503 (jmp :push-t-test) 3464 3504 :push-t-loop 3465 3505 (pushl (:$l x8632::t-value)) 3466 3506 :push-t-test 3467 (sub w (:$w x8632::node-size) (:%wx8632::nargs))3507 (subl (:$b x8632::node-size) (:%l x8632::nargs)) 3468 3508 (jge :push-t-loop) 3469 3509 (jmp :push-nil-test) … … 3471 3511 (pushl (:$l x8632::nil-value)) 3472 3512 :push-nil-test 3473 (sub w (:$w x8632::node-size) (:%wx8632::arg_z))3513 (subl (:$b x8632::node-size) (:%l x8632::arg_z)) 3474 3514 (jge :push-nil-loop)) 3475 3515 3476 3516 (define-x8632-vinsn one-opt-supplied-p (() 3477 3517 ()) 3478 (test w (:%w x8632::nargs) (:%wx8632::nargs))3518 (testl (:%l x8632::nargs) (:%l x8632::nargs)) 3479 3519 (je :one) 3480 3520 (pushl (:$l x8632::nil-value)) … … 3488 3528 ()) 3489 3529 ;; note that nargs is imm0 3490 (rcmp w (:%w x8632::nargs) (:$w(:apply ash 2 x8632::word-shift)))3530 (rcmpl (:%l x8632::nargs) (:$b (:apply ash 2 x8632::word-shift))) 3491 3531 (jge :two) 3492 (rcmp w (:%w x8632::nargs) (:$w(:apply ash 1 x8632::word-shift)))3532 (rcmpl (:%l x8632::nargs) (:$b (:apply ash 1 x8632::word-shift))) 3493 3533 (je :one) 3494 3534 ;; none
Note:
See TracChangeset
for help on using the changeset viewer.
