sparc_b.s 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /*
  2. * QuickThreads -- Threads-building toolkit.
  3. * Copyright (c) 1993 by David Keppel
  4. *
  5. * Permission to use, copy, modify and distribute this software and
  6. * its documentation for any purpose and without fee is hereby
  7. * granted, provided that the above copyright notice and this notice
  8. * appear in all copies. This software is provided as a
  9. * proof-of-concept and for demonstration purposes; there is no
  10. * representation about the suitability of this software for any
  11. * purpose.
  12. */
  13. .globl b_call_reg
  14. .globl b_call_imm
  15. .globl b_add
  16. .globl b_load
  17. b_null:
  18. retl
  19. nop
  20. b_call_reg:
  21. sethi %hi(b_null),%o4
  22. or %o4,%lo(b_null),%o4
  23. add %o7,%g0, %o3
  24. L0:
  25. call %o4
  26. nop
  27. call %o4
  28. nop
  29. call %o4
  30. nop
  31. call %o4
  32. nop
  33. call %o4
  34. nop
  35. subcc %o0,1,%o0
  36. bg L0
  37. nop
  38. add %o3,%g0, %o7
  39. retl
  40. nop
  41. b_call_imm:
  42. sethi %hi(b_null),%o4
  43. or %o4,%lo(b_null),%o4
  44. add %o7,%g0, %o3
  45. L1:
  46. call b_null
  47. call b_null
  48. call b_null
  49. call b_null
  50. call b_null
  51. subcc %o0,1,%o0
  52. bg L0
  53. nop
  54. add %o3,%g0, %o7
  55. retl
  56. nop
  57. b_add:
  58. add %o0,%g0,%o1
  59. add %o0,%g0,%o2
  60. add %o0,%g0,%o3
  61. add %o0,%g0,%o4
  62. L2:
  63. sub %o0,5,%o0
  64. sub %o1,5,%o1
  65. sub %o2,5,%o2
  66. sub %o3,5,%o3
  67. sub %o4,5,%o4
  68. subcc %o0,5,%o0
  69. sub %o1,5,%o1
  70. sub %o2,5,%o2
  71. sub %o3,5,%o3
  72. sub %o4,5,%o4
  73. bg L2
  74. nop
  75. retl
  76. nop
  77. b_load:
  78. ld [%sp+ 0], %g0
  79. L3:
  80. ld [%sp+ 4],%g0
  81. ld [%sp+ 8],%g0
  82. ld [%sp+12],%g0
  83. ld [%sp+16],%g0
  84. ld [%sp+20],%g0
  85. ld [%sp+24],%g0
  86. ld [%sp+28],%g0
  87. ld [%sp+32],%g0
  88. ld [%sp+36],%g0
  89. subcc %o0,10,%o0
  90. bg L3
  91. ld [%sp+ 0],%g0
  92. retl
  93. nop