# --- T2-COPYRIGHT-NOTE-BEGIN --- # T2 SDE: package/*/gcc/ibm-espresso.patch.powerpc # Copyright (C) 2024 The T2 SDE Project # # This Copyright note is generated by scripts/Create-CopyPatch, # more information can be found in the files COPYING and README. # # This patch file is dual-licensed. It is available under the license the # patched project is licensed under, as long as it is an OpenSource license # as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms # of the GNU General Public License version 2 as used by the T2 SDE. # --- T2-COPYRIGHT-NOTE-END --- Only in gcc-13.2.0.new/: build diff -rup gcc-13.2.0/gcc/config/rs6000/7xx.md gcc-13.2.0.new/gcc/config/rs6000/7xx.md --- gcc-13.2.0/gcc/config/rs6000/7xx.md 2023-07-27 18:13:04.000000000 +1000 +++ gcc-13.2.0.new/gcc/config/rs6000/7xx.md 2023-12-25 17:30:50.475274708 +1100 @@ -47,79 +47,79 @@ (define_insn_reservation "ppc750-load" 2 (and (eq_attr "type" "load,fpload,vecload,load_l") - (eq_attr "cpu" "ppc750,ppc7400")) + (eq_attr "cpu" "ppc750,ppc7400,espresso")) "ppc750_du,lsu_7xx") (define_insn_reservation "ppc750-store" 2 (and (eq_attr "type" "store,fpstore,vecstore") - (eq_attr "cpu" "ppc750,ppc7400")) + (eq_attr "cpu" "ppc750,ppc7400,espresso")) "ppc750_du,lsu_7xx") (define_insn_reservation "ppc750-storec" 8 (and (eq_attr "type" "store_c") - (eq_attr "cpu" "ppc750,ppc7400")) + (eq_attr "cpu" "ppc750,ppc7400,espresso")) "ppc750_du,lsu_7xx") (define_insn_reservation "ppc750-integer" 1 (and (ior (eq_attr "type" "integer,insert,trap,cntlz,isel") (and (eq_attr "type" "add,logical,shift,exts") (eq_attr "dot" "no"))) - (eq_attr "cpu" "ppc750,ppc7400")) + (eq_attr "cpu" "ppc750,ppc7400,espresso")) "ppc750_du,iu1_7xx|iu2_7xx") (define_insn_reservation "ppc750-two" 1 (and (eq_attr "type" "two") - (eq_attr "cpu" "ppc750,ppc7400")) + (eq_attr "cpu" "ppc750,ppc7400,espresso")) "ppc750_du,iu1_7xx|iu2_7xx,iu1_7xx|iu2_7xx") (define_insn_reservation "ppc750-three" 1 (and (eq_attr "type" "three") - (eq_attr "cpu" "ppc750,ppc7400")) + (eq_attr "cpu" "ppc750,ppc7400,espresso")) "ppc750_du,iu1_7xx|iu2_7xx,iu1_7xx|iu2_7xx,iu1_7xx|iu2_7xx") (define_insn_reservation "ppc750-imul" 4 (and (eq_attr "type" "mul") (eq_attr "size" "32") - (eq_attr "cpu" "ppc750,ppc7400")) + (eq_attr "cpu" "ppc750,ppc7400,espresso")) "ppc750_du,iu1_7xx*4") (define_insn_reservation "ppc750-imul2" 3 (and (eq_attr "type" "mul") (eq_attr "size" "16") - (eq_attr "cpu" "ppc750,ppc7400")) + (eq_attr "cpu" "ppc750,ppc7400,espresso")) "ppc750_du,iu1_7xx*2") (define_insn_reservation "ppc750-imul3" 2 (and (eq_attr "type" "mul") (eq_attr "size" "8") - (eq_attr "cpu" "ppc750,ppc7400")) + (eq_attr "cpu" "ppc750,ppc7400,espresso")) "ppc750_du,iu1_7xx") (define_insn_reservation "ppc750-idiv" 19 (and (eq_attr "type" "div") - (eq_attr "cpu" "ppc750,ppc7400")) + (eq_attr "cpu" "ppc750,ppc7400,espresso")) "ppc750_du,iu1_7xx*19") (define_insn_reservation "ppc750-compare" 2 (and (ior (eq_attr "type" "cmp") (and (eq_attr "type" "add,logical,shift,exts") (eq_attr "dot" "yes"))) - (eq_attr "cpu" "ppc750,ppc7400")) + (eq_attr "cpu" "ppc750,ppc7400,espresso")) "ppc750_du,(iu1_7xx|iu2_7xx)") (define_insn_reservation "ppc750-fpcompare" 2 (and (eq_attr "type" "fpcompare") - (eq_attr "cpu" "ppc750,ppc7400")) + (eq_attr "cpu" "ppc750,ppc7400,espresso")) "ppc750_du,fpu_7xx") (define_insn_reservation "ppc750-fp" 3 (and (eq_attr "type" "fp,fpsimple") - (eq_attr "cpu" "ppc750,ppc7400")) + (eq_attr "cpu" "ppc750,ppc7400,espresso")) "ppc750_du,fpu_7xx") (define_insn_reservation "ppc750-dmul" 4 (and (eq_attr "type" "dmul") - (eq_attr "cpu" "ppc750")) + (eq_attr "cpu" "ppc750,espresso")) "ppc750_du,fpu_7xx*2") (define_insn_reservation "ppc7400-dmul" 3 @@ -130,37 +130,37 @@ ; Divides are not pipelined (define_insn_reservation "ppc750-sdiv" 17 (and (eq_attr "type" "sdiv") - (eq_attr "cpu" "ppc750,ppc7400")) + (eq_attr "cpu" "ppc750,ppc7400,espresso")) "ppc750_du,fpu_7xx*17") (define_insn_reservation "ppc750-ddiv" 31 (and (eq_attr "type" "ddiv") - (eq_attr "cpu" "ppc750,ppc7400")) + (eq_attr "cpu" "ppc750,ppc7400,espresso")) "ppc750_du,fpu_7xx*31") (define_insn_reservation "ppc750-mfcr" 2 (and (eq_attr "type" "mfcr,mtcr") - (eq_attr "cpu" "ppc750,ppc7400")) + (eq_attr "cpu" "ppc750,ppc7400,espresso")) "ppc750_du,iu1_7xx") (define_insn_reservation "ppc750-crlogical" 3 (and (eq_attr "type" "cr_logical") - (eq_attr "cpu" "ppc750,ppc7400")) + (eq_attr "cpu" "ppc750,ppc7400,espresso")) "nothing,sru_7xx*2") (define_insn_reservation "ppc750-mtjmpr" 2 (and (eq_attr "type" "mtjmpr,isync,sync") - (eq_attr "cpu" "ppc750,ppc7400")) + (eq_attr "cpu" "ppc750,ppc7400,espresso")) "nothing,sru_7xx*2") (define_insn_reservation "ppc750-mfjmpr" 3 (and (eq_attr "type" "mfjmpr") - (eq_attr "cpu" "ppc750,ppc7400")) + (eq_attr "cpu" "ppc750,ppc7400,espresso")) "nothing,sru_7xx*2") (define_insn_reservation "ppc750-jmpreg" 1 (and (eq_attr "type" "jmpreg,branch,isync") - (eq_attr "cpu" "ppc750,ppc7400")) + (eq_attr "cpu" "ppc750,ppc7400,espresso")) "nothing,bpu_7xx") ;; Altivec diff -rup gcc-13.2.0/gcc/config/rs6000/driver-rs6000.cc gcc-13.2.0.new/gcc/config/rs6000/driver-rs6000.cc --- gcc-13.2.0/gcc/config/rs6000/driver-rs6000.cc 2023-07-27 18:13:04.000000000 +1000 +++ gcc-13.2.0.new/gcc/config/rs6000/driver-rs6000.cc 2023-12-25 17:37:00.150252750 +1100 @@ -506,6 +506,7 @@ static const struct asm_name asm_names[] { "630", "-mppc64" }, { "740", "-mppc" }, { "750", "-mppc" }, + { "espresso", "-mppc" }, { "G3", "-mppc" }, { "7400", "-mppc %{!mvsx:%{!maltivec:-maltivec}}" }, { "7450", "-mppc %{!mvsx:%{!maltivec:-maltivec}}" }, diff -rup gcc-13.2.0/gcc/config/rs6000/rs6000.cc gcc-13.2.0.new/gcc/config/rs6000/rs6000.cc --- gcc-13.2.0/gcc/config/rs6000/rs6000.cc 2023-07-27 18:13:04.000000000 +1000 +++ gcc-13.2.0.new/gcc/config/rs6000/rs6000.cc 2023-12-25 17:43:33.317711721 +1100 @@ -4687,6 +4687,7 @@ rs6000_option_override_internal (bool gl case PROCESSOR_PPC750: case PROCESSOR_PPC7400: + case PROCESSOR_ESPRESSO: rs6000_cost = &ppc750_cost; break; @@ -16545,6 +16546,10 @@ emit_store_conditional (machine_mode mod if (PPC405_ERRATUM77) emit_insn (gen_hwsync ()); + /* Emit dcbst before stwcx. to address Espresso erratum */ + if (ESPRESSO_ERRATUM) + emit_insn (gen_rs6000_dcbst (mem)); + emit_insn (fn (res, mem, val)); } @@ -17964,6 +17969,7 @@ rs6000_adjust_cost (rtx_insn *insn, int || rs6000_tune == PROCESSOR_PPC620 || rs6000_tune == PROCESSOR_PPC630 || rs6000_tune == PROCESSOR_PPC750 + || rs6000_tune == PROCESSOR_ESPRESSO || rs6000_tune == PROCESSOR_PPC7400 || rs6000_tune == PROCESSOR_PPC7450 || rs6000_tune == PROCESSOR_PPCE5500 @@ -18520,6 +18526,7 @@ rs6000_issue_rate (void) case PROCESSOR_PPC440: case PROCESSOR_PPC603: case PROCESSOR_PPC750: + case PROCESSOR_ESPRESSO: case PROCESSOR_PPC7400: case PROCESSOR_PPC8540: case PROCESSOR_PPC8548: diff -rup gcc-13.2.0/gcc/config/rs6000/rs6000-c.cc gcc-13.2.0.new/gcc/config/rs6000/rs6000-c.cc --- gcc-13.2.0/gcc/config/rs6000/rs6000-c.cc 2023-07-27 18:13:04.000000000 +1000 +++ gcc-13.2.0.new/gcc/config/rs6000/rs6000-c.cc 2023-12-25 17:43:42.106575203 +1100 @@ -654,6 +654,8 @@ rs6000_cpu_cpp_builtins (cpp_reader *pfi /* Used by lwarx/stwcx. errata work-around. */ if (rs6000_cpu == PROCESSOR_PPC405) builtin_define ("__PPC405__"); + if (ESPRESSO_ERRATUM) + builtin_define ("__ESPRESSO__"); /* Used by libstdc++. */ if (TARGET_NO_LWSYNC) builtin_define ("__NO_LWSYNC__"); diff -rup gcc-13.2.0/gcc/config/rs6000/rs6000-cpus.def gcc-13.2.0.new/gcc/config/rs6000/rs6000-cpus.def --- gcc-13.2.0/gcc/config/rs6000/rs6000-cpus.def 2023-07-27 18:13:04.000000000 +1000 +++ gcc-13.2.0.new/gcc/config/rs6000/rs6000-cpus.def 2023-12-25 17:35:46.983993390 +1100 @@ -206,6 +206,7 @@ RS6000_CPU ("740", PROCESSOR_PPC750, OPT RS6000_CPU ("7400", PROCESSOR_PPC7400, POWERPC_7400_MASK) RS6000_CPU ("7450", PROCESSOR_PPC7450, POWERPC_7400_MASK) RS6000_CPU ("750", PROCESSOR_PPC750, OPTION_MASK_PPC_GFXOPT) +RS6000_CPU ("espresso", PROCESSOR_ESPRESSO, OPTION_MASK_PPC_GFXOPT) RS6000_CPU ("801", PROCESSOR_MPCCORE, OPTION_MASK_SOFT_FLOAT) RS6000_CPU ("821", PROCESSOR_MPCCORE, OPTION_MASK_SOFT_FLOAT) RS6000_CPU ("823", PROCESSOR_MPCCORE, OPTION_MASK_SOFT_FLOAT) diff -rup gcc-13.2.0/gcc/config/rs6000/rs6000.h gcc-13.2.0.new/gcc/config/rs6000/rs6000.h --- gcc-13.2.0/gcc/config/rs6000/rs6000.h 2023-07-27 18:13:04.000000000 +1000 +++ gcc-13.2.0.new/gcc/config/rs6000/rs6000.h 2023-12-25 17:41:53.759311091 +1100 @@ -77,6 +77,9 @@ #define PPC405_ERRATUM77 0 #endif +/* Support Espresso stwcx erratum. */ +#define ESPRESSO_ERRATUM (rs6000_cpu == PROCESSOR_ESPRESSO || rs6000_tune == PROCESSOR_ESPRESSO) + #ifndef SUBTARGET_DRIVER_SELF_SPECS # define SUBTARGET_DRIVER_SELF_SPECS "" #endif @@ -144,6 +147,7 @@ mcpu=630: -mppc64; \ mcpu=740: -mppc; \ mcpu=750: -mppc; \ + mcpu=espresso: -mppc; \ mcpu=G3: -mppc; \ mcpu=7400: -mppc %{!mvsx:%{!maltivec:-maltivec}}; \ mcpu=7450: -mppc %{!mvsx:%{!maltivec:-maltivec}}; \ diff -rup gcc-13.2.0/gcc/config/rs6000/rs6000-logue.cc gcc-13.2.0.new/gcc/config/rs6000/rs6000-logue.cc --- gcc-13.2.0/gcc/config/rs6000/rs6000-logue.cc 2023-07-27 18:13:04.000000000 +1000 +++ gcc-13.2.0.new/gcc/config/rs6000/rs6000-logue.cc 2023-12-25 17:37:48.965097770 +1100 @@ -4327,6 +4327,7 @@ rs6000_emit_epilogue (enum epilogue_type bool using_mtcr_multiple = (rs6000_tune == PROCESSOR_PPC601 || rs6000_tune == PROCESSOR_PPC603 || rs6000_tune == PROCESSOR_PPC750 + || rs6000_tune == PROCESSOR_ESPRESSO || optimize_size); /* Restore via the backchain when we have a large frame, since this diff -rup gcc-13.2.0/gcc/config/rs6000/rs6000.md gcc-13.2.0.new/gcc/config/rs6000/rs6000.md --- gcc-13.2.0/gcc/config/rs6000/rs6000.md 2023-07-27 18:13:04.000000000 +1000 +++ gcc-13.2.0.new/gcc/config/rs6000/rs6000.md 2023-12-28 17:19:39.415655616 +1100 @@ -346,7 +346,7 @@ ;; enumeration in rs6000-opts.h. (define_attr "cpu" "ppc601,ppc603,ppc604,ppc604e,ppc620,ppc630, - ppc750,ppc7400,ppc7450, + ppc750,ppc7400,ppc7450,espresso, ppc403,ppc405,ppc440,ppc476, ppc8540,ppc8548,ppce300c2,ppce300c3,ppce500mc,ppce500mc64,ppce5500,ppce6500, power4,power5,power6,power7,power8,power9,power10, diff -rup gcc-13.2.0/gcc/config/rs6000/rs6000-opts.h gcc-13.2.0.new/gcc/config/rs6000/rs6000-opts.h --- gcc-13.2.0/gcc/config/rs6000/rs6000-opts.h 2023-07-27 18:13:04.000000000 +1000 +++ gcc-13.2.0.new/gcc/config/rs6000/rs6000-opts.h 2023-12-25 17:26:21.545836774 +1100 @@ -40,6 +40,7 @@ enum processor_type PROCESSOR_PPC750, PROCESSOR_PPC7400, PROCESSOR_PPC7450, + PROCESSOR_ESPRESSO, PROCESSOR_PPC403, PROCESSOR_PPC405, diff -rup gcc-13.2.0/gcc/config/rs6000/rs6000-tables.opt gcc-13.2.0.new/gcc/config/rs6000/rs6000-tables.opt --- gcc-13.2.0/gcc/config/rs6000/rs6000-tables.opt 2023-07-27 18:13:04.000000000 +1000 +++ gcc-13.2.0.new/gcc/config/rs6000/rs6000-tables.opt 2023-12-25 17:43:57.525335704 +1100 @@ -96,104 +96,107 @@ EnumValue Enum(rs6000_cpu_opt_value) String(750) Value(22) EnumValue -Enum(rs6000_cpu_opt_value) String(801) Value(23) +Enum(rs6000_cpu_opt_value) String(espresso) Value(23) EnumValue -Enum(rs6000_cpu_opt_value) String(821) Value(24) +Enum(rs6000_cpu_opt_value) String(801) Value(24) EnumValue -Enum(rs6000_cpu_opt_value) String(823) Value(25) +Enum(rs6000_cpu_opt_value) String(821) Value(25) EnumValue -Enum(rs6000_cpu_opt_value) String(8540) Value(26) +Enum(rs6000_cpu_opt_value) String(823) Value(26) EnumValue -Enum(rs6000_cpu_opt_value) String(8548) Value(27) +Enum(rs6000_cpu_opt_value) String(8540) Value(27) EnumValue -Enum(rs6000_cpu_opt_value) String(a2) Value(28) +Enum(rs6000_cpu_opt_value) String(8548) Value(28) EnumValue -Enum(rs6000_cpu_opt_value) String(e300c2) Value(29) +Enum(rs6000_cpu_opt_value) String(a2) Value(29) EnumValue -Enum(rs6000_cpu_opt_value) String(e300c3) Value(30) +Enum(rs6000_cpu_opt_value) String(e300c2) Value(30) EnumValue -Enum(rs6000_cpu_opt_value) String(e500mc) Value(31) +Enum(rs6000_cpu_opt_value) String(e300c3) Value(31) EnumValue -Enum(rs6000_cpu_opt_value) String(e500mc64) Value(32) +Enum(rs6000_cpu_opt_value) String(e500mc) Value(32) EnumValue -Enum(rs6000_cpu_opt_value) String(e5500) Value(33) +Enum(rs6000_cpu_opt_value) String(e500mc64) Value(33) EnumValue -Enum(rs6000_cpu_opt_value) String(e6500) Value(34) +Enum(rs6000_cpu_opt_value) String(e5500) Value(34) EnumValue -Enum(rs6000_cpu_opt_value) String(860) Value(35) +Enum(rs6000_cpu_opt_value) String(e6500) Value(35) EnumValue -Enum(rs6000_cpu_opt_value) String(970) Value(36) +Enum(rs6000_cpu_opt_value) String(860) Value(36) EnumValue -Enum(rs6000_cpu_opt_value) String(cell) Value(37) +Enum(rs6000_cpu_opt_value) String(970) Value(37) EnumValue -Enum(rs6000_cpu_opt_value) String(ec603e) Value(38) +Enum(rs6000_cpu_opt_value) String(cell) Value(38) EnumValue -Enum(rs6000_cpu_opt_value) String(G3) Value(39) +Enum(rs6000_cpu_opt_value) String(ec603e) Value(39) EnumValue -Enum(rs6000_cpu_opt_value) String(G4) Value(40) +Enum(rs6000_cpu_opt_value) String(G3) Value(40) EnumValue -Enum(rs6000_cpu_opt_value) String(G5) Value(41) +Enum(rs6000_cpu_opt_value) String(G4) Value(41) EnumValue -Enum(rs6000_cpu_opt_value) String(titan) Value(42) +Enum(rs6000_cpu_opt_value) String(G5) Value(42) EnumValue -Enum(rs6000_cpu_opt_value) String(power3) Value(43) +Enum(rs6000_cpu_opt_value) String(titan) Value(43) EnumValue -Enum(rs6000_cpu_opt_value) String(power4) Value(44) +Enum(rs6000_cpu_opt_value) String(power3) Value(44) EnumValue -Enum(rs6000_cpu_opt_value) String(power5) Value(45) +Enum(rs6000_cpu_opt_value) String(power4) Value(45) EnumValue -Enum(rs6000_cpu_opt_value) String(power5+) Value(46) +Enum(rs6000_cpu_opt_value) String(power5) Value(46) EnumValue -Enum(rs6000_cpu_opt_value) String(power6) Value(47) +Enum(rs6000_cpu_opt_value) String(power5+) Value(47) EnumValue -Enum(rs6000_cpu_opt_value) String(power6x) Value(48) +Enum(rs6000_cpu_opt_value) String(power6) Value(48) EnumValue -Enum(rs6000_cpu_opt_value) String(power7) Value(49) +Enum(rs6000_cpu_opt_value) String(power6x) Value(49) EnumValue -Enum(rs6000_cpu_opt_value) String(power8) Value(50) +Enum(rs6000_cpu_opt_value) String(power7) Value(50) EnumValue -Enum(rs6000_cpu_opt_value) String(power9) Value(51) +Enum(rs6000_cpu_opt_value) String(power8) Value(51) EnumValue -Enum(rs6000_cpu_opt_value) String(power10) Value(52) +Enum(rs6000_cpu_opt_value) String(power9) Value(52) EnumValue -Enum(rs6000_cpu_opt_value) String(powerpc) Value(53) +Enum(rs6000_cpu_opt_value) String(power10) Value(53) EnumValue -Enum(rs6000_cpu_opt_value) String(powerpc64) Value(54) +Enum(rs6000_cpu_opt_value) String(powerpc) Value(54) EnumValue -Enum(rs6000_cpu_opt_value) String(powerpc64le) Value(55) +Enum(rs6000_cpu_opt_value) String(powerpc64) Value(55) EnumValue -Enum(rs6000_cpu_opt_value) String(rs64) Value(56) +Enum(rs6000_cpu_opt_value) String(powerpc64le) Value(56) + +EnumValue +Enum(rs6000_cpu_opt_value) String(rs64) Value(57) diff -rup gcc-13.2.0/gcc/config/rs6000/sync.md gcc-13.2.0.new/gcc/config/rs6000/sync.md --- gcc-13.2.0/gcc/config/rs6000/sync.md 2023-07-27 18:13:04.000000000 +1000 +++ gcc-13.2.0.new/gcc/config/rs6000/sync.md 2023-12-28 16:58:45.235128306 +1100 @@ -347,6 +347,13 @@ " %2,%y1" [(set_attr "type" "store_c")]) +;; I am pretty sure VOID is correct since this actually affects a cache-block sized +;; chunk of memory + (define_insn "rs6000_dcbst" + [(match_operand:VOID 0 "memory_operand" "=Z")] + "" + "dcbst %y0") + ;; Use a temporary register to force getting an even register for the ;; lqarx/stqcrx. instructions. Normal optimizations will eliminate this extra ;; copy on big endian systems. diff -rup gcc-13.2.0/gcc/config.gcc gcc-13.2.0.new/gcc/config.gcc --- gcc-13.2.0/gcc/config.gcc 2023-07-27 18:13:04.000000000 +1000 +++ gcc-13.2.0.new/gcc/config.gcc 2023-12-28 17:58:48.853211935 +1100 @@ -5417,7 +5417,7 @@ case "${target}" in | rs64 \ | 401 | 403 | 405 | 405fp | 440 | 440fp | 464 | 464fp \ | 476 | 476fp | 505 | 601 | 602 | 603 | 603e | ec603e \ - | 604 | 604e | 620 | 630 | 740 | 750 | 7400 | 7450 \ + | 604 | 604e | 620 | 630 | 740 | 750 | 7400 | 7450 | espresso \ | a2 | e300c[23] | 854[08] | e500mc | e500mc64 | e5500 | e6500 \ | titan | 801 | 821 | 823 | 860 | 970 | G3 | G4 | G5 | cell) # OK