File:  [gforth] / gforth / arch / alpha / asm.fs
Revision 1.1: download - view: text, annotated - select for diffs
Tue Feb 2 22:02:54 1999 UTC (23 years, 3 months ago) by anton
Branches: MAIN
CVS tags: HEAD
MIPS port should now work even with GNU ld
added FORCE_REG stuff to arch/alpha/machine.h
added Alpha assembler (contributed by Bernd Thallner)

    1: \ bernd thallner 9725890 881
    2: \ assembler in forth for alpha
    3: 
    4: \ requires code.fs
    5: 
    6: also assembler definitions
    7: 
    8:  $0 constant v0
    9:  $1 constant t0
   10:  $2 constant t1
   11:  $3 constant t2
   12:  $4 constant t3
   13:  $5 constant t4
   14:  $6 constant t5
   15:  $7 constant t6
   16:  $8 constant t7
   17:  $9 constant s0
   18:  $a constant s1
   19:  $b constant s2
   20:  $c constant s3
   21:  $d constant s4
   22:  $e constant s5
   23:  $f constant fp
   24: $10 constant a0
   25: $11 constant a1
   26: $12 constant a2
   27: $13 constant a3
   28: $14 constant a4
   29: $15 constant a5
   30: $16 constant t8
   31: $17 constant t9
   32: $18 constant t10
   33: $19 constant t11
   34: $1a constant ra
   35: $1b constant t12
   36: $1c constant at
   37: $1d constant gp
   38: $1e constant sp
   39: $1f constant zero
   40: 
   41: : shift ( a n -- a<<=n )
   42: 0
   43: ?do
   44:   2*
   45: loop
   46: ;
   47: 
   48: : h, ( h -- )			\ 32 bit store
   49: here here aligned = if
   50:   here !
   51: else
   52:   32 shift 
   53:   here 4 - dup
   54:   @ rot or
   55:   swap !
   56: endif
   57: 4 allot
   58: ;
   59: 
   60: : Bra ( oo )			\ branch instruction format
   61:   create ,
   62: does> ( ra, branch_disp, addr )
   63:   @ 26 shift
   64:   swap $1fffff and or
   65:   swap $1f and 21 shift or h,
   66: ;
   67: 
   68: : Mbr ( oo.h )			\ memory branch instruction format
   69:   create 2,
   70: does> ( ra, rb, hint, addr )
   71:   2@ 14 shift
   72:   swap 26 shift or
   73:   swap $3fff and or
   74:   swap $1f and 16 shift or
   75:   swap $1f and 21 shift or
   76:   h,
   77: ; 
   78: 
   79: : F-P ( oo.fff )		\ floating-point operate instruction format
   80:   create 2,
   81: does> ( fa, fb, fc, addr )
   82:   2@ 5 shift
   83:   swap 26 shift or
   84:   swap $1f and or
   85:   swap $1f and 16 shift or
   86:   swap $1f and 21 shift or
   87:   h,
   88: ;
   89: 
   90: : Mem ( oo )			\ memory instruction format
   91:   create ,
   92: does> ( ra, memory_disp, rb, addr )
   93:   @ 26 shift
   94:   swap $1f and 16 shift or
   95:   swap $ffff and or 
   96:   swap $1f and 21 shift or
   97:   h,
   98: ;
   99: 
  100: : Mfc ( oo.ffff )		\ memory instruction with function code format
  101:   create 2,
  102: does> ( ra, rb, addr )
  103:   2@
  104:   swap 26 shift or
  105:   swap $1f and 16 shift or
  106:   swap $1f and 21 shift or
  107:   h,
  108: ;
  109: 
  110: : Opr ( oo.ff )			\ operate instruction format
  111:   create 2,
  112: does> ( ra, rb, rc, addr )
  113:   2@
  114:   5 shift
  115:   swap 26 shift or
  116:   swap $1f and or
  117:   swap $1f and 16 shift or
  118:   swap $1f and 21 shift or
  119:   h, 
  120: ;
  121: 
  122: : Opr# ( oo.ff )		\ operate instruction format
  123:   create 2,
  124: does> ( ra, lit, rc, addr )
  125:   2@
  126:   5 shift
  127:   swap 26 shift or
  128:   1 12 shift or
  129:   swap $1f and or
  130:   swap $ff and 13 shift or
  131:   swap $1f and 21 shift or
  132:   h, 
  133: ;
  134: 
  135: : Pcd ( oo )			\ palcode instruction format
  136:   create ,
  137: does> ( palcode, addr )
  138:   @ 26 shift
  139:   swap $3ffffff and or
  140:   h,
  141: ;
  142: 
  143: $15 $80   F-P  addf,
  144: $15 $a0   F-P  addg,
  145: $10 $00   Opr  addl,
  146: $10 $00   Opr# addl#,
  147: $10 $40   Opr  addlv,
  148: $10 $40   Opr# addlv#,
  149: $10 $20   Opr  addq,
  150: $10 $20   Opr# addq#,
  151: $10 $60   Opr  addqv,
  152: $10 $60   Opr# addqv#,
  153: $16 $80   F-P  adds,
  154: $16 $a0   F-P  addt,
  155: $11 $00   Opr  and,
  156: $11 $00   Opr# and#,
  157: $39       Bra  beq,
  158: $3e       Bra  bge,
  159: $3f       Bra  bgt,
  160: $11 $08   Opr  bic,
  161: $11 $08   Opr# bic#,
  162: $11 $20   Opr  bis,
  163: $11 $20   Opr# bis#,
  164: $38       Bra  blbc,
  165: $3c       Bra  blbs,
  166: $3b       Bra  ble,
  167: $3a       Bra  blt,
  168: $3d       Bra  bne,
  169: $30       Bra  br,
  170: $34       Bra  bsr,
  171: $00       Pcd  call_pal,
  172: $11 $24   Opr  cmoveq,
  173: $11 $24   Opr# cmoveq#,
  174: $11 $46   Opr  cmovge,
  175: $11 $46   Opr# cmovge#,
  176: $11 $66   Opr  cmovgt,
  177: $11 $66   Opr# cmovgt#,
  178: $11 $16   Opr  cmovlbc,
  179: $11 $16   Opr# cmovlbc#,
  180: $11 $14   Opr  cmovlbs,
  181: $11 $14   Opr# cmovlbs#,
  182: $11 $64   Opr  cmovle,
  183: $11 $64   Opr# cmovle#,
  184: $11 $44   Opr  cmovlt,
  185: $11 $44   Opr# cmovlt#,
  186: $11 $26   Opr  cmovne,
  187: $11 $26   Opr# cmovne#,
  188: $10 $0f   Opr  cmpbge,
  189: $10 $0f   Opr# cmpbge#,
  190: $10 $2d   Opr  cmpeq,
  191: $10 $2d   Opr# cmpeq#,
  192: $15 $a5   F-P  cmpgeq,
  193: $15 $a7   F-P  cmpgle,
  194: $15 $a6   F-P  cmpglt,
  195: $10 $6d   Opr  cmple,
  196: $10 $6d   Opr# cmple#,
  197: $10 $4d   Opr  cmplt,
  198: $10 $4d   Opr# cmplt#,
  199: $16 $a5   F-P  cmpteq,
  200: $16 $a7   F-P  cmptle,
  201: $16 $a6   F-P  cmptlt,
  202: $16 $a4   F-P  cmptun,
  203: $10 $3d   Opr  cmpule,
  204: $10 $3d   Opr# cmpule#,
  205: $10 $1d   Opr  cmpult,
  206: $10 $1d   Opr# cmpult#,
  207: $17 $20   F-P  cpys,
  208: $17 $22   F-P  cpyse,
  209: $17 $21   F-P  cpysn,
  210: $15 $9e   F-P  cvtdg,
  211: $15 $ad   F-P  cvtgd,
  212: $15 $ac   F-P  cvtgf,
  213: $15 $af   F-P  cvtgq,
  214: $17 $10   F-P  cvtlq,
  215: $15 $bc   F-P  cvtqf,
  216: $15 $be   F-P  cvtqg,
  217: $17 $30   F-P  cvtql,
  218: $17 $530  F-P  cvtqlsv,
  219: $17 $130  F-P  cvtqlv,
  220: $16 $bc   F-P  cvtqs,
  221: $16 $be   F-P  cvtqt,
  222: $16 $2ac  F-P  cvtst,
  223: $16 $af   F-P  cvttq,
  224: $16 $ac   F-P  cvtts,
  225: $15 $83   F-P  divf,
  226: $15 $a3   F-P  divg,
  227: $16 $83   F-P  divs,
  228: $16 $a3   F-P  divt,
  229: $11 $48   Opr  eqv,
  230: $11 $48   Opr# eqv#,
  231: $18 $400  Mfc  excb,
  232: $12 $06   Opr  extbl,
  233: $12 $06   Opr# extbl#,
  234: $12 $6a   Opr  extlh,
  235: $12 $6a   Opr# extlh#,
  236: $12 $26   Opr  extll,
  237: $12 $26   Opr# extll#,
  238: $12 $7a   Opr  extqh,
  239: $12 $7a   Opr# extqh#,
  240: $12 $36   Opr  extql,
  241: $12 $36   Opr# extql#,
  242: $12 $5a   Opr  extwh,
  243: $12 $5a   Opr# extwh#,
  244: $12 $16   Opr  extwl,
  245: $12 $16   Opr# extwl#,
  246: $31       Bra  fbeq,
  247: $36       Bra  fbge,
  248: $37       Bra  fbgt,
  249: $33       Bra  fble,
  250: $32       Bra  fblt,
  251: $35       Bra  fbne,
  252: $17 $2a   F-P  fcmoveq,
  253: $17 $2d   F-P  fcmovge,
  254: $17 $2f   F-P  fcmovgt,
  255: $17 $2e   F-P  fcmovle,
  256: $17 $2c   F-P  fcmovlt,
  257: $17 $2b   F-P  fcmovne,
  258: $18 $8000 Mfc  fetch,
  259: $18 $a000 Mfc  fetch_m,
  260: $12 $0b   Opr  insbl,
  261: $12 $0b   Opr# insbl#,
  262: $12 $67   Opr  inslh,
  263: $12 $67   Opr# inslh#,
  264: $12 $2b   Opr  insll,
  265: $12 $2b   Opr# insll#,
  266: $12 $77   Opr  insqh,
  267: $12 $77   Opr# insqh#,
  268: $12 $3b   Opr  insql,
  269: $12 $3b   Opr# insql#,
  270: $12 $57   Opr  inswh,
  271: $12 $57   Opr# inswh#,
  272: $12 $1b   Opr  inswl,
  273: $12 $1b   Opr# inswl#,
  274: $1a $00   Mbr  jmp,
  275: $1a $01   Mbr  jsr,
  276: $1a $03   Mbr  jsr_coroutine,
  277: $08       Mem  lda,
  278: $09       Mem  ldah,
  279: $20       Mem  ldf,
  280: $21       Mem  ldg,
  281: $28       Mem  ldl,
  282: $2a       Mem  ldl_l,
  283: $29       Mem  ldq,
  284: $2b       Mem  ldq_l,
  285: $0b       Mem  ldq_u,
  286: $22       Mem  lds,
  287: $23       Mem  ldt,
  288: $18 $4000 Mfc  mb,
  289: $17 $25   F-P  mf_fpcr,
  290: $12 $02   Opr  mskbl,
  291: $12 $02   Opr# mskbl#,
  292: $12 $62   Opr  msklh,
  293: $12 $62   Opr# msklh#,
  294: $12 $22   Opr  mskll,
  295: $12 $22   Opr# mskll#,
  296: $12 $72   Opr  mskqh,
  297: $12 $72   Opr# mskqh#,
  298: $12 $32   Opr  mskql,
  299: $12 $32   Opr# mskql#,
  300: $12 $52   Opr  mskwh,
  301: $12 $52   Opr# mskwh#,
  302: $12 $12   Opr  mskwl,
  303: $12 $12   Opr# mskwl#,
  304: $17 $24   F-P  mt_fpcr,
  305: $15 $82   F-P  mulf,
  306: $15 $a2   F-P  mulg,
  307: $13 $00   Opr  mull,
  308: $13 $00   Opr# mull#,
  309: $13 $40   Opr  mullv,
  310: $13 $40   Opr# mullv#,
  311: $13 $20   Opr  mullq,
  312: $13 $20   Opr# mullq#,
  313: $13 $60   Opr  mullqv,
  314: $13 $60   Opr# mullqv#,
  315: $16 $82   F-P  mulls,
  316: $16 $a2   F-P  mullt,
  317: $11 $28   Opr  ornot,
  318: $11 $28   Opr# ornot#,
  319: $18 $e000 Mfc  rc,
  320: $1a $02   Mbr  ret,
  321: $18 $c000 Mfc  rpcc,
  322: $18 $f000 Mfc  rs,
  323: $10 $02   Opr  s4addl,
  324: $10 $02   Opr# s4addl#,
  325: $10 $22   Opr  s4addq,
  326: $10 $22   Opr# s4addq#,
  327: $10 $0b   Opr  s4subl,
  328: $10 $0b   Opr# s4subl#,
  329: $10 $2b   Opr  s4subq,
  330: $10 $2b   Opr# s4subq#,
  331: $10 $12   Opr  s8addl,
  332: $10 $12   Opr# s8addl#,
  333: $10 $32   Opr  s8addq,
  334: $10 $32   Opr# s8addq#,
  335: $10 $1b   Opr  s8ubl,
  336: $10 $1b   Opr# s8ubl#,
  337: $10 $3b   Opr  s8ubq,
  338: $10 $3b   Opr# s8ubq#,
  339: $12 $39   Opr  sll,
  340: $12 $39   Opr# sll#,
  341: $12 $3c   Opr  sra,
  342: $12 $3c   Opr# sra#,
  343: $12 $34   Opr  srl,
  344: $12 $34   Opr# srl#,
  345: $24       Mem  stf,
  346: $25       Mem  stg,
  347: $26       Mem  sts,
  348: $2c       Mem  stl,
  349: $2e       Mem  stl_c,
  350: $2d       Mem  stq,
  351: $2f       Mem  stq_c,
  352: $0f       Mem  stq_u,
  353: $27       Mem  stt,
  354: $15 $81   F-P  subf,
  355: $15 $a1   F-P  subg,
  356: $10 $09   Opr  subl,
  357: $10 $09   Opr# subl#,
  358: $10 $49   Opr  sublv,
  359: $10 $49   Opr# sublv#,
  360: $10 $29   Opr  subq,
  361: $10 $29   Opr# subq#,
  362: $10 $69   Opr  subqv,
  363: $10 $69   Opr# subqv#,
  364: $16 $81   F-P  subs,
  365: $16 $a1   F-P  subt,
  366: $18 $00   Mfc  trapb,
  367: $13 $30   Opr  umulh,
  368: $13 $30   Opr# umulh#,
  369: $18 $4400 Mfc  wmb,
  370: $11 $40   Opr  xor,
  371: $11 $40   Opr# xor#,
  372: $12 $30   Opr  zap,
  373: $12 $30   Opr# zap#,
  374: $12 $31   Opr  zapnot,
  375: $12 $31   Opr# zapnot#,
  376: 

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>