FB builds using gcc 7.5, 8.4 and 9.3

Windows specific questions.
SARG
Posts: 1757
Joined: May 27, 2005 7:15
Location: FRANCE

Re: FB builds using gcc 7.5, 8.4 and 9.3

Post by SARG »

@UEZ
Thanks for testing gas64. However to be sure, have you used -gen gcc with fbc64_gas64 ? If so you got a "regular" exe compiled with gcc and the test has no real interest :-) But it would be surprising that without optimization (-o) you got the best average....

With fbc64_gas64 the default backend is gas64 : no need -gen gas64.

@deltarho
fbc64_gas64 is to be used like the standard fbc.exe. Nothing more except 'as' and 'ld'.
Not the lastest version but enough for testing http://users.freebasic-portal.de/sarg/fbc64_gas64.zip (2020/04/18)

And as already said in an other topic regarding the compiler the fastest exe depends greatly of the sort of program.
UEZ
Posts: 972
Joined: May 05, 2017 19:59
Location: Germany

Re: FB builds using gcc 7.5, 8.4 and 9.3

Post by UEZ »

SARG wrote:Thanks for testing gas64. However to be sure, have you used -gen gcc with fbc64_gas64 ? If so you got a "regular" exe compiled with gcc and the test has no real interest :-) But it would be surprising that without optimization (-o) you got the best average....
You are right, I used -gen gcc to have the same base but comparison is thus not correct.

Here the result vs FB without any additional parameter - just fbc.exe / fbc64_gas64.exe (I found also fbc32_gas64.exe for x86):

Code: Select all

									32-Bit / default					
					0			1			2			3			4			Average
FB				 5163 ms	3149 ms	2472 ms	2577 ms	2062 ms	3085 ms
GAS64 (SARG)	4960 ms	3232 ms	3263 ms	3890 ms	2760 ms	3621 ms


									64-Bit / default					
					0			1			2			3			4			Average
FB				 2491 ms	3024 ms	2506 ms	2328 ms	2176 ms	2505 ms
GAS64 (SARG)	2151 ms	3230 ms	2225 ms	2207 ms	1835 ms	2330 ms
For x64 your version seems to be faster! Good work. :-)
deltarho[1859]
Posts: 4292
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: FB builds using gcc 7.5, 8.4 and 9.3

Post by deltarho[1859] »

@SARG

I apologise for being outside of my comfort zone.
Nothing more except 'as' and 'ld'.
I have no idea what you are talking about.
dodicat
Posts: 7976
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: FB builds using gcc 7.5, 8.4 and 9.3

Post by dodicat »

For the gas64 method I use
compiler
fbc64_gas64.exe
with
-gen gas64

A typical compile log
compiling . . .
Success ( 0.7765392999863252 seconds)

FreeBASIC Compiler - Version 1.07-(08).0 (2020-02-23), built for win64 (64bit)
Copyright (C) 2004-2019 The FreeBASIC development team.
standalone

-gen gas64
deltarho[1859]
Posts: 4292
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: FB builds using gcc 7.5, 8.4 and 9.3

Post by deltarho[1859] »

In WinFBE I tried with 'Win64 Console (Release)
Image
and got

Code: Select all

FreeBASIC Compiler - Version 1.07-(08).0 (2020-02-23), built for win64 (64bit)
Copyright (C) 2004-2019 The FreeBASIC development team.
standalone
target:       win64, x86-64, 64bit
backend:      gas64
usage: fbc [options] <input files>
followed by a list of options.

I got Errors 1 Warnings 0 but I couldn't find what the error was.

My bas was

Code: Select all

Print "David"
Sleep
I have a feeling that I will be told to use a command line. I really hope not because that will be over my dead body. Image
dodicat
Posts: 7976
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: FB builds using gcc 7.5, 8.4 and 9.3

Post by dodicat »

Using an ide is OK, here is WinFBE version 1.94(64 bits)


