public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/31167]  New: ICE wnen using __int128_t on x86_64
@ 2007-03-13 21:30 john dot salmon at deshaw dot com
  2007-03-13 22:00 ` [Bug target/31167] " rguenth at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: john dot salmon at deshaw dot com @ 2007-03-13 21:30 UTC (permalink / raw)
  To: gcc-bugs

The source below is meant to return an int32_t that is the result of "rounding"
the upper 32 bits of an __int128_t, where rounding pays attention to the bits
that have been discarded and the low bit of what is kept.  Since it's an ICE,
the details are probably irrelevant. 

salmonj@drda0003.nyc$ cat brokengcc.cxx
#include <inttypes.h>

int32_t round32hi(const __int128_t &arg){
    const int SHIFT = 96;
    const int mshift = 96;
    const __int128_t M = (~__int128_t(0))<<mshift;
    const __int128_t L = (~M) + 1;
    const __int128_t L1 = __int128_t(L)>>1;
    const __int128_t Mlo = __int128_t(~M)>>1;
    __int128_t vv = arg & M;
    if( (arg & (L1))      // hi bit of discard set
        && ( (arg & Mlo)  // and ( any other bits of discard set
             || (arg & L) ) )   //       or lo bit of keep set )
        vv += L;
    return int32_t(vv>>SHIFT);
}
salmonj@drda0003.nyc$ gcc -v -c -O brokengcc.cxx
Reading specs from
/proj/desres/root/Linux/x86_64/gcc/4.1.2/lib/gcc/x86_64-unknown-linux-gnu/4.1.2/specs
Target: x86_64-unknown-linux-gnu
Configured with: /state/partition1/tmp/tmpwsa5nr/gcc-4.1.2/configure
--enable-languages=c,c++,fortran
--prefix=/proj/desres/root/Linux/x86_64/gcc/4.1.2
Thread model: posix
gcc version 4.1.2

/proj/desres/root/Linux/x86_64/gcc/4.1.2/libexec/gcc/x86_64-unknown-linux-gnu/4.1.2/cc1plus
-quiet -v -D_GNU_SOURCE brokengcc.cxx -quiet -dumpbase brokengcc.cxx -mtune=k8
-auxbase brokengcc -O -version -o /scratch/tmp/ccer1yVv.s
ignoring nonexistent directory
"/proj/desres/root/Linux/x86_64/gcc/4.1.2/lib/gcc/x86_64-unknown-linux-gnu/4.1.2/../../../../x86_64-unknown-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:

/proj/desres/root/Linux/x86_64/gcc/4.1.2/lib/gcc/x86_64-unknown-linux-gnu/4.1.2/../../../../include/c++/4.1.2

/proj/desres/root/Linux/x86_64/gcc/4.1.2/lib/gcc/x86_64-unknown-linux-gnu/4.1.2/../../../../include/c++/4.1.2/x86_64-unknown-linux-gnu

/proj/desres/root/Linux/x86_64/gcc/4.1.2/lib/gcc/x86_64-unknown-linux-gnu/4.1.2/../../../../include/c++/4.1.2/backward
 /usr/local/include
 /proj/desres/root/Linux/x86_64/gcc/4.1.2/include

/proj/desres/root/Linux/x86_64/gcc/4.1.2/lib/gcc/x86_64-unknown-linux-gnu/4.1.2/include
 /usr/include
End of search list.
GNU C++ version 4.1.2 (x86_64-unknown-linux-gnu)
        compiled by GNU C version 3.4.3 20041212 (Red Hat 3.4.3-9.EL4).
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 9975ef1eec7edce53d85d34b86837808
brokengcc.cxx: In function 'int32_t round32hi(const __int128_t&)':
brokengcc.cxx:16: error: unrecognizable insn:
(insn 92 91 50 3 (parallel [
            (set (reg:DI 38 r9 [ vv+8 ])
                (plus:DI (plus:DI (ltu:DI (reg:CC 17 flags)
                            (const_int 0 [0x0]))
                        (reg:DI 38 r9 [ vv+8 ]))
                    (const_int 4294967296 [0x100000000])))
            (clobber (reg:CC 17 flags))
        ]) -1 (nil)
    (nil))
brokengcc.cxx:16: internal compiler error: in extract_insn, at recog.c:2084
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
salmonj@drda0003.nyc$


-- 
           Summary: ICE wnen using __int128_t on x86_64
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: john dot salmon at deshaw dot com
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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


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

* [Bug target/31167] ICE wnen using __int128_t on x86_64
  2007-03-13 21:30 [Bug c/31167] New: ICE wnen using __int128_t on x86_64 john dot salmon at deshaw dot com
@ 2007-03-13 22:00 ` rguenth at gcc dot gnu dot org
  2007-03-14 13:13 ` ubizjak at gmail dot com
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2007-03-13 22:00 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2007-03-13 22:00 -------
Confirmed.  C testcase:

typedef int int32_t;
int32_t round32hi(const __int128_t arg)
{
    const int SHIFT = 96;
    const int mshift = 96;
    const __int128_t M = (~(__int128_t)0)<<mshift;
    const __int128_t L = (~M) + 1;
    const __int128_t L1 = ((__int128_t)L)>>1;
    const __int128_t Mlo = ((__int128_t)(~M))>>1;
    __int128_t vv = arg & M;
    if( (arg & (L1))      // hi bit of discard set
        && ( (arg & Mlo)  // and ( any other bits of discard set
             || (arg & L) ) )   //       or lo bit of keep set )
        vv += L;
    return (int32_t)(vv>>SHIFT);
}


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2007-03-13 22:00:38
               date|                            |


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


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

* [Bug target/31167] ICE wnen using __int128_t on x86_64
  2007-03-13 21:30 [Bug c/31167] New: ICE wnen using __int128_t on x86_64 john dot salmon at deshaw dot com
  2007-03-13 22:00 ` [Bug target/31167] " rguenth at gcc dot gnu dot org
