Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #26550
| From | anton@mips.complang.tuwien.ac.at (Anton Ertl) |
|---|---|
| Newsgroups | comp.lang.forth |
| Subject | Re: A problem with gforth-fast |
| Date | 2013-10-15 13:35 +0000 |
| Organization | Institut fuer Computersprachen, Technische Universitaet Wien |
| Message-ID | <2013Oct15.153544@mips.complang.tuwien.ac.at> (permalink) |
| References | (3 earlier) <l39a61$so1$1@online.de> <MImdnXkWs-Frn8TPnZ2dnUVZ8iadnZ2d@supernews.com> <2013Oct14.191716@mips.complang.tuwien.ac.at> <w--dnRhMSaYys8HPnZ2dnUVZ_rKdnZ2d@supernews.com> <2013Oct15.115028@mips.complang.tuwien.ac.at> |
anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
>And given that spTOS is not clobbered by calls in general, but only by
>a few transcendental functions, it seems that gcc mostly gets this
>right. But not always. I'll look into that later.
Ok, now I did. I started with the current git, and I had to disable
two workarounds: The new TOS_CLOBBERED flag and the older one (in
test/float.fs) that tests whether certain FP words clobber the TOS
(and then explicit registers are disabled automatically).
With gcc-4.6.3 I indeed get TOS in ecx:
see 1+
Code 1+
( $804BC6A ) add ebx , # 4 \ $83 $C3 $4
( $804BC6D ) inc ecx \ $41
( $804BC6E ) mov ebp , dword ptr FC [ebx] \ $8B $6B $FC
( $804BC71 ) mov eax , ebp \ $89 $E8
( $804BC73 ) jmp eax \ $FF $E0
end-code
and FCOS indeed does not save ecx when calling cos():
see fcos
Code fcos
( $804DFEF ) mov ebp , dword ptr 50 [esp] \ $8B $6C $24 $50
( $804DFF3 ) add ebx , # 4 \ $83 $C3 $4
( $804DFF6 ) fld double dword ptr 0 [ebp] \ $DD $45 $0
( $804DFF9 ) fstp double dword ptr [esp] \ $DD $1C $24
( $804DFFC ) call 804AA10 \ $E8 $F $CA $FF $FF
( $804E001 ) fstp double dword ptr 0 [ebp] \ $DD $5D $0
( $804E004 ) mov ebp , dword ptr FC [ebx] \ $8B $6B $FC
( $804E007 ) mov eax , ebp \ $89 $E8
( $804E009 ) jmp eax \ $FF $E0
end-code
Yet the test case at the start of the thread does not clobber TOS on
my system, but FCOSH does clobber it, and the code for it looks
very similar:
see fcosh
Code fcosh
( $804E17F ) mov ebp , dword ptr 50 [esp] \ $8B $6C $24 $50
( $804E183 ) add ebx , # 4 \ $83 $C3 $4
( $804E186 ) fld double dword ptr 0 [ebp] \ $DD $45 $0
( $804E189 ) fstp double dword ptr [esp] \ $DD $1C $24
( $804E18C ) call 804AF60 \ $E8 $CF $CD $FF $FF
( $804E191 ) fstp double dword ptr 0 [ebp] \ $DD $5D $0
( $804E194 ) mov ebp , dword ptr FC [ebx] \ $8B $6B $FC
( $804E197 ) mov eax , ebp \ $89 $E8
( $804E199 ) jmp eax \ $FF $E0
end-code
12345 0e fcosh cr f. .
1. -1073741825 ok
- anton
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html
comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: http://www.forth200x.org/forth200x.html
EuroForth 2013: http://www.euroforth.org/ef13/
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
A problem with gforth-fast humptydumpty <ouatubi@gmail.com> - 2013-10-11 02:51 -0700
Re: A problem with gforth-fast Bernd Paysan <bernd.paysan@gmx.de> - 2013-10-11 17:00 +0200
Re: A problem with gforth-fast humptydumpty <ouatubi@gmail.com> - 2013-10-11 08:54 -0700
Re: A problem with gforth-fast Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-10-11 10:57 -0500
Re: A problem with gforth-fast Bernd Paysan <bernd.paysan@gmx.de> - 2013-10-11 18:49 +0200
Re: A problem with gforth-fast Bernd Paysan <bernd.paysan@gmx.de> - 2013-10-11 21:08 +0200
Re: A problem with gforth-fast humptydumpty <ouatubi@gmail.com> - 2013-10-11 12:54 -0700
Re: A problem with gforth-fast Bernd Paysan <bernd.paysan@gmx.de> - 2013-10-11 23:21 +0200
Re: A problem with gforth-fast humptydumpty <ouatubi@gmail.com> - 2013-10-11 23:58 -0700
Re: A problem with gforth-fast Bernd Paysan <bernd.paysan@gmx.de> - 2013-10-11 21:30 +0200
Re: A problem with gforth-fast Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-10-12 03:06 -0500
Re: A problem with gforth-fast Bernd Paysan <bernd.paysan@gmx.de> - 2013-10-12 15:50 +0200
Re: A problem with gforth-fast anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-10-14 17:17 +0000
Re: A problem with gforth-fast Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-10-14 12:49 -0500
Re: A problem with gforth-fast anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-10-15 09:50 +0000
Re: A problem with gforth-fast Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-10-15 07:48 -0500
Re: A problem with gforth-fast anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-10-15 13:35 +0000
Re: A problem with gforth-fast Bernd Paysan <bernd.paysan@gmx.de> - 2013-10-15 17:09 +0200
Re: A problem with gforth-fast anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-10-16 16:36 +0000
csiph-web