[Bug target/62312] [4.9/5 Regression] [SH] Invalid operands for opcode div0s

olegendo at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun Aug 31 19:15:00 GMT 2014


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62312

Oleg Endo <olegendo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-08-31
     Ever confirmed|0                           |1

--- Comment #1 from Oleg Endo <olegendo at gcc dot gnu.org> ---
Ouch, yes, constraints missing.  Thanks for the reduced test case.

The patch below fixes it.  I'd apply it to trunk and 4.9 without further
testing, as it's obvious, I think.  Kaz, if you'd like to run it through your
test setup, I'll wait.

Index: gcc/config/sh/sh.md
===================================================================
--- gcc/config/sh/sh.md    (revision 214405)
+++ gcc/config/sh/sh.md    (working copy)
@@ -869,9 +869,9 @@

 (define_insn "*cmp_div0s_0"
   [(set (reg:SI T_REG)
-    (eq:SI (lshiftrt:SI (match_operand:SI 0 "arith_reg_operand")
+    (eq:SI (lshiftrt:SI (match_operand:SI 0 "arith_reg_operand" "%r")
                 (const_int 31))
-           (ge:SI (match_operand:SI 1 "arith_reg_operand")
+           (ge:SI (match_operand:SI 1 "arith_reg_operand" "r")
               (const_int 0))))]
   "TARGET_SH1"
   "div0s    %0,%1"


BTW, funny div0s use case.



More information about the Gcc-bugs mailing list