This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH: [darwin] Adding branch prediction bits for bdxx instructions
- From: Caroline Tice <ctice at apple dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: caroline Tice <ctice at apple dot com>
- Date: Fri, 19 Dec 2003 10:53:17 -0800
- Subject: PATCH: [darwin] Adding branch prediction bits for bdxx instructions
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
2003-12-09 Caroline Tice <ctice@apple.com>
* config/rs6000/rs6000-protos.h (output_bdxx_branch): New extern
function declaration.
* config/rs6000/rs6000.c (rs6000_branch_predictions): New global
variable.
(rs6000_branch_predictions_threshold): New global variable.
(rs6000_branch_predictions_string): New global variable.
(rs6000_branch_predictions_threshold_string): New global variable.
(rs6000_override_options): Add code to handle new
-mbranch-predictions and -mbranch_predictions_threshold=xx options.
(output_bdxx_branch): New function.
* config/rs6000/rs6000.h (TARGET_OPTIONS): Add branch-predictions,
and branch-predictions-threshold=xx options.
(rs6000_branch_predictions_string): New extern global variable.
(rs6000_branch_predictions_threshold_string): New extern global
variable.
* config/rs6000/rs6000.md (*ctrsi_internal1): Modified to call
output_bdxx_branch.
(*ctrsi_internal2): Modified to call output_bdxx_branch.
(*ctrdi_internal1): Modified to call output_bdxx_branch.
(*ctrdi_internal2): Modified to call output_bdxx_branch.
(*ctrsi_internal3): Modified to call output_bdxx_branch.
(*ctrsi_internal4): Modified to call output_bdxx_branch.
(*ctrdi_internal3): Modified to call output_bdxx_branch.
(*ctrdi_internal4): Modified to call output_bdxx_branch.
(*ctrsi_internal5): Modified to call output_bdxx_branch.
(*ctrsi_internal6): Modified to call output_bdxx_branch.
(*ctrdi_internal5): Modified to call output_bdxx_branch.
(*ctrdi_internal6): Modified to call output_bdxx_branch.
* gcc/doc/invoke.texi (-mbranch-predictions): Document new option.
(-mbranch-predictions-threshold): Document new option.
Attachment:
gcc4-branch-pred.txt
Description: Text document