]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
mips.c (mips_rtx_costs): Very slightly increase the cost of MULT when optimizing...
authorGraham Stott <grahams@gcc.gnu.org>
Wed, 10 Jul 2013 09:26:13 +0000 (09:26 +0000)
committerGraham Stott <grahams@gcc.gnu.org>
Wed, 10 Jul 2013 09:26:13 +0000 (09:26 +0000)
* config/mips/mips.c (mips_rtx_costs): Very slightly increase
the cost of MULT when optimizing for size.

* gcc.target/mips/mulsize-1.c: New.
* gcc.target/mips/mulsize-2.c: New.
* gcc.target/mips/mulsize-3.c: New.
* gcc.target/mips/mulsize-4.c: New.

From-SVN: r200867

gcc/ChangeLog
gcc/config/mips/mips.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/mips/mulsize-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/mips/mulsize-2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/mips/mulsize-3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/mips/mulsize-4.c [new file with mode: 0644]

index 0a26cf21509a9215c6a539284cb8ecf1109f6850..19016a2016a72382c4dfefb24501dc28f617e380 100644 (file)
@@ -1,3 +1,7 @@
+2013-07-10  Graham Stott  <graham.stott@btinternet.com>
+       * config/mips/mips.c (mips_rtx_costs): Very slightly increase
+       the cost of MULT when optimizing for size.
+
 2013-07-10  Jan-Benedict Glaw  <jbglaw@lug-owl.de>
 
        * config/cr16/cr16-protos.h: Don't include target.h.
index bd1d10b0e4ed363d7381ddece88948b75894aa79..3c5469b4b16e0fab385fcefb3c8b1014cbace0af 100644 (file)
@@ -3944,7 +3944,7 @@ mips_rtx_costs (rtx x, int code, int outer_code, int opno ATTRIBUTE_UNUSED,
                  ? mips_cost->int_mult_si * 3 + 6
                  : COSTS_N_INSNS (ISA_HAS_MUL3 ? 7 : 9));
       else if (!speed)
-       *total = COSTS_N_INSNS (ISA_HAS_MUL3 ? 1 : 2);
+       *total = COSTS_N_INSNS (ISA_HAS_MUL3 ? 1 : 2) + 1;
       else if (mode == DImode)
        *total = mips_cost->int_mult_di;
       else
index a9b8829d24c97b445bf30ddb258d486192bbbbfc..1b4e046c43947ad5461252bbba163dec340a6215 100644 (file)
@@ -1,3 +1,9 @@
+2013-07-10  Graham Stott  <grahams@btinternet.com>
+       * gcc.target/mips/mulsize-1.c: New.
+       * gcc.target/mips/mulsize-2.c: New.
+       * gcc.target/mips/mulsize-3.c: New.
+       * gcc.target/mips/mulsize-4.c: New.
+
 2013-07-09  Marc Glisse  <marc.glisse@inria.fr>
 
        PR c++/53094
diff --git a/gcc/testsuite/gcc.target/mips/mulsize-1.c b/gcc/testsuite/gcc.target/mips/mulsize-1.c
new file mode 100644 (file)
index 0000000..4dd5a19
--- /dev/null
@@ -0,0 +1,9 @@
+/* { dg-final { scan-assembler "\t.globl\tf7" } } */
+/* { dg-final { scan-assembler "\tsubu\t" } } */
+/* { dg-final { scan-assembler-not "\tli\t" } } */
+/* { dg-final { scan-assembler-not "\tmul\t" } } */
+int
+f7(int x)
+{
+  return x * 7;
+}
diff --git a/gcc/testsuite/gcc.target/mips/mulsize-2.c b/gcc/testsuite/gcc.target/mips/mulsize-2.c
new file mode 100644 (file)
index 0000000..c427bfa
--- /dev/null
@@ -0,0 +1,9 @@
+/* { dg-final { scan-assembler "\t.globl\tf9" } } */
+/* { dg-final { scan-assembler "\tsubu\t" } } */
+/* { dg-final { scan-assembler-not "\tli\t" } } */
+/* { dg-final { scan-assembler-not "\tmul\t" } } */
+int
+f9(int x)
+{
+  return x * 9;
+}
diff --git a/gcc/testsuite/gcc.target/mips/mulsize-3.c b/gcc/testsuite/gcc.target/mips/mulsize-3.c
new file mode 100644 (file)
index 0000000..552d8c9
--- /dev/null
@@ -0,0 +1,12 @@
+/* { dg-final { scan-assembler "\t.globl\tf15" } } */
+/* { dg-final { scan-assembler "\tsll\t" } } */
+/* { dg-final { scan-assembler "\tsubu\t" } } */
+/* { dg-final { scan-assembler-not "\tli\t" } } */
+/* { dg-final { scan-assembler-not "\tmul\t" } } */
+int
+f15(int x)
+{
+  return x * 15;
+}
+
+                                   
\ No newline at end of file
diff --git a/gcc/testsuite/gcc.target/mips/mulsize-4.c b/gcc/testsuite/gcc.target/mips/mulsize-4.c
new file mode 100644 (file)
index 0000000..7694d2c
--- /dev/null
@@ -0,0 +1,11 @@
+/* { dg-final { scan-assembler "\t.globl\tf17" } } */
+/* { dg-final { scan-assembler "\tsll\t" } } */
+/* { dg-final { scan-assembler "\taddu\t" } } */
+/* { dg-final { scan-assembler-not "\tli\t" } } */
+/* { dg-final { scan-assembler-not "\tmul\t" } } */
+int
+f17(int x)
+{
+  return x * 17;
+}
+                                   
\ No newline at end of file