public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/54418] New: [4.8 Regression] [SH] Invalid operands for opcode
@ 2012-08-30 12:20 kkojima at gcc dot gnu.org
  2012-08-30 13:11 ` [Bug target/54418] " olegendo at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: kkojima at gcc dot gnu.org @ 2012-08-30 12:20 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54418

             Bug #: 54418
           Summary: [4.8 Regression] [SH] Invalid operands for opcode
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: kkojima@gcc.gnu.org
                CC: olegendo@gcc.gnu.org
            Target: sh*-*-*


There are new libgomp failures with 4.8 compiler:

FAIL: libgomp.c++/loop-9.C  -O0  (test for excess errors)
Excess errors:
/tmp/ccGZWxT0.s:8594: Error: invalid operands for opcode

The compiler outputs the invalid insn like "cmp/hs #0,reg".
Here is a reduced test case with -O0 -fopenmp.

typedef struct { }  omp_sched_t;
extern "C" void abort ();
int arr[6 * 5];
void set (int loopidx, int idx)
{
  for (idx = 0; idx < 5; idx++)
    if (arr[4 * 5 + idx] != idx < 4)
      abort ();
}

int test4 ()
{
  int e = 0, idx;
  {
    unsigned long long j;
#pragma omp for schedule(static,1) nowait
    for (j = 9223372036854775807LL - 20000ULL;
     9223372036854775807LL + 10000ULL >= j;
     j += 10000ULL)
      {
      }
  }
  for (idx = 0; idx < 5; idx++)
    if (arr[5 * 5 + idx] != idx < 5)
      abort ();
}

It seems that cmpgeusi_t insn_and_split doesn't do its work.

(define_insn_and_split "cmpgeusi_t"
  [(set (reg:SI T_REG)
    (geu:SI (match_operand:SI 0 "arith_reg_operand" "r")
        (match_operand:SI 1 "arith_reg_or_0_operand" "rN")))]
  "TARGET_SH1"
  "cmp/hs    %1,%0"
  "&& satisfies_constraint_Z (operands[0])"
  [(set (reg:SI T_REG) (const_int 1))]

Oleg, operands[0] in the splitter condition is a typo of
operands[1], doesn't it?


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

* [Bug target/54418] [4.8 Regression] [SH] Invalid operands for opcode
  2012-08-30 12:20 [Bug target/54418] New: [4.8 Regression] [SH] Invalid operands for opcode kkojima at gcc dot gnu.org
@ 2012-08-30 13:11 ` olegendo at gcc dot gnu.org
  2012-08-30 17:36 ` olegendo at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: olegendo at gcc dot gnu.org @ 2012-08-30 13:11 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54418

--- Comment #1 from Oleg Endo <olegendo at gcc dot gnu.org> 2012-08-30 13:11:30 UTC ---
(In reply to comment #0)
>  
> It seems that cmpgeusi_t insn_and_split doesn't do its work.
> 
> (define_insn_and_split "cmpgeusi_t"
>   [(set (reg:SI T_REG)
>     (geu:SI (match_operand:SI 0 "arith_reg_operand" "r")
>         (match_operand:SI 1 "arith_reg_or_0_operand" "rN")))]
>   "TARGET_SH1"
>   "cmp/hs    %1,%0"
>   "&& satisfies_constraint_Z (operands[0])"
>   [(set (reg:SI T_REG) (const_int 1))]
> 
> Oleg, operands[0] in the splitter condition is a typo of
> operands[1], doesn't it?

Yes, it is.  Sorry about that.  Also, the 'N' alternative doesn't make sense in
this
case, as the split will happen before reload will start looking at the
constraints.
I think the pattern should be:

(define_insn_and_split "cmpgeusi_t"
  [(set (reg:SI T_REG)
    (geu:SI (match_operand:SI 0 "arith_reg_operand" "r")
        (match_operand:SI 1 "arith_reg_or_0_operand" "r")))]
  "TARGET_SH1"
  "cmp/hs    %1,%0"
  "&& satisfies_constraint_Z (operands[1])"
  [(set (reg:SI T_REG) (const_int 1))]
  ""
  [(set_attr "type" "mt_group")])

I always wondered under which condition this case would actually
happen.  Now I know it.  Thanks!


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

* [Bug target/54418] [4.8 Regression] [SH] Invalid operands for opcode
  2012-08-30 12:20 [Bug target/54418] New: [4.8 Regression] [SH] Invalid operands for opcode kkojima at gcc dot gnu.org
  2012-08-30 13:11 ` [Bug target/54418] " olegendo at gcc dot gnu.org
