You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
wtf 637bf2e68b gcc hacking 2 years ago
gcc/config/rs6000 add some gcc stuff 2 years ago gcc hacking 2 years ago


  • modify backend and add switches for A2 architectural experiments

  • modify backend to add new accelerator/sandbox ops


You can add new instructions, or change existing by modifying group of files in GCC called "machine description". Instruction patterns in .md file, some code in .c file, predicates, constraints and so on. All of these lays in $GCCHOME/gcc/config// folder. All of this stuff using on step of generation ASM code from RTL. You can also change cases of emiting instructions by change some other general GCC source files, change SSA tree generation, RTL generation, but all of this a little bit complicated. A simple explanation what`s happened:

the power definitions (inc. power10) are here:

  1. start with one of the 32b ones like 40x; comment out some stuff, rebuild

    • is there a set of operations that gcc requires to be able to guarantee it can gen code??? i guess this has to do with gimple->rtl semantic association

    • there also must be indicators to make it compile gud - like compatible issuers, latency, etc.??

      define_insn_reservation tells what resources are used by the op

  2. find some of the newer ops/facs implemented and update operation for 32b (tar, pcis, ...)

  3. add switch to specify a2p as target; and any other switches for extra options (test perf with limited ops, add fpu, etc.)

looking around

  • interesting - a2i, which does have a switch "ppca2") "mult" "ppca2") "axu" "ppca2") "ppca2-mfcr" 1       (eq_attr "cpu" "ppca2")) "ppca2-mfjmpr" 5       (eq_attr "cpu" "ppca2")) "ppca2-mtjmpr" 5       (eq_attr "cpu" "ppca2")) "ppca2-imul" 1       (eq_attr "cpu" "ppca2")) "ppca2-lmul" 6       (eq_attr "cpu" "ppca2")) "ppca2-idiv" 32       (eq_attr "cpu" "ppca2")) "ppca2-ldiv" 65       (eq_attr "cpu" "ppca2")) "ppca2-load" 5       (eq_attr "cpu" "ppca2")) "ppca2-fp" 6       (eq_attr "cpu" "ppca2")) "ppca2-fp-load" 6       (eq_attr "cpu" "ppca2")) "ppca2-fp-store" 2       (eq_attr "cpu" "ppca2")) "ppca2-fpcompare" 5       (eq_attr "cpu" "ppca2")) "ppca2-ddiv" 72       (eq_attr "cpu" "ppca2")) "ppca2-sdiv" 59       (eq_attr "cpu" "ppca2")) "ppca2-dsqrt" 69       (eq_attr "cpu" "ppca2")) "ppca2-ssqrt" 65       (eq_attr "cpu" "ppca2"))

rs6000-cpus.def:RS6000_CPU ("a2", PROCESSOR_PPCA2,
driver-rs6000.c:  { "a2",       "-ma2" },
rs6000.c:struct processor_costs ppca2_cost = {
rs6000.h:  mcpu=a2: -ma2; \   rs64a,mpccore,cell,ppca2,titan" "")
rs6000-tables.opt:Enum(rs6000_cpu_opt_value) String(a2) Value(28)
t-rs6000:       $(srcdir)/config/rs6000/ \

ppc-auxv.h:#define PPC_PLATFORM_PPCA2             8
rs6000.c:                       && rs6000_tune != PROCESSOR_PPCA2
rs6000.c:      case PROCESSOR_PPCA2:
rs6000-call.c:  { "ppca2",         PPC_PLATFORM_PPCA2 },
rs6000-cpus.def:RS6000_CPU ("a2", PROCESSOR_PPCA2,
rs6000-opts.h:   PROCESSOR_PPCA2,
  • is mostly/all perf stuff
  • add a2p to rs6000-cpus.def (core attributes)
  • add a2p to ppc-auxv.h (this supposedly must match glibc - so may have to have custom glibc if you toss out too many ops)
  • add a2p to rs6000.c (instruction costs - latency)
  • add a2p to rs6000-call.c (human name)
  • add a2p to rs6000-opts.h (MUST MATCH md FILE ORDER!! - after A2) check this!!!!!!