@ 2007-03-14 13:13 ` ubizjak at gmail dot com
  2007-03-14 13:42 ` ubizjak at gmail dot com
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ubizjak at gmail dot com @ 2007-03-14 13:13 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from ubizjak at gmail dot com  2007-03-14 13:13 -------
The problem is with TImode *addti3_1 splitter. An immediate is splitted from
TImode into double DImode values and these values are passed to add/addc pair:

(define_split
  [(set (match_operand:TI 0 "nonimmediate_operand" "")
        (plus:TI (match_operand:TI 1 "nonimmediate_operand" "")
                 (match_operand:TI 2 "general_operand" "")))
   (clobber (reg:CC FLAGS_REG))]
  "TARGET_64BIT && reload_completed"
  [(parallel [(set (reg:CC FLAGS_REG) (unspec:CC [(match_dup 1) (match_dup 2)]
                                          UNSPEC_ADD_CARRY))
              (set (match_dup 0) (plus:DI (match_dup 1) (match_dup 2)))])
   (parallel [(set (match_dup 3)
                   (plus:DI (plus:DI (ltu:DI (reg:CC FLAGS_REG) (const_int 0))
                                     (match_dup 4))
                            (match_dup 5)))
              (clobber (reg:CC FLAGS_REG))])]
  "split_ti (operands+0, 1, operands+0, operands+3);
   split_ti (operands+1, 1, operands+1, operands+4);
   split_ti (operands+2, 1, operands+2, operands+5);")

Here lies the problem. when TImode immediate operands[2] is split into DImode,
it doesn't satisfy x86_64_general_operand/x86_64_immediate_operand predicate in
splitted patterns that expects either 0xffffffffxxxxxxxx or 0x00000000xxxxxxxx.


-- 

ubizjak at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ubizjak at gmail dot com


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


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

* [Bug target/31167] ICE wnen using __int128_t on x86_64
  2007-03-13 21:30 [Bug c/31167] New: ICE wnen using __int128_t on x86_64 john dot salmon at deshaw dot com
  2007-03-13 22:00 ` [Bug target/31167] " rguenth at gcc dot gnu dot org
  2007-03-14 13:13 ` ubizjak at gmail dot com
@ 2007-03-14 13:42 ` ubizjak at gmail dot com
  2007-03-14 13:44 ` ubizjak at gmail dot com
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ubizjak at gmail dot com @ 2007-03-14 13:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from ubizjak at gmail dot com  2007-03-14 13:42 -------
Prototype patch that fixes the failure:

2007-03-14  Uros Bizjak  <ubizjak@gmail.com>

        * config/i386/i386.md (*addti3_1, *addti3_1 splitter): Use
        x86_64_general_operand as operand[2] predicate.
        (*subti3_1, *subti3_1 splitter): Ditto.
        (*negti2_1, *negti2_1 splitter): Ditto for operand[1].


-- 


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


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

* [Bug target/31167] ICE wnen using __int128_t on x86_64
  2007-03-13 21:30 [Bug c/31167] New: ICE wnen using __int128_t on x86_64 john dot salmon at deshaw dot com
                   ` (2 preceding siblings ...)
  2007-03-14 13:42 ` ubizjak at gmail dot com
@ 2007-03-14 13:44 ` ubizjak at gmail dot com
  2007-03-14 18:47 ` ubizjak at gmail dot com
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ubizjak at gmail dot com @ 2007-03-14 13:44 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from ubizjak at gmail dot com  2007-03-14 13:43 -------
Created an attachment (id=13205)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13205&action=view)
Patch


