From 0d7afd5d27bd51ec843a5fb78046c12ca4b9796f Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Tue, 17 Jul 2018 18:42:42 +0000 Subject: [PATCH] Fix invalid cc_status after [const_][us]mulsi3_highpart * 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 | 5 +++++ gcc/config/m68k/m68k.md | 20 +++++++++++++++---- gcc/testsuite/ChangeLog | 4 ++++ .../gcc.target/m68k/mulsi_highpart.c | 8 ++++++++ 4 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.target/m68k/mulsi_highpart.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 27f8a722fa5..2e724217fa4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2018-07-17 Andreas Schwab + + * 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 * config/arc/arc.c (arc_label_align): Use align_labels instead of diff --git a/gcc/config/m68k/m68k.md b/gcc/config/m68k/m68k.md index a28e3cd9d31..88335cdd4f2 100644 --- a/gcc/config/m68k/m68k.md +++ b/gcc/config/m68k/m68k.md @@ -3240,7 +3240,10 @@ (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") @@ -3251,7 +3254,10 @@ (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 @@ -3283,7 +3289,10 @@ (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") @@ -3294,7 +3303,10 @@ (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 "mul3" [(set (match_operand:FP 0 "nonimmediate_operand" "") diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 11936ee4610..b09943993dd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2018-07-17 Andreas Schwab + + * gcc.target/m68k/mulsi_highpart.c: New test. + 2018-07-17 Jakub Jelinek * 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 index 00000000000..f17586ee525 --- /dev/null +++ b/gcc/testsuite/gcc.target/m68k/mulsi_highpart.c @@ -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); +} -- 2.30.2