Bug 21477 - [4.1 Regression] adddi3 becomes external reference rather than instruction on powerpc64
Summary: [4.1 Regression] adddi3 becomes external reference rather than instruction on...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.1.0
: P2 normal
Target Milestone: 4.1.0
Assignee: Not yet assigned to anyone
URL:
Keywords: wrong-code
Depends on:
Blocks:
 
Reported: 2005-05-09 21:45 UTC by Janis Johnson
Modified: 2005-05-09 22:51 UTC (History)
4 users (show)

See Also:
Host:
Target: powerpc64-*-*
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-05-09 21:51:48


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Janis Johnson 2005-05-09 21:45:47 UTC
The following testcase fails on powerpc64-linux with GCC mainline
starting sometime after 2005-05-05 01:24 UTC:

long a, b;
void
foo ()
{
    a = b + 2147483647L;
}
int
main ()
{
    foo ();
    return 0;
}

elm3b11% /opt/gcc-nightly/mline/bin/gcc -m64 -O0 -g bug.c
/tmp/ccwXjSlP.o(.text+0x28): In function `foo':
/home/janis/work/bug.c:6: undefined reference to `__adddi3'
collect2: ld returned 1 exit status

It looks like a problem with this patch from geoffk on 2005-05-05:

  http://gcc.gnu.org/ml/gcc-cvs/2005-05/msg00232.html

This affects SPEC CPU2000 tests bzip2, eon, and gzip built without
optimization.
Comment 1 David Edelsohn 2005-05-09 21:51:48 UTC
confirmed
Comment 2 Andrew Pinski 2005-05-09 21:55:18 UTC
Also on powerpc64-darwin.
Comment 3 David Edelsohn 2005-05-09 21:56:03 UTC
This is caused by Geoff's mode macros patch:

http://gcc.gnu.org/ml/gcc-patches/2005-05/msg00392.html

addsi3 and adddi3 had different operand predicates, but the patch combined the
patterns, using the addsi3 predicate.  sub<mode>3 uses a helper, but add<mode>3
does not.  testing a patch...
Comment 4 GCC Commits 2005-05-09 22:05:05 UTC
Subject: Bug 21477

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	dje@gcc.gnu.org	2005-05-09 22:04:53

Modified files:
	gcc            : ChangeLog 
	gcc/config/rs6000: rs6000.md 

Log message:
	PR target/21477
	* config/rs6000/rs6000.md (add_op2): New.
	(add<mode>3): Use it.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.8695&r2=2.8696
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/rs6000/rs6000.md.diff?cvsroot=gcc&r1=1.366&r2=1.367

Comment 5 Andrew Pinski 2005-05-09 22:51:30 UTC
Fixed.