home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / mitsch75.zip / scheme-7_5_17-src.zip / scheme-7.5.17 / src / compiler / machines / sparc / instr2a.scm < prev    next >
Encoding:
Text File  |  1999-01-02  |  2.7 KB  |  101 lines

  1. #| -*-Scheme-*-
  2.  
  3. $Id: instr2a.scm,v 1.2 1999/01/02 06:06:43 cph Exp $
  4.  
  5. Copyright (c) 1987-1999 Massachusetts Institute of Technology
  6.  
  7. This program is free software; you can redistribute it and/or modify
  8. it under the terms of the GNU General Public License as published by
  9. the Free Software Foundation; either version 2 of the License, or (at
  10. your option) any later version.
  11.  
  12. This program is distributed in the hope that it will be useful, but
  13. WITHOUT ANY WARRANTY; without even the implied warranty of
  14. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15. General Public License for more details.
  16.  
  17. You should have received a copy of the GNU General Public License
  18. along with this program; if not, write to the Free Software
  19. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20. |#
  21.  
  22. ;;;; SPARC instruction set, part 2a
  23.  
  24. (declare (usual-integrations))
  25.  
  26. ;;;; Instructions that require branch tensioning: branch
  27.  
  28. (let-syntax
  29.     ((branch
  30.       (macro (keyword annul condition)
  31.     `(define-instruction ,keyword
  32.        (((@PCO (? offset)))
  33.         (LONG (2 0)
  34.           ,annul
  35.           ,condition
  36.           (3 2)
  37.           (22 (quotient offset 4) SIGNED)))
  38.        (((@PCR (? label)))
  39.         (VARIABLE-WIDTH (offset `(/ (- ,label (+ *PC* 0)) 4))
  40.           ((#x-400000 #x3fffff)
  41.            (LONG (2 0)
  42.              ,annul
  43.              ,condition
  44.              (3 2)
  45.              (22 offset SIGNED)))
  46.           ((() ())
  47.            ;; B??a condition, yyy
  48.            ;; JMPL xxx, $0
  49.            ;; yyy: SETHI $1, high(offset)
  50.            ;; OR $1, $1, low(offset)
  51.            ;; JMPL $1,$0
  52.            ;; xxx: fall through
  53.            (LONG (2 0)
  54.              (1 1)        ; set anull bit, the JMPL is cancelled
  55.                     ; on a taken branch
  56.              ,condition
  57.              (3 2)
  58.              (22 2 SIGNED)    ; B??condition, yyy
  59.              (2 2)
  60.              (5 0)
  61.              (6 #x38)
  62.              (5 0)
  63.              (1 1)
  64.              (13 16 SIGNED)    ; JMPL xxx, $0
  65.              (2 0)
  66.              (5 1)
  67.              (3 4)
  68.              (22 (high-bits (* offset 4)) SIGNED)
  69.                     ; SETHI $1, high22(offset)
  70.              (2 2)
  71.              (5 1)
  72.              (6 2)
  73.              (5 1)
  74.              (1 1)
  75.              (13 (low-bits (* offset 4)) SIGNED)
  76.                     ; OR $1, $1, low10(offset)
  77.              (2 2)
  78.              (5 0)
  79.              (6 #x38)
  80.              (5 1)
  81.              (1 0)
  82.              (8 0)
  83.              (5 0)        ; JMPL $1,$0
  84.              ))))))))
  85.   (branch ba  (1 0) (4 8))
  86.   (branch bn  (1 0) (4 0))
  87.   (branch bne (1 0) (4 9))
  88.   (branch be  (1 0) (4 1))
  89.   (branch bg  (1 0) (4 10))
  90.   (branch ble (1 0) (4 2))
  91.   (branch bge (1 0) (4 11))
  92.   (branch bl  (1 0) (4 3))
  93.   (branch bgu (1 0) (4 12))
  94.   (branch bleu (1 0) (4 4))
  95.   (branch bcc (1 0) (4 13))
  96.   (branch bcs (1 0) (4 5))
  97.   (branch bpos (1 0) (4 14))
  98.   (branch bneg (1 0) (4 6))
  99.   (branch bvc  (1 0) (4 15))
  100.   (branch bvs  (1 0) (4 7))
  101.   )