-- 


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


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

* [Bug target/31167] ICE wnen using __int128_t on x86_64
  2007-03-13 21:30 [Bug c/31167] New: ICE wnen using __int128_t on x86_64 john dot salmon at deshaw dot com
                   ` (3 preceding siblings ...)
  2007-03-14 13:44 ` ubizjak at gmail dot com
@ 2007-03-14 18:47 ` ubizjak at gmail dot com
  2007-03-15  7:25 ` uros at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ubizjak at gmail dot com @ 2007-03-14 18:47 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from ubizjak at gmail dot com  2007-03-14 18:47 -------
Patch at http://gcc.gnu.org/ml/gcc-patches/2007-03/msg00947.html.


-- 

ubizjak at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |http://gcc.gnu.org/ml/gcc-
                   |                            |patches/2007-
                   |                            |03/msg00947.html
           Keywords|                            |patch


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


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

* [Bug target/31167] ICE wnen using __int128_t on x86_64
  2007-03-13 21:30 [Bug c/31167] New: ICE wnen using __int128_t on x86_64 john dot salmon at deshaw dot com
                   ` (4 preceding siblings ...)
  2007-03-14 18:47 ` ubizjak at gmail dot com
@ 2007-03-15  7:25 ` uros at gcc dot gnu dot org
  2007-04-05 12:06 ` ubizjak at gmail dot com
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: uros at gcc dot gnu dot org @ 2007-03-15  7:25 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from uros at gcc dot gnu dot org  2007-03-15 07:25 -------
Subject: Bug 31167

Author: uros
Date: Thu Mar 15 07:25:22 2007
New Revision: 122945

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=122945
Log:
        PR target/31167
        * config/i386/i386.md (*addti3_1, *addti3_1 splitter): Use
        x86_64_general_operand as operand[2] predicate.  Remove "iF"
        from operand constraints and use "e" constraint instead.
        (*subti3_1, *subti3_1 splitter): Ditto.
        (*negti2_1, *negti2_1 splitter): Use nonimmediate_operand as
        operand[1] predicate.

testsuite/ChangeLog

       PR target/31167
       * gcc.target/i386/pr31167.c: New test.


Added:
    trunk/gcc/testsuite/gcc.target/i386/pr31167.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/i386/i386.md
    trunk/gcc/testsuite/ChangeLog


-- 


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


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

* [Bug target/31167] ICE wnen using __int128_t on x86_64
  2007-03-13 21:30 [Bug c/31167] New: ICE wnen using __int128_t on x86_64 john dot salmon at deshaw dot com
                   ` (5 preceding siblings ...)
  2007-03-15  7:25 ` uros at gcc dot gnu dot org
