1 # --- T2-COPYRIGHT-NOTE-BEGIN ---
2 # T2 SDE: package/*/gcc/ibm-espresso.patch.powerpc
3 # Copyright (C) 2024 The T2 SDE Project
5 # This Copyright note is generated by scripts/Create-CopyPatch,
6 # more information can be found in the files COPYING and README.
8 # This patch file is dual-licensed. It is available under the license the
9 # patched project is licensed under, as long as it is an OpenSource license
10 # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
11 # of the GNU General Public License version 2 as used by the T2 SDE.
12 # --- T2-COPYRIGHT-NOTE-END ---
14 Only in gcc-13.2.0.new/: build
15 diff -rup gcc-13.2.0/gcc/config/rs6000/7xx.md gcc-13.2.0.new/gcc/config/rs6000/7xx.md
16 --- gcc-13.2.0/gcc/config/rs6000/7xx.md 2023-07-27 18:13:04.000000000 +1000
17 +++ gcc-13.2.0.new/gcc/config/rs6000/7xx.md 2023-12-25 17:30:50.475274708 +1100
20 (define_insn_reservation "ppc750-load" 2
21 (and (eq_attr "type" "load,fpload,vecload,load_l")
22 - (eq_attr "cpu" "ppc750,ppc7400"))
23 + (eq_attr "cpu" "ppc750,ppc7400,espresso"))
26 (define_insn_reservation "ppc750-store" 2
27 (and (eq_attr "type" "store,fpstore,vecstore")
28 - (eq_attr "cpu" "ppc750,ppc7400"))
29 + (eq_attr "cpu" "ppc750,ppc7400,espresso"))
32 (define_insn_reservation "ppc750-storec" 8
33 (and (eq_attr "type" "store_c")
34 - (eq_attr "cpu" "ppc750,ppc7400"))
35 + (eq_attr "cpu" "ppc750,ppc7400,espresso"))
38 (define_insn_reservation "ppc750-integer" 1
39 (and (ior (eq_attr "type" "integer,insert,trap,cntlz,isel")
40 (and (eq_attr "type" "add,logical,shift,exts")
41 (eq_attr "dot" "no")))
42 - (eq_attr "cpu" "ppc750,ppc7400"))
43 + (eq_attr "cpu" "ppc750,ppc7400,espresso"))
44 "ppc750_du,iu1_7xx|iu2_7xx")
46 (define_insn_reservation "ppc750-two" 1
47 (and (eq_attr "type" "two")
48 - (eq_attr "cpu" "ppc750,ppc7400"))
49 + (eq_attr "cpu" "ppc750,ppc7400,espresso"))
50 "ppc750_du,iu1_7xx|iu2_7xx,iu1_7xx|iu2_7xx")
52 (define_insn_reservation "ppc750-three" 1
53 (and (eq_attr "type" "three")
54 - (eq_attr "cpu" "ppc750,ppc7400"))
55 + (eq_attr "cpu" "ppc750,ppc7400,espresso"))
56 "ppc750_du,iu1_7xx|iu2_7xx,iu1_7xx|iu2_7xx,iu1_7xx|iu2_7xx")
58 (define_insn_reservation "ppc750-imul" 4
59 (and (eq_attr "type" "mul")
61 - (eq_attr "cpu" "ppc750,ppc7400"))
62 + (eq_attr "cpu" "ppc750,ppc7400,espresso"))
63 "ppc750_du,iu1_7xx*4")
65 (define_insn_reservation "ppc750-imul2" 3
66 (and (eq_attr "type" "mul")
68 - (eq_attr "cpu" "ppc750,ppc7400"))
69 + (eq_attr "cpu" "ppc750,ppc7400,espresso"))
70 "ppc750_du,iu1_7xx*2")
72 (define_insn_reservation "ppc750-imul3" 2
73 (and (eq_attr "type" "mul")
75 - (eq_attr "cpu" "ppc750,ppc7400"))
76 + (eq_attr "cpu" "ppc750,ppc7400,espresso"))
79 (define_insn_reservation "ppc750-idiv" 19
80 (and (eq_attr "type" "div")
81 - (eq_attr "cpu" "ppc750,ppc7400"))
82 + (eq_attr "cpu" "ppc750,ppc7400,espresso"))
83 "ppc750_du,iu1_7xx*19")
85 (define_insn_reservation "ppc750-compare" 2
86 (and (ior (eq_attr "type" "cmp")
87 (and (eq_attr "type" "add,logical,shift,exts")
88 (eq_attr "dot" "yes")))
89 - (eq_attr "cpu" "ppc750,ppc7400"))
90 + (eq_attr "cpu" "ppc750,ppc7400,espresso"))
91 "ppc750_du,(iu1_7xx|iu2_7xx)")
93 (define_insn_reservation "ppc750-fpcompare" 2
94 (and (eq_attr "type" "fpcompare")
95 - (eq_attr "cpu" "ppc750,ppc7400"))
96 + (eq_attr "cpu" "ppc750,ppc7400,espresso"))
99 (define_insn_reservation "ppc750-fp" 3
100 (and (eq_attr "type" "fp,fpsimple")
101 - (eq_attr "cpu" "ppc750,ppc7400"))
102 + (eq_attr "cpu" "ppc750,ppc7400,espresso"))
105 (define_insn_reservation "ppc750-dmul" 4
106 (and (eq_attr "type" "dmul")
107 - (eq_attr "cpu" "ppc750"))
108 + (eq_attr "cpu" "ppc750,espresso"))
109 "ppc750_du,fpu_7xx*2")
111 (define_insn_reservation "ppc7400-dmul" 3
112 @@ -130,37 +130,37 @@
113 ; Divides are not pipelined
114 (define_insn_reservation "ppc750-sdiv" 17
115 (and (eq_attr "type" "sdiv")
116 - (eq_attr "cpu" "ppc750,ppc7400"))
117 + (eq_attr "cpu" "ppc750,ppc7400,espresso"))
118 "ppc750_du,fpu_7xx*17")
120 (define_insn_reservation "ppc750-ddiv" 31
121 (and (eq_attr "type" "ddiv")
122 - (eq_attr "cpu" "ppc750,ppc7400"))
123 + (eq_attr "cpu" "ppc750,ppc7400,espresso"))
124 "ppc750_du,fpu_7xx*31")
126 (define_insn_reservation "ppc750-mfcr" 2
127 (and (eq_attr "type" "mfcr,mtcr")
128 - (eq_attr "cpu" "ppc750,ppc7400"))
129 + (eq_attr "cpu" "ppc750,ppc7400,espresso"))
132 (define_insn_reservation "ppc750-crlogical" 3
133 (and (eq_attr "type" "cr_logical")
134 - (eq_attr "cpu" "ppc750,ppc7400"))
135 + (eq_attr "cpu" "ppc750,ppc7400,espresso"))
138 (define_insn_reservation "ppc750-mtjmpr" 2
139 (and (eq_attr "type" "mtjmpr,isync,sync")
140 - (eq_attr "cpu" "ppc750,ppc7400"))
141 + (eq_attr "cpu" "ppc750,ppc7400,espresso"))
144 (define_insn_reservation "ppc750-mfjmpr" 3
145 (and (eq_attr "type" "mfjmpr")
146 - (eq_attr "cpu" "ppc750,ppc7400"))
147 + (eq_attr "cpu" "ppc750,ppc7400,espresso"))
150 (define_insn_reservation "ppc750-jmpreg" 1
151 (and (eq_attr "type" "jmpreg,branch,isync")
152 - (eq_attr "cpu" "ppc750,ppc7400"))
153 + (eq_attr "cpu" "ppc750,ppc7400,espresso"))
157 diff -rup gcc-13.2.0/gcc/config/rs6000/driver-rs6000.cc gcc-13.2.0.new/gcc/config/rs6000/driver-rs6000.cc
158 --- gcc-13.2.0/gcc/config/rs6000/driver-rs6000.cc 2023-07-27 18:13:04.000000000 +1000
159 +++ gcc-13.2.0.new/gcc/config/rs6000/driver-rs6000.cc 2023-12-25 17:37:00.150252750 +1100
160 @@ -506,6 +506,7 @@ static const struct asm_name asm_names[]
161 { "630", "-mppc64" },
164 + { "espresso", "-mppc" },
166 { "7400", "-mppc %{!mvsx:%{!maltivec:-maltivec}}" },
167 { "7450", "-mppc %{!mvsx:%{!maltivec:-maltivec}}" },
168 diff -rup gcc-13.2.0/gcc/config/rs6000/rs6000.cc gcc-13.2.0.new/gcc/config/rs6000/rs6000.cc
169 --- gcc-13.2.0/gcc/config/rs6000/rs6000.cc 2023-07-27 18:13:04.000000000 +1000
170 +++ gcc-13.2.0.new/gcc/config/rs6000/rs6000.cc 2023-12-25 17:43:33.317711721 +1100
171 @@ -4687,6 +4687,7 @@ rs6000_option_override_internal (bool gl
173 case PROCESSOR_PPC750:
174 case PROCESSOR_PPC7400:
175 + case PROCESSOR_ESPRESSO:
176 rs6000_cost = &ppc750_cost;
179 @@ -16545,6 +16546,10 @@ emit_store_conditional (machine_mode mod
180 if (PPC405_ERRATUM77)
181 emit_insn (gen_hwsync ());
183 + /* Emit dcbst before stwcx. to address Espresso erratum */
184 + if (ESPRESSO_ERRATUM)
185 + emit_insn (gen_rs6000_dcbst (mem));
187 emit_insn (fn (res, mem, val));
190 @@ -17964,6 +17969,7 @@ rs6000_adjust_cost (rtx_insn *insn, int
191 || rs6000_tune == PROCESSOR_PPC620
192 || rs6000_tune == PROCESSOR_PPC630
193 || rs6000_tune == PROCESSOR_PPC750
194 + || rs6000_tune == PROCESSOR_ESPRESSO
195 || rs6000_tune == PROCESSOR_PPC7400
196 || rs6000_tune == PROCESSOR_PPC7450
197 || rs6000_tune == PROCESSOR_PPCE5500
198 @@ -18520,6 +18526,7 @@ rs6000_issue_rate (void)
199 case PROCESSOR_PPC440:
200 case PROCESSOR_PPC603:
201 case PROCESSOR_PPC750:
202 + case PROCESSOR_ESPRESSO:
203 case PROCESSOR_PPC7400:
204 case PROCESSOR_PPC8540:
205 case PROCESSOR_PPC8548:
206 diff -rup gcc-13.2.0/gcc/config/rs6000/rs6000-c.cc gcc-13.2.0.new/gcc/config/rs6000/rs6000-c.cc
207 --- gcc-13.2.0/gcc/config/rs6000/rs6000-c.cc 2023-07-27 18:13:04.000000000 +1000
208 +++ gcc-13.2.0.new/gcc/config/rs6000/rs6000-c.cc 2023-12-25 17:43:42.106575203 +1100
209 @@ -654,6 +654,8 @@ rs6000_cpu_cpp_builtins (cpp_reader *pfi
210 /* Used by lwarx/stwcx. errata work-around. */
211 if (rs6000_cpu == PROCESSOR_PPC405)
212 builtin_define ("__PPC405__");
213 + if (ESPRESSO_ERRATUM)
214 + builtin_define ("__ESPRESSO__");
215 /* Used by libstdc++. */
216 if (TARGET_NO_LWSYNC)
217 builtin_define ("__NO_LWSYNC__");
218 diff -rup gcc-13.2.0/gcc/config/rs6000/rs6000-cpus.def gcc-13.2.0.new/gcc/config/rs6000/rs6000-cpus.def
219 --- gcc-13.2.0/gcc/config/rs6000/rs6000-cpus.def 2023-07-27 18:13:04.000000000 +1000
220 +++ gcc-13.2.0.new/gcc/config/rs6000/rs6000-cpus.def 2023-12-25 17:35:46.983993390 +1100
221 @@ -206,6 +206,7 @@ RS6000_CPU ("740", PROCESSOR_PPC750, OPT
222 RS6000_CPU ("7400", PROCESSOR_PPC7400, POWERPC_7400_MASK)
223 RS6000_CPU ("7450", PROCESSOR_PPC7450, POWERPC_7400_MASK)
224 RS6000_CPU ("750", PROCESSOR_PPC750, OPTION_MASK_PPC_GFXOPT)
225 +RS6000_CPU ("espresso", PROCESSOR_ESPRESSO, OPTION_MASK_PPC_GFXOPT)
226 RS6000_CPU ("801", PROCESSOR_MPCCORE, OPTION_MASK_SOFT_FLOAT)
227 RS6000_CPU ("821", PROCESSOR_MPCCORE, OPTION_MASK_SOFT_FLOAT)
228 RS6000_CPU ("823", PROCESSOR_MPCCORE, OPTION_MASK_SOFT_FLOAT)
229 diff -rup gcc-13.2.0/gcc/config/rs6000/rs6000.h gcc-13.2.0.new/gcc/config/rs6000/rs6000.h
230 --- gcc-13.2.0/gcc/config/rs6000/rs6000.h 2023-07-27 18:13:04.000000000 +1000
231 +++ gcc-13.2.0.new/gcc/config/rs6000/rs6000.h 2023-12-25 17:41:53.759311091 +1100
233 #define PPC405_ERRATUM77 0
236 +/* Support Espresso stwcx erratum. */
237 +#define ESPRESSO_ERRATUM (rs6000_cpu == PROCESSOR_ESPRESSO || rs6000_tune == PROCESSOR_ESPRESSO)
239 #ifndef SUBTARGET_DRIVER_SELF_SPECS
240 # define SUBTARGET_DRIVER_SELF_SPECS ""
246 + mcpu=espresso: -mppc; \
248 mcpu=7400: -mppc %{!mvsx:%{!maltivec:-maltivec}}; \
249 mcpu=7450: -mppc %{!mvsx:%{!maltivec:-maltivec}}; \
250 diff -rup gcc-13.2.0/gcc/config/rs6000/rs6000-logue.cc gcc-13.2.0.new/gcc/config/rs6000/rs6000-logue.cc
251 --- gcc-13.2.0/gcc/config/rs6000/rs6000-logue.cc 2023-07-27 18:13:04.000000000 +1000
252 +++ gcc-13.2.0.new/gcc/config/rs6000/rs6000-logue.cc 2023-12-25 17:37:48.965097770 +1100
253 @@ -4327,6 +4327,7 @@ rs6000_emit_epilogue (enum epilogue_type
254 bool using_mtcr_multiple = (rs6000_tune == PROCESSOR_PPC601
255 || rs6000_tune == PROCESSOR_PPC603
256 || rs6000_tune == PROCESSOR_PPC750
257 + || rs6000_tune == PROCESSOR_ESPRESSO
260 /* Restore via the backchain when we have a large frame, since this
261 diff -rup gcc-13.2.0/gcc/config/rs6000/rs6000.md gcc-13.2.0.new/gcc/config/rs6000/rs6000.md
262 --- gcc-13.2.0/gcc/config/rs6000/rs6000.md 2023-07-27 18:13:04.000000000 +1000
263 +++ gcc-13.2.0.new/gcc/config/rs6000/rs6000.md 2023-12-28 17:19:39.415655616 +1100
265 ;; enumeration in rs6000-opts.h.
267 "ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630,
268 - ppc750,ppc7400,ppc7450,
269 + ppc750,ppc7400,ppc7450,espresso,
270 ppc403,ppc405,ppc440,ppc476,
271 ppc8540,ppc8548,ppce300c2,ppce300c3,ppce500mc,ppce500mc64,ppce5500,ppce6500,
272 power4,power5,power6,power7,power8,power9,power10,
273 diff -rup gcc-13.2.0/gcc/config/rs6000/rs6000-opts.h gcc-13.2.0.new/gcc/config/rs6000/rs6000-opts.h
274 --- gcc-13.2.0/gcc/config/rs6000/rs6000-opts.h 2023-07-27 18:13:04.000000000 +1000
275 +++ gcc-13.2.0.new/gcc/config/rs6000/rs6000-opts.h 2023-12-25 17:26:21.545836774 +1100
276 @@ -40,6 +40,7 @@ enum processor_type
280 + PROCESSOR_ESPRESSO,
284 diff -rup gcc-13.2.0/gcc/config/rs6000/rs6000-tables.opt gcc-13.2.0.new/gcc/config/rs6000/rs6000-tables.opt
285 --- gcc-13.2.0/gcc/config/rs6000/rs6000-tables.opt 2023-07-27 18:13:04.000000000 +1000
286 +++ gcc-13.2.0.new/gcc/config/rs6000/rs6000-tables.opt 2023-12-25 17:43:57.525335704 +1100
287 @@ -96,104 +96,107 @@ EnumValue
288 Enum(rs6000_cpu_opt_value) String(750) Value(22)
291 -Enum(rs6000_cpu_opt_value) String(801) Value(23)
292 +Enum(rs6000_cpu_opt_value) String(espresso) Value(23)
295 -Enum(rs6000_cpu_opt_value) String(821) Value(24)
296 +Enum(rs6000_cpu_opt_value) String(801) Value(24)
299 -Enum(rs6000_cpu_opt_value) String(823) Value(25)
300 +Enum(rs6000_cpu_opt_value) String(821) Value(25)
303 -Enum(rs6000_cpu_opt_value) String(8540) Value(26)
304 +Enum(rs6000_cpu_opt_value) String(823) Value(26)
307 -Enum(rs6000_cpu_opt_value) String(8548) Value(27)
308 +Enum(rs6000_cpu_opt_value) String(8540) Value(27)
311 -Enum(rs6000_cpu_opt_value) String(a2) Value(28)
312 +Enum(rs6000_cpu_opt_value) String(8548) Value(28)
315 -Enum(rs6000_cpu_opt_value) String(e300c2) Value(29)
316 +Enum(rs6000_cpu_opt_value) String(a2) Value(29)
319 -Enum(rs6000_cpu_opt_value) String(e300c3) Value(30)
320 +Enum(rs6000_cpu_opt_value) String(e300c2) Value(30)
323 -Enum(rs6000_cpu_opt_value) String(e500mc) Value(31)
324 +Enum(rs6000_cpu_opt_value) String(e300c3) Value(31)
327 -Enum(rs6000_cpu_opt_value) String(e500mc64) Value(32)
328 +Enum(rs6000_cpu_opt_value) String(e500mc) Value(32)
331 -Enum(rs6000_cpu_opt_value) String(e5500) Value(33)
332 +Enum(rs6000_cpu_opt_value) String(e500mc64) Value(33)
335 -Enum(rs6000_cpu_opt_value) String(e6500) Value(34)
336 +Enum(rs6000_cpu_opt_value) String(e5500) Value(34)
339 -Enum(rs6000_cpu_opt_value) String(860) Value(35)
340 +Enum(rs6000_cpu_opt_value) String(e6500) Value(35)
343 -Enum(rs6000_cpu_opt_value) String(970) Value(36)
344 +Enum(rs6000_cpu_opt_value) String(860) Value(36)
347 -Enum(rs6000_cpu_opt_value) String(cell) Value(37)
348 +Enum(rs6000_cpu_opt_value) String(970) Value(37)
351 -Enum(rs6000_cpu_opt_value) String(ec603e) Value(38)
352 +Enum(rs6000_cpu_opt_value) String(cell) Value(38)
355 -Enum(rs6000_cpu_opt_value) String(G3) Value(39)
356 +Enum(rs6000_cpu_opt_value) String(ec603e) Value(39)
359 -Enum(rs6000_cpu_opt_value) String(G4) Value(40)
360 +Enum(rs6000_cpu_opt_value) String(G3) Value(40)
363 -Enum(rs6000_cpu_opt_value) String(G5) Value(41)
364 +Enum(rs6000_cpu_opt_value) String(G4) Value(41)
367 -Enum(rs6000_cpu_opt_value) String(titan) Value(42)
368 +Enum(rs6000_cpu_opt_value) String(G5) Value(42)
371 -Enum(rs6000_cpu_opt_value) String(power3) Value(43)
372 +Enum(rs6000_cpu_opt_value) String(titan) Value(43)
375 -Enum(rs6000_cpu_opt_value) String(power4) Value(44)
376 +Enum(rs6000_cpu_opt_value) String(power3) Value(44)
379 -Enum(rs6000_cpu_opt_value) String(power5) Value(45)
380 +Enum(rs6000_cpu_opt_value) String(power4) Value(45)
383 -Enum(rs6000_cpu_opt_value) String(power5+) Value(46)
384 +Enum(rs6000_cpu_opt_value) String(power5) Value(46)
387 -Enum(rs6000_cpu_opt_value) String(power6) Value(47)
388 +Enum(rs6000_cpu_opt_value) String(power5+) Value(47)
391 -Enum(rs6000_cpu_opt_value) String(power6x) Value(48)
392 +Enum(rs6000_cpu_opt_value) String(power6) Value(48)
395 -Enum(rs6000_cpu_opt_value) String(power7) Value(49)
396 +Enum(rs6000_cpu_opt_value) String(power6x) Value(49)
399 -Enum(rs6000_cpu_opt_value) String(power8) Value(50)
400 +Enum(rs6000_cpu_opt_value) String(power7) Value(50)
403 -Enum(rs6000_cpu_opt_value) String(power9) Value(51)
404 +Enum(rs6000_cpu_opt_value) String(power8) Value(51)
407 -Enum(rs6000_cpu_opt_value) String(power10) Value(52)
408 +Enum(rs6000_cpu_opt_value) String(power9) Value(52)
411 -Enum(rs6000_cpu_opt_value) String(powerpc) Value(53)
412 +Enum(rs6000_cpu_opt_value) String(power10) Value(53)
415 -Enum(rs6000_cpu_opt_value) String(powerpc64) Value(54)
416 +Enum(rs6000_cpu_opt_value) String(powerpc) Value(54)
419 -Enum(rs6000_cpu_opt_value) String(powerpc64le) Value(55)
420 +Enum(rs6000_cpu_opt_value) String(powerpc64) Value(55)
423 -Enum(rs6000_cpu_opt_value) String(rs64) Value(56)
424 +Enum(rs6000_cpu_opt_value) String(powerpc64le) Value(56)
427 +Enum(rs6000_cpu_opt_value) String(rs64) Value(57)
429 diff -rup gcc-13.2.0/gcc/config/rs6000/sync.md gcc-13.2.0.new/gcc/config/rs6000/sync.md
430 --- gcc-13.2.0/gcc/config/rs6000/sync.md 2023-07-27 18:13:04.000000000 +1000
431 +++ gcc-13.2.0.new/gcc/config/rs6000/sync.md 2023-12-28 16:58:45.235128306 +1100
434 [(set_attr "type" "store_c")])
436 +;; I am pretty sure VOID is correct since this actually affects a cache-block sized
438 +
\f(define_insn "rs6000_dcbst"
439 + [(match_operand:VOID 0 "memory_operand" "=Z")]
443 ;; Use a temporary register to force getting an even register for the
444 ;; lqarx/stqcrx. instructions. Normal optimizations will eliminate this extra
445 ;; copy on big endian systems.
446 diff -rup gcc-13.2.0/gcc/config.gcc gcc-13.2.0.new/gcc/config.gcc
447 --- gcc-13.2.0/gcc/config.gcc 2023-07-27 18:13:04.000000000 +1000
448 +++ gcc-13.2.0.new/gcc/config.gcc 2023-12-28 17:58:48.853211935 +1100
449 @@ -5417,7 +5417,7 @@ case "${target}" in
451 | 401 | 403 | 405 | 405fp | 440 | 440fp | 464 | 464fp \
452 | 476 | 476fp | 505 | 601 | 602 | 603 | 603e | ec603e \
453 - | 604 | 604e | 620 | 630 | 740 | 750 | 7400 | 7450 \
454 + | 604 | 604e | 620 | 630 | 740 | 750 | 7400 | 7450 | espresso \
455 | a2 | e300c[23] | 854[08] | e500mc | e500mc64 | e5500 | e6500 \
456 | titan | 801 | 821 | 823 | 860 | 970 | G3 | G4 | G5 | cell)