Fix invalid cc_status after [const_][us]mulsi3_highpart
authorAndreas Schwab <schwab@linux-m68k.org>
Tue, 17 Jul 2018 18:42:42 +0000 (18:42 +0000)
committerAndreas Schwab <schwab@gcc.gnu.org>
Tue, 17 Jul 2018 18:42:42 +0000 (18:42 +0000)
* config/m68k/m68k.md (umulsi3_highpart+1, const_umulsi3_highpart)
(smulsi3_highpart+1, const_smulsi3_highpart): Add CC_STATUS_INIT.

testsuite/:
* gcc.target/m68k/mulsi_highpart.c: New test.

From-SVN: r262835

gcc/ChangeLog
gcc/config/m68k/m68k.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/m68k/mulsi_highpart.c [new file with mode: 0644]

index 27f8a722fa570bed3e79690adbfc14248c02bc4b..2e724217fa49fa9cdba292c6ceb26f0e506ff78a 100644 (file)
@@ -1,3 +1,8 @@
+2018-07-17  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * config/m68k/m68k.md (umulsi3_highpart+1, const_umulsi3_highpart)
+       (smulsi3_highpart+1, const_smulsi3_highpart): Add CC_STATUS_INIT.
+
 2018-07-17  Claudiu Zissulescu  <claziss@synopsys.com>
 
        * config/arc/arc.c (arc_label_align): Use align_labels instead of
index a28e3cd9d31ef9592dc5901ad73e58f4b3359d59..88335cdd4f29a1121260490420d47790fca10332 100644 (file)
          (const_int 32))))
    (clobber (match_operand:SI 1 "register_operand" "=d"))]
   "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
-  "mulu%.l %3,%0:%1")
+{
+  CC_STATUS_INIT;
+  return "mulu%.l %3,%0:%1";
+})
 
 (define_insn "const_umulsi3_highpart"
   [(set (match_operand:SI 0 "register_operand" "=d")
          (const_int 32))))
    (clobber (match_operand:SI 1 "register_operand" "=d"))]
   "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
-  "mulu%.l %3,%0:%1")
+{
+  CC_STATUS_INIT;
+  return "mulu%.l %3,%0:%1";
+})
 
 (define_expand "smulsi3_highpart"
   [(parallel
          (const_int 32))))
    (clobber (match_operand:SI 1 "register_operand" "=d"))]
   "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
-  "muls%.l %3,%0:%1")
+{
+  CC_STATUS_INIT;
+  return "muls%.l %3,%0:%1";
+})
 
 (define_insn "const_smulsi3_highpart"
   [(set (match_operand:SI 0 "register_operand" "=d")
          (const_int 32))))
    (clobber (match_operand:SI 1 "register_operand" "=d"))]
   "TARGET_68020 && !TUNE_68060 && !TARGET_COLDFIRE"
-  "muls%.l %3,%0:%1")
+{
+  CC_STATUS_INIT;
+  return "muls%.l %3,%0:%1";
+})
 
 (define_expand "mul<mode>3"
   [(set (match_operand:FP 0 "nonimmediate_operand" "")
index 11936ee4610af9941587815337fddf7e06b123b7..b09943993ddb2c64af81601ae54906929b6eea21 100644 (file)
@@ -1,3 +1,7 @@
+2018-07-17  Andreas Schwab  <schwab@linux-m68k.org>
+
+       * gcc.target/m68k/mulsi_highpart.c: New test.
+
 2018-07-17  Jakub Jelinek  <jakub@redhat.com>
 
        * gcc.dg/cpp/pr61854-c90.c (foo): Expect a note, rather than error.
diff --git a/gcc/testsuite/gcc.target/m68k/mulsi_highpart.c b/gcc/testsuite/gcc.target/m68k/mulsi_highpart.c
new file mode 100644 (file)
index 0000000..f17586e
--- /dev/null
@@ -0,0 +1,8 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -m68020" } */
+/* Don't optimize away a compare after [us]mulsi_highpart.  */
+/* { dg-final { scan-assembler {tst\.?l} } } */
+int cmp (unsigned int a, unsigned int b)
+{
+  return (a > 0xffffffff / b);
+}