home *** CD-ROM | disk | FTP | other *** search
/ PC-Online 1998 February / PCOnline_02_1998.iso / filesbbs / os2 / pgp263.arj / PGP263I.SRC / PGP263II.ZIP / src / sparc.S < prev    next >
Text File  |  1994-10-13  |  2KB  |  92 lines

  1. !
  2. ! SPARC assembler primitives for rsalib.c
  3. ! written by Branko Lankester, lankeste@fwi.uva.nl    8/29/91
  4. !
  5. ! Tested with gcc 1.39 and newer, and SunOS cc.
  6. ! NOTE: does not work with gcc 1.37 (and older?)
  7. !
  8. ! other sources must be compiled with UNIT32 and HIGHFIRST defined
  9. !
  10. #ifndef SYSV
  11. #ifdef __STDC__
  12. #define ENTRY(name)    _##name ; _##name##:
  13. #else
  14. #define ENTRY(name)    _/**/name ; _/**/name/**/:
  15. #endif
  16. #define GLOB        _global_precision
  17. #else /* SYSV */
  18. #define ENTRY(name)    name ; name:
  19. #define GLOB        global_precision
  20. #endif
  21.  
  22.     .seg    "text"
  23.         .proc   4
  24.     .global ENTRY(P_SETP)
  25.     retl
  26.     nop
  27.  
  28.  
  29.         .proc   4
  30.     .global ENTRY(P_ADDC)
  31.     sethi    %hi(GLOB), %o3
  32.     ldsh    [%o3+%lo(GLOB)], %o3
  33.     and    %o2, 1, %o2
  34.     dec    %o3
  35.     sll    %o3, 2, %o3
  36.     ld    [%o0+%o3], %o4
  37. add_loop:
  38.     ld    [%o1+%o3], %o5
  39.     subcc    %g0, %o2, %g0
  40.     addxcc    %o4, %o5, %o4
  41.     addx    %g0, %g0, %o2
  42.     st    %o4, [%o0+%o3]
  43.     subcc    %o3, 4, %o3
  44.     bge,a    add_loop
  45.     ld    [%o0+%o3], %o4
  46.     retl
  47.     mov    %o2, %o0        ! return carry
  48.  
  49.  
  50.         .proc   4
  51.     .global ENTRY(P_SUBB)
  52.     sethi    %hi(GLOB), %o3
  53.     ldsh    [%o3+%lo(GLOB)], %o3
  54.     and    %o2, 1, %o2
  55.     dec    %o3
  56.     sll    %o3, 2, %o3
  57.     ld    [%o0+%o3], %o4
  58. sub_loop:
  59.     ld    [%o1+%o3], %o5
  60.     subcc    %g0, %o2, %g0
  61.     subxcc    %o4, %o5, %o4
  62.     addx    %g0, %g0, %o2
  63.     st    %o4, [%o0+%o3]
  64.     subcc    %o3, 4, %o3
  65.     bge,a    sub_loop
  66.     ld    [%o0+%o3], %o4
  67.     retl
  68.     mov    %o2, %o0
  69.  
  70.  
  71.         .proc   4
  72.     .global ENTRY(P_ROTL)
  73.     sethi    %hi(GLOB), %o3
  74.     ldsh    [%o3+%lo(GLOB)], %o3
  75.     and    %o1, 1, %o1
  76.     dec    %o3
  77.     sll    %o3, 2, %o3
  78.     ld    [%o0+%o3], %o4
  79. rot_loop:
  80.     sll    %o4, 1, %o5
  81.     or    %o5, %o1, %o5
  82.     st    %o5, [%o0+%o3]
  83.     srl    %o4, 31, %o1
  84.     subcc    %o3, 4, %o3
  85.     bge,a    rot_loop
  86.     ld    [%o0+%o3], %o4
  87.     retl
  88.     mov    %o1, %o0
  89.  
  90.     .seg    "data"
  91.  
  92.