sto_res.S 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. |
  2. | sto_res.sa 3.1 12/10/90
  3. |
  4. | Takes the result and puts it in where the user expects it.
  5. | Library functions return result in fp0. If fp0 is not the
  6. | users destination register then fp0 is moved to the
  7. | correct floating-point destination register. fp0 and fp1
  8. | are then restored to the original contents.
  9. |
  10. | Input: result in fp0,fp1
  11. |
  12. | d2 & a0 should be kept unmodified
  13. |
  14. | Output: moves the result to the true destination reg or mem
  15. |
  16. | Modifies: destination floating point register
  17. |
  18. | Copyright (C) Motorola, Inc. 1990
  19. | All Rights Reserved
  20. |
  21. | For details on the license for this file, please see the
  22. | file, README, in this same directory.
  23. STO_RES: |idnt 2,1 | Motorola 040 Floating Point Software Package
  24. |section 8
  25. #include "fpsp.h"
  26. .global sto_cos
  27. sto_cos:
  28. bfextu CMDREG1B(%a6){#13:#3},%d0 |extract cos destination
  29. cmpib #3,%d0 |check for fp0/fp1 cases
  30. bles c_fp0123
  31. fmovemx %fp1-%fp1,-(%a7)
  32. moveql #7,%d1
  33. subl %d0,%d1 |d1 = 7- (dest. reg. no.)
  34. clrl %d0
  35. bsetl %d1,%d0 |d0 is dynamic register mask
  36. fmovemx (%a7)+,%d0
  37. rts
  38. c_fp0123:
  39. cmpib #0,%d0
  40. beqs c_is_fp0
  41. cmpib #1,%d0
  42. beqs c_is_fp1
  43. cmpib #2,%d0
  44. beqs c_is_fp2
  45. c_is_fp3:
  46. fmovemx %fp1-%fp1,USER_FP3(%a6)
  47. rts
  48. c_is_fp2:
  49. fmovemx %fp1-%fp1,USER_FP2(%a6)
  50. rts
  51. c_is_fp1:
  52. fmovemx %fp1-%fp1,USER_FP1(%a6)
  53. rts
  54. c_is_fp0:
  55. fmovemx %fp1-%fp1,USER_FP0(%a6)
  56. rts
  57. .global sto_res
  58. sto_res:
  59. bfextu CMDREG1B(%a6){#6:#3},%d0 |extract destination register
  60. cmpib #3,%d0 |check for fp0/fp1 cases
  61. bles fp0123
  62. fmovemx %fp0-%fp0,-(%a7)
  63. moveql #7,%d1
  64. subl %d0,%d1 |d1 = 7- (dest. reg. no.)
  65. clrl %d0
  66. bsetl %d1,%d0 |d0 is dynamic register mask
  67. fmovemx (%a7)+,%d0
  68. rts
  69. fp0123:
  70. cmpib #0,%d0
  71. beqs is_fp0
  72. cmpib #1,%d0
  73. beqs is_fp1
  74. cmpib #2,%d0
  75. beqs is_fp2
  76. is_fp3:
  77. fmovemx %fp0-%fp0,USER_FP3(%a6)
  78. rts
  79. is_fp2:
  80. fmovemx %fp0-%fp0,USER_FP2(%a6)
  81. rts
  82. is_fp1:
  83. fmovemx %fp0-%fp0,USER_FP1(%a6)
  84. rts
  85. is_fp0:
  86. fmovemx %fp0-%fp0,USER_FP0(%a6)
  87. rts
  88. |end