OpenSDE Packages Database (without history before r20070)
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.

579 lines
21 KiB

  1. # --- SDE-COPYRIGHT-NOTE-BEGIN ---
  2. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  3. #
  4. # Filename: package/.../gcc/niagara.patch
  5. # Copyright (C) 2006 The T2 SDE Project
  6. #
  7. # More information can be found in the files COPYING and README.
  8. #
  9. # This patch file is dual-licensed. It is available under the license the
  10. # patched project is licensed under, as long as it is an OpenSource license
  11. # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
  12. # of the GNU General Public License as published by the Free Software
  13. # Foundation; either version 2 of the License, or (at your option) any later
  14. # version.
  15. # --- SDE-COPYRIGHT-NOTE-END ---
  16. 2006-03-02 David S. Miller <davem@sunset.davemloft.net>
  17. Sun Niagara specific optimizations.
  18. * config.gcc: Recognize niagara as target.
  19. * config/sparc/sparc.h (SPARC_RELAXED_ORDERING): Mention Niagara.
  20. (TARGET_CPU_niagara): Define.
  21. (CPP_CPU64_DEFAULT_SPEC): Define __sparc_v9__ for Niagara.
  22. (ASM_CPU64_DEFAULT_SPEC): Pass -Av9b for Niagara.
  23. (CPP_CPU_SPEC): Handle -mcpu=niagara.
  24. (ASM_CPU_SPEC): Likewise.
  25. (PROCESSOR_NIAGARA): New enum entry.
  26. (REGISTER_MOVE_COST): Handle Niagara.
  27. (BRANCH_COST, PREFETCH_BLOCK, SIMULTANEOUS_PREFETCHES): Likewise.
  28. * config/sparc/sparc.c (niagara_costs): New processor_costs entry.
  29. (sparc_override_options): Recognize "niagara", set appropriate
  30. default MASK_* values for it, and align functions to 32-bytes
  31. by default just like ULTRASPARC/ULTRASPARC3.
  32. (sparc_initialize_trampoline): Handle niagara like ultrasparc.
  33. (sparc64_initialize_trampoline): Likewise.
  34. (sparc_use_sched_lookahead): Use zero for niagara.
  35. (sparc_issue_rate): Use one for niagara.
  36. * config/sparc/niagara.md: New file.
  37. * config/sparc/sparc.md: Include it.
  38. * config/sparc/sol2-bi.h (CPP_CPU64_DEFAULT_SPEC,
  39. ASM_CPU32_DEFAULT_SPEC, ASM_CPU64_DEFAULT_SPEC): Set appropriately
  40. when default cpu is niagara.
  41. (CPP_CPU_SPEC): Handle -mcpu=niagara.
  42. (ASM_CPU_SPEC): Likewise.
  43. * config/sparc/sol2.h (ASM_CPU_DEFAULT_SPEC): Set appropriately
  44. when default cpu is niagara.
  45. (ASM_CPU_SPEC): Handle -mcpu=niagara.
  46. * config/sparc/linux64.h: Handle a default of TARGET_CPU_niagara
  47. just like v9/ultrasparc/ultrasparc3.
  48. * doc/invoke.texi: Add documentation for "niagara" and improve
  49. existing documentation for ultrasparc variants.
  50. Index: gcc/config.gcc
  51. ===================================================================
  52. --- ./gcc/config.gcc (revision 111647)
  53. +++ ./gcc/config.gcc (working copy)
  54. @@ -2830,7 +2830,7 @@
  55. "" | sparc | sparcv9 | sparc64 | sparc86x \
  56. | v7 | cypress | v8 | supersparc | sparclite | f930 \
  57. | f934 | hypersparc | sparclite86x | sparclet | tsc701 \
  58. - | v9 | ultrasparc | ultrasparc3)
  59. + | v9 | ultrasparc | ultrasparc3 | niagara)
  60. # OK
  61. ;;
  62. *)
  63. Index: gcc/config/sparc/linux64.h
  64. ===================================================================
  65. --- ./gcc/config/sparc/linux64.h (revision 111647)
  66. +++ ./gcc/config/sparc/linux64.h (working copy)
  67. @@ -43,7 +43,8 @@
  68. #if TARGET_CPU_DEFAULT == TARGET_CPU_v9 \
  69. || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc \
  70. - || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc3
  71. + || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc3 \
  72. + || TARGET_CPU_DEFAULT == TARGET_CPU_niagara
  73. /* A 64 bit v9 compiler with stack-bias,
  74. in a Medium/Low code model environment. */
  75. Index: gcc/config/sparc/niagara.md
  76. ===================================================================
  77. --- ./gcc/config/sparc/niagara.md (revision 0)
  78. +++ ./gcc/config/sparc/niagara.md (revision 0)
  79. @@ -0,0 +1,119 @@
  80. +;; Scheduling description for Niagara.
  81. +;; Copyright (C) 2006 Free Software Foundation, Inc.
  82. +;;
  83. +;; This file is part of GCC.
  84. +;;
  85. +;; GCC is free software; you can redistribute it and/or modify
  86. +;; it under the terms of the GNU General Public License as published by
  87. +;; the Free Software Foundation; either version 2, or (at your option)
  88. +;; any later version.
  89. +;;
  90. +;; GCC is distributed in the hope that it will be useful,
  91. +;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  92. +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  93. +;; GNU General Public License for more details.
  94. +;;
  95. +;; You should have received a copy of the GNU General Public License
  96. +;; along with GCC; see the file COPYING. If not, write to
  97. +;; the Free Software Foundation, 51 Franklin Street, Fifth Floor,
  98. +;; Boston, MA 02110-1301, USA.
  99. +
  100. +;; Niagara is a single-issue processor.
  101. +
  102. +(define_automaton "niagara_0")
  103. +
  104. +(define_cpu_unit "niag_pipe" "niagara_0")
  105. +
  106. +(define_insn_reservation "niag_5cycle" 5
  107. + (and (eq_attr "cpu" "niagara")
  108. + (eq_attr "type" "multi,flushw,iflush,trap"))
  109. + "niag_pipe*5")
  110. +
  111. +(define_insn_reservation "niag_4cycle" 4
  112. + (and (eq_attr "cpu" "niagara")
  113. + (eq_attr "type" "savew"))
  114. + "niag_pipe*4")
  115. +
  116. +/* Most basic operations are single-cycle. */
  117. +(define_insn_reservation "niag_ialu" 1
  118. + (and (eq_attr "cpu" "niagara")
  119. + (eq_attr "type" "ialu,shift,compare,cmove"))
  120. + "niag_pipe")
  121. +
  122. +(define_insn_reservation "niag_imul" 11
  123. + (and (eq_attr "cpu" "niagara")
  124. + (eq_attr "type" "imul"))
  125. + "niag_pipe*11")
  126. +
  127. +(define_insn_reservation "niag_idiv" 72
  128. + (and (eq_attr "cpu" "niagara")
  129. + (eq_attr "type" "idiv"))
  130. + "niag_pipe*72")
  131. +
  132. +(define_insn_reservation "niag_branch" 3
  133. + (and (eq_attr "cpu" "niagara")
  134. + (eq_attr "type" "call,sibcall,call_no_delay_slot,uncond_branch,branch"))
  135. + "niag_pipe*3")
  136. +
  137. +(define_insn_reservation "niag_3cycle_load" 3
  138. + (and (eq_attr "cpu" "niagara")
  139. + (eq_attr "type" "load"))
  140. + "niag_pipe*3")
  141. +
  142. +(define_insn_reservation "niag_9cycle_load" 9
  143. + (and (eq_attr "cpu" "niagara")
  144. + (eq_attr "type" "fpload"))
  145. + "niag_pipe*9")
  146. +
  147. +(define_insn_reservation "niag_1cycle_store" 1
  148. + (and (eq_attr "cpu" "niagara")
  149. + (eq_attr "type" "store"))
  150. + "niag_pipe")
  151. +
  152. +(define_insn_reservation "niag_8cycle_store" 8
  153. + (and (eq_attr "cpu" "niagara")
  154. + (eq_attr "type" "fpstore"))
  155. + "niag_pipe*8")
  156. +
  157. +/* Things incorrectly modelled here:
  158. + * FPADD{s,d}: 26 cycles
  159. + * FPSUB{s,d}: 26 cycles
  160. + * FABSD: 26 cycles
  161. + * F{s,d}TO{s,d}: 26 cycles
  162. + * F{s,d}TO{i,x}: 26 cycles
  163. + * FSMULD: 29 cycles
  164. + */
  165. +(define_insn_reservation "niag_fmov" 8
  166. + (and (eq_attr "cpu" "niagara")
  167. + (eq_attr "type" "fpmove,fpcmove,fpcrmove"))
  168. + "niag_pipe*8")
  169. +
  170. +(define_insn_reservation "niag_fpcmp" 26
  171. + (and (eq_attr "cpu" "niagara")
  172. + (eq_attr "type" "fpcmp"))
  173. + "niag_pipe*26")
  174. +
  175. +(define_insn_reservation "niag_fmult" 29
  176. + (and (eq_attr "cpu" "niagara")
  177. + (eq_attr "type" "fpmul"))
  178. + "niag_pipe*29")
  179. +
  180. +(define_insn_reservation "niag_fdivs" 54
  181. + (and (eq_attr "cpu" "niagara")
  182. + (eq_attr "type" "fpdivs"))
  183. + "niag_pipe*54")
  184. +
  185. +(define_insn_reservation "niag_fdivd" 83
  186. + (and (eq_attr "cpu" "niagara")
  187. + (eq_attr "type" "fpdivd"))
  188. + "niag_pipe*83")
  189. +
  190. +/* Things incorrectly modelled here:
  191. + * FPADD{16,32}: 10 cycles
  192. + * FPSUB{16,32}: 10 cycles
  193. + * FALIGNDATA: 10 cycles
  194. + */
  195. +(define_insn_reservation "niag_vis" 8
  196. + (and (eq_attr "cpu" "niagara")
  197. + (eq_attr "type" "fga,fgm_pack,fgm_mul,fgm_cmp,fgm_pdist"))
  198. + "niag_pipe*8")
  199. Index: gcc/config/sparc/sol2-bi.h
  200. ===================================================================
  201. --- ./gcc/config/sparc/sol2-bi.h (revision 111647)
  202. +++ ./gcc/config/sparc/sol2-bi.h (working copy)
  203. @@ -39,6 +39,15 @@
  204. #define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG "b"
  205. #endif
  206. +#if TARGET_CPU_DEFAULT == TARGET_CPU_niagara
  207. +#undef CPP_CPU64_DEFAULT_SPEC
  208. +#define CPP_CPU64_DEFAULT_SPEC ""
  209. +#undef ASM_CPU32_DEFAULT_SPEC
  210. +#define ASM_CPU32_DEFAULT_SPEC "-xarch=v8plusb"
  211. +#undef ASM_CPU64_DEFAULT_SPEC
  212. +#define ASM_CPU64_DEFAULT_SPEC AS_SPARC64_FLAG "b"
  213. +#endif
  214. +
  215. #if DEFAULT_ARCH32_P
  216. #define DEF_ARCH32_SPEC(__str) "%{!m64:" __str "}"
  217. #define DEF_ARCH64_SPEC(__str) "%{m64:" __str "}"
  218. @@ -57,7 +66,7 @@
  219. %{mcpu=sparclite|mcpu-f930|mcpu=f934:-D__sparclite__} \
  220. %{mcpu=v8:" DEF_ARCH32_SPEC("-D__sparcv8") "} \
  221. %{mcpu=supersparc:-D__supersparc__ " DEF_ARCH32_SPEC("-D__sparcv8") "} \
  222. -%{mcpu=v9|mcpu=ultrasparc|mcpu=ultrasparc3:" DEF_ARCH32_SPEC("-D__sparcv8") "} \
  223. +%{mcpu=v9|mcpu=ultrasparc|mcpu=ultrasparc3|mcpu=niagara:" DEF_ARCH32_SPEC("-D__sparcv8") "} \
  224. %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:%(cpp_cpu_default)}}}}}}} \
  225. "
  226. @@ -66,7 +75,8 @@
  227. %{mcpu=v9:" DEF_ARCH32_SPEC("-xarch=v8plus") DEF_ARCH64_SPEC(AS_SPARC64_FLAG) "} \
  228. %{mcpu=ultrasparc:" DEF_ARCH32_SPEC("-xarch=v8plusa") DEF_ARCH64_SPEC(AS_SPARC64_FLAG "a") "} \
  229. %{mcpu=ultrasparc3:" DEF_ARCH32_SPEC("-xarch=v8plusb") DEF_ARCH64_SPEC(AS_SPARC64_FLAG "b") "} \
  230. -%{!mcpu=ultrasparc3:%{!mcpu=ultrasparc:%{!mcpu=v9:%{mcpu*:" DEF_ARCH32_SPEC("-xarch=v8") DEF_ARCH64_SPEC(AS_SPARC64_FLAG) "}}}} \
  231. +%{mcpu=niagara:" DEF_ARCH32_SPEC("-xarch=v8plusb") DEF_ARCH64_SPEC(AS_SPARC64_FLAG "b") "} \
  232. +%{!mcpu=niagara:%{!mcpu=ultrasparc3:%{!mcpu=ultrasparc:%{!mcpu=v9:%{mcpu*:" DEF_ARCH32_SPEC("-xarch=v8") DEF_ARCH64_SPEC(AS_SPARC64_FLAG) "}}}}} \
  233. %{!mcpu*:%(asm_cpu_default)} \
  234. "
  235. Index: gcc/config/sparc/sol2.h
  236. ===================================================================
  237. --- ./gcc/config/sparc/sol2.h (revision 111647)
  238. +++ ./gcc/config/sparc/sol2.h (working copy)
  239. @@ -1,6 +1,6 @@
  240. /* Definitions of target machine for GCC, for SPARC running Solaris 2
  241. - Copyright 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005
  242. - Free Software Foundation, Inc.
  243. + Copyright 1992, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2005,
  244. + 2006 Free Software Foundation, Inc.
  245. Contributed by Ron Guilmette (rfg@netcom.com).
  246. Additional changes by David V. Henkel-Wallace (gumby@cygnus.com).
  247. @@ -41,11 +41,17 @@
  248. #define ASM_CPU_DEFAULT_SPEC "-xarch=v8plusb"
  249. #endif
  250. +#if TARGET_CPU_DEFAULT == TARGET_CPU_niagara
  251. +#undef ASM_CPU_DEFAULT_SPEC
  252. +#define ASM_CPU_DEFAULT_SPEC "-xarch=v8plusb"
  253. +#endif
  254. +
  255. #undef ASM_CPU_SPEC
  256. #define ASM_CPU_SPEC "\
  257. %{mcpu=v9:-xarch=v8plus} \
  258. %{mcpu=ultrasparc:-xarch=v8plusa} \
  259. %{mcpu=ultrasparc3:-xarch=v8plusb} \
  260. +%{mcpu=niagara:-xarch=v8plusb} \
  261. %{!mcpu*:%(asm_cpu_default)} \
  262. "
  263. Index: gcc/config/sparc/sparc.c
  264. ===================================================================
  265. --- ./gcc/config/sparc/sparc.c (revision 111647)
  266. +++ ./gcc/config/sparc/sparc.c (working copy)
  267. @@ -197,6 +197,30 @@
  268. 0, /* shift penalty */
  269. };
  270. +static const
  271. +struct processor_costs niagara_costs = {
  272. + COSTS_N_INSNS (3), /* int load */
  273. + COSTS_N_INSNS (3), /* int signed load */
  274. + COSTS_N_INSNS (3), /* int zeroed load */
  275. + COSTS_N_INSNS (9), /* float load */
  276. + COSTS_N_INSNS (8), /* fmov, fneg, fabs */
  277. + COSTS_N_INSNS (8), /* fadd, fsub */
  278. + COSTS_N_INSNS (26), /* fcmp */
  279. + COSTS_N_INSNS (8), /* fmov, fmovr */
  280. + COSTS_N_INSNS (29), /* fmul */
  281. + COSTS_N_INSNS (54), /* fdivs */
  282. + COSTS_N_INSNS (83), /* fdivd */
  283. + COSTS_N_INSNS (100), /* fsqrts - not implemented in hardware */
  284. + COSTS_N_INSNS (100), /* fsqrtd - not implemented in hardware */
  285. + COSTS_N_INSNS (11), /* imul */
  286. + COSTS_N_INSNS (11), /* imulX */
  287. + 0, /* imul bit factor */
  288. + COSTS_N_INSNS (72), /* idiv */
  289. + COSTS_N_INSNS (72), /* idivX */
  290. + COSTS_N_INSNS (1), /* movcc/movr */
  291. + 0, /* shift penalty */
  292. +};
  293. +
  294. const struct processor_costs *sparc_costs = &cypress_costs;
  295. #ifdef HAVE_AS_RELAX_OPTION
  296. @@ -597,6 +621,7 @@
  297. { TARGET_CPU_v9, "v9" },
  298. { TARGET_CPU_ultrasparc, "ultrasparc" },
  299. { TARGET_CPU_ultrasparc3, "ultrasparc3" },
  300. + { TARGET_CPU_niagara, "niagara" },
  301. { 0, 0 }
  302. };
  303. const struct cpu_default *def;
  304. @@ -632,6 +657,8 @@
  305. /* TI ultrasparc III */
  306. /* ??? Check if %y issue still holds true in ultra3. */
  307. { "ultrasparc3", PROCESSOR_ULTRASPARC3, MASK_ISA, MASK_V9|MASK_DEPRECATED_V8_INSNS},
  308. + /* UltraSPARC T1 */
  309. + { "niagara", PROCESSOR_NIAGARA, MASK_ISA, MASK_V9|MASK_DEPRECATED_V8_INSNS},
  310. { 0, 0, 0, 0 }
  311. };
  312. const struct cpu_table *cpu;
  313. @@ -741,7 +768,8 @@
  314. /* Supply a default value for align_functions. */
  315. if (align_functions == 0
  316. && (sparc_cpu == PROCESSOR_ULTRASPARC
  317. - || sparc_cpu == PROCESSOR_ULTRASPARC3))
  318. + || sparc_cpu == PROCESSOR_ULTRASPARC3
  319. + || sparc_cpu == PROCESSOR_NIAGARA))
  320. align_functions = 32;
  321. /* Validate PCC_STRUCT_RETURN. */
  322. @@ -790,6 +818,9 @@
  323. case PROCESSOR_ULTRASPARC3:
  324. sparc_costs = &ultrasparc3_costs;
  325. break;
  326. + case PROCESSOR_NIAGARA:
  327. + sparc_costs = &niagara_costs;
  328. + break;
  329. };
  330. #ifdef TARGET_DEFAULT_LONG_DOUBLE_128
  331. @@ -7099,7 +7130,8 @@
  332. aligned on a 16 byte boundary so one flush clears it all. */
  333. emit_insn (gen_flush (validize_mem (gen_rtx_MEM (SImode, tramp))));
  334. if (sparc_cpu != PROCESSOR_ULTRASPARC
  335. - && sparc_cpu != PROCESSOR_ULTRASPARC3)
  336. + && sparc_cpu != PROCESSOR_ULTRASPARC3
  337. + && sparc_cpu != PROCESSOR_NIAGARA)
  338. emit_insn (gen_flush (validize_mem (gen_rtx_MEM (SImode,
  339. plus_constant (tramp, 8)))));
  340. @@ -7141,7 +7173,8 @@
  341. emit_insn (gen_flushdi (validize_mem (gen_rtx_MEM (DImode, tramp))));
  342. if (sparc_cpu != PROCESSOR_ULTRASPARC
  343. - && sparc_cpu != PROCESSOR_ULTRASPARC3)
  344. + && sparc_cpu != PROCESSOR_ULTRASPARC3
  345. + && sparc_cpu != PROCESSOR_NIAGARA)
  346. emit_insn (gen_flushdi (validize_mem (gen_rtx_MEM (DImode, plus_constant (tramp, 8)))));
  347. /* Call __enable_execute_stack after writing onto the stack to make sure
  348. @@ -7321,6 +7354,8 @@
  349. static int
  350. sparc_use_sched_lookahead (void)
  351. {
  352. + if (sparc_cpu == PROCESSOR_NIAGARA)
  353. + return 0;
  354. if (sparc_cpu == PROCESSOR_ULTRASPARC
  355. || sparc_cpu == PROCESSOR_ULTRASPARC3)
  356. return 4;
  357. @@ -7336,6 +7371,7 @@
  358. {
  359. switch (sparc_cpu)
  360. {
  361. + case PROCESSOR_NIAGARA:
  362. default:
  363. return 1;
  364. case PROCESSOR_V9:
  365. Index: gcc/config/sparc/sparc.h
  366. ===================================================================
  367. --- ./gcc/config/sparc/sparc.h (revision 111647)
  368. +++ ./gcc/config/sparc/sparc.h (working copy)
  369. @@ -1,6 +1,6 @@
  370. /* Definitions of target machine for GNU compiler, for Sun SPARC.
  371. Copyright (C) 1987, 1988, 1989, 1992, 1994, 1995, 1996, 1997, 1998, 1999
  372. - 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
  373. + 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
  374. Contributed by Michael Tiemann (tiemann@cygnus.com).
  375. 64-bit SPARC-V9 support by Michael Tiemann, Jim Wilson, and Doug Evans,
  376. at Cygnus Support.
  377. @@ -206,7 +206,7 @@
  378. which requires the following macro to be true if enabled. Prior to V9,
  379. there are no instructions to even talk about memory synchronization.
  380. Note that the UltraSPARC III processors don't implement RMO, unlike the
  381. - UltraSPARC II processors.
  382. + UltraSPARC II processors. Niagara does not implement RMO either.
  383. Default to false; for example, Solaris never enables RMO, only ever uses
  384. total memory ordering (TMO). */
  385. @@ -238,10 +238,12 @@
  386. #define TARGET_CPU_sparc64 7 /* alias */
  387. #define TARGET_CPU_ultrasparc 8
  388. #define TARGET_CPU_ultrasparc3 9
  389. +#define TARGET_CPU_niagara 10
  390. #if TARGET_CPU_DEFAULT == TARGET_CPU_v9 \
  391. || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc \
  392. - || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc3
  393. + || TARGET_CPU_DEFAULT == TARGET_CPU_ultrasparc3 \
  394. + || TARGET_CPU_DEFAULT == TARGET_CPU_niagara
  395. #define CPP_CPU32_DEFAULT_SPEC ""
  396. #define ASM_CPU32_DEFAULT_SPEC ""
  397. @@ -262,6 +264,10 @@
  398. #define CPP_CPU64_DEFAULT_SPEC "-D__sparc_v9__"
  399. #define ASM_CPU64_DEFAULT_SPEC "-Av9b"
  400. #endif
  401. +#if TARGET_CPU_DEFAULT == TARGET_CPU_niagara
  402. +#define CPP_CPU64_DEFAULT_SPEC "-D__sparc_v9__"
  403. +#define ASM_CPU64_DEFAULT_SPEC "-Av9b"
  404. +#endif
  405. #else
  406. @@ -352,6 +358,7 @@
  407. %{mcpu=v9:-D__sparc_v9__} \
  408. %{mcpu=ultrasparc:-D__sparc_v9__} \
  409. %{mcpu=ultrasparc3:-D__sparc_v9__} \
  410. +%{mcpu=niagara:-D__sparc_v9__} \
  411. %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:%(cpp_cpu_default)}}}}}}} \
  412. "
  413. #define CPP_ARCH32_SPEC ""
  414. @@ -401,6 +408,7 @@
  415. %{mcpu=v9:-Av9} \
  416. %{mcpu=ultrasparc:%{!mv8plus:-Av9a}} \
  417. %{mcpu=ultrasparc3:%{!mv8plus:-Av9b}} \
  418. +%{mcpu=niagara:%{!mv8plus:-Av9b}} \
  419. %{!mcpu*:%{!mcypress:%{!msparclite:%{!mf930:%{!mf934:%{!mv8:%{!msupersparc:%(asm_cpu_default)}}}}}}} \
  420. "
  421. @@ -524,7 +532,8 @@
  422. PROCESSOR_TSC701,
  423. PROCESSOR_V9,
  424. PROCESSOR_ULTRASPARC,
  425. - PROCESSOR_ULTRASPARC3
  426. + PROCESSOR_ULTRASPARC3,
  427. + PROCESSOR_NIAGARA
  428. };
  429. /* This is set from -m{cpu,tune}=xxx. */
  430. @@ -2137,7 +2146,8 @@
  431. || (GENERAL_OR_I64 (CLASS1) && FP_REG_CLASS_P (CLASS2)) \
  432. || (CLASS1) == FPCC_REGS || (CLASS2) == FPCC_REGS) \
  433. ? ((sparc_cpu == PROCESSOR_ULTRASPARC \
  434. - || sparc_cpu == PROCESSOR_ULTRASPARC3) ? 12 : 6) : 2)
  435. + || sparc_cpu == PROCESSOR_ULTRASPARC3 \
  436. + || sparc_cpu == PROCESSOR_NIAGARA) ? 12 : 6) : 2)
  437. /* Provide the cost of a branch. For pre-v9 processors we use
  438. a value of 3 to take into account the potential annulling of
  439. @@ -2147,22 +2157,30 @@
  440. On v9 and later, which have branch prediction facilities, we set
  441. it to the depth of the pipeline as that is the cost of a
  442. - mispredicted branch. */
  443. + mispredicted branch.
  444. + On Niagara, normal branches insert 3 bubbles into the pipe
  445. + and annulled branches insert 4 bubbles. */
  446. +
  447. #define BRANCH_COST \
  448. ((sparc_cpu == PROCESSOR_V9 \
  449. || sparc_cpu == PROCESSOR_ULTRASPARC) \
  450. ? 7 \
  451. : (sparc_cpu == PROCESSOR_ULTRASPARC3 \
  452. - ? 9 : 3))
  453. + ? 9 \
  454. + : (sparc_cpu == PROCESSOR_NIAGARA \
  455. + ? 4 \
  456. + : 3)))
  457. #define PREFETCH_BLOCK \
  458. ((sparc_cpu == PROCESSOR_ULTRASPARC \
  459. - || sparc_cpu == PROCESSOR_ULTRASPARC3) \
  460. + || sparc_cpu == PROCESSOR_ULTRASPARC3 \
  461. + || sparc_cpu == PROCESSOR_NIAGARA) \
  462. ? 64 : 32)
  463. #define SIMULTANEOUS_PREFETCHES \
  464. - ((sparc_cpu == PROCESSOR_ULTRASPARC) \
  465. + ((sparc_cpu == PROCESSOR_ULTRASPARC \
  466. + || sparc_cpu == PROCESSOR_NIAGARA) \
  467. ? 2 \
  468. : (sparc_cpu == PROCESSOR_ULTRASPARC3 \
  469. ? 8 : 3))
  470. Index: gcc/config/sparc/sparc.md
  471. ===================================================================
  472. --- ./gcc/config/sparc/sparc.md (revision 111647)
  473. +++ ./gcc/config/sparc/sparc.md (working copy)
  474. @@ -1,6 +1,6 @@
  475. ;; Machine description for SPARC chip for GCC
  476. ;; Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
  477. -;; 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
  478. +;; 1999, 2000, 2001, 2002, 2003, 2004, 2005,2006 Free Software Foundation, Inc.
  479. ;; Contributed by Michael Tiemann (tiemann@cygnus.com)
  480. ;; 64-bit SPARC-V9 support by Michael Tiemann, Jim Wilson, and Doug Evans,
  481. ;; at Cygnus Support.
  482. @@ -94,7 +94,8 @@
  483. sparclet,tsc701,
  484. v9,
  485. ultrasparc,
  486. - ultrasparc3"
  487. + ultrasparc3,
  488. + niagara"
  489. (const (symbol_ref "sparc_cpu_attr")))
  490. ;; Attribute for the instruction set.
  491. @@ -315,6 +316,7 @@
  492. (include "sparclet.md")
  493. (include "ultra1_2.md")
  494. (include "ultra3.md")
  495. +(include "niagara.md")
  496. ;; Operand and operator predicates.
  497. Index: gcc/doc/invoke.texi
  498. ===================================================================
  499. --- ./gcc/doc/invoke.texi (revision 111647)
  500. +++ ./gcc/doc/invoke.texi (working copy)
  501. @@ -12268,8 +12268,8 @@
  502. for machine type @var{cpu_type}. Supported values for @var{cpu_type} are
  503. @samp{v7}, @samp{cypress}, @samp{v8}, @samp{supersparc}, @samp{sparclite},
  504. @samp{f930}, @samp{f934}, @samp{hypersparc}, @samp{sparclite86x},
  505. -@samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc}, and
  506. -@samp{ultrasparc3}.
  507. +@samp{sparclet}, @samp{tsc701}, @samp{v9}, @samp{ultrasparc},
  508. +@samp{ultrasparc3}, and @samp{niagara}.
  509. Default instruction scheduling parameters are used for values that select
  510. an architecture and not an implementation. These are @samp{v7}, @samp{v8},
  511. @@ -12283,7 +12283,7 @@
  512. v8: supersparc, hypersparc
  513. sparclite: f930, f934, sparclite86x
  514. sparclet: tsc701
  515. - v9: ultrasparc, ultrasparc3
  516. + v9: ultrasparc, ultrasparc3, niagara
  517. @end smallexample
  518. By default (unless configured otherwise), GCC generates code for the V7
  519. @@ -12317,9 +12317,11 @@
  520. architecture. This adds 64-bit integer and floating-point move instructions,
  521. 3 additional floating-point condition code registers and conditional move
  522. instructions. With @option{-mcpu=ultrasparc}, the compiler additionally
  523. -optimizes it for the Sun UltraSPARC I/II chips. With
  524. +optimizes it for the Sun UltraSPARC I/II/IIi chips. With
  525. @option{-mcpu=ultrasparc3}, the compiler additionally optimizes it for the
  526. -Sun UltraSPARC III chip.
  527. +Sun UltraSPARC III/III+/IIIi/IIIi+/IV/IV+ chips. With
  528. +@option{-mcpu=niagara}, the compiler additionally optimizes it for
  529. +Sun UltraSPARC T1 chips.
  530. @item -mtune=@var{cpu_type}
  531. @opindex mtune
  532. @@ -12331,8 +12333,8 @@
  533. @option{-mtune=@var{cpu_type}}, but the only useful values are those
  534. that select a particular cpu implementation. Those are @samp{cypress},
  535. @samp{supersparc}, @samp{hypersparc}, @samp{f930}, @samp{f934},
  536. -@samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc}, and
  537. -@samp{ultrasparc3}.
  538. +@samp{sparclite86x}, @samp{tsc701}, @samp{ultrasparc},
  539. +@samp{ultrasparc3}, and @samp{niagara}.
  540. @item -mv8plus
  541. @itemx -mno-v8plus