public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/15825] New: if-cvt optimisation patch noce_try_sign_mask breaks apple-ppc-darwin port
@ 2004-06-04 17:47 fjahanian at apple dot com
  2004-06-04 18:02 ` [Bug middle-end/15825] [3.5 Regression] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: fjahanian at apple dot com @ 2004-06-04 17:47 UTC (permalink / raw)
  To: gcc-bugs

Following patch breaks gcc bootstrap on apple-ppc-darwin. A small test case is attached. Note
that it may not ICE on the FSF mainlline. But it ICEd on a locally built compiler with local
patches. I have also attached the pattern which when presented to noce_try_sign_mask causes
the illegal instruction.

2004-03-09  Roger Sayle  <roger@eyesopen.com>
            Andrew Pinski  <pinskia@physics.uc.edu>

        * ifcvt.c (noce_try_sign_mask): New function to transform
        "x = (y < 0) ? z : 0" into the equivalent "x = (y >> C) & z".
        (noce_process_if_block): Call noce_try_sign_mask.

unsigned int
real_from_integer (long long high, int unsigned_p)
{
      return high < 0 &&  !unsigned_p;
}

/Volumes/sandbox/apple-ppc-lno-merge.bootstrap/gcc/stage1/xgcc -B /Volumes/sandbox/
apple-ppc-lno-merge.bootstrap/gcc/stage1 -O2 -c bad.c
bad.c: In function `real_from_integer':
bad.c:5: error: unrecognizable insn:
(insn:HI 67 66 68 0 (set (reg:SI 132)
        (eq:SI (reg/v:SI 121 [ unsigned_p ])
            (const_int 0 [0x0]))) -1 (nil)
    (expr_list:REG_DEAD (reg/v:SI 121 [ unsigned_p ])
        (nil)))
bad.c:5: internal compiler error: in extract_insn, at recog.c:2068
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://developer.apple.com/bugreporter> for instructions.

The patter which causes this is:

(insn 61 60 32 2 (parallel [
            (set (reg:SI 118 [ iftmp.0 ])
                (eq:SI (reg/v:SI 121 [ unsigned_p ])
                    (const_int 0 [0x0])))
            (clobber (scratch:SI))
        ]) 413 {*rs6000.md:11584} (nil)
    (expr_list:REG_DEAD (reg/v:SI 121 [ unsigned_p ])
        (expr_list:REG_UNUSED (scratch:SI)
            (nil))))

-- 
           Summary: if-cvt optimisation patch noce_try_sign_mask breaks
                    apple-ppc-darwin port
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: fjahanian at apple dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: powerpc-apple-darwin7.2.0
  GCC host triplet: powerpc-apple-darwin7.2.0
GCC target triplet: powerpc-apple-darwin7.2.0


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


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

* [Bug middle-end/15825] [3.5 Regression] if-cvt optimisation patch noce_try_sign_mask breaks apple-ppc-darwin port
  2004-06-04 17:47 [Bug middle-end/15825] New: if-cvt optimisation patch noce_try_sign_mask breaks apple-ppc-darwin port fjahanian at apple dot com
