995-fa526.patch 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. --- a/gcc/config/arm/arm-cores.def
  2. +++ b/gcc/config/arm/arm-cores.def
  3. @@ -74,6 +74,7 @@ ARM_CORE("strongarm", strongarm, 4,
  4. ARM_CORE("strongarm110", strongarm110, 4, FL_MODE26 | FL_LDSCHED | FL_STRONG, fastmul)
  5. ARM_CORE("strongarm1100", strongarm1100, 4, FL_MODE26 | FL_LDSCHED | FL_STRONG, fastmul)
  6. ARM_CORE("strongarm1110", strongarm1110, 4, FL_MODE26 | FL_LDSCHED | FL_STRONG, fastmul)
  7. +ARM_CORE("fa526", fa526, 4, FL_LDSCHED, fastmul)
  8. /* V4T Architecture Processors */
  9. ARM_CORE("arm7tdmi", arm7tdmi, 4T, FL_CO_PROC , fastmul)
  10. --- a/gcc/config/arm/arm.md
  11. +++ b/gcc/config/arm/arm.md
  12. @@ -435,7 +435,7 @@
  13. (define_attr "generic_sched" "yes,no"
  14. (const (if_then_else
  15. - (ior (eq_attr "tune" "arm926ejs,arm1020e,arm1026ejs,arm1136js,arm1136jfs,cortexa5,cortexa8,cortexa9,cortexm4")
  16. + (ior (eq_attr "tune" "fa526,arm926ejs,arm1020e,arm1026ejs,arm1136js,arm1136jfs,cortexa5,cortexa8,cortexa9,cortexm4")
  17. (eq_attr "tune_cortexr4" "yes"))
  18. (const_string "no")
  19. (const_string "yes"))))
  20. @@ -467,6 +467,7 @@
  21. (include "arm1020e.md")
  22. (include "arm1026ejs.md")
  23. (include "arm1136jfs.md")
  24. +(include "fa526.md")
  25. (include "cortex-a5.md")
  26. (include "cortex-a8.md")
  27. (include "cortex-a9.md")
  28. --- a/gcc/config/arm/arm-tune.md
  29. +++ b/gcc/config/arm/arm-tune.md
  30. @@ -1,5 +1,5 @@
  31. ;; -*- buffer-read-only: t -*-
  32. ;; Generated automatically by gentune.sh from arm-cores.def
  33. (define_attr "tune"
  34. - "arm2,arm250,arm3,arm6,arm60,arm600,arm610,arm620,arm7,arm7d,arm7di,arm70,arm700,arm700i,arm710,arm720,arm710c,arm7100,arm7500,arm7500fe,arm7m,arm7dm,arm7dmi,arm8,arm810,strongarm,strongarm110,strongarm1100,strongarm1110,arm7tdmi,arm7tdmis,arm710t,arm720t,arm740t,arm9,arm9tdmi,arm920,arm920t,arm922t,arm940t,ep9312,arm10tdmi,arm1020t,arm9e,arm946es,arm966es,arm968es,arm10e,arm1020e,arm1022e,xscale,iwmmxt,iwmmxt2,arm926ejs,arm1026ejs,arm1136js,arm1136jfs,arm1176jzs,arm1176jzfs,mpcorenovfp,mpcore,arm1156t2s,arm1156t2fs,cortexa5,cortexa8,cortexa9,cortexr4,cortexr4f,cortexm4,cortexm3,cortexm1,cortexm0"
  35. + "arm2,arm250,arm3,arm6,arm60,arm600,arm610,arm620,arm7,arm7d,arm7di,arm70,arm700,arm700i,arm710,arm720,arm710c,arm7100,arm7500,arm7500fe,arm7m,arm7dm,arm7dmi,arm8,arm810,strongarm,strongarm110,strongarm1100,strongarm1110,fa526,arm7tdmi,arm7tdmis,arm710t,arm720t,arm740t,arm9,arm9tdmi,arm920,arm920t,arm922t,arm940t,ep9312,arm10tdmi,arm1020t,arm9e,arm946es,arm966es,arm968es,arm10e,arm1020e,arm1022e,xscale,iwmmxt,iwmmxt2,arm926ejs,arm1026ejs,arm1136js,arm1136jfs,arm1176jzs,arm1176jzfs,mpcorenovfp,mpcore,arm1156t2s,arm1156t2fs,cortexa5,cortexa8,cortexa9,cortexr4,cortexr4f,cortexm4,cortexm3,cortexm1,cortexm0"
  36. (const (symbol_ref "((enum attr_tune) arm_tune)")))
  37. --- a/gcc/config/arm/bpabi.h
  38. +++ b/gcc/config/arm/bpabi.h
  39. @@ -52,7 +52,8 @@
  40. /* The BPABI integer comparison routines return { -1, 0, 1 }. */
  41. #define TARGET_LIB_INT_CMP_BIASED !TARGET_BPABI
  42. -#define TARGET_FIX_V4BX_SPEC " %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*|march=armv4:--fix-v4bx}"
  43. +#define TARGET_FIX_V4BX_SPEC " %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*\
  44. +|march=armv4|mcpu=fa526:--fix-v4bx}"
  45. #define BE8_LINK_SPEC " %{mbig-endian:%{march=armv7-a|mcpu=cortex-a5|mcpu=cortex-a8|mcpu=cortex-a9:%{!r:--be8}}}"
  46. --- /dev/null
  47. +++ b/gcc/config/arm/fa526.md
  48. @@ -0,0 +1,161 @@
  49. +;; Faraday FA526 Pipeline Description
  50. +;; Copyright (C) 2010 Free Software Foundation, Inc.
  51. +;; Written by I-Jui Sung, based on ARM926EJ-S Pipeline Description.
  52. +
  53. +;; This file is part of GCC.
  54. +;;
  55. +;; GCC is free software; you can redistribute it and/or modify it under
  56. +;; the terms of the GNU General Public License as published by the Free
  57. +;; Software Foundation; either version 3, or (at your option) any later
  58. +;; version.
  59. +;;
  60. +;; GCC is distributed in the hope that it will be useful, but WITHOUT ANY
  61. +;; WARRANTY; without even the implied warranty of MERCHANTABILITY or
  62. +;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
  63. +;; for more details.
  64. +;;
  65. +;; You should have received a copy of the GNU General Public License
  66. +;; along with GCC; see the file COPYING3. If not see
  67. +;; <http://www.gnu.org/licenses/>. */
  68. +
  69. +;; These descriptions are based on the information contained in the
  70. +;; FA526 Core Design Note, Copyright (c) 2010 Faraday Technology Corp.
  71. +;;
  72. +;; Modeled pipeline characteristics:
  73. +;; LD -> any use: latency = 3 (2 cycle penalty).
  74. +;; ALU -> any use: latency = 2 (1 cycle penalty).
  75. +
  76. +;; This automaton provides a pipeline description for the Faraday
  77. +;; FA526 core.
  78. +;;
  79. +;; The model given here assumes that the condition for all conditional
  80. +;; instructions is "true", i.e., that all of the instructions are
  81. +;; actually executed.
  82. +
  83. +(define_automaton "fa526")
  84. +
  85. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  86. +;; Pipelines
  87. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  88. +
  89. +;; There is a single pipeline
  90. +;;
  91. +;; The ALU pipeline has fetch, decode, execute, memory, and
  92. +;; write stages. We only need to model the execute, memory and write
  93. +;; stages.
  94. +
  95. +;; S E M W
  96. +
  97. +(define_cpu_unit "fa526_core" "fa526")
  98. +
  99. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  100. +;; ALU Instructions
  101. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  102. +
  103. +;; ALU instructions require two cycles to execute, and use the ALU
  104. +;; pipeline in each of the three stages. The results are available
  105. +;; after the execute stage stage has finished.
  106. +;;
  107. +;; If the destination register is the PC, the pipelines are stalled
  108. +;; for several cycles. That case is not modeled here.
  109. +
  110. +;; ALU operations
  111. +(define_insn_reservation "526_alu_op" 1
  112. + (and (eq_attr "tune" "fa526")
  113. + (eq_attr "type" "alu"))
  114. + "fa526_core")
  115. +
  116. +(define_insn_reservation "526_alu_shift_op" 2
  117. + (and (eq_attr "tune" "fa526")
  118. + (eq_attr "type" "alu_shift,alu_shift_reg"))
  119. + "fa526_core")
  120. +
  121. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  122. +;; Multiplication Instructions
  123. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  124. +
  125. +(define_insn_reservation "526_mult1" 2
  126. + (and (eq_attr "tune" "fa526")
  127. + (eq_attr "insn" "smlalxy,smulxy,smlaxy,smlalxy"))
  128. + "fa526_core")
  129. +
  130. +(define_insn_reservation "526_mult2" 5
  131. + (and (eq_attr "tune" "fa526")
  132. + (eq_attr "insn" "mul,mla,muls,mlas,umull,umlal,smull,smlal,umulls,\
  133. + umlals,smulls,smlals,smlawx"))
  134. + "fa526_core*4")
  135. +
  136. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  137. +;; Load/Store Instructions
  138. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  139. +
  140. +;; The models for load/store instructions do not accurately describe
  141. +;; the difference between operations with a base register writeback
  142. +;; (such as "ldm!"). These models assume that all memory references
  143. +;; hit in dcache.
  144. +
  145. +(define_insn_reservation "526_load1_op" 3
  146. + (and (eq_attr "tune" "fa526")
  147. + (eq_attr "type" "load1,load_byte"))
  148. + "fa526_core")
  149. +
  150. +(define_insn_reservation "526_load2_op" 4
  151. + (and (eq_attr "tune" "fa526")
  152. + (eq_attr "type" "load2"))
  153. + "fa526_core*2")
  154. +
  155. +(define_insn_reservation "526_load3_op" 5
  156. + (and (eq_attr "tune" "fa526")
  157. + (eq_attr "type" "load3"))
  158. + "fa526_core*3")
  159. +
  160. +(define_insn_reservation "526_load4_op" 6
  161. + (and (eq_attr "tune" "fa526")
  162. + (eq_attr "type" "load4"))
  163. + "fa526_core*4")
  164. +
  165. +(define_insn_reservation "526_store1_op" 0
  166. + (and (eq_attr "tune" "fa526")
  167. + (eq_attr "type" "store1"))
  168. + "fa526_core")
  169. +
  170. +(define_insn_reservation "526_store2_op" 1
  171. + (and (eq_attr "tune" "fa526")
  172. + (eq_attr "type" "store2"))
  173. + "fa526_core*2")
  174. +
  175. +(define_insn_reservation "526_store3_op" 2
  176. + (and (eq_attr "tune" "fa526")
  177. + (eq_attr "type" "store3"))
  178. + "fa526_core*3")
  179. +
  180. +(define_insn_reservation "526_store4_op" 3
  181. + (and (eq_attr "tune" "fa526")
  182. + (eq_attr "type" "store4"))
  183. + "fa526_core*4")
  184. +
  185. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  186. +;; Branch and Call Instructions
  187. +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  188. +
  189. +;; Branch instructions are difficult to model accurately. The FA526
  190. +;; core can predict most branches. If the branch is predicted
  191. +;; correctly, and predicted early enough, the branch can be completely
  192. +;; eliminated from the instruction stream. Some branches can
  193. +;; therefore appear to require zero cycle to execute. We assume that
  194. +;; all branches are predicted correctly, and that the latency is
  195. +;; therefore the minimum value.
  196. +
  197. +(define_insn_reservation "526_branch_op" 0
  198. + (and (eq_attr "tune" "fa526")
  199. + (eq_attr "type" "branch"))
  200. + "fa526_core")
  201. +
  202. +;; The latency for a call is actually the latency when the result is available.
  203. +;; i.e. R0 ready for int return value. For most cases, the return value is set
  204. +;; by a mov instruction, which has 1 cycle latency.
  205. +(define_insn_reservation "526_call_op" 1
  206. + (and (eq_attr "tune" "fa526")
  207. + (eq_attr "type" "call"))
  208. + "fa526_core")
  209. +
  210. --- a/gcc/config/arm/t-arm
  211. +++ b/gcc/config/arm/t-arm
  212. @@ -23,6 +23,7 @@ MD_INCLUDES= $(srcdir)/config/arm/arm-tu
  213. $(srcdir)/config/arm/arm-generic.md \
  214. $(srcdir)/config/arm/arm1020e.md \
  215. $(srcdir)/config/arm/arm1026ejs.md \
  216. + $(srcdir)/config/arm/fa526.md \
  217. $(srcdir)/config/arm/arm1136jfs.md \
  218. $(srcdir)/config/arm/arm926ejs.md \
  219. $(srcdir)/config/arm/cirrus.md \
  220. --- a/gcc/config/arm/t-arm-elf
  221. +++ b/gcc/config/arm/t-arm-elf
  222. @@ -36,6 +36,10 @@ MULTILIB_DIRNAMES = arm thumb
  223. MULTILIB_EXCEPTIONS =
  224. MULTILIB_MATCHES =
  225. +#MULTILIB_OPTIONS += mcpu=fa526
  226. +#MULTILIB_DIRNAMES += fa526
  227. +#MULTILIB_EXCEPTIONS += *mthumb*/*mcpu=fa526
  228. +
  229. #MULTILIB_OPTIONS += march=armv7
  230. #MULTILIB_DIRNAMES += thumb2
  231. #MULTILIB_EXCEPTIONS += march=armv7* marm/*march=armv7*
  232. @@ -52,6 +56,7 @@ MULTILIB_MATCHES =
  233. MULTILIB_OPTIONS += mfloat-abi=hard
  234. MULTILIB_DIRNAMES += fpu
  235. MULTILIB_EXCEPTIONS += *mthumb/*mfloat-abi=hard*
  236. +MULTILIB_EXCEPTIONS += *mcpu=fa526/*mfloat-abi=hard*
  237. # MULTILIB_OPTIONS += mcpu=ep9312
  238. # MULTILIB_DIRNAMES += ep9312
  239. --- a/gcc/doc/invoke.texi
  240. +++ b/gcc/doc/invoke.texi
  241. @@ -9923,7 +9923,8 @@ assembly code. Permissible names are: @
  242. @samp{cortex-r4}, @samp{cortex-r4f}, @samp{cortex-m4}, @samp{cortex-m3},
  243. @samp{cortex-m1},
  244. @samp{cortex-m0},
  245. -@samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312}.
  246. +@samp{xscale}, @samp{iwmmxt}, @samp{iwmmxt2}, @samp{ep9312},
  247. +@samp{fa526}.
  248. @item -mtune=@var{name}
  249. @opindex mtune