Bug 24315 - [3.4 Regression] amd64 fails -fpeephole2
Summary: [3.4 Regression] amd64 fails -fpeephole2
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.0.2
: P2 normal
Target Milestone: 3.4.5
Assignee: Uroš Bizjak
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: ice-on-valid-code, patch
: 24330 (view as bug list)
Depends on: 24330
Blocks:
  Show dependency treegraph
 
Reported: 2005-10-11 18:57 UTC by Doug Coleman
Modified: 2005-11-10 07:31 UTC (History)
2 users (show)

See Also:
Host:
Target: x86_64-*-linux-gnu
Build:
Known to work: 3.2.3 4.1.0 4.0.3 3.4.5
Known to fail: 3.3.5 4.0.2
Last reconfirmed: 2005-10-17 07:21:18


Attachments
scheme48 bignum modified for use with Factor (30.16 KB, text/plain)
2005-10-11 18:59 UTC, Doug Coleman
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Doug Coleman 2005-10-11 18:57:55 UTC
native/s48_bignum.c:456: internal compiler error: in final_scan_insn, at final.c:2514
Please submit a full bug report,

I'm still looking for where to attach my .i file.  Hopefully I can attach it after submitting this page.
uname -a:
Linux frogger 2.6.12-9-amd64-generic #1 Tue Oct 4 19:23:45 BST 2005 x86_64 GNU/Linux

gcc --version:
gcc (GCC) 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9)
Comment 1 Doug Coleman 2005-10-11 18:59:51 UTC
Created attachment 9968 [details]
scheme48 bignum modified for use with Factor
Comment 2 Andrew Pinski 2005-10-11 19:00:03 UTC
Oh, can you show the command line invokation of gcc?
Comment 3 Doug Coleman 2005-10-11 19:03:00 UTC
gcc -fpeephole2 s48_bignum.i

