Gas64 (no more use of gcc, only gas) WDS / LNX

User projects written in or related to FreeBASIC.
Post Reply
Xusinboy Bekchanov
Posts: 879
Joined: Jul 26, 2018 18:28

Re: Gas64 (no more use of gcc, only gas) WDS / LNX

Post by Xusinboy Bekchanov »

SARG wrote: Mar 04, 2024 10:02
Xusinboy Bekchanov wrote: Mar 04, 2024 8:00 After the latest changes in the compiler, the program no longer crashes in gas64, thank you very much.
Thank you for the report and the help you gave me via discord ;-)
Is it possible to improve the speed of gas64? Currently gas64 is twice as slow as gas.
SARG
Posts: 1888
Joined: May 27, 2005 7:15
Location: FRANCE

Re: Gas64 (no more use of gcc, only gas) WDS / LNX

Post by SARG »

Compil time or running time ?
If compil time that's possible as there are optimizations done for speed when executing.
I can provide you a version without these optimizations.
In fact I'm pretty sure that processors are so 'clever' that optimizations done are useless.
Xusinboy Bekchanov
Posts: 879
Joined: Jul 26, 2018 18:28

Re: Gas64 (no more use of gcc, only gas) WDS / LNX

Post by Xusinboy Bekchanov »

SARG wrote: Mar 30, 2025 9:29 Compil time or running time ?
If compil time that's possible as there are optimizations done for speed when executing.
I can provide you a version without these optimizations.
In fact I'm pretty sure that processors are so 'clever' that optimizations done are useless.
Compilation time. If I compile with 32-bit gas, the compilation of IDE source files into an asm file takes 14.34 seconds. And assembly takes 3 seconds. If I compile with 64-bit gas64, the compilation of IDE source files into an asm file takes 30.02 seconds. And assembly takes 3 seconds as well.
SARG
Posts: 1888
Joined: May 27, 2005 7:15
Location: FRANCE

Re: Gas64 (no more use of gcc, only gas) WDS / LNX

Post by SARG »

I sent you a test version on Discord. No warranty it works (no compilation fail and better time.....)
SARG
Posts: 1888
Joined: May 27, 2005 7:15
Location: FRANCE

Re: Gas64 (no more use of gcc, only gas) WDS / LNX

Post by SARG »

I managed to get a much shorter compilation time when gas64 is used (for 1.20 version). :o

For those interested : https://users.freebasic-portal.de/sarg/fbc64_gas64.zip

Please report time savings and any possible bug.
VANYA
Posts: 1887
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: Gas64 (no more use of gcc, only gas) WDS / LNX

Post by VANYA »

SARG wrote: Jun 02, 2025 10:10 I managed to get a much shorter compilation time when gas64 is used (for 1.20 version).
Hi SARG!
That is, are all the latest changes 1.20 there? Can you tell us in more detail how the compilation speed has increased? What has been done to achieve this?
SARG
Posts: 1888
Joined: May 27, 2005 7:15
Location: FRANCE

Re: Gas64 (no more use of gcc, only gas) WDS / LNX

Post by SARG »

VANYA wrote: Jun 02, 2025 11:14 That is, are all the latest changes 1.20 there? Can you tell us in more detail how the compilation speed has increased? What has been done to achieve this?
Hi VANYA,
Yes all changes planned for 1.2 are included.

I changed all longs by integers (faster operations on 64bit) and mainly in only one procedure (the check for freeing registers) removed many operations (move, test, instr) on strings replaced by tests on longs via pointers. Plus others improvements elsewhere.

Tested on xusinboy's editor source the compilation without assembling/linking is reduced by 2.5/3 time. I'm expecting a report from his side.

Nota : I find a bug with for-next loops using single variable due to some wrong optimization (not related to the last changes I guess) I have to investigate.
Xusinboy Bekchanov
Posts: 879
Joined: Jul 26, 2018 18:28

Re: Gas64 (no more use of gcc, only gas) WDS / LNX

Post by Xusinboy Bekchanov »

SARG wrote: Jun 02, 2025 10:10 I managed to get a much shorter compilation time when gas64 is used (for 1.20 version). :o

For those interested : https://users.freebasic-portal.de/sarg/fbc64_gas64.zip

Please report time savings and any possible bug.
Hello, very good result, better than gas32.

gas32 compiles in 14.31 seconds, and gas64 in 10.98 seconds.