@ 2012-08-30 17:36 ` olegendo at gcc dot gnu.org
  2012-08-30 22:18 ` olegendo at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: olegendo at gcc dot gnu.org @ 2012-08-30 17:36 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54418

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2012-08-30
         AssignedTo|unassigned at gcc dot       |olegendo at gcc dot gnu.org
                   |gnu.org                     |
     Ever Confirmed|0                           |1


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

* [Bug target/54418] [4.8 Regression] [SH] Invalid operands for opcode
  2012-08-30 12:20 [Bug target/54418] New: [4.8 Regression] [SH] Invalid operands for opcode kkojima at gcc dot gnu.org
  2012-08-30 13:11 ` [Bug target/54418] " olegendo at gcc dot gnu.org
  2012-08-30 17:36 ` olegendo at gcc dot gnu.org
@ 2012-08-30 22:18 ` olegendo at gcc dot gnu.org
  2012-08-31 10:52 ` kkojima at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: olegendo at gcc dot gnu.org @ 2012-08-30 22:18 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54418

--- Comment #2 from Oleg Endo <olegendo at gcc dot gnu.org> 2012-08-30 22:18:34 UTC ---
Unfortunately I was not able to reproduce this case without the -fopenmp
option, and that option requires threads, which are not available on the sh-sim
config I've got here for testing.  Kaz, could you please try out the following?

Index: gcc/config/sh/sh.md
===================================================================
--- gcc/config/sh/sh.md    (revision 190781)
+++ gcc/config/sh/sh.md    (working copy)
@@ -1043,13 +1043,19 @@
 ;; SImode unsigned integer comparisons
 ;; -------------------------------------------------------------------------

+;; Usually comparisons of 'unsigned int >= 0' are optimized away completely.
+;; However, especially when optimizations are off (e.g. -O0) such comparisons
+;; might remain and we have to handle them.  If the '>= 0' case wasn't
+;; handled here, something else would just load a '0' into the second operand
+;; and do the comparison.  We can do slightly better by just setting the
+;; T bit to '1'.
 (define_insn_and_split "cmpgeusi_t"
   [(set (reg:SI T_REG)
     (geu:SI (match_operand:SI 0 "arith_reg_operand" "r")
-        (match_operand:SI 1 "arith_reg_or_0_operand" "rN")))]
+        (match_operand:SI 1 "arith_reg_or_0_operand" "r")))]
   "TARGET_SH1"
   "cmp/hs    %1,%0"
-  "&& satisfies_constraint_Z (operands[0])"
+  "&& satisfies_constraint_Z (operands[1])"
   [(set (reg:SI T_REG) (const_int 1))]
   ""
   [(set_attr "type" "mt_group")])


Just in case, I'll also test this as usually on sh-sim.


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

* [Bug target/54418] [4.8 Regression] [SH] Invalid operands for opcode
  2012-08-30 12:20 [Bug target/54418] New: [4.8 Regression] [SH] Invalid operands for opcode kkojima at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2012-08-30 22:18 ` olegendo at gcc dot gnu.org
@ 2012-08-31 10:52 ` kkojima at gcc dot gnu.org
  2012-09-02 23:15 ` olegendo at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: kkojima at gcc dot gnu.org @ 2012-08-31 10:52 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54418

--- Comment #3 from Kazumoto Kojima <kkojima at gcc dot gnu.org> 2012-08-31 10:51:48 UTC ---
(In reply to comment #2)
> Unfortunately I was not able to reproduce this case without the -fopenmp
> option, and that option requires threads, which are not available on the sh-sim
> config I've got here for testing.  Kaz, could you please try out the following?

I've confirmed that libgomp failures go away with your patch.


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

* [Bug target/54418] [4.8 Regression] [SH] Invalid operands for opcode
  2012-08-30 12:20 [Bug target/54418] New: [4.8 Regression] [SH] Invalid operands for opcode kkojima at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2012-08-31 10:52 ` kkojima at gcc dot gnu.org
