diff options
author | Chris Demetriou <cgd@broadcom.com> | 2002-08-07 02:57:53 +0000 |
---|---|---|
committer | Chris Demetriou <cgd@gcc.gnu.org> | 2002-08-06 19:57:53 -0700 |
commit | af34e51e35a9db97532a89dac909cc50c3b9ac6c (patch) | |
tree | c13b0c62cab6a17157a952037ef5199d0d414ea6 /gcc/config/mips/mips.c | |
parent | f538618effe28e22c24338e973a5916c36771651 (diff) | |
download | gcc-af34e51e35a9db97532a89dac909cc50c3b9ac6c.zip gcc-af34e51e35a9db97532a89dac909cc50c3b9ac6c.tar.gz gcc-af34e51e35a9db97532a89dac909cc50c3b9ac6c.tar.bz2 |
mips.c (override_options): Set MASK_BRANCHLIKELY in target_flags based on ISA...
2002-08-06 Chris Demetriou <cgd@broadcom.com>
* config/mips/mips.c (override_options): Set MASK_BRANCHLIKELY
in target_flags based on ISA, if it was not set on the command
line. Warn if MASK_BRANCHLIKLEY is set but the ISA does not
support Branch Likely instructions.
* config/mips/mips.h (MASK_BRANCHLIKLEY): New macro.
(TARGET_BRANCHLIKELY): Likewise.
(TARGET_SWITCHES): Add -mbranch-likely and -mno-branch-likely.
(GENERATE_BRANCHLIKELY): Use TARGET_BRANCHLIKELY rather than
ISA_HAS_BRANCHLIKELY.
(ISA_HAS_BRANCHLIKELY): Do not include MIPS16 check.
* doc/invoke.texi: Document new MIPS -mbranch-likely and
-mno-branch-likely options.
From-SVN: r56088
Diffstat (limited to 'gcc/config/mips/mips.c')
-rw-r--r-- | gcc/config/mips/mips.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c index 31cd0d0..aa6be83 100644 --- a/gcc/config/mips/mips.c +++ b/gcc/config/mips/mips.c @@ -5177,6 +5177,31 @@ override_options () if (mips_abi != ABI_32 && mips_abi != ABI_O64) flag_pcc_struct_return = 0; + if ((target_flags_explicit & MASK_BRANCHLIKELY) == 0) + { + /* If neither -mbranch-likely nor -mno-branch-likely was given + on the command line, set MASK_BRANCHLIKELY based on the target + architecture. + + By default, we enable use of Branch Likely instructions on + all architectures which support them except for MIPS32 and MIPS64 + (i.e., the generic MIPS32 and MIPS64 ISAs, and processors which + implement them). + + The MIPS32 and MIPS64 architecture specifications say "Software + is strongly encouraged to avoid use of Branch Likely + instructions, as they will be removed from a future revision + of the [MIPS32 and MIPS64] architecture." Therefore, we do not + issue those instructions unless instructed to do so by + -mbranch-likely. */ + if (ISA_HAS_BRANCHLIKELY && !(ISA_MIPS32 || ISA_MIPS64)) + target_flags |= MASK_BRANCHLIKELY; + else + target_flags &= ~MASK_BRANCHLIKELY; + } + if (TARGET_BRANCHLIKELY && !ISA_HAS_BRANCHLIKELY) + warning ("generation of Branch Likely instructions enabled, but not supported by architecture"); + /* -fpic (-KPIC) is the default when TARGET_ABICALLS is defined. We need to set flag_pic so that the LEGITIMATE_PIC_OPERAND_P macro will work. */ /* ??? -non_shared turns off pic code generation, but this is not |