@ 2007-04-05 12:06 ` ubizjak at gmail dot com
  2007-04-15  6:17 ` pinskia at gcc dot gnu dot org
  2007-05-21 11:32 ` uros at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: ubizjak at gmail dot com @ 2007-04-05 12:06 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from ubizjak at gmail dot com  2007-04-05 13:06 -------
Not marked as a regression on branches, so fixed.

(The patch from Comment #6 applies cleanly on all branches. It is up to RM to
decide if this can still go into 4.1.2 and 4.2.)


-- 

ubizjak at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
      Known to fail|4.1.2 4.2.0 4.3.0           |4.1.2 4.2.0
      Known to work|                            |4.3.0
         Resolution|                            |FIXED


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


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

* [Bug target/31167] ICE wnen using __int128_t on x86_64
  2007-03-13 21:30 [Bug c/31167] New: ICE wnen using __int128_t on x86_64 john dot salmon at deshaw dot com
                   ` (6 preceding siblings ...)
  2007-04-05 12:06 ` ubizjak at gmail dot com
@ 2007-04-15  6:17 ` pinskia at gcc dot gnu dot org
  2007-05-21 11:32 ` uros at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-04-15  6:17 UTC (permalink / raw)
  To: gcc-bugs



-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.3.0


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


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

* [Bug target/31167] ICE wnen using __int128_t on x86_64
  2007-03-13 21:30 [Bug c/31167] New: ICE wnen using __int128_t on x86_64 john dot salmon at deshaw dot com
                   ` (7 preceding siblings ...)
  2007-04-15  6:17 ` pinskia at gcc dot gnu dot org
@ 2007-05-21 11:32 ` uros at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: uros at gcc dot gnu dot org @ 2007-05-21 11:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from uros at gcc dot gnu dot org  2007-05-21 12:31 -------
Subject: Bug 31167

Author: uros
Date: Mon May 21 11:31:14 2007
New Revision: 124900

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=124900
Log:
       PR target/31167
       Backport from mainline.
       * config/i386/i386.md (*addti3_1, *addti3_1 splitter): Use
       x86_64_general_operand as operand[2] predicate.  Remove "iF"
       from operand constraints and use "e" constraint instead.
       (*subti3_1, *subti3_1 splitter): Ditto.
       (*negti2_1, *negti2_1 splitter): Use nonimmediate_operand as
       operand[1] predicate.

       PR target/30041
       Backport from mainline.
       * config/i386/sse.md ("*sse3_movddup"): Use operands[0] and
       operands[1] in insn constraint.  Correct type attribute to sselog1.

testsuite/ChangeLog

       Backport from mainline.
       * gcc.target/i386/pr31167.c: New test.


Added:
    branches/gcc-4_2-branch/gcc/testsuite/gcc.target/i386/pr31167.c
      - copied unchanged from r122945,
trunk/gcc/testsuite/gcc.target/i386/pr31167.c
Modified:
    branches/gcc-4_2-branch/gcc/ChangeLog
    branches/gcc-4_2-branch/gcc/config/i386/i386.md
    branches/gcc-4_2-branch/gcc/config/i386/sse.md
    branches/gcc-4_2-branch/gcc/testsuite/ChangeLog


-- 


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


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

end of thread, other threads:[~2007-05-21 11:32 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-13 21:30 [Bug c/31167] New: ICE wnen using __int128_t on x86_64 john dot salmon at deshaw dot com
2007-03-13 22:00 ` [Bug target/31167] " rguenth at gcc dot gnu dot org
2007-03-14 13:13 ` ubizjak at gmail dot com
2007-03-14 13:42 ` ubizjak at gmail dot com
2007-03-14 13:44 ` ubizjak at gmail dot com
2007-03-14 18:47 ` ubizjak at gmail dot com
2007-03-15  7:25 ` uros at gcc dot gnu dot org
2007-04-05 12:06 ` ubizjak at gmail dot com
2007-04-15  6:17 ` pinskia at gcc dot gnu dot org
2007-05-21 11:32 ` uros at gcc dot gnu dot 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).