You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

125 lines
2.3KB

  1. /*
  2. * Copyright (c) 2009 Loren Merritt
  3. *
  4. * This file is part of FFmpeg.
  5. *
  6. * FFmpeg is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * FFmpeg is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General Public
  17. * License along with FFmpeg; if not, write to the Free Software
  18. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  19. */
  20. #include "config.h"
  21. #define GLUE(a, b) a ## b
  22. #define JOIN(a, b) GLUE(a, b)
  23. #define X(s) JOIN(EXTERN_ASM, s)
  24. #if ARCH_PPC64
  25. #define PTR .quad
  26. #define lp ld
  27. #define lpx ldx
  28. #define stp std
  29. #define stpu stdu
  30. #define PS 8
  31. #define L(s) JOIN(., s)
  32. .macro extfunc name
  33. .global X(\name)
  34. .section .opd, "aw"
  35. X(\name):
  36. .quad L(\name), .TOC.@tocbase, 0
  37. .previous
  38. .type X(\name), STT_FUNC
  39. L(\name):
  40. .endm
  41. .macro movrel rd, sym
  42. ld \rd, \sym@got(r2)
  43. .endm
  44. #else /* ARCH_PPC64 */
  45. #define PTR .int
  46. #define lp lwz
  47. #define lpx lwzx
  48. #define stp stw
  49. #define stpu stwu
  50. #define PS 4
  51. #define L(s) s
  52. .macro extfunc name
  53. .global X(\name)
  54. .type X(\name), STT_FUNC
  55. X(\name):
  56. \name:
  57. .endm
  58. .macro movrel rd, sym
  59. #if CONFIG_PIC
  60. bcl 20, 31, lab_pic_\@
  61. lab_pic_\@:
  62. mflr \rd
  63. addis \rd, \rd, (\sym - lab_pic_\@)@ha
  64. addi \rd, \rd, (\sym - lab_pic_\@)@l
  65. #else
  66. lis \rd, \sym@ha
  67. la \rd, \sym@l(\rd)
  68. #endif
  69. .endm
  70. #endif /* ARCH_PPC64 */
  71. #if HAVE_IBM_ASM
  72. .macro DEFINE_REG n
  73. .equiv r\n, \n
  74. .equiv f\n, \n
  75. .equiv v\n, \n
  76. .endm
  77. DEFINE_REG 0
  78. DEFINE_REG 1
  79. DEFINE_REG 2
  80. DEFINE_REG 3
  81. DEFINE_REG 4
  82. DEFINE_REG 5
  83. DEFINE_REG 6
  84. DEFINE_REG 7
  85. DEFINE_REG 8
  86. DEFINE_REG 9
  87. DEFINE_REG 10
  88. DEFINE_REG 11
  89. DEFINE_REG 12
  90. DEFINE_REG 13
  91. DEFINE_REG 14
  92. DEFINE_REG 15
  93. DEFINE_REG 16
  94. DEFINE_REG 17
  95. DEFINE_REG 18
  96. DEFINE_REG 19
  97. DEFINE_REG 20
  98. DEFINE_REG 21
  99. DEFINE_REG 22
  100. DEFINE_REG 23
  101. DEFINE_REG 24
  102. DEFINE_REG 25
  103. DEFINE_REG 26
  104. DEFINE_REG 27
  105. DEFINE_REG 28
  106. DEFINE_REG 29
  107. DEFINE_REG 30
  108. DEFINE_REG 31
  109. #endif /* HAVE_IBM_ASM */