mips: add support for branch likely instruction
Review Request #748 - Created June 19, 2011 and updated
| Information | |
|---|---|
| Deyuan Guo | |
| gem5 | |
| Reviewers | |
| Default | |
| ali, gblack, nate, stever | |
Make the newly gem5 support mips branch likely instruction again. Fix 4 files: src/arch/mips/isa/formats/branch.isa src/cpu/inorder/inorder_dyn_inst.cc src/cpu/inorder/resources/branch_predictor.cc src/cpu/inorder/resources/fetch_seq_unit.cc
Tested.
Posted (June 19, 2011, 10:19 p.m.)
-
src/arch/mips/isa/formats/branch.isa (Diff revision 1) -
Great, thanks for the quick code review and change.
-
src/cpu/inorder/inorder_dyn_inst.cc (Diff revision 1) -
In general, commenting out code in patches is not a good practice as it leads to lots of old text floating through code. If the old code has some remaining purpose, then we should place a comment there for future reference. Otherwise, the best thing to do is just delete it. Can you update this to either delete that comment or place a note why that code is still there? Assuming this patch has been tested for the MIPS regressions we have (and you have), this looks good. Lastly, I want to test on a SPARC hello world regression that I have.
-
src/cpu/inorder/resources/branch_predictor.cc (Diff revision 1) -
I'd like to avoid "#if ISA_HAS_DELAY_SLOT" as much as possible in code that's not in src/arch/*, but this may be a spot where it's necessary
-
src/cpu/inorder/resources/fetch_seq_unit.cc (Diff revision 1) -
same as above.
-
src/cpu/inorder/resources/fetch_seq_unit.cc (Diff revision 1) -
This will work for all architectures right without the "#if"? No other defined ISAs mark that CondDelaySlot() flag. I dont think saving the check here will be worth the clutter. Can you remove then test some alpha regressions? Maybe just the hello world-quick-alpha regression. and the 70.twolf-long-alpha regression?
-
src/cpu/inorder/resources/fetch_seq_unit.cc (Diff revision 1) -
same as above. Checking for that cond-delay-slot flag already separates out the MIPS code. We can get rid of the #if and possibly put a comment below (or beside that line w/in 80 characters) saying that the 2nd condition handles MIPS branch likely instructions.
Review request changed
Updated (June 20, 2011, 12:54 p.m.)
Change Summary:
o. Delete the unused code instead of commenting out it; o. Remove the "#if ISA_HAS_DELAY_SLOT" because the isCondDelaySlot() is only used/set by MIPS ISA; o. Define readMiscRegNoEffect/setMiscRegNoEffect in inorder_dyn_inst.cc. Or else if we use this two functions in arch/mips/locked_mem.hh, ld will complain. (Sometimes, linked load instructions will make a thread halt then restart it. After that, the tick becomes a large number and it says 'because simulate() limit reached'. I haven't found the root cause yet. All I can do is using read/setMiscRegNoEffect instead of read/setMiscReg in arch/mips/locked_mem.hh...)
Diff: |
Revision 2 (+21 -8) |
|---|
Review request changed
Updated (June 20, 2011, 7:16 p.m.)
Change Summary:
find a small bug: in src/arch/mips/isa/decoder.isa, nmadd/nmsub are wrongly defined.
Diff: |
Revision 3 (+24 -11) |
|---|
Posted (June 20, 2011, 9:49 p.m.)
-
src/arch/mips/isa/decoder.isa (Diff revision 3) -
This is a separate patch then the mips branch prediction. IF you have updates for the same patch, then update it. If you are patching a differen issue, please post a new review for that. This is important for logging of changesets. Also, did you test this through observation of wrong output or through comparing against the ISA spec?
-
src/arch/mips/isa/decoder.isa (Diff revision 3) -
same as above Why would nmsub add and nmadd subtract?
-
src/cpu/inorder/inorder_dyn_inst.cc (Diff revision 3) -
separate patch. also, what code in locked_mem.hh requires this?
Posted (June 20, 2011, 11:17 p.m.)
-
src/arch/mips/isa/decoder.isa (Diff revision 3) -
I see, the instruction was defined in a non-intuitive way. Another way to write this (from the SEE MIPS RUN book is): Fr.sf - (Fs.sf * Ft.sf) for nmsub_s and -1 * (Fs.sf * Ft.sf + Fr.sf) for nmadd_s I agree w/your updates now. However, how did you find this error? Through inspection or running a benchmark? If the latter, we need to add that regression (or a similar one) to preserve that functionality.
-
src/cpu/inorder/inorder_dyn_inst.cc (Diff revision 3) -
Separate patch means add a new review request. Eventually, I'll have to commit your patches to the tree (w/your email as author), so it's best not to merge nonrelated changes. If you get "simulate() reached", that means your system likely deadlocked as there are no more events on the main event queue. Run w/the cpu progress interval on to help determine where the CPUs stops committing instructions. Also, post the locked_mem.hh patch if you want comments on what you are trying to do to resolve the problem.
Review request changed
Updated (June 21, 2011, 11:39 a.m.)
Change Summary:
Move the unrelated patch to new review requests. Here are all about the MIPS branch likely instructions.
Diff: |
Revision 4 (+9 -8) |
|---|
Posted (June 22, 2011, 2:24 a.m.)
-
src/arch/mips/isa/formats/branch.isa (Diff revision 4) -
The last thing to do is pass the regressions. Can you run the ALPHA quick regressions for inorder and also the MIPS quick regression and verify they pass? Is there a dhrystone benchmark that exposes this branch likely functionality? It'd be nice to make sure we check that this does not get broken on future regression runs.
