Changeset 5213


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

x8664 vinsns for typechecking signed/unsigned bytes of sizes 8,16,32,64.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/compiler/X86/X8664/x8664-vinsns.lisp

    r5187 r5213  
    25532553  :ok)
    25542554
     2555(define-x8664-vinsn require-s8 (()
     2556                                ((object :lisp))
     2557                                ((tag :u32)))
     2558  :again
     2559  (movq (:%q object) (:%q tag))
     2560  (shlq (:$ub (- x8664::nbits-in-word (+ 8 x8664::fixnumshift))) (:%q tag))
     2561  (sarq (:$ub (- x8664::nbits-in-word (+ 8 x8664::fixnumshift))) (:%q tag))
     2562  (cmpq (:%q object) (:%q tag))
     2563  (jne.pn :bad)
     2564  (testb (:$b x8664::fixnummask) (:%b object))
     2565  (je.pt :bad)
     2566  :bad
     2567  (uuo-error-reg-not-type (:%q object) (:$ub arch::error-object-not-signed-byte-8))
     2568  (jmp :again)
     2569  :ok)
     2570
    25552571(define-x8664-vinsn require-u8 (()
    25562572                                ((object :lisp))
    25572573                                ((tag :u32)))
    25582574  :again
    2559   (movq (:$l (lognot (ash #xff x8664::fixnumshift))) (:%q tag))
     2575  (movl (:$l (lognot (ash #xff x8664::fixnumshift))) (:%l tag))
    25602576  (andq (:% object) (:% tag))
    25612577  (je.pt :ok)
    25622578  (uuo-error-reg-not-type (:%q object) (:$ub arch::error-object-not-unsigned-byte-8))
    25632579  (jmp :again)
     2580  :ok)
     2581
     2582(define-x8664-vinsn require-s16 (()
     2583                                ((object :lisp))
     2584                                ((tag :s64)))
     2585  :again
     2586  (movq (:%q object) (:%q tag))
     2587  (shlq (:$ub (- x8664::nbits-in-word (+ 16 x8664::fixnumshift))) (:%q tag))
     2588  (sarq (:$ub (- x8664::nbits-in-word (+ 16 x8664::fixnumshift))) (:%q tag))
     2589  (cmpq (:%q object) (:%q tag))
     2590  (jne.pn :bad)
     2591  (testb (:$b x8664::fixnummask) (:%b object))
     2592  (je.pt :bad)
     2593  :bad
     2594  (uuo-error-reg-not-type (:%q object) (:$ub arch::error-object-not-signed-byte-16))
     2595  (jmp :again)
     2596  :ok)
     2597
     2598(define-x8664-vinsn require-u16 (()
     2599                                ((object :lisp))
     2600                                ((tag :u32)))
     2601  :again
     2602  (movl (:$l (lognot (ash #xffff x8664::fixnumshift))) (:%l tag))
     2603  (andq (:% object) (:% tag))
     2604  (je.pt :ok)
     2605  (uuo-error-reg-not-type (:%q object) (:$ub arch::error-object-not-unsigned-byte-16))
     2606  (jmp :again)
     2607  :ok)
     2608
     2609(define-x8664-vinsn require-s32 (()
     2610                                ((object :lisp))
     2611                                ((tag :s64)))
     2612  :again
     2613  (movq (:%q object) (:%q tag))
     2614  (shlq (:$ub (- x8664::nbits-in-word (+ 32 x8664::fixnumshift))) (:%q tag))
     2615  (sarq (:$ub (- x8664::nbits-in-word (+ 32 x8664::fixnumshift))) (:%q tag))
     2616  (cmpq (:%q object) (:%q tag))
     2617  (jne.pn :bad)
     2618  (testb (:$b x8664::fixnummask) (:%b object))
     2619  (je.pt :bad)
     2620  :bad
     2621  (uuo-error-reg-not-type (:%q object) (:$ub arch::error-object-not-signed-byte-32))
     2622  (jmp :again)
     2623  :ok)
     2624
     2625(define-x8664-vinsn require-u32 (()
     2626                                 ((object :lisp))
     2627                                 ((tag :u32)))
     2628  :again
     2629  (movq (:$q (lognot (ash #xffffffff x8664::fixnumshift))) (:%q tag))
     2630  (andq (:% object) (:% tag))
     2631  (je.pt :ok)
     2632  (uuo-error-reg-not-type (:%q object) (:$ub arch::error-object-not-unsigned-byte-32))
     2633  (jmp :again)
     2634  :ok)
     2635
     2636(define-x8664-vinsn require-s64 (()
     2637                                ((object :lisp))
     2638                                ((tag :s64)))
     2639  :again
     2640  (testb (:$b x8664::fixnummask) (:%b object))
     2641  (movq (:%q object) (:%q tag))
     2642  (je.pt :ok)
     2643  (andb (:$b x8664::fulltagmask) (:%b tag))
     2644  (cmpb (:$b x8664::fulltag-misc) (:%b tag))
     2645  (jne.pn :bad)
     2646  (cmpq (:$l x8664::two-digit-bignum-header) (:@ x8664::misc-header-offset (:%q object)))
     2647  (je.pt :ok)
     2648  :bad
     2649  (uuo-error-reg-not-type (:%q object) (:$ub arch::error-object-not-signed-byte-64))
     2650  (jmp :again)
     2651  :ok)
     2652
     2653(define-x8664-vinsn require-s64 (()
     2654                                ((object :lisp))
     2655                                ((tag :s64)))
     2656  :again
     2657  (testb (:$b x8664::fixnummask) (:%b object))
     2658  (movq (:%q object) (:%q tag))
     2659  (je.pt :ok-if-non-negative)
     2660  (andb (:$b x8664::fulltagmask) (:%b tag))
     2661  (cmpb (:$b x8664::fulltag-misc) (:%b tag))
     2662  (jne.pn :bad)
     2663  (cmpq (:$l x8664::two-digit-bignum-header) (:@ x8664::misc-header-offset (:%q object)))
     2664  (je :two)
     2665  (cmpq (:$l x8664::three-digit-bignum-header) (:@ x8664::misc-header-offset (:%q object)))
     2666  (je.pn :bad)
     2667  (cmpl (:$b 0) (:@ (+ x8664::misc-data-offset 8) (:%q object)))
     2668  (je :ok)
     2669  :bad
     2670  (uuo-error-reg-not-type (:%q object) (:$ub arch::error-object-not-unsigned-byte-64))
     2671  (jmp :again)
     2672  :two
     2673  (movq (:@ x8664::misc-data-offset (:%q object)) (:%q tag))
     2674  :ok-if-non-negative
     2675  (testq (:%q tag) (:%q tag))
     2676  (jl :bad)
    25642677  :ok)
    25652678
Note: See TracChangeset for help on using the changeset viewer.