mulsi3.S 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /* libgcc1 routines for 68000 w/o floating-point hardware.
  2. Copyright (C) 1994, 1996, 1997, 1998 Free Software Foundation, Inc.
  3. This file is part of GNU CC.
  4. GNU CC is free software; you can redistribute it and/or modify it
  5. under the terms of the GNU General Public License as published by the
  6. Free Software Foundation; either version 2, or (at your option) any
  7. later version.
  8. In addition to the permissions in the GNU General Public License, the
  9. Free Software Foundation gives you unlimited permission to link the
  10. compiled version of this file with other programs, and to distribute
  11. those programs without any restriction coming from the use of this
  12. file. (The General Public License restrictions do apply in other
  13. respects; for example, they cover modification of the file, and
  14. distribution when not linked into another program.)
  15. This file is distributed in the hope that it will be useful, but
  16. WITHOUT ANY WARRANTY; without even the implied warranty of
  17. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. General Public License for more details. */
  19. /* As a special exception, if you link this library with files
  20. compiled with GCC to produce an executable, this does not cause
  21. the resulting executable to be covered by the GNU General Public License.
  22. This exception does not however invalidate any other reasons why
  23. the executable file might be covered by the GNU General Public License. */
  24. /* Use this one for any 680x0; assumes no floating point hardware.
  25. The trailing " '" appearing on some lines is for ANSI preprocessors. Yuk.
  26. Some of this code comes from MINIX, via the folks at ericsson.
  27. D. V. Henkel-Wallace (gumby@cygnus.com) Fete Bastille, 1992
  28. */
  29. /* These are predefined by new versions of GNU cpp. */
  30. #ifndef __USER_LABEL_PREFIX__
  31. #define __USER_LABEL_PREFIX__ _
  32. #endif
  33. #ifndef __REGISTER_PREFIX__
  34. #define __REGISTER_PREFIX__
  35. #endif
  36. #ifndef __IMMEDIATE_PREFIX__
  37. #define __IMMEDIATE_PREFIX__ #
  38. #endif
  39. /* ANSI concatenation macros. */
  40. #define CONCAT1(a, b) CONCAT2(a, b)
  41. #define CONCAT2(a, b) a ## b
  42. /* Use the right prefix for global labels. */
  43. #define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
  44. /* Use the right prefix for registers. */
  45. #define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)
  46. /* Use the right prefix for immediate values. */
  47. #define IMM(x) CONCAT1 (__IMMEDIATE_PREFIX__, x)
  48. #define d0 REG (d0)
  49. #define d1 REG (d1)
  50. #define d2 REG (d2)
  51. #define d3 REG (d3)
  52. #define d4 REG (d4)
  53. #define d5 REG (d5)
  54. #define d6 REG (d6)
  55. #define d7 REG (d7)
  56. #define a0 REG (a0)
  57. #define a1 REG (a1)
  58. #define a2 REG (a2)
  59. #define a3 REG (a3)
  60. #define a4 REG (a4)
  61. #define a5 REG (a5)
  62. #define a6 REG (a6)
  63. #define fp REG (fp)
  64. #define sp REG (sp)
  65. .text
  66. .proc
  67. .globl SYM (__mulsi3)
  68. SYM (__mulsi3):
  69. movew sp@(4), d0 /* x0 -> d0 */
  70. muluw sp@(10), d0 /* x0*y1 */
  71. movew sp@(6), d1 /* x1 -> d1 */
  72. muluw sp@(8), d1 /* x1*y0 */
  73. #if !(defined(__mcf5200__) || defined(__mcoldfire__))
  74. addw d1, d0
  75. #else
  76. addl d1, d0
  77. #endif
  78. swap d0
  79. clrw d0
  80. movew sp@(6), d1 /* x1 -> d1 */
  81. muluw sp@(10), d1 /* x1*y1 */
  82. addl d1, d0
  83. rts