public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: target/6788: multiple inheritance "non-virtual thunk" assembly incorrect on sparc64-sun-solars2.8
@ 2002-05-24 10:01 Jakub Jelinek
0 siblings, 0 replies; 6+ messages in thread
From: Jakub Jelinek @ 2002-05-24 10:01 UTC (permalink / raw)
To: rth; +Cc: gcc-prs
The following reply was made to PR target/6788; it has been noted by GNATS.
From: Jakub Jelinek <jakub@redhat.com>
To: "David S. Miller" <davem@redhat.com>
Cc: spencer@infointeractive.com, rth@gcc.gnu.org, gcc-bugs@gcc.gnu.org,
gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, spencer@aol.net,
gcc-gnats@gcc.gnu.org, binutils@sources.redhat.com
Subject: Re: target/6788: multiple inheritance "non-virtual thunk" assembly incorrect on sparc64-sun-solars2.8
Date: Fri, 24 May 2002 17:26:48 +0200
On Fri, May 24, 2002 at 08:06:58AM -0700, David S. Miller wrote:
> From: Brad Spencer <spencer@infointeractive.com>
> Date: Fri, 24 May 2002 12:11:14 -0300
>
> I have been able to work around this bug by patching gas-2.12.1 as
> shown below. I still suspect that this is a gcc bug, because I can't
> see why the assembler would be wrong about "set" not taking negative
> values. Isn't that what "setsw" is for?
>
> Right. But there are other bugs in how gas implements
> setx and friends, so best not to even attempt to use it.
>
> I attach a fix for your bug below, I'm having other problems
> with your test case after my patch but at least the thunks
> are output correctly.
>
> Try to use setx with current binutils results in junk like:
>
> ? cat x.s
> .globl foo
> foo: setx 0x81928192, %o0
> ? as -Av9a -o x.o x.s
> x.s: Assembler messages:
> x.s:2: Error: Illegal operands
> x.s:2: Warning: setx: temporary register same as destination register
> ?
?? setx has 3 arguments:
.globl foo
foo: setx 0x81928192, %g1, %o0
works just fine.
Jakub
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: target/6788: multiple inheritance "non-virtual thunk" assembly incorrect on sparc64-sun-solars2.8
@ 2002-05-26 1:26 rth
0 siblings, 0 replies; 6+ messages in thread
From: rth @ 2002-05-26 1:26 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, rth, spencer
Synopsis: multiple inheritance "non-virtual thunk" assembly incorrect on sparc64-sun-solars2.8
State-Changed-From-To: analyzed->closed
State-Changed-By: rth
State-Changed-When: Sat May 25 19:47:18 2002
State-Changed-Why:
http://gcc.gnu.org/ml/gcc-patches/2002-05/msg02046.html
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6788
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: target/6788: multiple inheritance "non-virtual thunk" assembly incorrect on sparc64-sun-solars2.8
@ 2002-05-24 9:36 David S. Miller
0 siblings, 0 replies; 6+ messages in thread
From: David S. Miller @ 2002-05-24 9:36 UTC (permalink / raw)
To: rth; +Cc: gcc-prs
The following reply was made to PR target/6788; it has been noted by GNATS.
From: "David S. Miller" <davem@redhat.com>
To: jakub@redhat.com
Cc: spencer@infointeractive.com, rth@gcc.gnu.org, gcc-bugs@gcc.gnu.org,
gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, spencer@aol.net,
gcc-gnats@gcc.gnu.org, binutils@sources.redhat.com
Subject: Re: target/6788: multiple inheritance "non-virtual thunk" assembly
incorrect on sparc64-sun-solars2.8
Date: Fri, 24 May 2002 08:14:39 -0700 (PDT)
From: Jakub Jelinek <jakub@redhat.com>
Date: Fri, 24 May 2002 17:26:48 +0200
?? setx has 3 arguments:
.globl foo
foo: setx 0x81928192, %g1, %o0
works just fine.
Sorry, major brain fart.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: target/6788: multiple inheritance "non-virtual thunk" assembly incorrect on sparc64-sun-solars2.8
@ 2002-05-24 8:36 David S. Miller
0 siblings, 0 replies; 6+ messages in thread
From: David S. Miller @ 2002-05-24 8:36 UTC (permalink / raw)
To: rth; +Cc: gcc-prs
The following reply was made to PR target/6788; it has been noted by GNATS.
From: "David S. Miller" <davem@redhat.com>
To: spencer@infointeractive.com
Cc: rth@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
nobody@gcc.gnu.org, spencer@aol.net, gcc-gnats@gcc.gnu.org,
binutils@sources.redhat.com
Subject: Re: target/6788: multiple inheritance "non-virtual thunk" assembly
incorrect on sparc64-sun-solars2.8
Date: Fri, 24 May 2002 08:06:58 -0700 (PDT)
From: Brad Spencer <spencer@infointeractive.com>
Date: Fri, 24 May 2002 12:11:14 -0300
I have been able to work around this bug by patching gas-2.12.1 as
shown below. I still suspect that this is a gcc bug, because I can't
see why the assembler would be wrong about "set" not taking negative
values. Isn't that what "setsw" is for?
Right. But there are other bugs in how gas implements
setx and friends, so best not to even attempt to use it.
I attach a fix for your bug below, I'm having other problems
with your test case after my patch but at least the thunks
are output correctly.
Try to use setx with current binutils results in junk like:
? cat x.s
.globl foo
foo: setx 0x81928192, %o0
? as -Av9a -o x.o x.s
x.s: Assembler messages:
x.s:2: Error: Illegal operands
x.s:2: Warning: setx: temporary register same as destination register
?
You can use just about whatever destination register you like, GAS
still says that the temporary register conflicts :-)
Anywhere, here is my gcc thunk fix for sparc64. It also fixes
the warning your testcase generates when generating 32-bit sparc
code.
2002-05-23 David S. Miller <davem@redhat.com>
* config/sparc/sparc.h (ASM_OUTPUT_MI_THUNK): Handle negative
DELTA correctly when TARGET_ARCH64.
--- config/sparc/sparc.h.~1~ Thu May 16 03:00:42 2002
+++ config/sparc/sparc.h Thu May 23 23:55:23 2002
@@ -2916,8 +2916,21 @@ do { \
&& aggregate_value_p (TREE_TYPE (TREE_TYPE (FUNCTION)))) \
reg = 1; \
if ((DELTA) >= 4096 || (DELTA) < -4096) \
- fprintf (FILE, "\tset\t%d, %%g1\n\tadd\t%%o%d, %%g1, %%o%d\n", \
- (int)(DELTA), reg, reg); \
+ { \
+ if ((DELTA) < 0 && TARGET_ARCH64) \
+ fprintf (FILE, \
+ "\tsethi\t%%hi(%d), %%g1\n" \
+ "\txor\t%%g1, %%lo(%d), %%g1\n", \
+ ~((int)(DELTA)), \
+ (-0x400 | ((int)(DELTA) & 0x3ff))); \
+ else \
+ fprintf (FILE, \
+ "\tsethi\t%%hi(%d), %%g1\n" \
+ "\tor\t%%g1, %%lo(%d), %%g1\n", \
+ (int)(DELTA), (int)(DELTA)); \
+ fprintf (FILE, "\tadd\t%%o%d, %%g1, %%o%d\n", \
+ reg, reg); \
+ } \
else \
fprintf (FILE, "\tadd\t%%o%d, %d, %%o%d\n", reg, (int)(DELTA), reg);\
fprintf (FILE, "\tor\t%%o7, %%g0, %%g1\n"); \
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: target/6788: multiple inheritance "non-virtual thunk" assembly incorrect on sparc64-sun-solars2.8
@ 2002-05-24 8:26 Brad Spencer
0 siblings, 0 replies; 6+ messages in thread
From: Brad Spencer @ 2002-05-24 8:26 UTC (permalink / raw)
To: rth; +Cc: gcc-prs
The following reply was made to PR target/6788; it has been noted by GNATS.
From: Brad Spencer <spencer@infointeractive.com>
To: rth@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
nobody@gcc.gnu.org, spencer@aol.net, gcc-gnats@gcc.gnu.org
Cc: binutils@sources.redhat.com
Subject: Re: target/6788: multiple inheritance "non-virtual thunk" assembly incorrect on sparc64-sun-solars2.8
Date: Fri, 24 May 2002 12:11:14 -0300
I'm copying this to the binutils mailing list for comment. Sorry for
the lack of context there. Scroll down...
On Fri, May 24, 2002 at 04:24:16AM -0000, rth@gcc.gnu.org wrote:
> Synopsis: multiple inheritance "non-virtual thunk" assembly incorrect on sparc64-sun-solars2.8
>
> Responsible-Changed-From-To: unassigned->rth
> Responsible-Changed-By: rth
> Responsible-Changed-When: Thu May 23 21:24:16 2002
> Responsible-Changed-Why:
> .
> State-Changed-From-To: open->analyzed
> State-Changed-By: rth
> State-Changed-When: Thu May 23 21:24:16 2002
> State-Changed-Why:
> Probably an assembler bug. GCC emits the assembler macro
> set -16392, %g1
> which should have done the right thing. I guess we have
> to do this by hand here.
>
> http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6788
I have been able to work around this bug by patching gas-2.12.1 as
shown below. I still suspect that this is a gcc bug, because I can't
see why the assembler would be wrong about "set" not taking negative
values. Isn't that what "setsw" is for?
I've basically taken the warning case and made it treat the "set" as a
"setsw". I figure that this does workaround the problem and it would
only break already broken instructions at the most (or at least mostly
:).
The patch:
*** tc-sparc.c.orig Fri May 24 09:16:54 2002
--- tc-sparc.c Fri May 24 12:09:41 2002
***************
*** 1025,1032 ****
{
if (sizeof (offsetT) > 4
&& (the_insn.exp.X_add_number < 0
! || the_insn.exp.X_add_number > (offsetT) U0xffffffff))
! as_warn (_("set: number not in 0..4294967295 range"));
}
else
{
--- 1025,1038 ----
{
if (sizeof (offsetT) > 4
&& (the_insn.exp.X_add_number < 0
! || the_insn.exp.X_add_number > (offsetT) U0xffffffff)) {
! /* gcc-3.1 incorrectly generates set -x,%reg for certain cases
! (see PR c++/6788) */
! as_warn (_("set: number not in 0..4294967295 range, "
! "treating as setsw"));
! synthetize_setsw(insn);
! return;
! }
}
else
{
--
-----------------------------------------------------------------
Brad Spencer - spencer@infointeractive.com - "It's quite nice..."
Systems Architect | InfoInterActive Corp. | An AOL Company
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: target/6788: multiple inheritance "non-virtual thunk" assembly incorrect on sparc64-sun-solars2.8
@ 2002-05-23 21:24 rth
0 siblings, 0 replies; 6+ messages in thread
From: rth @ 2002-05-23 21:24 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, nobody, rth, spencer
Synopsis: multiple inheritance "non-virtual thunk" assembly incorrect on sparc64-sun-solars2.8
Responsible-Changed-From-To: unassigned->rth
Responsible-Changed-By: rth
Responsible-Changed-When: Thu May 23 21:24:16 2002
Responsible-Changed-Why:
.
State-Changed-From-To: open->analyzed
State-Changed-By: rth
State-Changed-When: Thu May 23 21:24:16 2002
State-Changed-Why:
Probably an assembler bug. GCC emits the assembler macro
set -16392, %g1
which should have done the right thing. I guess we have
to do this by hand here.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6788
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2002-05-26 2:47 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-24 10:01 target/6788: multiple inheritance "non-virtual thunk" assembly incorrect on sparc64-sun-solars2.8 Jakub Jelinek
-- strict thread matches above, loose matches on Subject: below --
2002-05-26 1:26 rth
2002-05-24 9:36 David S. Miller
2002-05-24 8:36 David S. Miller
2002-05-24 8:26 Brad Spencer
2002-05-23 21:24 rth
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).