@ 2004-06-04 18:02 ` pinskia at gcc dot gnu dot org
  2004-06-04 19:48 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-04 18:02 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-04 18:02 -------
Hmm,  looks like there is no (compare ) in front as eq:
(insn:HI 67 66 68 0 (set (reg:SI 132)
        (eq:SI (reg/v:SI 121 [ unsigned_p ])
            (const_int 0 [0x0]))) -1 (nil)
    (expr_list:REG_DEAD (reg/v:SI 121 [ unsigned_p ])
        (nil)))

  [(set (match_operand:CC 4 "cc_reg_operand" "=x,x,x,x,x,?y,?y,?y,?y,?y")
        (compare:CC
         (eq:DI (match_operand:DI 1 "gpc_reg_operand" "%r,r,r,r,r,r,r,r,r,r")
                (match_operand:DI 2 "reg_or_cint_operand" "r,O,K,J,I,r,O,K,J,I"))
         (const_int 0)))
   (set (match_operand:DI 0 "gpc_reg_operand" "=r,r,r,r,r,r,r,r,r,r")
        (eq:DI (match_dup 1) (match_dup 2)))
   (clobber (match_scratch:DI 3 "=r,&r,r,r,r,r,&r,r,r,r"))]


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org
           Keywords|                            |ice-on-valid-code
            Summary|if-cvt optimisation patch   |[3.5 Regression] if-cvt
                   |noce_try_sign_mask breaks   |optimisation patch
                   |apple-ppc-darwin port       |noce_try_sign_mask breaks
                   |                            |apple-ppc-darwin port
   Target Milestone|---                         |3.5.0


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


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

* [Bug middle-end/15825] [3.5 Regression] if-cvt optimisation patch noce_try_sign_mask breaks apple-ppc-darwin port
  2004-06-04 17:47 [Bug middle-end/15825] New: if-cvt optimisation patch noce_try_sign_mask breaks apple-ppc-darwin port fjahanian at apple dot com
  2004-06-04 18:02 ` [Bug middle-end/15825] [3.5 Regression] " pinskia at gcc dot gnu dot org
@ 2004-06-04 19:48 ` pinskia at gcc dot gnu dot org
  2004-06-04 20:04 ` pinskia at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-04 19:48 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-04 19:48 -------
Confirmed, here is the example which can be reproduced on the clean mainline (I kinda knew which 
local patch caused the difference, the BRANCH_COST one so I made this example which breaks):
unsigned int
real_from_integer1 (long long high, int unsigned_p)
{
  int i;
  if (high < 0)
   if (!unsigned_p)
    { i = 1; goto t; }
  i = 0;
  t:
  return i;
}

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |roger at eyesopen dot com
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-06-04 19:48:14
               date|                            |


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


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

* [Bug middle-end/15825] [3.5 Regression] if-cvt optimisation patch noce_try_sign_mask breaks apple-ppc-darwin port
  2004-06-04 17:47 [Bug middle-end/15825] New: if-cvt optimisation patch noce_try_sign_mask breaks apple-ppc-darwin port fjahanian at apple dot com
  2004-06-04 18:02 ` [Bug middle-end/15825] [3.5 Regression] " pinskia at gcc dot gnu dot org
  2004-06-04 19:48 ` pinskia at gcc dot gnu dot org
@ 2004-06-04 20:04 ` pinskia at gcc dot gnu dot org
  2004-06-04 20:27 ` pinskia at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-04 20:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-04 20:04 -------
Actually looking again there is a non-compare equal:
[(set (match_operand:SI 0 "gpc_reg_operand" "=r,r,r,r,r")
        (eq:SI (match_operand:SI 1 "gpc_reg_operand" "%r,r,r,r,r")
               (match_operand:SI 2 "reg_or_cint_operand" "r,O,K,L,I")))
   (clobber (match_scratch:SI 3 "=r,&r,r,r,r"))]

Looks like someone forgets to add the clobbers, that is where the problem is.

-- 


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


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

* [Bug middle-end/15825] [3.5 Regression] if-cvt optimisation patch noce_try_sign_mask breaks apple-ppc-darwin port
  2004-06-04 17:47 [Bug middle-end/15825] New: if-cvt optimisation patch noce_try_sign_mask breaks apple-ppc-darwin port fjahanian at apple dot com
                   ` (2 preceding siblings ...)
  2004-06-04 20:04 ` pinskia at gcc dot gnu dot org
