public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* Re: "asm needs too many reloads" new since 1.0.3a (1.1?)
       [not found] <818c840e.35f9d99e@aol.com>
@ 1998-09-11 22:38 ` Zack Weinberg
  0 siblings, 0 replies; 2+ messages in thread
From: Zack Weinberg @ 1998-09-11 22:38 UTC (permalink / raw)
  To: N8TM, egcs-bugs

On Fri, 11 Sep 1998 22:17:02 EDT, N8TM@aol.com wrote:
>In a message dated 9/11/98 3:18:54 PM Pacific Daylight Time,
>zack@rabi.columbia.edu writes:
>
>> inline double 
>>  atan2 (double y, double x)
>>  {
>>    register long double value;
>>    asm volatile ("fpatan" : "=t" (value) : "0" (x), "u" (y) : "st(1)");
>>    return value;
>>  }
>
>Is the "volatile" or "register" needed?  I've tried to read all the stuff on
>these macros I could find, but the only conclusion so far is no one has all
>the answers.  I'll try my CELEFUNT stuff with egcs-1.1.

They were in the original.  Taking them out doesn't change the bug,
but they might be necessary for something unrelated.

>I repeated CELEFUNT tests with egcs-1.1 and found no source code changes
>needed since gcc-2.8.1, no change in results for complex, and improvement in
>accuracy of all complex*16 math functions.  I haven't been using volatile or
>register qualifiers, and I use in-lining only within the math functions
>themselves, which are libg2c compatible.  I haven't tried omit-leaf-pointer.
>So I'm pleased with egcs-1.1.

omit-leaf-pointer isn't necessary, but inlining is:  -O -finline
provokes the bug, -O alone doesn't. 

It's also possible that this is a C-specific bug.  The Fortran calling
convention is sufficiently different from the C convention that it
might not tickle the bug.

zw


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

* "asm needs too many reloads" new since 1.0.3a (1.1?)
@ 1998-09-11 13:52 Zack Weinberg
  0 siblings, 0 replies; 2+ messages in thread
From: Zack Weinberg @ 1998-09-11 13:52 UTC (permalink / raw)
  To: egcs-bugs

The current CVS egcs will not compile the appended test case.  I get:

$ ~/glibc/bin/gcc -v -O2 -march=pentium -mcpu=pentium \
	-momit-leaf-frame-pointer -S test.i
Reading specs from .../glibc/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.92.04/specs
gcc version egcs-2.92.04 19980910 (gcc2 ss-980609 experimental)
 .../glibc/lib/gcc-lib/i586-pc-linux-gnu/egcs-2.92.04/cc1 test.i \
	-quiet -march=pentium -mcpu=pentium -momit-leaf-frame-pointer \
	-O2 -version -o test.s
GNU C version egcs-2.92.04 19980910 (gcc2 ss-980609 experimental) 
(i586-pc-linux-gnu) compiled by GNU C version egcs-2.92.04 19980910
(gcc2 ss-980609 experimental).
test.i: In function `atan2_test':
test.i:7: `asm' needs too many reloads

The same code compiles fine with egcs 1.0.3a and I think with 1.1
also.

Incidentally, if I disable inlining then it compiles fine but the
generated assembly is suboptimal and possibly incorrect.  I don't
know x86 asm well enough to say for sure.

zw

-- test.i --
extern void check (const char *, double, double);

inline double 
atan2 (double y, double x)
{
  register long double value;
  asm volatile ("fpatan" : "=t" (value) : "0" (x), "u" (y) : "st(1)");
  return value;
}

void
atan2_test (void)
{
  check ("atan2 (0, x) == 0 for x > 0", atan2 (0, 12.04), 0);
}


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

end of thread, other threads:[~1998-09-11 22:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <818c840e.35f9d99e@aol.com>
1998-09-11 22:38 ` "asm needs too many reloads" new since 1.0.3a (1.1?) Zack Weinberg
1998-09-11 13:52 Zack Weinberg

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).