Thanks!
Comment 4 Andrew Pinski 2005-10-11 19:05:25 UTC
(In reply to comment #2)
> Oh, can you show the command line invokation of gcc?
Never mind, -O0 -fpeephole2 makes it fail.
Comment 5 Andrew Pinski 2005-10-11 19:28:46 UTC
Reduced testcase for 4.0.x and above:
void s48_double_to_bignum(int exponent){
     long length = ((((exponent) + ((((sizeof (long)) * 8) - 2) - 1)) / (((sizeof (long)) * 8) - 2)));
   }

This really should be filed in a different PR as that one is a regression.

I will try to get a reduced testcase for 3.4.x and 3.3.x later today.
Comment 6 Andrew Pinski 2005-10-12 13:30:41 UTC
Here is the one for 3.3.3 and above:
typedef long bignum_digit_type;
void bignum_divide_unsigned_normalized( ){
bignum_digit_type guess;
guess = ((((unsigned long) 1) << (((sizeof (bignum_digit_type)) * 8) - 2)) - 1);
}

I will file the other one seperate now.
Comment 7 Andrew Pinski 2005-10-12 13:33:07 UTC
(In reply to comment #5)
> Reduced testcase for 4.0.x and above:

Filed as PR 24330.
Comment 8 Andrew Pinski 2005-10-12 13:42:21 UTC
Confirmed that this is a real regression.
Comment 9 Andrew Pinski 2005-10-12 13:45:19 UTC
The instruction we are should have split earlier:
(insn/v 8 21 26 (set (mem/c/i:DI (plus:DI (reg/f:DI 6 bp)
                (const_int -8 [0xfffffffffffffff8])) [0 guess+0 S8 A64])
        (const_int 4611686018427387903 [0x3fffffffffffffff])) 81 {*movdi_1_rex64} (nil)
    (nil))
Comment 10 Andrew Pinski 2005-10-12 13:46:49 UTC
*** Bug 24330 has been marked as a duplicate of this bug. ***
Comment 11 Andrew Pinski 2005-10-12 13:48:42 UTC
It turned out the one in comment #5 is the same issue as the orginal bug too.
Comment 12 GCC Commits 2005-10-17 07:09:33 UTC
Subject: Bug 24315

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	uros@gcc.gnu.org	2005-10-17 07:09:25

Modified files:
	gcc            : ChangeLog 
	gcc/testsuite  : ChangeLog 
	gcc/config/i386: i386.md 
Added files:
	gcc/testsuite/gcc.target/i386: pr24315.c 

Log message:
	PR target/24315
	* config/i386/i386.md (*pushdi2_rex64 splitter)
	(*movdi_1_rex64 splitter, *ashldi3_1 splitter)
	(*ashrdi3_1 splitter, *lshrdi3_1 splitter): Delay splitting after
	flow2 pass only when (optimize > 0 && flag_peephole2).
	
	testsuite:
	
	PR target/24315
	* gcc.target/i386/pr24315.c: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.10169&r2=2.10170
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.6201&r2=1.6202
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.target/i386/pr24315.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.md.diff?cvsroot=gcc&r1=1.659&r2=1.660

Comment 13 Uroš Bizjak 2005-10-17 07:21:18 UTC
Fixed on mainline.

The bugfix is really trivial to fix, but I don't have older branches installed here. Could somebody help me with a backports?
Comment 14 uros 2005-11-08 07:59:04 UTC
Subject: Bug 24315

Author: uros
Date: Tue Nov  8 07:58:51 2005
New Revision: 106633

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=106633
Log:
	PR target/19340
	* reg-stack.c (reg_to_stack): Update register liveness also
	for flag_sched2_use_traces.

	PR target/24315
	* config/i386/i386.md (*pushdi2_rex64 splitter)
	(*movdi_1_rex64 splitter, *ashldi3_1 splitter)
	(*ashrdi3_1 splitter, *lshrdi3_1 splitter): Delay splitting after
	flow2 pass only when (optimize > 0 && flag_peephole2).

testsuite/

	PR target/19340
	* gcc.dg/pr19340.c: New test.

	PR target/24315
	* gcc.target/i386/pr24315.c: New test.


Added:
    branches/gcc-4_0-branch/gcc/testsuite/gcc.dg/pr19340.c
    branches/gcc-4_0-branch/gcc/testsuite/gcc.target/i386/pr24315.c
Modified:
    branches/gcc-4_0-branch/gcc/ChangeLog
    branches/gcc-4_0-branch/gcc/config/i386/i386.md
    branches/gcc-4_0-branch/gcc/reg-stack.c
    branches/gcc-4_0-branch/gcc/testsuite/ChangeLog

Comment 15 Paolo Bonzini 2005-11-08 08:19:45 UTC
now fixed on 4.0 branch too
Comment 16 uros 2005-11-10 07:27:53 UTC
Subject: Bug 24315

Author: uros
Date: Thu Nov 10 07:27:47 2005
New Revision: 106728

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=106728
Log:
        PR target/24315
        * config/i386/i386.md (*pushdi2_rex64 splitter)
        (*movdi_1_rex64 splitter): Delay splitting after
        flow2 pass only when (optimize > 0 && flag_peephole2).

	PR target/19340
	* reg-stack.c (reg_to_stack): Update register liveness also
	for flag_sched2_use_traces.

testsuite/

        PR target/24315
        * gcc.dg/pr24315.c: New test.

        PR target/19340
        * gcc.dg/pr19340.c: New test.


Added:
    branches/gcc-3_4-branch/gcc/testsuite/gcc.dg/pr19340.c
      - copied unchanged from r106632, trunk/gcc/testsuite/gcc.dg/pr19340.c
    branches/gcc-3_4-branch/gcc/testsuite/gcc.dg/pr24315.c
Modified:
    branches/gcc-3_4-branch/gcc/ChangeLog
    branches/gcc-3_4-branch/gcc/config/i386/i386.md
    branches/gcc-3_4-branch/gcc/reg-stack.c
    branches/gcc-3_4-branch/gcc/testsuite/ChangeLog

Comment 17 Uroš Bizjak 2005-11-10 07:31:55 UTC
Fixed on 3.4 branch.