]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
IBM Z: Remove match_scratch workaround
authorIlya Leoshkevich <iii@linux.ibm.com>
Mon, 31 May 2021 19:59:50 +0000 (21:59 +0200)
committerIlya Leoshkevich <iii@linux.ibm.com>
Wed, 2 Jun 2021 09:56:32 +0000 (11:56 +0200)
Since commit dd1ef00c45ba ("Fix bug in the define_subst handling that
made match_scratch unusable for multi-alternative patterns.") the
workaround for that bug in *ashrdi3_31<setcc><cconly> is not only no
longer necessary, but actually breaks the build.

Get rid of it by using only one alternative in (match_scratch).  It
will be replicated as many times as needed in order to match the
pattern with which (define_subst) is used.

gcc/ChangeLog:

* config/s390/s390.md(*ashrdi3_31<setcc><cconly>): Use a single
constraint.
* config/s390/subst.md(cconly_subst): Use a single constraint
in (match_scratch).

gcc/testsuite/ChangeLog:

* gcc.target/s390/ashr.c: New test.

gcc/config/s390/s390.md
gcc/config/s390/subst.md
gcc/testsuite/gcc.target/s390/ashr.c [new file with mode: 0644]

index 7faf775fbf2df720e2c336be14227832e33f98cd..0c5b4dc90293da99ba389e03da555184b5edea56 100644 (file)
   ""
   "")
 
-; FIXME: The number of alternatives is doubled here to match the fix
-; number of 2 in the subst pattern for the (clobber (match_scratch...
-; The right fix should be to support match_scratch in the output
-; pattern of a define_subst.
 (define_insn "*ashrdi3_31<setcc><cconly>"
-  [(set (match_operand:DI 0 "register_operand"               "=d, d")
-        (ashiftrt:DI (match_operand:DI 1 "register_operand"   "0, 0")
-                     (match_operand:QI 2 "shift_count_operand" "jsc,jsc")))
+  [(set (match_operand:DI 0 "register_operand"               "=d")
+        (ashiftrt:DI (match_operand:DI 1 "register_operand"   "0")
+                     (match_operand:QI 2 "shift_count_operand" "jsc")))
    (clobber (reg:CC CC_REGNUM))]
   "!TARGET_ZARCH"
-  "@
-   srda\t%0,%Y2
-   srda\t%0,%Y2"
+  "srda\t%0,%Y2"
   [(set_attr "op_type" "RS")
    (set_attr "atype"   "reg")])
 
index 384af11c1981d48b6f2a748a7fe4c7a927240e57..3ea6fc40ba82f32b65a369a31a3174ca49c6535b 100644 (file)
@@ -45,7 +45,7 @@
   "s390_match_ccmode(insn, CCSmode)"
   [(set (reg CC_REGNUM)
        (compare (match_dup 1) (const_int 0)))
-   (clobber (match_scratch:DSI 0 "=d,d"))])
+   (clobber (match_scratch:DSI 0 "=d"))])
 
 (define_subst_attr "cconly" "cconly_subst" "" "_cconly")
 
diff --git a/gcc/testsuite/gcc.target/s390/ashr.c b/gcc/testsuite/gcc.target/s390/ashr.c
new file mode 100644 (file)
index 0000000..8cffdfa
--- /dev/null
@@ -0,0 +1,11 @@
+/* Test the arithmetic shift right pattern.  */
+
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+
+int e(void);
+
+int f (long c, int b)
+{
+  return (c >> b) && e ();
+}