compile log
Successful Compile (Errors 0 Warnings 0)

Primary Source: C:\Users\User\Desktop\fb64\WinFBE_Suite\WinFBE_Suite\TMP1727.bas
Target Compilation: C:\Users\User\Desktop\fb64\WinFBE_Suite\WinFBE_Suite\TMP1727.exe (99 KB, 101076 bytes)
Compile Time: 0.3 seconds (2020-05-21 11:09:19)

Command Line:
C:\Users\User\Desktop\gas64\fb1764\FreeBASIC-1.07.1-win64\FreeBASIC-1.07.1-win64\fbc64_gas64.exe -m "C:\Users\User\Desktop\fb64\WinFBE_Suite\WinFBE_Suite\TMP1727.bas" "" -v -gen gas64
And my test code tests virtual methods VIZ:

Code: Select all


Type FB Extends Object
  Declare virtual Function atan(As Double) As Double
End Type

Function FB.atan(x As Double) As Double
  Print __function__;Tab(20);@this,
  Return Atn(x)
End Function

Type derived Extends FB
  Declare Function atan(As Double) As Double override
  private:
  Declare Function taylor(As Double) As Double
End Type

Function derived.taylor(x As Double) As Double
  Dim As Integer c=1,counter=0
  Dim As Double inv,sign=-1,XX=x*x,term,p=x,accum
  Dim As Double temp1=x,temp2
  Do
    c=c+2
    temp2=temp1
    counter=counter+1
    inv=1/c
    p=p*XX
    term=p*inv
    accum=temp1+sign*term
    sign=-sign
    temp1=accum
  Loop Until temp1=temp2
  Return accum
End Function

Function derived.atan(x As Double)As Double
  Print __function__;Tab(20);@this,
  Const f=65536
  Dim As Double y
  For n As Byte =1 To 16
    y=x/(1+Sqr(1+x*x))
    x=y
  Next n
  Return f*Taylor(y)
End Function


Print "function";Tab(20);"address";Tab(30);"answer"
Print

Dim As FB F
Dim As derived d

'method 1 
Dim Byref As FB  Fr = F
Dim Byref As FB  dr = d
Print  Fr.atan(.5)
Print  dr.atan(.5)
print


'method 2
Dim As FB Ptr Fp = @F
Dim As FB Ptr dp = @d

Print Fp->atan(.5)
Print dp->atan(.5)
print

Fr.constructor
dr.constructor

Print Fr.atan(.5)
Print dr.atan(.5)
print

Fp->constructor
dp->constructor

Print Fp->atan(.5)
Print dp->atan(.5)
print

Sleep


 
deltarho[1859]
Posts: 4292
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: FB builds using gcc 7.5, 8.4 and 9.3

Post by deltarho[1859] »

On the face of it I am not doing anything wrong. I am using WinFBE (64-bit) 2.1.6)

Sorry SARG, I will not be playing with gas64. Image
deltarho[1859]
Posts: 4292
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: FB builds using gcc 7.5, 8.4 and 9.3

Post by deltarho[1859] »

I have just broken out in a rash. Why? Well, because I ran FBEdit. Image

I got this: Executable not found: "E:\Downloads\WinFBE_Suite\fbc64_gas64\WDS 1.07\bin\win64\as.exe"

WinFBE cut that out of the Output Window.

I mentioned that statement a little while back. I don't have a bl***y bin folder.

SARG's link does not give me what I need. SARG wrote " Nothing more except 'as' and 'ld' " and I responded with "I have no idea what you are talking about". So treat me like an bright and don't assume that I will fill in the gaps. Pretend you are writing a Help file. The reason why I hate writing Help files is that I keep asking myself "Have I given the reader enough or have I left them wanting?" That is so time-consuming but I end up with pretty good Help files even if I say so myself.
robert
Posts: 169
Joined: Aug 06, 2019 18:45