@ 2012-09-02 23:15 ` olegendo at gcc dot gnu.org
  2012-09-03  9:48 ` olegendo at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: olegendo at gcc dot gnu.org @ 2012-09-02 23:15 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54418

--- Comment #4 from Oleg Endo <olegendo at gcc dot gnu.org> 2012-09-02 23:15:30 UTC ---
Author: olegendo
Date: Sun Sep  2 23:15:25 2012
New Revision: 190864

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=190864
Log:
    PR target/54418
    * config/sh/sh.md (cmpgeusi_t): Remove N alternative.
    Check operands[1] in split condition instead of operands[0].
    Add comments.


Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/sh/sh.md


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

* [Bug target/54418] [4.8 Regression] [SH] Invalid operands for opcode
  2012-08-30 12:20 [Bug target/54418] New: [4.8 Regression] [SH] Invalid operands for opcode kkojima at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2012-09-02 23:15 ` olegendo at gcc dot gnu.org
@ 2012-09-03  9:48 ` olegendo at gcc dot gnu.org
  2014-08-29 20:02 ` glaubitz at physik dot fu-berlin.de
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: olegendo at gcc dot gnu.org @ 2012-09-03  9:48 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54418

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

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

--- Comment #5 from Oleg Endo <olegendo at gcc dot gnu.org> 2012-09-03 09:48:35 UTC ---
Fixed.


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

* [Bug target/54418] [4.8 Regression] [SH] Invalid operands for opcode
  2012-08-30 12:20 [Bug target/54418] New: [4.8 Regression] [SH] Invalid operands for opcode kkojima at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2012-09-03  9:48 ` olegendo at gcc dot gnu.org
@ 2014-08-29 20:02 ` glaubitz at physik dot fu-berlin.de
  2014-08-29 20:06 ` glaubitz at physik dot fu-berlin.de
  2014-08-30  2:32 ` kkojima at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: glaubitz at physik dot fu-berlin.de @ 2014-08-29 20:02 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="UTF-8", Size: 4820 bytes --]

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

John Paul Adrian Glaubitz <glaubitz at physik dot fu-berlin.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |glaubitz at physik dot fu-berlin.d
                   |                            |e

--- Comment #6 from John Paul Adrian Glaubitz <glaubitz at physik dot fu-berlin.de> ---
I'm seeing this issue again when compiling postgresql-9.4 with gcc-4.9.1, but I
am not sure whether the issues are related.

The tail of the build log is:

gcc -g -O2 -fstack-protector-strong -Wformat -Werror=format-security
-I/usr/include/mit-krb5 -DLINUX_OOM_SCORE_ADJ=0 -Wall -Wmissing-prototypes
-Wpointer-arith -Wdeclaration-after-statement -Wendif-labels
-Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv
-fexcess-precision=standard -g -I../../../../src/include
-I/«PKGBUILDDIR»/build/../src/include -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE
-I/usr/include/libxml2  -I/usr/include/tcl8.6  -c -o timestamp.o
/«PKGBUILDDIR»/build/../src/backend/utils/adt/timestamp.c
/tmp/ccBriPih.s: Assembler messages:
/tmp/ccBriPih.s:1824: Error: invalid operands for opcode
/tmp/ccBriPih.s:1838: Error: invalid operands for opcode
make[6]: *** [timestamp.o] Error 1

The full buildlog can be found here [1].

Cheers,
Adrian
>From gcc-bugs-return-459524-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Fri Aug 29 20:04:37 2014
Return-Path: <gcc-bugs-return-459524-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 21401 invoked by alias); 29 Aug 2014 20:04:37 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 21339 invoked by uid 48); 29 Aug 2014 20:04:31 -0000
From: "glaubitz at physik dot fu-berlin.de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/43744] SH: Error: pcrel too far
Date: Fri, 29 Aug 2014 20:04:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 4.4.3
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: glaubitz at physik dot fu-berlin.de
X-Bugzilla-Status: RESOLVED
X-Bugzilla-Priority: P4
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields: cc
Message-ID: <bug-43744-4-SKnpiMsxRy@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-43744-4@http.gcc.gnu.org/bugzilla/>
References: <bug-43744-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-08/txt/msg02021.txt.bz2
Content-length: 1576

https://gcc.gnu.org/bugzilla/show_bug.cgi?idC744

John Paul Adrian Glaubitz <glaubitz at physik dot fu-berlin.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |glaubitz at physik dot fu-berlin.d
                   |                            |e

--- Comment #12 from John Paul Adrian Glaubitz <glaubitz at physik dot fu-berlin.de> ---
I'm seeing this issue again when compiling binutils-2.24.51.20140818 with
gcc-4.9.1, but I am not sure whether the issues are related.

The tail of the build log is:

/bin/sh ./libtool --tagÌ   --mode=compile gcc -DHAVE_CONFIG_H -I.
-I../../opcodes  -I. -I../../opcodes -I../bfd -I../../opcodes/../include
-I../../opcodes/../bfd    -W -Wall -Wstrict-prototypes -Wmissing-prototypes
-Wshadow -g -O2 -MT hppa-dis.lo -MD -MP -MF .deps/hppa-dis.Tpo -c -o
hppa-dis.lo ../../opcodes/hppa-dis.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../../opcodes -I. -I../../opcodes
-I../bfd -I../../opcodes/../include -I../../opcodes/../bfd -W -Wall
-Wstrict-prototypes -Wmissing-prototypes -Wshadow -g -O2 -MT hppa-dis.lo -MD
-MP -MF .deps/hppa-dis.Tpo -c ../../opcodes/hppa-dis.c  -fPIC -DPIC -o
.libs/hppa-dis.o
/tmp/ccZrwibi.s: Assembler messages:
/tmp/ccZrwibi.s:1903: Error: pcrel too far
make[5]: *** [hppa-dis.lo] Error 1

The full buildlog can be found here [1].

Cheers,
Adrian

> [1] http://buildd.debian-ports.org/status/fetch.php?pkg=binutils&arch=sh4&ver=2.24.51.20140818-1&stamp\x1408638991


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

* [Bug target/54418] [4.8 Regression] [SH] Invalid operands for opcode
  2012-08-30 12:20 [Bug target/54418] New: [4.8 Regression] [SH] Invalid operands for opcode kkojima at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2014-08-29 20:02 ` glaubitz at physik dot fu-berlin.de
