Prior to Armv6, the SMULL and UMULL instructions, which have the form

     UMULL Rdlo, Rdhi, Rm, Rs

had an operand restriction such that Rdlo, Rdhi and Rm must all be
different registers.  Rs, however can overlap either of the
destination registers.  Add some register-tie alternatives to allow
the register allocator to find these forms without having to use
additional register moves.

In addition to this, the test is pretty meaningless on Thumb-1 targets
as the S/UMULL instructions do not exist in a 16-bit encoding.  So skip
the test in this case.

gcc/ChangeLog:

        * config/arm/arm.md (<US>mull): Add alternatives that allow Rs
        to be tied to either Rdlo or Rdhi.

gcc/testsuite/ChangeLog:

        * gcc.target/arm/pr42575.c: Skip test if thumb1.
---
 gcc/config/arm/arm.md                  | 10 +++++-----
 gcc/testsuite/gcc.target/arm/pr42575.c |  1 +
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/gcc/config/arm/arm.md b/gcc/config/arm/arm.md
index 442d86b9329..597ef6725bb 100644
--- a/gcc/config/arm/arm.md
+++ b/gcc/config/arm/arm.md
@@ -2432,11 +2432,11 @@ (define_expand "<Us>mulsidi3"
 )
 
 (define_insn "<US>mull"
-  [(set (match_operand:SI 0 "s_register_operand" "=r,&r")
+  [(set (match_operand:SI 0 "s_register_operand" "=r,&r,&r,&r")
        (mult:SI
-        (match_operand:SI 2 "s_register_operand" "%r,r")
-        (match_operand:SI 3 "s_register_operand" "r,r")))
-   (set (match_operand:SI 1 "s_register_operand" "=r,&r")
+        (match_operand:SI 2 "s_register_operand" "%r,r,r,r")
+        (match_operand:SI 3 "s_register_operand" "r,r,0,1")))
+   (set (match_operand:SI 1 "s_register_operand" "=r,&r,&r,&r")
        (truncate:SI
         (lshiftrt:DI
          (mult:DI (SE:DI (match_dup 2)) (SE:DI (match_dup 3)))
@@ -2445,7 +2445,7 @@ (define_insn "<US>mull"
   "<US>mull%?\\t%0, %1, %2, %3"
   [(set_attr "type" "umull")
    (set_attr "predicable" "yes")
-   (set_attr "arch" "v6,nov6")]
+   (set_attr "arch" "v6,nov6,nov6,nov6")]
 )
 
 (define_expand "<Us>maddsidi4"
diff --git a/gcc/testsuite/gcc.target/arm/pr42575.c 
b/gcc/testsuite/gcc.target/arm/pr42575.c
index 1998e323df1..3906c77ed56 100644
--- a/gcc/testsuite/gcc.target/arm/pr42575.c
+++ b/gcc/testsuite/gcc.target/arm/pr42575.c
@@ -1,4 +1,5 @@
 /* { dg-options "-O2" }  */
+/* { dg-skip-if "Thumb1 lacks UMULL" { arm_thumb1 } } */
 /* Make sure RA does good job allocating registers and avoids
    unnecessary moves.  */
 /* { dg-final { scan-assembler-not "mov" } } */
-- 
2.34.1

Reply via email to