Re: FB builds using gcc 7.5, 8.4 and 9.3

Post by robert »

deltarho[1859] wrote: So treat me like an bright and don't assume that I will fill in the gaps.
O.K.

Place fbc64_gas64.exe in the same folder as fbc.exe.
deltarho[1859]
Posts: 4292
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: FB builds using gcc 7.5, 8.4 and 9.3

Post by deltarho[1859] »

robert wrote:Place fbc64_gas64.exe in the same folder as fbc.exe.
robert Image

I might get flamed for not realizing the obvious but sometimes the 'obvious' evades us especially with 'stuff' we rarely dabble in.

Anyway, thank you, robert. Next time I write a Help file I may ask you to beta test it for me. Image.

I have six gcc toolchains and I use fbc32.exe and fbc64.exe. I dropped fbc64_gas64.exe into the gcc 5.2 toolchain. Now, as.exe and ld.exe are not the same for all toolchains so I don't know what that may mean.

I compiled my Encrypternet program and the binary was about three times larger than my gcc version using -O3 which produces larger binaries than -O2. I looked at quite a few applications and they all compiled with very much larger binaries compared with the gcc versions.

Code: Select all

Print "David"
Sleep
came in at 89754 compared with gcc 8.3 and -O3 at 32256.

Quite a few console apps opened and then closed immediately. Of the ones that did run they suffered quite a large performance hit.

So, I am getting decidedly unfit and clinically obese exes and gcc has nothing to worry about.

I will experiment with moving fbc64_gas64.exe around the other toolchains and start making notes, especially with the programs which compiled but did not run; some were graphics masterpieces by UEZ and dodicat. Obviously, I'll report to SARG with issues.

Thanks again.
deltarho[1859]
Posts: 4292
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: FB builds using gcc 7.5, 8.4 and 9.3

Post by deltarho[1859] »

Yours truly wrote:I looked at quite a few applications and they all compiled with very much larger binaries compared with the gcc versions.
My bad, I should have used '-strip'. We could do with that as the default as with fbc.

In my SetCompilerSwitchesII.ini for WinFBE I have "-strip -gen gas64".

I will take time out and go through the 18 pages of SARG's thread otherwise I could end up p*****g some members off by asking questions that may have been answered. I saw one comment suggesting that BASIC should compile to asm and not C. I take the view that if the result is 'lean and mean' it could be compiled in Ferengi for all that I care.
SARG
Posts: 1757
Joined: May 27, 2005 7:15
Location: FRANCE

Re: FB builds using gcc 7.5, 8.4 and 9.3

Post by SARG »

@dodicat, robert
Thank you for the help :-)

@deltarho
No need to read all the pages.
Use fbc64_gas64 as regular fbc. Fbc64_gas64 generates asm code but all the upstream of the compilation stays unchanged.

By the way no need -gen gas64 it's set by default. See it like fbc under 32bit.

'as' is the assembler and 'ld' the linker, I meant that gcc.exe was not necessary. I should be clearer and also how to use fbc64, sorry.
I think WE often assume that people are more skilled (in certain domains) that they really are. It's easier but not always good ......

All reports obviously are welcome.
deltarho[1859]
Posts: 4292
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: FB builds using gcc 7.5, 8.4 and 9.3

Post by deltarho[1859] »

SARG wrote:I think WE often assume that people are more skilled (in certain domains) that they really are.
Good teachers make no such assumptions and good students don't object to that.
PaulSquires
Posts: 999
Joined: Jul 14, 2005 23:41

deleted

Post by PaulSquires »

deleted
Last edited by PaulSquires on May 22, 2020 20:51, edited 1 time in total.
Imortis
Moderator
Posts: 1923
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Re: FB builds using gcc 7.5, 8.4 and 9.3

Post by Imortis »

Paul, could you move this to the WinFBE thread? You are welcome to put a link to the post here as it is semi-related.
Post Reply