home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / vol_200 / 250_01 / fpcmp.s < prev    next >
Text File  |  1987-10-29  |  1KB  |  46 lines

  1.     .ttl    fpcmp.s
  2.  
  3. * MC68020/MC68881 IEEE Format Single Precision Routines
  4. *
  5. * Written by: Edmund H. Ramm
  6. *
  7. * dbcmp: compares two single precision numbers: "x" and "y"
  8. * Input: 4(sp)   first  single precision number  ("x")
  9. *        8(sp)   second single precision number  ("y")
  10. *
  11. *     sp     4      8
  12. *    ----------------------
  13. *    | ret  |  x   |   y  |
  14. *
  15. * Output: d0 =  0 if x == y
  16. *            =  1 if x > y
  17. *            = -1 if x < y
  18. *
  19. * Function:
  20. * This function compares two single precision numbers and returns the
  21. * result of this comparison in d0
  22. *
  23.  
  24.     .text
  25.     .globl    fpcmp,_fpcmp
  26.  
  27.  
  28. fpcmp:
  29. _fpcmp:
  30. ~~fpcmp:
  31. *    fmove.s    8(sp),fp0        * fp0 <-- "y"
  32.     dc.w    $f22f,$4400,$0008
  33. *    fcmp.s    4(sp),fp0        * compare with "x"
  34.     dc.w    $f22f,$4438,$0004
  35.     moveq    #0,d0            * assume equal
  36. *    fbeq    L_dbcmp1        * return with d0 = 0
  37.     dc.w    $f281,$000a
  38.     moveq    #1,d0            * assume x > y
  39. *    fbolt    L_dbcmp1        * return with d0 = 1
  40.     dc.w    $f284,$0004
  41.     moveq    #-1,d0            * must be x < y
  42. L_dbcmp1:
  43.     rts
  44.  
  45.     .end
  46.