[Mips] R3000A load-delay scheduling: post-RA at -O2/-Os, LWL/LWR pairs (PS2-193) #22
Loading…
Reference in a new issue
No description provided.
Delete branch "r3000a-load-delay"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Two R3000A-gated changes from PS2-193 (IOP code size and timing against GCC). Both rest on how the R3000A's load delay works.
getOptLevelToEnablePostRASchedulerreturned Default only for the R5900. The R3000A has a scheduling model (LoadLatency 2), so the post-RA scheduler now also runs at -O2/-Os, where IOP modules are built, and fills load delay slots with independent work.unalignedload.llPSX (-mcpu=mips1) checks keep their nop.New tests:
CodeGen/Mips/r3000a-postra-sched.ll(with and without-post-RA-scheduler=false) andCodeGen/Mips/r3000a-lwl-lwr-delay.ll(R3000A without the nop, mips1 with it).Effect, measured on the 904 sdk-core IOP objects (PS2-193 comments): nops 33,130 down to 31,622; IRX total from +8.7% to +8.3% against GCC. Timing on the console is not measured yet.
Verified:
llvm-lit CodeGen/Mips MC/Mips, 1552 tests, 0 failures. That run was on the local branchr3000a-postra-sched, which also carries two more R3000A commits that are not in this PR (see below). These two changes do not depend on them.Held back for review against the fork rule (UPDATING.md, "What belongs in the fork"), still local on
r3000a-postra-sched:🤖 Generated with Claude Code
New commit
fe782f0: limit the R3000A post-RA scheduler to one instruction per cycle.The R3000A has no itinerary, so the post-RA list scheduler got the default hazard recognizer, which never limits issue. It put several instructions in one "cycle", spent the independent ones before a jump-table load was ready, and left the load directly before
jr, which costs a load-delay nop. On the console the IOP state-machine kernel got 6% slower with the post-RA change alone. A single-issue hazard recognizer, gated on the R3000A, fixes it. Test:CodeGen/Mips/r3000a-postra-single-issue.ll, which fails without the fix.r3000a-postra-sched.llis updated for the new order.Lit on this branch (separate build of
r3000a-load-delay): CodeGen/Mips + MC/Mips, 1553 tests, 0 failures.Results for this branch against r5900-ee
5c05831:IOP kernel timing on the console, IOP system clock ticks, minimum over 3 boots:
No kernel is slower than the baseline. sort is 1.13x GCC with or without this PR: GCC ends the inner loop with
bneagainst a hoisted -1, while LLVM's loop strength reduction uses a separate counter and needsslti+beqz. That choice is made in a generic pass, so it is left as a documented exception.