@ 2014-08-29 20:06 ` glaubitz at physik dot fu-berlin.de
  2014-08-30  2:32 ` kkojima at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: glaubitz at physik dot fu-berlin.de @ 2014-08-29 20:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from John Paul Adrian Glaubitz <glaubitz at physik dot fu-berlin.de> ---
(In reply to John Paul Adrian Glaubitz from comment #6)
>
> The full buildlog can be found here [1].

Forgot the actual link:
http://buildd.debian-ports.org/status/fetch.php?pkg=postgresql-9.4&arch=sh4&ver=9.4~beta2-1&stamp=1409261773


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

* [Bug target/54418] [4.8 Regression] [SH] Invalid operands for opcode
  2012-08-30 12:20 [Bug target/54418] New: [4.8 Regression] [SH] Invalid operands for opcode kkojima at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2014-08-29 20:06 ` glaubitz at physik dot fu-berlin.de
@ 2014-08-30  2:32 ` kkojima at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: kkojima at gcc dot gnu.org @ 2014-08-30  2:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Kazumoto Kojima <kkojima at gcc dot gnu.org> ---
(In reply to John Paul Adrian Glaubitz from comment #6)
> I'm seeing this issue again when compiling postgresql-9.4 with gcc-4.9.1,
> but I am not sure whether the issues are related.

I've filed a new PR62312 for the issue in #c6 because it looks
a bit different problem.


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

end of thread, other threads:[~2014-08-30  2:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-30 12:20 [Bug target/54418] New: [4.8 Regression] [SH] Invalid operands for opcode kkojima at gcc dot gnu.org
2012-08-30 13:11 ` [Bug target/54418] " olegendo at gcc dot gnu.org
2012-08-30 17:36 ` olegendo at gcc dot gnu.org
2012-08-30 22:18 ` olegendo at gcc dot gnu.org
2012-08-31 10:52 ` kkojima at gcc dot gnu.org
2012-09-02 23:15 ` olegendo at gcc dot gnu.org
2012-09-03  9:48 ` olegendo at gcc dot gnu.org
2014-08-29 20:02 ` glaubitz at physik dot fu-berlin.de
2014-08-29 20:06 ` glaubitz at physik dot fu-berlin.de
2014-08-30  2:32 ` kkojima 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).