@ 2004-06-04 20:27 ` pinskia at gcc dot gnu dot org
  2004-06-07 16:14 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-04 20:27 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-04 20:27 -------
Ok, I was just think this looks like one if-cvt is happen (a==0?1:0) and then the other (b<0?c:0) is 
happening which causes the rtl not to have the correct clobber on the eq RTL.  I have not looked into 
the source yet though, this was just a thought of what was happening.

-- 


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


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

* [Bug middle-end/15825] [3.5 Regression] if-cvt optimisation patch noce_try_sign_mask breaks apple-ppc-darwin port
  2004-06-04 17:47 [Bug middle-end/15825] New: if-cvt optimisation patch noce_try_sign_mask breaks apple-ppc-darwin port fjahanian at apple dot com
                   ` (3 preceding siblings ...)
  2004-06-04 20:27 ` pinskia at gcc dot gnu dot org
@ 2004-06-07 16:14 ` pinskia at gcc dot gnu dot org
  2004-06-25 18:40 ` cvs-commit at gcc dot gnu dot org
  2004-06-25 18:53 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-07 16:14 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-07 16:14 -------
http://gcc.gnu.org/ml/gcc-patches/2004-06/msg00338.html

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


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


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

* [Bug middle-end/15825] [3.5 Regression] if-cvt optimisation patch noce_try_sign_mask breaks apple-ppc-darwin port
  2004-06-04 17:47 [Bug middle-end/15825] New: if-cvt optimisation patch noce_try_sign_mask breaks apple-ppc-darwin port fjahanian at apple dot com
                   ` (4 preceding siblings ...)
  2004-06-07 16:14 ` pinskia at gcc dot gnu dot org
@ 2004-06-25 18:40 ` cvs-commit at gcc dot gnu dot org
  2004-06-25 18:53 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-06-25 18:40 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-06-25 18:40 -------
Subject: Bug 15825

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	sayle@gcc.gnu.org	2004-06-25 18:40:07

Modified files:
	gcc            : ChangeLog ifcvt.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gcc.dg: pr15825-1.c 

Log message:
	PR middle-end/15825
	* ifcvt.c (unshare_ifcvt_sequence): Rename to end_ifcvt_sequence.
	Use get_isns and end_sequence instead of accepting a seq argument.
	Scan the instruction sequence for unrecognizable or jump insns.
	(noce_try_move, noce_try_store_flag, noce_try_store_flag_constants,
	noce_try_addcc, noce_try_store_flag_mask, noce_try_cmove,
	noce_try_cmove_arith, noce_try_minmax, noce_try_abs,
	noce_try_sign_mask): Use end_ifcvt_sequence to factor common code.
	
	* gcc.dg/pr15825-1.c: New test case.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.4148&r2=2.4149
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ifcvt.c.diff?cvsroot=gcc&r1=1.147&r2=1.148
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3899&r2=1.3900
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/pr15825-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1



-- 


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


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

* [Bug middle-end/15825] [3.5 Regression] if-cvt optimisation patch noce_try_sign_mask breaks apple-ppc-darwin port
  2004-06-04 17:47 [Bug middle-end/15825] New: if-cvt optimisation patch noce_try_sign_mask breaks apple-ppc-darwin port fjahanian at apple dot com
                   ` (5 preceding siblings ...)
  2004-06-25 18:40 ` cvs-commit at gcc dot gnu dot org
@ 2004-06-25 18:53 ` pinskia at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-06-25 18:53 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-25 18:52 -------
Fixed.

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


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


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

end of thread, other threads:[~2004-06-25 18:52 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-04 17:47 [Bug middle-end/15825] New: if-cvt optimisation patch noce_try_sign_mask breaks apple-ppc-darwin port fjahanian at apple dot com
2004-06-04 18:02 ` [Bug middle-end/15825] [3.5 Regression] " pinskia at gcc dot gnu dot org
2004-06-04 19:48 ` pinskia at gcc dot gnu dot org
2004-06-04 20:04 ` pinskia at gcc dot gnu dot org
2004-06-04 20:27 ` pinskia at gcc dot gnu dot org
2004-06-07 16:14 ` pinskia at gcc dot gnu dot org
2004-06-25 18:40 ` cvs-commit at gcc dot gnu dot org
2004-06-25 18:53 ` pinskia 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).