While testing GCC on a 74k MIPS chip I noticed that by default the -mtune=74k*
flags cause GCC to not use the integer madd/msub instructions.  According to
the checkin comments these were found to cause a performance hit over using
individual mult and add/sub instructions.  I think there are some programs
though where using madd/msub would be a win on the 74k and I would like to
have a flag to allow users to override the default behaviour (either turning
it on for 74k or turning it off for other achitectures).  This patch allows
-mimadd or -mno-imadd to override the default behaviour but does not change
that default behaviour.

OK for checkin?

Steve Ellcey
sell...@imgtec.com


2013-03-22  Steve Ellcey  <sell...@mips.com>

        * config/mips/mips.md (mimadd): New flag for integer madd/msub.
        * config/mips/mips.h (GENERATE_MADD_MSUB): Check -mimadd flag.


diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h
index 0acce14..62a7701 100644
--- a/gcc/config/mips/mips.h
+++ b/gcc/config/mips/mips.h
@@ -875,7 +875,9 @@ struct mips_cpu_info {
                                 && !TARGET_MIPS16)
 
 /* Integer multiply-accumulate instructions should be generated.  */
-#define GENERATE_MADD_MSUB      (ISA_HAS_MADD_MSUB && !TUNE_74K)
+#define GENERATE_MADD_MSUB     (ISA_HAS_MADD_MSUB \
+                                && (target_flags_explicit & MASK_IMADD \
+                                       ? TARGET_IMADD : !TUNE_74K))
 
 /* ISA has floating-point madd and msub instructions 'd = a * b [+-] c'.  */
 #define ISA_HAS_FP_MADD4_MSUB4  ISA_HAS_FP4
diff --git a/gcc/config/mips/mips.opt b/gcc/config/mips/mips.opt
index d8ef2e7..6b3024b 100644
--- a/gcc/config/mips/mips.opt
+++ b/gcc/config/mips/mips.opt
@@ -58,6 +58,10 @@ mmad
 Target Report Var(TARGET_MAD)
 Use PMC-style 'mad' instructions
 
+mimadd
+Target Report Mask(IMADD)
+Use integer madd/msub instructions
+
 march=
 Target RejectNegative Joined Var(mips_arch_option) ToLower 
Enum(mips_arch_opt_value)
 -march=ISA     Generate code for the given ISA

Reply via email to