形式
Asm
投稿日時
2020-01-06 06:51
公開期間
無期限
  1. sine.m
  2. =====
  3. :- module sine.
  4. % Compile with mmc -O 7 --intermodule-optimization --make libsine
  5. :- interface.
  6. :- pred sine_lookup(int::in, int::out) is det.
  7. :- implementation.
  8. :- use_module math.
  9. :- import_module float.
  10. % Ignore the lie that this is a "lookup"
  11. sine_lookup(I, float.round_to_int(math.sin(float.float(I) * math.pi * 2.0 / 255.0))).
  12. Resulting assembly without the spf change
  13. ==================================
  14. 00000000 <_sine__sine_lookup_2_p_0>:
  15. 0: 55 push %ebp
  16. 1: 8b ec mov %esp,%ebp
  17. 3: 83 ec 34 sub $0x34,%esp
  18. 6: 8b 45 08 mov 0x8(%ebp),%eax
  19. 9: 89 45 fc mov %eax,-0x4(%ebp)
  20. c: f3 0f 2a 45 fc cvtsi2ssl -0x4(%ebp),%xmm0
  21. 11: f3 0f 11 45 f8 movss %xmm0,-0x8(%ebp)
  22. 16: f3 0f 10 45 f8 movss -0x8(%ebp),%xmm0
  23. 1b: f3 0f 11 45 f0 movss %xmm0,-0x10(%ebp)
  24. 20: f3 0f 10 05 00 00 00 movss 0x0,%xmm0
  25. 27: 00
  26. 28: f3 0f 11 45 f4 movss %xmm0,-0xc(%ebp)
  27. 2d: f3 0f 10 45 f4 movss -0xc(%ebp),%xmm0
  28. 32: f3 0f 11 45 ec movss %xmm0,-0x14(%ebp)
  29. 37: f3 0f 10 45 f0 movss -0x10(%ebp),%xmm0
  30. 3c: f3 0f 59 45 ec mulss -0x14(%ebp),%xmm0
  31. 41: f3 0f 11 45 e8 movss %xmm0,-0x18(%ebp)
  32. 46: f3 0f 10 45 e8 movss -0x18(%ebp),%xmm0
  33. 4b: f3 0f 59 05 00 00 00 mulss 0x0,%xmm0
  34. 52: 00
  35. 53: f3 0f 11 45 e4 movss %xmm0,-0x1c(%ebp)
  36. 58: f3 0f 10 45 e4 movss -0x1c(%ebp),%xmm0
  37. 5d: f3 0f 5e 05 00 00 00 divss 0x0,%xmm0
  38. 64: 00
  39. 65: f3 0f 11 45 e0 movss %xmm0,-0x20(%ebp)
  40. 6a: f3 0f 10 45 e0 movss -0x20(%ebp),%xmm0
  41. 6f: f3 0f 11 45 dc movss %xmm0,-0x24(%ebp)
  42. 74: f3 0f 5a 45 dc cvtss2sd -0x24(%ebp),%xmm0
  43. 79: 83 ec 08 sub $0x8,%esp
  44. 7c: f2 0f 11 04 24 movsd %xmm0,(%esp)
  45. 81: e8 00 00 00 00 call 86 <_sine__sine_lookup_2_p_0+0x86>
  46. 86: 83 c4 08 add $0x8,%esp
  47. 89: d9 5d d8 fstps -0x28(%ebp)
  48. 8c: f3 0f 10 45 d8 movss -0x28(%ebp),%xmm0
  49. 91: f3 0f 11 45 d4 movss %xmm0,-0x2c(%ebp)
  50. 96: f3 0f 10 45 d4 movss -0x2c(%ebp),%xmm0
  51. 9b: f3 0f 11 45 d0 movss %xmm0,-0x30(%ebp)
  52. a0: f3 0f 5a 45 d0 cvtss2sd -0x30(%ebp),%xmm0
  53. a5: f2 0f 58 05 00 00 00 addsd 0x0,%xmm0
  54. ac: 00
  55. ad: 83 ec 08 sub $0x8,%esp
  56. b0: f2 0f 11 04 24 movsd %xmm0,(%esp)
  57. b5: e8 00 00 00 00 call ba <_sine__sine_lookup_2_p_0+0xba>
  58. ba: 83 c4 08 add $0x8,%esp
  59. bd: e8 00 00 00 00 call c2 <_sine__sine_lookup_2_p_0+0xc2>
  60. c2: 89 45 cc mov %eax,-0x34(%ebp)
  61. c5: 8b 4d 0c mov 0xc(%ebp),%ecx
  62. c8: 8b 55 cc mov -0x34(%ebp),%edx
  63. cb: 89 11 mov %edx,(%ecx)
  64. cd: 8b e5 mov %ebp,%esp
  65. cf: 5d pop %ebp
  66. d0: c3 ret
  67. Resulting assembly with the spf change
  68. ============================
  69. 00000000 <_sine__sine_lookup_2_p_0>:
  70. 0: 55 push %ebp
  71. 1: 8b ec mov %esp,%ebp
  72. 3: 83 ec 34 sub $0x34,%esp
  73. 6: 8b 45 08 mov 0x8(%ebp),%eax
  74. 9: 89 45 fc mov %eax,-0x4(%ebp)
  75. c: f3 0f 2a 45 fc cvtsi2ssl -0x4(%ebp),%xmm0
  76. 11: f3 0f 11 45 f8 movss %xmm0,-0x8(%ebp)
  77. 16: f3 0f 10 45 f8 movss -0x8(%ebp),%xmm0
  78. 1b: f3 0f 11 45 f0 movss %xmm0,-0x10(%ebp)
  79. 20: f3 0f 10 05 00 00 00 movss 0x0,%xmm0
  80. 27: 00
  81. 28: f3 0f 11 45 f4 movss %xmm0,-0xc(%ebp)
  82. 2d: f3 0f 10 45 f4 movss -0xc(%ebp),%xmm0
  83. 32: f3 0f 11 45 ec movss %xmm0,-0x14(%ebp)
  84. 37: f3 0f 10 45 f0 movss -0x10(%ebp),%xmm0
  85. 3c: f3 0f 59 45 ec mulss -0x14(%ebp),%xmm0
  86. 41: f3 0f 11 45 e8 movss %xmm0,-0x18(%ebp)
  87. 46: f3 0f 10 45 e8 movss -0x18(%ebp),%xmm0
  88. 4b: f3 0f 59 05 00 00 00 mulss 0x0,%xmm0
  89. 52: 00
  90. 53: f3 0f 11 45 e4 movss %xmm0,-0x1c(%ebp)
  91. 58: f3 0f 10 45 e4 movss -0x1c(%ebp),%xmm0
  92. 5d: f3 0f 5e 05 00 00 00 divss 0x0,%xmm0
  93. 64: 00
  94. 65: f3 0f 11 45 e0 movss %xmm0,-0x20(%ebp)
  95. 6a: f3 0f 10 45 e0 movss -0x20(%ebp),%xmm0
  96. 6f: f3 0f 11 45 dc movss %xmm0,-0x24(%ebp)
  97. 74: 51 push %ecx
  98. 75: f3 0f 10 45 dc movss -0x24(%ebp),%xmm0
  99. 7a: f3 0f 11 04 24 movss %xmm0,(%esp)
  100. 7f: e8 00 00 00 00 call 84 <_sine__sine_lookup_2_p_0+0x84>
  101. 84: 83 c4 04 add $0x4,%esp
  102. 87: d9 5d d8 fstps -0x28(%ebp)
  103. 8a: f3 0f 10 45 d8 movss -0x28(%ebp),%xmm0
  104. 8f: f3 0f 11 45 d4 movss %xmm0,-0x2c(%ebp)
  105. 94: f3 0f 10 45 d4 movss -0x2c(%ebp),%xmm0
  106. 99: f3 0f 11 45 d0 movss %xmm0,-0x30(%ebp)
  107. 9e: f3 0f 10 45 d0 movss -0x30(%ebp),%xmm0
  108. a3: f3 0f 58 05 00 00 00 addss 0x0,%xmm0
  109. aa: 00
  110. ab: 51 push %ecx
  111. ac: f3 0f 11 04 24 movss %xmm0,(%esp)
  112. b1: e8 00 00 00 00 call b6 <_sine__sine_lookup_2_p_0+0xb6>
  113. b6: 83 c4 04 add $0x4,%esp
  114. b9: e8 00 00 00 00 call be <_sine__sine_lookup_2_p_0+0xbe>
  115. be: 89 45 cc mov %eax,-0x34(%ebp)
  116. c1: 8b 4d 0c mov 0xc(%ebp),%ecx
  117. c4: 8b 55 cc mov -0x34(%ebp),%edx
  118. c7: 89 11 mov %edx,(%ecx)
  119. c9: 8b e5 mov %ebp,%esp
  120. cb: 5d pop %ebp
  121. cc: c3 ret
ダウンロード 印刷用表示

このコピペの URL

JavaScript での埋め込み

iframe での埋め込み

元のテキスト