home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / emulate / sparc / addsub.s < prev    next >
Text File  |  1991-11-20  |  5KB  |  312 lines

  1. !
  2. ! test addition/subtraction insns
  3. !
  4. ! add
  5.     mov    123,%o1
  6.     mov    456,%o2
  7.     add    %o1,%o2,%o3
  8.     cmp    %o3,579
  9.     bne,a    .+0x8
  10.     unimp    0
  11.     add    %o1,789,%o3
  12.     cmp    %o3,912
  13.     bne,a    .+0x8
  14.     unimp    0
  15.     mov    -456,%o0
  16.     add    %o1,%o0,%o3
  17.     cmp    %o3,-333
  18.     bne,a    .+0x8
  19.     unimp    0
  20.     add    %o0,-321,%o3
  21.     cmp    %o3,-777
  22.     bne,a    .+0x8
  23.     unimp    0
  24. ! addcc
  25.     addcc    %o1,%o2,%g0
  26.     be,a    .+0x8
  27.     unimp    0
  28.     bcs,a    .+0x8
  29.     unimp    0
  30.     bvs,a    .+0x8
  31.     unimp    0
  32.     bneg,a    .+0x8
  33.     unimp    0
  34.     addcc    %o1,-123,%g0
  35.     bne,a    .+0x8
  36.     unimp    0
  37.     bcc,a    .+0x8
  38.     unimp    0
  39.     bvs,a    .+0x8
  40.     unimp    0
  41.     bneg,a    .+0x8
  42.     unimp    0
  43.     set    0x7fffffff,%l1
  44.     addcc    %l1,%l1,%g0
  45.     be,a    .+0x8
  46.     unimp    0
  47.     bcs,a    .+0x8
  48.     unimp    0
  49.     bvc,a    .+0x8
  50.     unimp    0
  51.     bpos,a    .+0x8
  52.     unimp    0
  53.     set    0x80000001,%l2
  54.     addcc    %l2,%l2,%g0
  55.     be,a    .+0x8
  56.     unimp    0
  57.     bcc,a    .+0x8
  58.     unimp    0
  59.     bvc,a    .+0x8
  60.     unimp    0
  61.     bneg,a    .+0x8
  62.     unimp    0
  63. ! addx
  64.     addx    %o1,1,%o3
  65.     cmp    %o3,125
  66.     bne,a    .+0x8
  67.     unimp    0
  68.     addx    %o1,1,%o3
  69.     cmp    %o3,124
  70.     bne,a    .+0x8
  71.     unimp    0
  72. ! addxcc
  73.     addxcc    %o1,%o2,%g0
  74.     be,a    .+0x8
  75.     unimp    0
  76.     bcs,a    .+0x8
  77.     unimp    0
  78.     bvs,a    .+0x8
  79.     unimp    0
  80.     bneg,a    .+0x8
  81.     unimp    0
  82.     addxcc    %o1,-123,%g0
  83.     bne,a    .+0x8
  84.     unimp    0
  85.     bcc,a    .+0x8
  86.     unimp    0
  87.     bvs,a    .+0x8
  88.     unimp    0
  89.     bneg,a    .+0x8
  90.     unimp    0
  91.     set    0x7fffffff,%l1
  92.     addxcc    %l1,%l1,%g0
  93.     be,a    .+0x8
  94.     unimp    0
  95.     bcs,a    .+0x8
  96.     unimp    0
  97.     bvc,a    .+0x8
  98.     unimp    0
  99.     bpos,a    .+0x8
  100.     unimp    0
  101.     set    0x80000001,%l2
  102.     addxcc    %l2,%l2,%g0
  103.     be,a    .+0x8
  104.     unimp    0
  105.     bcc,a    .+0x8
  106.     unimp    0
  107.     bvc,a    .+0x8
  108.     unimp    0
  109.     bneg,a    .+0x8
  110.     unimp    0
  111.     subcc    %g0,1,%g0
  112.     addxcc    %l1,%g0,%g0
  113.     bvc,a    .+0x8
  114.     unimp    0
  115. ! sub
  116.     sub    %o1,%o2,%o3
  117.     cmp    %o3,-333
  118.     bne,a    .+0x8
  119.     unimp    0
  120.     sub    %o1,788,%o3
  121.     cmp    %o3,-665
  122.     bne,a    .+0x8
  123.     unimp    0
  124.     mov    -456,%o0
  125.     sub    %o1,%o0,%o3
  126.     cmp    %o3,579
  127.     bne,a    .+0x8
  128.     unimp    0
  129.     sub    %o0,-321,%o3
  130.     cmp    %o3,-135
  131.     bne,a    .+0x8
  132.     unimp    0
  133. ! subcc
  134.     subcc    %o1,%o2,%g0
  135.     be,a    .+0x8
  136.     unimp    0
  137.     bcc,a    .+0x8
  138.     unimp    0
  139.     bvs,a    .+0x8
  140.     unimp    0
  141.     bpos,a    .+0x8
  142.     unimp    0
  143.     subcc    %o1,123,%g0
  144.     bne,a    .+0x8
  145.     unimp    0
  146.     bcs,a    .+0x8
  147.     unimp    0
  148.     bvs,a    .+0x8
  149.     unimp    0
  150.     bneg,a    .+0x8
  151.     unimp    0
  152.     set    0x7fffffff,%l1
  153.     set    0x80000001,%l2
  154.     subcc    %l1,%l2,%g0
  155.     be,a    .+0x8
  156.     unimp    0
  157.     bcc,a    .+0x8
  158.     unimp    0
  159.     bvc,a    .+0x8
  160.     unimp    0
  161.     bpos,a    .+0x8
  162.     unimp    0
  163.     subcc    %l2,%l1,%g0
  164.     be,a    .+0x8
  165.     unimp    0
  166.     bcs,a    .+0x8
  167.     unimp    0
  168.     bvc,a    .+0x8
  169.     unimp    0
  170.     bneg,a    .+0x8
  171.     unimp    0
  172. ! subx
  173.     cmp    %g0,-1
  174.     subx    %o1,1,%o3
  175.     cmp    %o3,121
  176.     bne,a    .+0x8
  177.     unimp    0
  178.     subx    %o1,1,%o3
  179.     cmp    %o3,122
  180.     bne,a    .+0x8
  181.     unimp    0
  182. ! subxcc
  183.     subxcc    %o1,%o2,%g0
  184.     be,a    .+0x8
  185.     unimp    0
  186.     bcc,a    .+0x8
  187.     unimp    0
  188.     bvs,a    .+0x8
  189.     unimp    0
  190.     bpos,a    .+0x8
  191.     unimp    0
  192.     subxcc    %o1,122,%g0
  193.     bne,a    .+0x8
  194.     unimp    0
  195.     bcs,a    .+0x8
  196.     unimp    0
  197.     bvs,a    .+0x8
  198.     unimp    0
  199.     bneg,a    .+0x8
  200.     unimp    0
  201.     set    0x7fffffff,%l1
  202.     set    0x80000001,%l2
  203.     subxcc    %l1,%l2,%g0
  204.     be,a    .+0x8
  205.     unimp    0
  206.     bcc,a    .+0x8
  207.     unimp    0
  208.     bvc,a    .+0x8
  209.     unimp    0
  210.     bpos,a    .+0x8
  211.     unimp    0
  212.     subxcc    %l2,%l1,%g0
  213.     be,a    .+0x8
  214.     unimp    0
  215.     bcs,a    .+0x8
  216.     unimp    0
  217.     bvc,a    .+0x8
  218.     unimp    0
  219.     bneg,a    .+0x8
  220.     unimp    0
  221.     subcc    %g0,1,%g0
  222.     subxcc    %l2,1,%g0
  223.     bvc,a    .+0x8
  224.     unimp    0
  225. ! taddcc
  226.     taddcc    %g0,1,%g0
  227.     bvc,a    .+0x8
  228.     unimp    0
  229.     taddcc    %l1,%g0,%g0    
  230.     bvc,a    .+0x8
  231.     unimp    0
  232. !
  233. ! setup SIGEMT signal handler for taddcctv
  234. !
  235.     set    sigtramp,%o1
  236.     set    sv1,%o0
  237.     st    %o1,[%o0] ! init sigvec struct
  238.     mov    %o0,%o1
  239.     clr    %o2
  240.     mov    7,%o0
  241.     mov    0x6c,%g1 ! sigvec system call
  242.     ta    0
  243. ! taddcctv
  244.     taddcctv    %g0,1,%g0
  245.     unimp    0
  246.     taddcctv    %l1,%g0,%g0    
  247.     unimp    0
  248. ! tsubcc
  249.     tsubcc    %g0,1,%g0
  250.     bvc,a    .+0x8
  251.     unimp    0
  252.     tsubcc    %l1,%g0,%g0    
  253.     bvc,a    .+0x8
  254.     unimp    0
  255. ! tsubcctv
  256.     tsubcctv    %g0,1,%g0
  257.     unimp    0
  258.     tsubcctv    %l1,%g0,%g0    
  259.     unimp    0
  260.  
  261. exit:
  262.     mov    1,%g1
  263.     clr    %o0
  264.     ta    0
  265.     nop
  266.  
  267.  
  268.     .seg "bss"
  269. sv1:
  270.     .skip 0xc
  271. !
  272. ! handler skips 2 insns and returns
  273. !
  274.         .seg "text"
  275. handler:
  276.         ld      [%o2+0xc],%l0  ! return pc
  277.         ld      [%o2+0x10],%l1 ! return npc
  278.         inc     8,%l0
  279.         inc     8,%l1
  280.         st      %l0,[%o2+0xc]
  281.         st      %l1,[%o2+0x10]
  282.         retl
  283.         nop
  284.  
  285. !
  286. ! sigtramp sets up arguments for and calls the user handler,
  287. ! which is assumed not to touch the fp regs
  288. !
  289.     .seg "text"
  290. sigtramp:
  291.     save    %sp,-128,%sp ! protect ins, locals
  292.     mov    %y,%l0
  293.     st    %l0,[%sp+0x60]
  294.     std    %g6,[%sp+0x68]
  295.     std    %g4,[%sp+0x70]
  296.     std    %g2,[%sp+0x78]
  297.     ld    [%fp+0x40],%o0 ! sig
  298.     ld    [%fp+0x44],%o1 ! code
  299.     ld    [%fp+0x48],%o2 ! sigcontext ptr
  300.     set    handler,%g1
  301.     call    %g1            ! user's handler
  302.     ld    [%fp+0x4c],%o3 ! faulty addr
  303.     ld    [%sp+0x60],%l0
  304.     mov    %l0,%y
  305.     ldd    [%sp+0x68],%g6
  306.     ldd    [%sp+0x70],%g4
  307.     ldd    [%sp+0x78],%g2
  308.     ld    [%fp+0x48],%i0 ! will be %o0 after restore
  309.     mov    0x8b,%g1       ! return to sigcontext syscall
  310.     restore                ! regs restored (expect %o0)
  311.     ta    0
  312.