I am very happy, thank you very much. I should check Stack Overflow while running the IDE.
VANYA
Posts: 1887
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: Gas64 (no more use of gcc, only gas) WDS / LNX

Post by VANYA »

I ran a test on my project.:

gas32:
fbc -pp fbnp.bas
3 seconds

fbc fbnp.bas -o fbnp.asm
2 seconds

gas64:
fbc -pp fbnp.bas
3 seconds

fbc fbnp.bas -o fbnp.asm
25 seconds

And although for some reason they both could not compile the project into an ASM file, they returned the same errors, but at different times. The GAS64 compiler still has room to improve in terms of code optimization. The usual compilation runs without problems. I'm still investigating the issue with the output to the ASM file.

------------
upd:
I understood why it is not possible to compile to an ASM file. There is a macro in the source file that prevents this from happening:

Code: Select all

#if __fb_out_exe__
 here variables
#endif

use variables ' error for output ASM
SARG
Posts: 1888
Joined: May 27, 2005 7:15
Location: FRANCE

Re: Gas64 (no more use of gcc, only gas) WDS / LNX

Post by SARG »

@xusinboy Thanks. And that's you fault, you push me to do that :-)
VANYA wrote: Jun 02, 2025 16:45 The GAS64 compiler still has room to improve in terms of code optimization.
I already explained how backend generation works.
All final code generators (even C) receives small elements of information one by one, very close of asm instruction so no global vision.

2 ways of improvement :
1/Currently all the optimizations made in gas64 are by analysing the currentl line of code with the previous one so there is no great possibility.
It could be possible to do better if working on much more lines (3 or 4). The problem will be a compilation time increased.
2/working at a higher level in the compiler but it's a huge job.

Any idea welcome so maybe we can exchange on the subject (by message).


BTW I didn't know this define : #if __fb_out_exe__ (and its brothers) ;-)
SARG
Posts: 1888
Joined: May 27, 2005 7:15
Location: FRANCE

Re: Gas64 (no more use of gcc, only gas) WDS / LNX

Post by SARG »

Bug found and easy to fix. Next version tomorrow.

Btw I still have some improvements but I'll implement them later.
VANYA
Posts: 1887
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: Gas64 (no more use of gcc, only gas) WDS / LNX

Post by VANYA »

I wanted to see the difference in execution speed of gas32 and gas64 using profiling, but I couldn't do it. Still, the difference in time in seconds is colossal: gas32 2 sec vs gas64 25 sec

I tried to build a compiler with such options:

Code: Select all

make compiler ENABLE_STANDALONE=1 FBCFLAGS=-profile
But he failed because of the problems with the link:
undefined reference to `mcount'
The libgmon.a library exists, but for some reason the linker gives an error.
SARG
Posts: 1888
Joined: May 27, 2005 7:15
Location: FRANCE

Re: Gas64 (no more use of gcc, only gas) WDS / LNX

Post by SARG »

VANYA wrote: Jun 03, 2025 3:44 Still, the difference in time in seconds is colossal: gas32 2 sec vs gas64 25 sec
What are you compiling ?
undefined reference to `mcount'
Have you tried to compile with the new option : -profgen < profiler > (either fb or cycles). It needs 1.20
The old way is problematic.
VANYA
Posts: 1887
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: Gas64 (no more use of gcc, only gas) WDS / LNX

Post by VANYA »

SARG wrote: Jun 03, 2025 8:27 What are you compiling ?'
IUP_FB_EDITOR

The code is the same. The number of lines after the preprocessor is about the same. So the bottleneck is: Gas64
Of course, this is relative to Gas32. Because GAS64 is the same speed as (GCC without optimization options).
Maybe somewhere we need to remove runtime functions and replace them with pure C functions for better optimization?
I don't understand why there is such a gap in compilation speed between gas32 and gas64
SARG wrote: Jun 03, 2025 8:27 Have you tried to compile with the new option : -profgen < profiler > (either fb or cycles). It needs 1.20
The old way is problematic.
I have not put/setup a 1.20 version yet
SARG
Posts: 1888
Joined: May 27, 2005 7:15
Location: FRANCE

Re: Gas64 (no more use of gcc, only gas) WDS / LNX

Post by SARG »

I compiled on my side iup_fb_editor in less than 3 secondes so I don't understand of what you are talking 25sec ???
Post Reply