public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/62312] New: [4.9/5 Regression] [SH] Invalid operands for opcode div0s
@ 2014-08-30  2:29 kkojima at gcc dot gnu.org
  2014-08-31 19:15 ` [Bug target/62312] " olegendo at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: kkojima at gcc dot gnu.org @ 2014-08-30  2:29 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 62312
           Summary: [4.9/5 Regression] [SH] Invalid operands for opcode
                    div0s
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kkojima at gcc dot gnu.org
                CC: glaubitz at physik dot fu-berlin.de, olegendo at gcc dot gnu.org
            Target: sh*-*-*

Created attachment 33420
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33420&action=edit
A reduced test case for -O2

The attached test case generates an invalid instruction like
"div0s @(4,r8),r1" with -O2.  It seems that

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

has no constraints.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/62312] [4.9/5 Regression] [SH] Invalid operands for opcode div0s
  2014-08-30  2:29 [Bug target/62312] New: [4.9/5 Regression] [SH] Invalid operands for opcode div0s kkojima at gcc dot gnu.org
@ 2014-08-31 19:15 ` olegendo at gcc dot gnu.org
  2014-09-01  9:41 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: olegendo at gcc dot gnu.org @ 2014-08-31 19:15 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/62312] [4.9/5 Regression] [SH] Invalid operands for opcode div0s
  2014-08-30  2:29 [Bug target/62312] New: [4.9/5 Regression] [SH] Invalid operands for opcode div0s kkojima at gcc dot gnu.org
  2014-08-31 19:15 ` [Bug target/62312] " olegendo at gcc dot gnu.org
@ 2014-09-01  9:41 ` rguenth at gcc dot gnu.org
  2014-09-01 11:38 ` kkojima at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-09-01  9:41 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.9.2


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/62312] [4.9/5 Regression] [SH] Invalid operands for opcode div0s
  2014-08-30  2:29 [Bug target/62312] New: [4.9/5 Regression] [SH] Invalid operands for opcode div0s kkojima at gcc dot gnu.org
  2014-08-31 19:15 ` [Bug target/62312] " olegendo at gcc dot gnu.org
  2014-09-01  9:41 ` rguenth at gcc dot gnu.org
@ 2014-09-01 11:38 ` kkojima at gcc dot gnu.org
  2014-09-01 22:25 ` olegendo at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: kkojima at gcc dot gnu.org @ 2014-09-01 11:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Kazumoto Kojima <kkojima at gcc dot gnu.org> ---
(In reply to Oleg Endo from comment #1)
> 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.

Looks fine.  Please go ahead.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/62312] [4.9/5 Regression] [SH] Invalid operands for opcode div0s
  2014-08-30  2:29 [Bug target/62312] New: [4.9/5 Regression] [SH] Invalid operands for opcode div0s kkojima at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2014-09-01 11:38 ` kkojima at gcc dot gnu.org
@ 2014-09-01 22:25 ` olegendo at gcc dot gnu.org
  2014-09-01 22:32 ` olegendo at gcc dot gnu.org
  2014-09-01 22:37 ` olegendo at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: olegendo at gcc dot gnu.org @ 2014-09-01 22:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Oleg Endo <olegendo at gcc dot gnu.org> ---
Author: olegendo
Date: Mon Sep  1 22:25:09 2014
New Revision: 214804

URL: https://gcc.gnu.org/viewcvs?rev=214804&root=gcc&view=rev
Log:
gcc/
    PR target/62312
    * config/sh/sh.md (*cmp_div0s_0): Add missing constraints.

gcc/testsuite/
    PR target/62312
    * gcc.c-torture/compile/pr62312.c: New.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr62312.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/sh/sh.md
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/62312] [4.9/5 Regression] [SH] Invalid operands for opcode div0s
  2014-08-30  2:29 [Bug target/62312] New: [4.9/5 Regression] [SH] Invalid operands for opcode div0s kkojima at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2014-09-01 22:25 ` olegendo at gcc dot gnu.org
@ 2014-09-01 22:32 ` olegendo at gcc dot gnu.org
  2014-09-01 22:37 ` olegendo at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: olegendo at gcc dot gnu.org @ 2014-09-01 22:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Oleg Endo <olegendo at gcc dot gnu.org> ---
Author: olegendo
Date: Mon Sep  1 22:31:55 2014
New Revision: 214805

URL: https://gcc.gnu.org/viewcvs?rev=214805&root=gcc&view=rev
Log:
gcc/
    Backport from mainline
    2014-09-01  Oleg Endo  <olegendo@gcc.gnu.org>

    PR target/62312
    * config/sh/sh.md (*cmp_div0s_0): Add missing constraints.

gcc/testsuite/
    Backport from mainline
    2014-09-01  Oleg Endo  <olegendo@gcc.gnu.org>

    PR target/62312
    * gcc.c-torture/compile/pr62312.c: New.

Added:
    branches/gcc-4_9-branch/gcc/testsuite/gcc.c-torture/compile/pr62312.c
Modified:
    branches/gcc-4_9-branch/gcc/ChangeLog
    branches/gcc-4_9-branch/gcc/config/sh/sh.md
    branches/gcc-4_9-branch/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug target/62312] [4.9/5 Regression] [SH] Invalid operands for opcode div0s
  2014-08-30  2:29 [Bug target/62312] New: [4.9/5 Regression] [SH] Invalid operands for opcode div0s kkojima at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2014-09-01 22:32 ` olegendo at gcc dot gnu.org
@ 2014-09-01 22:37 ` olegendo at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: olegendo at gcc dot gnu.org @ 2014-09-01 22:37 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Oleg Endo <olegendo at gcc dot gnu.org> ---
Fixed on trunk and 4.9.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-09-01 22:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-30  2:29 [Bug target/62312] New: [4.9/5 Regression] [SH] Invalid operands for opcode div0s kkojima at gcc dot gnu.org
2014-08-31 19:15 ` [Bug target/62312] " olegendo at gcc dot gnu.org
2014-09-01  9:41 ` rguenth at gcc dot gnu.org
2014-09-01 11:38 ` kkojima at gcc dot gnu.org
2014-09-01 22:25 ` olegendo at gcc dot gnu.org
2014-09-01 22:32 ` olegendo at gcc dot gnu.org
2014-09-01 22:37 ` olegendo at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).