aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2017-09-08 17:09:16 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2017-09-08 17:09:16 +0000
commit8bd5e1f70755bb9d400e1ab08828d739ae9d9cf3 (patch)
tree4539d205a45189e75fe76cabb6cfcb4d01a54fc1
parentedcc77dbd9f95301a8be1a2f2b0d774680b46a1a (diff)
downloadgcc-8bd5e1f70755bb9d400e1ab08828d739ae9d9cf3.zip
gcc-8bd5e1f70755bb9d400e1ab08828d739ae9d9cf3.tar.gz
gcc-8bd5e1f70755bb9d400e1ab08828d739ae9d9cf3.tar.bz2
re PR target/81988 (invalid std instruction with odd register)
PR target/81988 * config/sparc/sparc.md (mulsi3): Rename into *mulsi3_sp32. (*mulsi3_sp64): New instruction. (mulsi3): New expander. From-SVN: r251904
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/config/sparc/sparc.md17
-rw-r--r--gcc/testsuite/ChangeLog6
-rw-r--r--gcc/testsuite/gcc.dg/pr81988.c22
4 files changed, 50 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d3a149c..9f11d0e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2017-09-07 Eric Botcazou <ebotcazou@adacore.com>
+
+ PR target/81988
+ * config/sparc/sparc.md (mulsi3): Rename into *mulsi3_sp32.
+ (*mulsi3_sp64): New instruction.
+ (mulsi3): New expander.
+
2017-09-08 Uros Bizjak <ubizjak@gmail.com>
* config/alpha/alpha.c (alpha_print_operand) <case 'S'>: Remove.
diff --git a/gcc/config/sparc/sparc.md b/gcc/config/sparc/sparc.md
index 925b49e..d9cbd4f 100644
--- a/gcc/config/sparc/sparc.md
+++ b/gcc/config/sparc/sparc.md
@@ -4517,7 +4517,14 @@ visl")
;; The 32-bit multiply/divide instructions are deprecated on v9, but at
;; least in UltraSPARC I, II and IIi it is a win tick-wise.
-(define_insn "mulsi3"
+(define_expand "mulsi3"
+ [(set (match_operand:SI 0 "register_operand" "")
+ (mult:SI (match_operand:SI 1 "arith_operand" "")
+ (match_operand:SI 2 "arith_operand" "")))]
+ "TARGET_HARD_MUL || TARGET_ARCH64"
+ "")
+
+(define_insn "*mulsi3_sp32"
[(set (match_operand:SI 0 "register_operand" "=r")
(mult:SI (match_operand:SI 1 "arith_operand" "%r")
(match_operand:SI 2 "arith_operand" "rI")))]
@@ -4525,6 +4532,14 @@ visl")
"smul\t%1, %2, %0"
[(set_attr "type" "imul")])
+(define_insn "*mulsi3_sp64"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (mult:SI (match_operand:SI 1 "arith_operand" "%r")
+ (match_operand:SI 2 "arith_operand" "rI")))]
+ "TARGET_ARCH64"
+ "mulx\t%1, %2, %0"
+ [(set_attr "type" "imul")])
+
(define_expand "muldi3"
[(set (match_operand:DI 0 "register_operand" "")
(mult:DI (match_operand:DI 1 "arith_operand" "")
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 2ef3b16..4a1ebd6 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,9 @@
2017-09-07 Eric Botcazou <ebotcazou@adacore.com>
-
+
+ * gcc.dg/pr81988.c: New test.
+
+2017-09-07 Eric Botcazou <ebotcazou@adacore.com>
+
* gnat.dg/opt67.adb: New test.
* gnat.dg/opt67_pkg.ad[sb]: New helper.
diff --git a/gcc/testsuite/gcc.dg/pr81988.c b/gcc/testsuite/gcc.dg/pr81988.c
new file mode 100644
index 0000000..dbbf436f
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr81988.c
@@ -0,0 +1,22 @@
+/* PR target/81988 */
+/* Testcase by James Cowgill <jcowgill+gcc@jcowgill.uk> */
+
+/* { dg-do assemble } */
+/* { dg-require-effective-target pie } */
+/* { dg-options "-O3 -fpie" } */
+
+int c, d;
+
+short **e;
+int *a;
+
+void foo(void)
+{
+ int g[64 * 35], *h = g;
+ do {
+ short *f = e[d];
+ for (int i = 0; i < 4; i++)
+ a[i] = a[i] + (h[364] + f[4] * h[64] + f[5] * h[i] + f[6] * h[i + 3 * 4] +
+ f[7] * h[i + 4]);
+ } while (c);
+}