Changeset 5221


Ignore:
Timestamp:
Sep 19, 2006, 12:38:38 AM (18 years ago)
Author:
Gary Byers
Message:

vinsns for REQUIRE-[US][8,16,32,64]

Location:
trunk/ccl/compiler/PPC
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/compiler/PPC/PPC32/ppc32-vinsns.lisp

    r5189 r5221  
    857857
    858858
     859(define-ppc32-vinsn require-s8 (()
     860                                ((object :lisp))
     861                                ((crf0 (:crf 0 ))
     862                                 (crf1 :crf)
     863                                 (tag :u32)))
     864  :again
     865  (clrlwi. tag object (- ppc32::nbits-in-word ppc32::nlisptagbits))
     866  (slwi tag object (- ppc32::nbits-in-word (+ 8 ppc32::fixnumshift)))
     867  (srawi tag tag (- ppc32::nbits-in-word (+ 8 ppc32::fixnumshift)))
     868  (cmpw crf1 tag object)
     869  (bne- crf1 :bad)
     870  (beq+ crf0 :got-it)
     871  :bad
     872  (uuo_intcerr arch::error-object-not-signed-byte-8 object)
     873  (b :again)
     874  :got-it)
     875
    859876(define-ppc32-vinsn require-u8 (()
    860877                                ((object :lisp))
     
    869886  (b :again)
    870887  :got-it)
     888
     889(define-ppc32-vinsn require-s16 (()
     890                                ((object :lisp))
     891                                ((crf0 (:crf 0 ))
     892                                 (crf1 :crf)
     893                                 (tag :u32)))
     894  :again
     895  (clrlwi. tag object (- ppc32::nbits-in-word ppc32::nlisptagbits))
     896  (slwi tag object (- ppc32::nbits-in-word (+ 16 ppc32::fixnumshift)))
     897  (srawi tag tag (- ppc32::nbits-in-word (+ 16 ppc32::fixnumshift)))
     898  (cmpw crf1 tag object)
     899  (bne- crf1 :bad)
     900  (beq+ crf0 :got-it)
     901  :bad
     902  (uuo_intcerr arch::error-object-not-signed-byte-16 object)
     903  (b :again)
     904  :got-it)
     905
     906(define-ppc32-vinsn require-u16 (()
     907                                ((object :lisp))
     908                                ((crf0 (:crf 0))
     909                                 (tag :u32)))
     910  :again
     911  ;; The bottom ppc32::fixnumshift bits and the top (- 32 (+
     912  ;; ppc32::fixnumshift 16)) must all be zero.
     913  (rlwinm. tag object 0 (- ppc32::nbits-in-word ppc32::fixnumshift) (- ppc32::least-significant-bit (+ ppc32::fixnumshift 16)))
     914  (beq+ crf0 :got-it)
     915  (uuo_intcerr arch::error-object-not-unsigned-byte-16 object)
     916  (b :again)
     917  :got-it)
     918
     919(define-ppc32-vinsn require-s32 (()
     920                                 ((src :lisp))
     921                                 ((crfx :crf)
     922                                  (crfy :crf)
     923                                  (tag :u32)))
     924  :again
     925  (clrlwi tag src (- ppc32::nbits-in-word ppc32::nlisptagbits))
     926  (cmpwi crfx tag ppc32::tag-fixnum)
     927  (cmpwi crfy tag ppc32::tag-misc)
     928  (beq+ crfx :got-it)
     929  (bne- crfy :bad)
     930  (lwz tag ppc32::misc-header-offset src)
     931  (cmpwi crfx tag ppc32::one-digit-bignum-header)
     932  (beq+ crfx :got-it)
     933  :bad
     934  (uuo_intcerr arch::error-object-not-signed-byte-32 src)
     935  (b :again)
     936  :got-it)
     937
     938
     939(define-ppc32-vinsn require-u32 (()
     940                                 ((src :lisp))
     941                                 ((crf0 (:crf 0))
     942                                  (crf1 :crf)
     943                                  (temp :u32)))
     944  :again
     945  (rlwinm. temp src 0 (- ppc32::nbits-in-word ppc32::fixnumshift) 0)
     946  (beq+ crf0 :got-it)
     947  (clrlwi temp src (- ppc32::nbits-in-word ppc32::nlisptagbits))
     948  (cmpwi crf0 temp ppc32::tag-misc)
     949  (bne- crf0 :bad)
     950  (lwz temp ppc32::misc-header-offset src)
     951  (cmpwi crf1 temp ppc32::two-digit-bignum-header)
     952  (cmpwi crf0 temp ppc32::one-digit-bignum-header)
     953  (lwz temp ppc32::misc-data-offset src)
     954  (beq crf1 :two)
     955  (bne crf0 :bad)
     956  (cmpwi crf0 temp 0)
     957  (bgt+ crf0 :got-it)
     958  :bad
     959  (uuo_intcerr arch::error-object-not-unsigned-byte-32 src)
     960  (b :again)
     961  :two
     962  (lwz temp (+ ppc32::misc-data-offset 4) src)
     963  (cmpwi crf0 temp 0)
     964  (bne- crf0 :bad)
     965  :got-it)
     966
     967(define-ppc32-vinsn require-s64 (()
     968                                 ((src :lisp))
     969                                 ((crfx :crf)
     970                                  (crfy :crf)
     971                                  (tag :u32)))
     972  :again
     973  (clrlwi tag src (- ppc32::nbits-in-word ppc32::nlisptagbits))
     974  (cmpwi crfx tag ppc32::tag-fixnum)
     975  (cmpwi crfy tag ppc32::tag-misc)
     976  (beq+ crfx :got-it)
     977  (bne- crfy :bad)
     978  (lwz tag ppc32::misc-header-offset src)
     979  (cmpwi crfx tag ppc32::one-digit-bignum-header)
     980  (cmpwi crfy tag ppc32::two-digit-bignum-header)
     981  (lwz tag ppc32::misc-data-offset src)
     982  (beq+ crfx :got-it)
     983  (beq+ crfy :got-it)
     984  :bad
     985  (uuo_intcerr arch::error-object-not-signed-byte-64 src)
     986  (b :again)
     987  :got-it)
     988
     989(define-ppc32-vinsn require-u64 (()
     990                                 ((src :lisp))
     991                                 ((crf0 (:crf 0))
     992                                  (crf1 :crf)
     993                                  (crf2 :crf)
     994                                  (temp :u32)))
     995  :again
     996  (rlwinm. temp src 0 (- ppc32::nbits-in-word ppc32::fixnumshift) 0)
     997  (beq+ crf0 :got-it)
     998  (clrlwi temp src (- ppc32::nbits-in-word ppc32::nlisptagbits))
     999  (cmpwi crf0 temp ppc32::tag-misc)
     1000  (bne- crf0 :bad)
     1001  (lwz temp ppc32::misc-header-offset src)
     1002  (cmpwi crf2 temp ppc32::three-digit-bignum-header)
     1003  (cmpwi crf1 temp ppc32::two-digit-bignum-header)
     1004  (cmpwi crf0 temp ppc32::one-digit-bignum-header)
     1005  (lwz temp ppc32::misc-data-offset src)
     1006  (beq crf2 :three)
     1007  (beq crf1 :two)
     1008  (bne crf0 :bad)
     1009  (cmpwi crf0 temp 0)
     1010  (bgt+ crf0 :got-it)
     1011  :bad
     1012  (uuo_intcerr arch::error-object-not-unsigned-byte-64 src)
     1013  (b :again)
     1014  :three
     1015  (lwz temp (+ ppc32::misc-data-offset 8) src)
     1016  (cmpwi crf0 temp 0)
     1017  (beq+ crf0 :got-it)
     1018  (b :bad)
     1019  :two
     1020  (lwz temp (+ ppc32::misc-data-offset 4) src)
     1021  (cmpwi crf0 temp 0)
     1022  (blt- crf0 :bad)
     1023  :got-it)
     1024
     1025
    8711026
    8721027(define-ppc32-vinsn require-char-code (()
  • trunk/ccl/compiler/PPC/PPC64/ppc64-vinsns.lisp

    r5189 r5221  
    935935
    936936
     937(define-ppc64-vinsn require-s8 (()
     938                                ((object :lisp))
     939                                ((crf0 (:crf 0))
     940                                 (crf1 :crf)
     941                                 (tag :s64)))
     942  :again
     943  (clrldi. tag object (- ppc64::nbits-in-word ppc64::nlisptagbits))
     944  (sldi tag object (- ppc64::nbits-in-word (+ 8 ppc64::fixnumshift)))
     945  (sradi tag tag (- ppc64::nbits-in-word (+ 8 ppc64::fixnumshift)))
     946  (cmpd crf1 tag object)
     947  (bne- crf1 :bad)
     948  (beq+ crf0 :got-it)
     949  :bad
     950  (uuo_intcerr arch::error-object-not-signed-byte-8 object)
     951  (b :again)
     952  :got-it)
     953
    937954(define-ppc64-vinsn require-u8 (()
    938955                                ((object :lisp))
     
    948965  :got-it)
    949966
    950 (define-ppc64-vinsn require-u8 (()
     967(define-ppc64-vinsn require-s16 (()
     968                                 ((object :lisp))
     969                                 ((crf0 (:crf 0))
     970                                  (crf1 :crf)
     971                                  (tag :s64)))
     972  :again
     973  (sldi tag object (- ppc64::nbits-in-word (+ 16 ppc64::fixnumshift)))
     974  (sradi tag tag (- ppc64::nbits-in-word (+ 16 ppc64::fixnumshift)))
     975  (cmpd crf1 tag object)
     976  (clrldi. tag object (- ppc64::nbits-in-word ppc64::nlisptagbits))
     977  (bne- crf1 :bad)
     978  (beq+ crf0 :got-it)
     979  :bad
     980  (uuo_intcerr arch::error-object-not-signed-byte-16 object)
     981  (b :again)
     982  :got-it)
     983
     984(define-ppc64-vinsn require-u16 (()
    951985                                ((object :lisp))
    952986                                ((crf0 (:crf 0))
    953                                  (tag :u32)))
     987                                 (tag :s64)))
    954988  :again
    955989  ;; The bottom ppc64::fixnumshift bits and the top (- 64 (+
    956990  ;; ppc64::fixnumshift 8)) must all be zero.
    957   (rldicr. tag object (- 64 ppc64::fixnumshift) 55)
     991  (rldicr. tag object (- 64 ppc64::fixnumshift) 47)
    958992  (beq+ crf0 :got-it)
    959   (uuo_intcerr arch::error-object-not-unsigned-byte-8 object)
     993  (uuo_intcerr arch::error-object-not-unsigned-byte-16 object)
    960994  (b :again)
    961995  :got-it)
     996
     997(define-ppc64-vinsn require-s32 (()
     998                                 ((object :lisp))
     999                                 ((crf0 (:crf 0))
     1000                                  (crf1 :crf)
     1001                                  (tag :s64)))
     1002  :again
     1003  (sldi tag object (- ppc64::nbits-in-word (+ 32 ppc64::fixnumshift)))
     1004  (sradi tag tag (- ppc64::nbits-in-word (+ 32 ppc64::fixnumshift)))
     1005  (cmpd crf1 tag object)
     1006  (clrldi. tag object (- ppc64::nbits-in-word ppc64::nlisptagbits))
     1007  (bne- crf1 :bad)
     1008  (beq+ crf0 :got-it)
     1009  :bad
     1010  (uuo_intcerr arch::error-object-not-signed-byte-32 object)
     1011  (b :again)
     1012  :got-it)
     1013
     1014(define-ppc64-vinsn require-u32 (()
     1015                                ((object :lisp))
     1016                                ((crf0 (:crf 0))
     1017                                 (tag :s64)))
     1018  :again
     1019  ;; The bottom ppc64::fixnumshift bits and the top (- 64 (+
     1020  ;; ppc64::fixnumshift 32)) must all be zero.
     1021  (rldicr. tag object (- 64 ppc64::fixnumshift) 31)
     1022  (beq+ crf0 :got-it)
     1023  (uuo_intcerr arch::error-object-not-unsigned-byte-32 object)
     1024  (b :again)
     1025  :got-it)
     1026
     1027(define-ppc64-vinsn require-s64 (()
     1028                                 ((object :lisp))
     1029                                 ((crf0 (:crf 0))
     1030                                  (crf1 :crf)
     1031                                  (tag :s64)))
     1032  :again
     1033  (clrldi. tag object (- ppc64::nbits-in-word ppc64::nlisptagbits))
     1034  (clrldi tag object (- ppc64::nbits-in-word ppc64::ntagbits))
     1035  (beq+ crf0 :got-it)
     1036  (cmpdi crf1 tag ppc64::fulltag-misc)
     1037  (bne- crf1 :bad)
     1038  (ld tag ppc64::misc-header-offset object)
     1039  (cmpdi crf0 tag ppc64::two-digit-bignum-header)
     1040  (beq+ crf0 :got-it)
     1041  :bad
     1042  (uuo_intcerr arch::error-object-not-signed-byte-64 object)
     1043  (b :again)
     1044  :got-it)
     1045
     1046(define-ppc64-vinsn require-u64 (()
     1047                                 ((object :lisp))
     1048                                 ((crf0 (:crf 0))
     1049                                  (crf1 :crf)
     1050                                  (crf2 :crf)
     1051                                  (temp :u64)))
     1052  (clrldi. temp object (- ppc64::nbits-in-word ppc64::fixnumshift))
     1053  (clrldi temp object (- ppc64::nbits-in-word ppc64::ntagbits))
     1054  (cmpdi crf1 temp ppc64::fulltag-misc)
     1055  (sradi temp object ppc64::fixnumshift)
     1056  (beq crf0 :good-if-positive)
     1057  (bne crf1 :bad)
     1058  (ld temp ppc64::misc-header-offset object)
     1059  (cmpdi crf0 temp  ppc64::three-digit-bignum-header)
     1060  (cmpdi crf2 temp ppc64::two-digit-bignum-header)
     1061  (beq crf0 :three-digit)
     1062  (bne crf2 :bad)
     1063  ;; two-digit case.  Must be positive.
     1064  (ld temp ppc64::misc-data-offset object)
     1065  (rotldi temp temp 32)
     1066  :good-if-positive
     1067  (cmpdi crf1 temp 0)
     1068  (bge crf1 :good)
     1069  :bad
     1070  (uuo_interr arch::error-object-not-unsigned-byte-64 object)
     1071  :three-digit
     1072  (lwz temp (+ ppc64::misc-data-offset 8) object)
     1073  (cmpwi crf1 temp 0)
     1074  (bne crf1 :bad)
     1075  :good
     1076  )
     1077
    9621078
    9631079(define-ppc64-vinsn require-char-code (()
Note: See TracChangeset for help on using the changeset viewer.