This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: [darwin] Adding branch prediction bits for bdxx instructions



On Dec 19, 2003, at 10:53 AM, Caroline Tice wrote:

This is a bit of code we've had in the Apple compiler for the last six months or so, and
we hope the FSF community will accept it. It adds branch prediction bits to the bdn, bdz,
and bdnz instructions. It also adds two target options for controlling this: -mbranch-predictions,
which indicates whether or not to add the branch prediction bits, and
-mbranch-predictions-threshold, which takes an integer value indicating what percentage of
the time a branch needs to be taken in order for the bits to be set.

All the code changes are in the config/rs6000 directory, so should only affect darwin. This code
has been tested on G4 and G5 architectures, running powerpc-apple-darwin7.0.0. It has
bootstrapped and passed the DejaGnu tests.

May I commit it to 3.4?

-- Caroline Tice
ctice@apple.com



I've updated the original patch to incorporate the various suggestions I received. Below is the
updated patch, as well as five new test-cases. It passes the test cases, it bootstraps, and it passes
DejaGnu. This was tested on both a G4 and a G5 running powerpc-apple-darwin.

Is this okay to commit to the 3.5 integration branch?

-- Caroline Tice
ctice@apple.com

ChangeLog entry:

2004-01-16 Caroline Tice <ctice@apple.com>

* config/rs6000/rs6000-protos.h (output_bdxx_branch): New extern function
declaration.
* config/rs6000/rs6000.h (MASK_NO_BRANCH_PREDICTIONS): New definition, for
adding m(no-)branch-predictions to list of target_flags.
(TARGET_NO_BRANCH_PREDICTIONS): Likewise.
(TARGET_BRANCH_PREDICTIONS): Likewise.
(TARGET_SWITCHES): Added branch-predictions and no-branch-predictions.
(TARGET_OPTIONS): Added branch-predictions-threshold=xx.
(rs6000_branch_predictions_threshold_string): New extern global variable
definition.
* config/rs6000/rs6000.c (rs6000_branch_predictions_threshold): New global
variable.
(rs6000_branch_predictions_threshold_string): New global variable.
(rs6000_override_options): Add code to set value of
rs6000_branch_predictions_threshold.
(determine_branch_prediction_bits): New function.
(output_cbranch): Moved code for determining branch prediction bits into
new function (see above); added call to the new function.
(output_bdxx_branch): New function, to output bdn, bdz, and bdnz
instructions, with the appropriate branch prediction bits set.
* config/rs6000/rs6000.md (*ctrsi_internal1): Combined two alternatives
into a single function call (output_bdxx_branch); made number of
constraints match the reduced number of alternatives.
(*ctrsi_internal2): Likewise.
(*ctrdi_internal1): Likewise.
(*ctrdi_internal2): Likewise.
(*ctrsi_internal3): Likewise.
(*ctrsi_internal4): Likewise.
(*ctrdi_internal3): Likewise.
(*ctrdi_internal4): Likewise.
(*ctrsi_internal5): Likewise.
(*ctrsi_internal6): Likewise.
(*ctrdi_internal5): Likewise.
(*ctrdi_internal6): Likewise.
* doc/invoke.texi (m(no-)branch-predictions): Document new option.
(mbranch-predictions-threshold): Document new option.



Here is the patch:

Attachment: gcc5-branch-pred.txt
Description: Text document






Here are the test cases:

Attachment: branch-pred-1.c
Description: Text document

Attachment: branch-pred-2.c
Description: Text document

Attachment: branch-pred-3.c
Description: Text document

Attachment: branch-pred-4.c
Description: Text document

Attachment: branch-pred-5.c
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]