@@ -51,6 +51,7 @@ enum mips_r10k_cache_barrier_setting {
enum mips_cb_setting {
MIPS_CB_NEVER,
MIPS_CB_OPTIMAL,
- MIPS_CB_ALWAYS
+ MIPS_CB_ALWAYS,
+ MIPS_CB_PREFER
};
#endif
@@ -106,20 +106,22 @@ struct mips_cpu_info {
'never' policy or the 'optimal' policy on a core that lacks
compact branch instructions. */
#define TARGET_CB_NEVER (mips_cb == MIPS_CB_NEVER \
- || (mips_cb == MIPS_CB_OPTIMAL \
+ || ((mips_cb == MIPS_CB_OPTIMAL || mips_cb == MIPS_CB_PREFER) \
&& !ISA_HAS_COMPACT_BRANCHES))
/* Compact branches may be used if the user either selects the
'always' policy or the 'optimal' policy on a core that supports
compact branch instructions. */
#define TARGET_CB_MAYBE (TARGET_CB_ALWAYS \
- || (mips_cb == MIPS_CB_OPTIMAL \
+ || ((mips_cb == MIPS_CB_OPTIMAL || mips_cb == MIPS_CB_PREFER) \
&& ISA_HAS_COMPACT_BRANCHES))
/* Compact branches must always be generated if the user selects
the 'always' policy or the 'optimal' policy om a core that
lacks delay slot branch instructions. */
#define TARGET_CB_ALWAYS (mips_cb == MIPS_CB_ALWAYS \
+ || (mips_cb == MIPS_CB_PREFER \
+ && ISA_HAS_COMPACT_BRANCHES) \
|| (mips_cb == MIPS_CB_OPTIMAL \
&& !ISA_HAS_DELAY_SLOTS))
@@ -464,6 +464,9 @@ Enum(mips_cb_setting) String(optimal) Value(MIPS_CB_OPTIMAL)
EnumValue
Enum(mips_cb_setting) String(always) Value(MIPS_CB_ALWAYS)
+EnumValue
+Enum(mips_cb_setting) String(prefer) Value(MIPS_CB_PREFER)
+
mloongson-mmi
Target Mask(LOONGSON_MMI)
Use Loongson MultiMedia extensions Instructions (MMI) instructions.
@@ -25199,9 +25199,11 @@ and MIPS64 architectures specifically deprecate their use.
@item -mcompact-branches=never
@itemx -mcompact-branches=optimal
@itemx -mcompact-branches=always
+@itemx -mcompact-branches=prefer
@opindex mcompact-branches=never
@opindex mcompact-branches=optimal
@opindex mcompact-branches=always
+@opindex mcompact-branches=prefer
These options control which form of branches will be generated. The
default is @option{-mcompact-branches=optimal}.
@@ -25215,6 +25217,10 @@ used instead.
This option is supported from MIPS Release 6 onwards.
+The @option{-mcompact-branches=prefer} option is same with
+@option{-mcompact-branches=always} for MIPS Release 6 onwards, and
+is same with @option{-mcompact-branches=never} for pre-R6.
+
The @option{-mcompact-branches=optimal} option will cause a delay slot
branch to be used if one is available in the current ISA and the delay
slot is successfully filled. If the delay slot is not filled, a compact
new file mode 100644
@@ -0,0 +1,10 @@
+/* { dg-options "-mno-abicalls -mcompact-branches=prefer isa_rev<=5" } */
+void bar (int);
+
+void
+foo ()
+{
+ bar (1);
+}
+
+/* { dg-final { scan-assembler "\t(j|jal)\t" } } */
new file mode 100644
@@ -0,0 +1,10 @@
+/* { dg-options "-mno-abicalls -fno-PIC -mcompact-branches=prefer isa_rev>=6" } */
+void bar (int);
+
+void
+foo ()
+{
+ bar (1);
+}
+
+/* { dg-final { scan-assembler "\t(bc|balc)\t" } } */