Gas64 (no more use of gcc, only gas) :-)

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

Re: Gas64 (no more use of gcc, only gas) :-)

Postby Xusinboy Bekchanov » May 02, 2019 4:15

Hello, thanks for doing the gas64 version
I can't compile my IDE. Says that:

Code: Select all

08:52:21: Compilation: "F:\Install\Install2\FreeBASIC-1.06.0-win64\FreeBASIC-1.06.0-win64\fbc64_gas64.exe"  -b "F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.bas"  -g -s gui -x "../VisualFBEditor64.exe" "VisualFBEditor.rc" -exx -RR -R -gen gas64 -v -g -i "F:\Install\Install2\VisualFBEditor.1.1.0/./MyFbFramework" ...

FreeBASIC Compiler - Version 1.06.0 (03-28-2019), built for win64 (64bit)
Copyright (C) 2004-2019 The FreeBASIC development team.
standalone
target:       win64, x86-64, 64bit
compiling:    F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.bas -o F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64 (main module)
assembling:   F:\Install\Install2\FreeBASIC-1.06.0-win64\FreeBASIC-1.06.0-win64\bin\win64\as.exe --64 "F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64" -o "F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.o"
assembling failed: 'F:\Install\Install2\FreeBASIC-1.06.0-win64\FreeBASIC-1.06.0-win64\bin\win64\as.exe' terminated with exit code 1
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64: Assembler messages:
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:80245: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:80248: Error: `r10' not allowed with `cmpb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:133332: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:135011: Error: no such instruction: `found AN ERROR:no free reg use RAX'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:135023: Error: no such instruction: `found AN ERROR:no free reg use RAX'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:135030: Error: no such instruction: `found AN ERROR:virtual register=76 no real register corresponding,using KREG_XXX'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:135034: Error: bad expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:135034: Error: missing right bracket
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:135034: Error: junk `X_Q]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:135041: Error: no such instruction: `found AN ERROR:Warning rax used before a function call,should not happen 77'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:227125: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:227127: Error: `r10' not allowed with `cmpb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:249330: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:249332: Error: `r10' not allowed with `cmpb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:249637: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:249959: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:249961: Error: `r10' not allowed with `cmpb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:274304: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:292064: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:292270: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:314632: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:314634: Error: `r10' not allowed with `cmpb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:315073: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:315075: Error: `r10' not allowed with `cmpb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:330612: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:330614: Error: `r10' not allowed with `cmpb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:330690: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:331045: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:331047: Error: `r10' not allowed with `cmpb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:338907: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:352387: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:352389: Error: `r10' not allowed with `cmpb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:353759: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:353761: Error: `r10' not allowed with `cmpb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:356503: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:356505: Error: `r10' not allowed with `cmpb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:359275: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:359277: Error: `r10' not allowed with `cmpb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:364434: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:364436: Error: `r10' not allowed with `cmpb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:384169: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:384171: Error: `r10' not allowed with `cmpb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:405562: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:414024: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:414027: Error: `r10' not allowed with `cmpb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:430485: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:430487: Error: `r10' not allowed with `cmpb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:431757: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:431759: Error: `r10' not allowed with `cmpb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:441925: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:441927: Error: `r10' not allowed with `cmpb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:448928: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:452580: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:452583: Error: `r10' not allowed with `cmpb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:453536: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:453539: Error: `r10' not allowed with `cmpb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:458414: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:461612: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:461615: Error: `r10' not allowed with `cmpb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:462429: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:462432: Error: `r10' not allowed with `cmpb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:463246: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:463249: Error: `r10' not allowed with `cmpb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:464789: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:464792: Error: `r10' not allowed with `cmpb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:470540: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:479060: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:479062: Error: `r10' not allowed with `cmpb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:482196: Error: `r11' not allowed with `orb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:487782: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:499831: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:499833: Error: `r10' not allowed with `cmpb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:504256: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:504258: Error: `r10' not allowed with `cmpb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:504576: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:504578: Error: `r10' not allowed with `cmpb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:532095: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:532097: Error: `r10' not allowed with `cmpb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:536924: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:536926: Error: `r10' not allowed with `cmpb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:537244: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:537246: Error: `r10' not allowed with `cmpb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:578555: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:578557: Error: `r10' not allowed with `cmpb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:579257: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:579259: Error: `r10' not allowed with `cmpb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:594114: Error: `r8' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:594115: Error: `r8' not allowed with `orb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:596720: Error: `r8' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:596721: Error: `r8' not allowed with `orb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:596736: Error: `r8' not allowed with `orb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:599265: Error: `r8' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:599266: Error: `r8' not allowed with `orb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:599281: Error: `r8' not allowed with `orb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:602218: Error: no such instruction: `found AN ERROR:virtual register=207 no real register corresponding,using KREG_XXX'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:602220: Error: bad expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:602220: Error: missing right bracket
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:602220: Error: junk `X_Q]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:605952: Error: no such instruction: `found AN ERROR:virtual register=86 no real register corresponding,using KREG_XXX'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:605954: Error: bad expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:605954: Error: junk `X_Q' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:609574: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:620996: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:621024: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:621052: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:621533: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:621535: Error: `r10' not allowed with `cmpb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:630753: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:631109: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:639923: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:639939: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:643014: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:643375: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:644918: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:644920: Error: `r10' not allowed with `cmpb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:645204: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:650710: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:665913: Error: `r8' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:670427: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:670783: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:671068: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:684131: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:684603: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:684637: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:685861: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:686126: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:686295: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:696240: Error: `r8' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:709548: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:709880: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:710705: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:710955: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:711183: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:711529: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:712487: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:713668: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:714257: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:715045: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:716322: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:722416: Error: no such instruction: `found AN ERROR:virtual register=974 no real register corresponding,using KREG_XXX'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:722418: Error: bad expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:722418: Error: missing right bracket
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:722418: Error: junk `X_Q]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:723327: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:723477: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:723946: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:724039: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:751311: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:766780: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:766995: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:773042: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:806221: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:814029: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:820013: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:825799: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:827189: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:841450: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:859034: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:865352: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:869848: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:870084: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:870959: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:871224: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:874035: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:874785: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:875155: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:894761: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:894762: Error: `r11' not allowed with `orb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:895132: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:895180: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:895241: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:895849: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:900015: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:901562: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:906613: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:906651: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:914377: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:917927: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:923637: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:923820: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:924954: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:925304: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:925550: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:926600: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:936094: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:944058: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:957987: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:957988: Error: `r11' not allowed with `orb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:964586: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:964706: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:968052: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:969364: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:972242: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:977793: Error: `r8' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:981348: Error: no such instruction: `found AN ERROR:virtual register=98 no real register corresponding,using KREG_XXX'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:981350: Error: bad expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:981350: Error: junk `X_Q' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:981869: Error: no such instruction: `found AN ERROR:virtual register=123 no real register corresponding,using KREG_XXX'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:981871: Error: bad expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:981871: Error: junk `X_Q' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:982784: Error: no such instruction: `found AN ERROR:virtual register=161 no real register corresponding,using KREG_XXX'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:982786: Error: bad expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:982786: Error: junk `X_Q' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:983305: Error: no such instruction: `found AN ERROR:virtual register=186 no real register corresponding,using KREG_XXX'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:983307: Error: bad expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:983307: Error: junk `X_Q' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:994453: Error: `r10' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:994455: Error: `r10' not allowed with `cmpb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1026663: Error: no such instruction: `found AN ERROR:virtual register=69 no real register corresponding,using KREG_XXX'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1026665: Error: bad expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1026665: Error: junk `X_Q' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1062169: Error: no such instruction: `found AN ERROR:virtual register=5 no real register corresponding,using KREG_XXX'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1062171: Error: bad expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1062171: Error: junk `X_Q' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1073413: Error: no such instruction: `found AN ERROR:virtual register=14 no real register corresponding,using KREG_XXX'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1073415: Error: bad expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1073415: Error: junk `X_Q' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1122299: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1123017: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1136529: Error: `r11' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1137511: Error: no such instruction: `found AN ERROR:virtual register=44 no real register corresponding,using KREG_XXX'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1137513: Error: bad expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1137513: Error: junk `X_Q' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1154038: Error: junk `CONSTRUCTIONS[rip+255]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1154053: Error: junk `CONSTRUCTIONS[rip+256]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1154329: Error: junk `CONSTRUCTIONS[rip+512]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1154344: Error: junk `CONSTRUCTIONS[rip+513]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1154620: Error: junk `CONSTRUCTIONS[rip+769]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1154635: Error: junk `CONSTRUCTIONS[rip+770]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1154911: Error: junk `CONSTRUCTIONS[rip+1026]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1154926: Error: junk `CONSTRUCTIONS[rip+1027]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1155202: Error: junk `CONSTRUCTIONS[rip+1283]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1155217: Error: junk `CONSTRUCTIONS[rip+1284]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1155493: Error: junk `CONSTRUCTIONS[rip+1540]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1155508: Error: junk `CONSTRUCTIONS[rip+1541]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1155784: Error: junk `CONSTRUCTIONS[rip+1797]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1155799: Error: junk `CONSTRUCTIONS[rip+1798]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1156075: Error: junk `CONSTRUCTIONS[rip+2054]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1156090: Error: junk `CONSTRUCTIONS[rip+2055]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1156366: Error: junk `CONSTRUCTIONS[rip+2311]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1156381: Error: junk `CONSTRUCTIONS[rip+2312]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1156657: Error: junk `CONSTRUCTIONS[rip+2568]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1156672: Error: junk `CONSTRUCTIONS[rip+2569]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1156948: Error: junk `CONSTRUCTIONS[rip+2825]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1156963: Error: junk `CONSTRUCTIONS[rip+2826]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1157239: Error: junk `CONSTRUCTIONS[rip+3082]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1157254: Error: junk `CONSTRUCTIONS[rip+3083]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1157530: Error: junk `CONSTRUCTIONS[rip+3339]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1157545: Error: junk `CONSTRUCTIONS[rip+3340]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1157821: Error: junk `CONSTRUCTIONS[rip+3596]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1157836: Error: junk `CONSTRUCTIONS[rip+3597]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1158112: Error: junk `CONSTRUCTIONS[rip+3853]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1158127: Error: junk `CONSTRUCTIONS[rip+3854]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1158403: Error: junk `CONSTRUCTIONS[rip+4110]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1158418: Error: junk `CONSTRUCTIONS[rip+4111]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1158694: Error: junk `CONSTRUCTIONS[rip+4367]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1158709: Error: junk `CONSTRUCTIONS[rip+4368]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1158985: Error: junk `CONSTRUCTIONS[rip+4624]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1159000: Error: junk `CONSTRUCTIONS[rip+4625]' after expression
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1554341: Error: `r8' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1554344: Error: `r8' not allowed with `cmpb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1554707: Error: `r8' not allowed with `movb'
F:\Install\Install2\VisualFBEditor.1.1.0\src/VisualFBEditor.a64:1554710: Error: `r8' not allowed with `cmpb'

08:59:14: Do not build file.


And compiles for a very long time.
frisian
Posts: 249
Joined: Oct 08, 2009 17:25

Re: Gas64 (no more use of gcc, only gas) :-)

Postby frisian » May 02, 2019 21:43

@SARG

0/Conv, int and fix for float --> integer when SSE4_1 feature is not available
done with your code for all integer variables except uinteger. I tested simulating the SEE41 lack but check on your side.
for uinteger I'm not sure how it could be done. Could you propose a solution. Maybe VCVTS(D/S)2USI instructions are usable.

VCVTS(D/S)2USI is a AVX512F instructions, not available on older processors.
Freebasic and GCC simply cast the signed integer into the unsigned integer, in other words they simply dump the result into the unsigned integer without considering the sign.
For now it would be best to follow this behavior.
The only problem would be if with a double number that is greater then 2^31 that is converted into 32bit integer.
It's possible to handle the sign, this would add 4 or 5 lines of extra code.

Select Case as Const does not work correctly, crashes with Case Else.
Modified Select Case As Const example from the FBC help file/wiki

Code: Select all

Dim As Integer n

For n = 1 To 9

    Select Case As Const n
        Case 1
            Print n;" = 1"
        Case 2, 4
            Print n;" = 2 or 4"
        Case 5 To 7
            Print n;" >= 5 and <= 7"
        Case Else
            Print n;" = something else"
    End Select

Next

Sleep
End

Compiled with FBC gives.

Code: Select all

 1 = 1
 2 = 2 or 4
 3 = something else
 4 = 2 or 4
 5 >= 5 and <= 7
 6 >= 5 and <= 7
 7 >= 5 and <= 7
 8 = something else
 9 = something else

compile with FBC64_GAS64 -exx gives the following result and then crashes.

Code: Select all

 1 = 1
 2 = 2 or 4
 3 = 2 or 4
 4 >= 5 and <= 7
 5 >= 5 and <= 7
 6 >= 5 and <= 7

Aborting due to runtime error 12 ("segmentation violation" signal) in case select.bas::()

When the case else is removed the result is the same, without the crash.
A look into the a64 file reveals that the jump table is incorrect and the entry for case else is missing.

testtest.bas fails because of use of a reserved GAS word cs (cs = code segment)

Code: Select all

dim shared as integer arr(5)
for i as integer = 0 to 5
  print arr(i),
next

dim shared as integer cs(5)
for i as integer = 0 to 5
  print cs(i),
next

sleep
end

Compiler errors

Code: Select all

[C:\FBC106win64]fbc64_gas64 -RR -R -gen gas64 -v -g testtest.bas
FreeBASIC Compiler - Version 1.06.0 (03-28-2019), built for win64 (64bit)
Copyright (C) 2004-2019 The FreeBASIC development team.
standalone
target:       win64, x86-64, 64bit
compiling:    testtest.bas -o testtest.a64 (main module)
assembling:   C:\FBC106win64\bin\win64\as.exe --64 "testtest.a64" -o "testtest.o"
testtest.a64: Assembler messages:
testtest.a64:185: Error: invalid use of register
testtest.a64:186: Error: invalid use of register
testtest.a64:191: Error: invalid use of register
assembling failed: 'C:\FBC106win64\bin\win64\as.exe' terminated with exit code 1


testtest.a64

Code: Select all

.intel_syntax noprefix
.file "testtest.bas"
.section .text

# Info --> SSE41 not supported
.section .bss
.lcomm $mxcsr1,4,4
.lcomm $mxcsr2,4,4
.section .text
# Info --> registers released
# Info --> =============================================================================
# Info --> ===== Proc begin : main / main =====
# Info --> =============================================================================
   # Info --> stk4=112 reserved space for saving registers when proc calls
   # Info --> registers released
   # Info --> proc shared public declared parsed hasalias mainproc procemitted  cdecl [long]
   .text
   # Info --> Not accessed --> not used ??
   .globl main
main:
   # Info --> usefull ? [long] main( [long] __FB_ARGC__, [zstring ptr ptr] __FB_ARGV__ )
   push rbp
   mov  rbp,rsp
   sub rsp, 176
   call __main
   # Info --> paramvar=__FB_ARGC__ real typ=[long] symbgetlen=4
   # Info --> var local parambyval declared __FB_ARGC__ [long]
   # Info --> lgt=4 real=4
   mov DWORD PTR 16[rbp], ecx
   # Info --> paramvar=__FB_ARGV__ real typ=[zstring ptr ptr] symbgetlen=8
   # Info --> var local parambyval declared argv __FB_ARGV__ [zstring ptr ptr]
   # Info --> lgt=8 real=8
   mov QWORD PTR 24[rbp], rdx
   # Info --> localvar fb$result
   # Info --> fb$result fb$result
   # Info --> symbdump=var local funcresult declared implicit fb$result [long]
   # Info --> lgt=4 real=4
   # Info --> var total size=4
   # Info --> stk=112
   # Info --> stk1=116
   # Info --> addrof fb$result+-116 [long]
   # Info --> v1=var fb$result ofs=-116 [long] symbdump=var local funcresult accessed declared implicit fb$result [long]
   # Info --> vr=reg 0 [long ptr]
   # Info --> virtual register =0 real register=r11
   # Info --> marked as used register=r11
#O4lea r11, -116[rbp]
   # Info --> memclear vr0 [long ptr]
   # Info --> v1=reg 0 [long ptr]
   # Info --> v2=imm 4 [integer]
   # Info --> virtual register =0 real register=r11
   # Info --> Release done for register=r11
   # Info --> OPTIMIZATION 4 (lea)
   # Info --> END OF OPTIMIZATION4
   #O4mov DWORD PTR [r11], 0
   mov DWORD PTR -116[rbp], 0 #Optim 4
   # Info --> call fb_Init / mang=fb_Init
   # Info --> vr=<NULL>
   # Info --> level=1
   # Info --> arg __FB_ARGC__+16 [long]
   # Info --> arg=var __FB_ARGC__ ofs=16 [long] symbdump=var local parambyval accessed declared __FB_ARGC__ [long] vreg=-1
   mov ecx, 16[rbp]
   # Info --> arg __FB_ARGV__+24 [zstring ptr ptr]
   # Info --> arg=var __FB_ARGV__ ofs=24 [zstring ptr ptr] symbdump=var local parambyval accessed declared argv __FB_ARGV__ [zstring ptr ptr] vreg=-1
   mov rdx, 24[rbp]
   # Info --> arg 0 [long]
   # Info --> arg=imm 0 [long] vreg=-1
   xor r8d, r8d
   call fb_Init
   .Lt_0002: #label not mangled=.Lt_0002
   # Info --> registers released
   # -----------------------------------------
   # basic --> dim shared as integer arr(5)
   # -----------------------------------------
   # -----------------------------------------
   # basic --> for i as integer = 0 to 5
   # -----------------------------------------
   # Info --> localvar I
   # Info --> I I
   # Info --> symbdump=var local declared I [integer]
   # Info --> lgt=8 real=8
   # Info --> var total size=8
   # Info --> stk=116
   # Info --> stk1=128
   # Info --> store I+-128 [integer] := 0 [integer]
   # Info --> v1=var I ofs=-128 [integer] symbdump=var local accessed declared I [integer]
   # Info --> v2=imm 0 [integer]
   mov QWORD PTR -128[rbp], 0
   .Lt_0008: #label not mangled=.Lt_0008
   # Info --> registers released
   # -----------------------------------------
   # basic --> print arr(i),
   # -----------------------------------------
   # Info --> bop I+-128 [integer] SHL 3 [integer]
   # Info --> v1=var I ofs=-128 [integer] symbdump=var local accessed declared I [integer]
   # Info --> v2=imm 3 [integer]
   # Info --> vr=reg 1 [integer]
   # Info --> Vr<>0 op =>shl
   # Info --> marked as used register=r11
   mov r11, QWORD PTR -128[rbp]
   shl r11, 3
   # Info --> CONVERTING vr2 [longint] := ARR+vr1 [integer] [integer]
   # Info --> v1=reg 2 [longint] xx 2
   # Info --> v2=idx ARR [integer] vidx=<reg 1 [integer]> symbdump=var shared static accessed declared ARR(0 to 5) [integer] xx -1
   # Info --> no convert as exactly same datatype
   # Info --> call fb_PrintLongint / mang=fb_PrintLongint
   # Info --> vr=<NULL>
   # Info --> level=1
   # Info --> arg 0 [long]
   # Info --> arg=imm 0 [long] vreg=-1
   xor ecx, ecx
   # Info --> arg ARR+vr1 [integer] [integer]
   # Info --> arg=idx ARR [integer] vidx=<reg 1 [integer]> symbdump=var shared static accessed declared ARR(0 to 5) [integer] vreg=-1
   # Info --> virtual register =1 real register=r11
   lea r10, ARR[rip+0]
   lea r10, ARR[rip+0]
   # Info --> Release done for register=r11
   mov rdx, [r10+r11]
   # Info --> arg 2 [long]
   # Info --> arg=imm 2 [long] vreg=-1
   lea r10, ARR[rip+0]
   mov r8d, 2
   call fb_PrintLongint
   # Info --> registers released
   # -----------------------------------------
   # basic --> next
   # -----------------------------------------
   .Lt_0006: #label not mangled=.Lt_0006
   # Info --> selfbop I+-128 [integer] + 1 [integer]
   # Info --> v1=var I ofs=-128 [integer] symbdump=var local accessed declared I [integer]
   # Info --> v2=imm 1 [integer]
   # Info --> Vr=0 op =>add
   inc QWORD PTR -128[rbp]
   .Lt_0005: #label not mangled=.Lt_0005
   # Info --> branchbop I+-128 [integer] <= 5 [integer] .Lt_0008
   # Info --> v1=var I ofs=-128 [integer] symbdump=var local accessed declared I [integer]
   # Info --> v2=imm 5 [integer]
   # Info --> Vr=0 op =>icmp sle
   cmp QWORD PTR -128[rbp], 5
   jle .Lt_0008
   .Lt_0007: #label not mangled=.Lt_0007
   # Info --> registers released
   # -----------------------------------------
   # basic --> dim shared as integer cs(5)
   # -----------------------------------------
   # -----------------------------------------
   # basic --> for i as integer = 0 to 5
   # -----------------------------------------
   # Info --> localvar I
   # Info --> I I
   # Info --> symbdump=var local declared I [integer]
   # Info --> lgt=8 real=8
   # Info --> var total size=8
   # Info --> stk=128
   # Info --> stk1=136
   # Info --> store I+-136 [integer] := 0 [integer]
   # Info --> v1=var I ofs=-136 [integer] symbdump=var local accessed declared I [integer]
   # Info --> v2=imm 0 [integer]
   mov QWORD PTR -136[rbp], 0
   .Lt_000D: #label not mangled=.Lt_000D
   # Info --> registers released
   # -----------------------------------------
   # basic --> print cs(i),
   # -----------------------------------------
   # Info --> bop I+-136 [integer] SHL 3 [integer]
   # Info --> v1=var I ofs=-136 [integer] symbdump=var local accessed declared I [integer]
   # Info --> v2=imm 3 [integer]
   # Info --> vr=reg 3 [integer]
   # Info --> Vr<>0 op =>shl
   # Info --> marked as used register=r11
   mov r11, QWORD PTR -136[rbp]
   shl r11, 3
   # Info --> CONVERTING vr4 [longint] := CS+vr3 [integer] [integer]
   # Info --> v1=reg 4 [longint] xx 4
   # Info --> v2=idx CS [integer] vidx=<reg 3 [integer]> symbdump=var shared static accessed declared CS(0 to 5) [integer] xx -1
   # Info --> no convert as exactly same datatype
   # Info --> call fb_PrintLongint / mang=fb_PrintLongint
   # Info --> vr=<NULL>
   # Info --> level=1
   # Info --> arg 0 [long]
   # Info --> arg=imm 0 [long] vreg=-1
   xor ecx, ecx
   # Info --> arg CS+vr3 [integer] [integer]
   # Info --> arg=idx CS [integer] vidx=<reg 3 [integer]> symbdump=var shared static accessed declared CS(0 to 5) [integer] vreg=-1
   # Info --> virtual register =3 real register=r11
   lea r10, CS[rip+0]
   lea r10, CS[rip+0]
   # Info --> Release done for register=r11
   mov rdx, [r10+r11]
   # Info --> arg 2 [long]
   # Info --> arg=imm 2 [long] vreg=-1
   lea r10, CS[rip+0]
   mov r8d, 2
   call fb_PrintLongint
   # Info --> registers released
   # -----------------------------------------
   # basic --> next
   # -----------------------------------------
   .Lt_000B: #label not mangled=.Lt_000B
   # Info --> selfbop I+-136 [integer] + 1 [integer]
   # Info --> v1=var I ofs=-136 [integer] symbdump=var local accessed declared I [integer]
   # Info --> v2=imm 1 [integer]
   # Info --> Vr=0 op =>add
   inc QWORD PTR -136[rbp]
   .Lt_000A: #label not mangled=.Lt_000A
   # Info --> branchbop I+-136 [integer] <= 5 [integer] .Lt_000D
   # Info --> v1=var I ofs=-136 [integer] symbdump=var local accessed declared I [integer]
   # Info --> v2=imm 5 [integer]
   # Info --> Vr=0 op =>icmp sle
   cmp QWORD PTR -136[rbp], 5
   jle .Lt_000D
   .Lt_000C: #label not mangled=.Lt_000C
   # Info --> registers released
   # -----------------------------------------
   # basic --> sleep
   # -----------------------------------------
   # Info --> call fb_Sleep / mang=fb_Sleep
   # Info --> vr=<NULL>
   # Info --> level=1
   # Info --> arg -1 [long]
   # Info --> arg=imm -1 [long] vreg=-1
   mov rcx, -1
   call fb_Sleep
   # Info --> registers released
   # -----------------------------------------
   # basic --> end
   # -----------------------------------------
   # Info --> call fb_End / mang=fb_End
   # Info --> vr=<NULL>
   # Info --> level=1
   # Info --> arg 0 [long]
   # Info --> arg=imm 0 [long] vreg=-1
   xor ecx, ecx
   call fb_End
   # Info --> registers released
   .Lt_0003: #label not mangled=.Lt_0003
   # Info --> call fb_End / mang=fb_End
   # Info --> vr=<NULL>
   # Info --> level=1
   # Info --> arg 0 [long]
   # Info --> arg=imm 0 [long] vreg=-1
   xor ecx, ecx
   call fb_End
   # Info --> loadres fb$result+-116 [long]
   # Info --> v1=var fb$result ofs=-116 [long] symbdump=var local funcresult accessed declared implicit fb$result [long]
   # Info --> vr=reg 5 [long]
   mov eax, -116[rbp]
   # Info --> stk=136
   # Info --> stk5=176

   mov rsp,rbp
   pop rbp
   ret
# Info --> ===== End of proc =====

   # Info -->  __fb_ZTS6Object
   # Info --> symbdump=var shared extern hasalias <unnamed> alias "__fb_ZTS6Object" [struct FB_RTTI$]
   # Info --> Is extern so not defined here
   # Info --> {fbsc} Lt_0000
   # Info --> symbdump=var shared literal const hasalias {fbsc} alias "Lt_0000" [zstring]
   # Info --> Not accessed
   # Info --> ARR ARR
   # Info --> symbdump=var shared static accessed declared ARR(0 to 5) [integer]
   # Info --> Is an array
   .section .bss
   # Info --> var total size=48
   .lcomm ARR,48,8
   # Info --> >>[integer]
   # Info --> Lt_0004 Lt_0004
   # Info --> symbdump=var shared static descriptor implicit Lt_0004 [struct $FBARRAY1<u7INTEGER>]
   # Info --> Not accessed
   # Info --> CS CS
   # Info --> symbdump=var shared static accessed declared CS(0 to 5) [integer]
   # Info --> Is an array
   # Info --> var total size=48
   .lcomm CS,48,8
   # Info --> >>[integer]
   # Info --> Lt_0009 Lt_0009
   # Info --> symbdump=var shared static descriptor implicit Lt_0009 [struct $FBARRAY1<u7INTEGER>]
   # Info --> Not accessed
   .section .text


Some duplicate code in the following lines
114 lea r10, ARR[rip+0]
115 lea r10, ARR[rip+0]

185 lea r10, CS[rip+0]
186 lea r10, CS[rip+0]

The following program worked fine in previous version, but with the new version the first part is OK but it crashes on the second part.( starting with max = 123456 ' 1234567 takes about ten minutes)
9 billion names of God the integer.bas

Code: Select all

#Include Once "gmp.bi"

Sub partitions(max As ULong, p() As MpZ_ptr)
    ' based on Numericana code example
    Dim As ULong a, b, i, k
    Dim As Long j

    Dim As Mpz_ptr s = Allocate(Len(__mpz_struct)) : Mpz_init(s)

    Mpz_set_ui(p(0), 1)

    For i = 1 To max
        j = 1 : k = 1 : b = 2 : a = 5
        While j > 0
            ' j = i - (3*k*k+k) \ 2
            j = i - b : b = b + a : a = a + 3
            If j >= 0 Then
                If k And 1 Then Mpz_add(s, s, p(j)) Else Mpz_sub(s, s, p(j))
            End If
            j = j + k
            If j >= 0 Then
                If k And 1 Then Mpz_add(s, s, p(j)) Else Mpz_sub(s, s, p(j))
            End If
            k = k +1
        Wend
        Mpz_swap(p(i), s)
    Next

    Mpz_clear(s)

End Sub

' ------=< MAIN >=------

Dim As ULong n, k, max = 25              ' with max > 479 the numbers become
Dim As ULongInt p(max, max)              ' to big for a 64bit unsigned integer

p(1, 1) = 1                              ' fill the first 3 rows
p(2, 1) = 1 : p(2, 2) = 1
p(3, 1) = 1 : p(3, 2) = 1 : p(3, 3) = 1

For n = 4 To max                         ' fill the rest
    For k = 1 To n
        If k * 2 > n  Then
           p(n,k)= p(n-1,k-1)
        Else
           p(n,k) = p(n-1,k-1) + p(n-k, k)
        End If
    Next
Next

For n = 1 To 25                          ' print the triangle
    Print Space((max - n) * 2);
    For k = 1 To n
        Print Using "####"; p(n, k);
    Next
    Print
Next
Print : print

                                         ' calculate the integer partition
max = 123456                             ' 1234567 takes about ten minutes
Dim As ZString Ptr ans

ReDim big_p(max) As Mpz_ptr
For n = 0 To max
    big_p(n) = Allocate(Len(__mpz_struct)) : Mpz_init(big_p(n))
Next

partitions(max, big_p())

For n = 1 To Len(Str(max))
    k = Val(Left(Str(max), n))
    ans = Mpz_get_str (0, 10, big_p(k))
    Print Space(10 - n); "P("; Str(k); ") = "; *ans
Next

For n = 0 To max
    Mpz_clear(big_p(n))
Next

' empty keyboard buffer
While InKey <> "" : Wend
Print : Print "hit any key to end program"
Sleep
End

Snippet from the a64 file, the difference is that the new version adds two lines.

Code: Select all

   # -----------------------------------------
   # basic --> Mpz_set_ui(p(0), 1)
   # -----------------------------------------
   # Info --> CONVERTING vr7 [integer ptr] := P+24 [struct $FBARRAY<P12__mpz_struct> ptr]
   # Info --> v1=reg 7 [integer ptr] xx 7
   # Info --> v2=var P ofs=24 [struct $FBARRAY<P12__mpz_struct> ptr] symbdump=var local parambydesc accessed declared P()  [struct __MPZ_STRUCT ptr] xx -1
   # Info --> virtual register =7 real register=r11
   # Info --> size dst <= size src  changing src dtype by dst dtype
   # Info --> initial dtype src=[integer] dst=[integer]
   # Info --> marked as used register=r11
   mov r11, QWORD PTR 24[rbp]
   # Info --> call __gmpz_set_ui / mang=__gmpz_set_ui
   # Info --> vr=<NULL>
   # Info --> level=1
   # Info --> arg vr7 [integer ptr] [integer] [struct __MPZ_STRUCT ptr]
   # Info --> arg=idx [struct __MPZ_STRUCT ptr] vidx=<ptr [integer] vidx=<reg 7 [integer ptr]>> vreg=-1
   # Info --> virtual register =7 real register=r11
   # Info --> Release done for register=r11
   mov r11, [r11]
   mov r11, [r11]         <=== first line added by the new version
   mov rcx, 0[r11]
   # Info --> arg 1 [ulong]
   # Info --> arg=imm 1 [ulong] vreg=-1
   mov r11, [r11]         <=== second line added by the new version
   mov edx, 1
   call __gmpz_set_ui
   # Info --> registers released
   # -----------------------------------------
   # basic --> For i = 1 To max
   # -----------------------------------------


Duplicated heading in the a64 file

Code: Select all

.intel_syntax noprefix
.file "circle of given radius to 2 points.bas"
.section .text

# Info --> SSE41 not supported
.section .bss
.lcomm $mxcsr1,4,4
.lcomm $mxcsr2,4,4
.section .text
# Info --> registers released
.intel_syntax noprefix
.file "circle of given radius to 2 points.bas"

# Info --> SSE41 not supported
.section .bss
.lcomm $mxcsr1,4,4
.lcomm $mxcsr2,4,4
.section .text
# Info --> registers released

This is what I have for the moment, more to follow.
SARG
Posts: 904
Joined: May 27, 2005 7:15
Location: FRANCE

Re: Gas64 (no more use of gcc, only gas) :-)

Postby SARG » May 04, 2019 23:23

@all Hi,
Thank you for help, reports and encouraging words.
Nobody for testing under linux ? :-(

new version : http://users.freebasic-portal.de/sarg/fbcgas64.zip

@srvaldez
"the name fbc32_gas64 is confusing to me, I expected that it would produce a 64-bit executable"

I guess I missed something during my tests.....
Now fbc32_gas64 produces a 64bit executable by forcing another option (FB_CPUTYPE_X86_64 --> FB_COMPOPT_CPUTYPE)
Otherwise '-arch 64 -gen gas64 etc' were necessary.

So fbc32_gas64 <name>.bas is now enough. Just let -R to keep the a64 file if needed.

-naked procedures failing
They were yet not handled and as the parameter names are empty (don't know why) the compiler crashed.
Now that's fixed and no prolog neither epilog are generated in case of naked procedures.

@frisian
"Freebasic and GCC simply cast the signed integer into the unsigned integer, in other words they simply dump the result into the unsigned integer without considering the sign.
For now it would be best to follow this behavior.
The only problem would be if with a double number that is greater then 2^31 that is converted into 32bit integer.
It's possible to handle the sign, this would add 4 or 5 lines of extra code."

Anyway using the command line "fbc -s console -arch 64 -RR -R -v -target linux-x86_64 -Wc -mabi=sysv,-msse4.1 bug.bas" I get an asm version without SSE42 features so I'm going to look at how things are done for uinteger converting.

-select case issue is fixed.

-asm name used as variable name is fixed. Every variable name is prefixed by an underscore. Maybe some collateral effects.

-repeated and added lines issues are fixed.

-duplicated header issue ???? I can't reproduce the case. Is there an include at the top of the code file ?

Waiting for more issues I hope not too much :-)

@srvaldez,Xusinboy Bekchanov
I don't forget your other reports, need a bit of time.
frisian
Posts: 249
Joined: Oct 08, 2009 17:25

Re: Gas64 (no more use of gcc, only gas) :-)

Postby frisian » May 05, 2019 20:10

@SARG

-select case issue is fixed.

-asm name used as variable name is fixed. Every variable name is prefixed by an underscore. Maybe some collateral effects.

-repeated and added lines issues are fixed.

Can confirm that these items has been fixed.
duplicated header issue ???? I can't reproduce the case. Is there an include at the top of the code file ?

No a include but a #Lang "qb" tag. Program will compile and run if the double header is reduced to a single header.

These two line generate a error (Xusinboy Bekchanov problem).
mov r11, WORD PTR -268[rbp] Error: incorrect register `r11' used with `w' suffix
cmp WORD PTR -120[rbp], r11 Error: incorrect register `r11' used with `w' suffix
If r11 is changed into r11w the program compiles and run correctly. A check needs to made if both operands are of the same size.

R11 (qword),R118d (lower dword), R11w (lowest word), R11b (lowest byte).

Managed to reduce a problem into small program.

Code: Select all

dim as integer array(1)
dim as integer sum, i, j = 1

array(0) = 1
array(1) = 2

print array(i) + array(j)
'sum = array(i) + array(j)

sleep
end

the a64 file

Code: Select all

.intel_syntax noprefix
.file "test.bas"
.section .text

# Info --> SSE41 not supported
.section .bss
.lcomm $mxcsr1,4,4
.lcomm $mxcsr2,4,4
.section .text
# Info --> registers released
# Info --> =============================================================================
# Info --> ===== Proc begin : main / main =====
# Info --> =============================================================================
   # Info --> stk4=112 reserved space for saving registers when proc calls
   # Info --> registers released
   # Info --> proc shared public declared parsed hasalias mainproc procemitted  cdecl [long]
   .text
   # Info --> Not accessed --> not used ??
   .globl main
main:
   # Info --> usefull ? [long] main( [long] ___FB_ARGC__, [zstring ptr ptr] ___FB_ARGV__ )
   push rbp
   mov  rbp,rsp
   sub rsp, 256
   call __main
   # Info --> paramvar=___FB_ARGC__ real typ=[long] symbgetlen=4
   # Info --> var local parambyval declared __FB_ARGC__ [long]
   # Info --> lgt=4 real=4
   mov DWORD PTR 16[rbp], ecx
   # Info --> paramvar=___FB_ARGV__ real typ=[zstring ptr ptr] symbgetlen=8
   # Info --> var local parambyval declared argv __FB_ARGV__ [zstring ptr ptr]
   # Info --> lgt=8 real=8
   mov QWORD PTR 24[rbp], rdx
   # Info --> localvar _fb$result
   # Info --> fb$result _fb$result
   # Info --> symbdump=var local funcresult declared implicit fb$result [long]
   # Info --> lgt=4 real=4
   # Info --> var total size=4
   # Info --> stk=112
   # Info --> stk1=116
   # Info --> localvar _ARRAY
   # Info --> ARRAY _ARRAY
   # Info --> symbdump=var local declared ARRAY(0 to 1) [integer]
   # Info --> Is an array
   # Info --> lgt=8 real=16
   # Info --> var total size=16
   # Info --> stk=116
   # Info --> stk1=136
   # Info --> localvar _Lt_0004
   # Info --> Lt_0004 _Lt_0004
   # Info --> symbdump=var local descriptor implicit Lt_0004 [struct $FBARRAY1<u7INTEGER>]
   # Info --> lgt=64 real=64
   # Info --> var total size=64
   # Info --> stk=136
   # Info --> length udt=64 natalign=8 unpadlgt=64
   # Info --> stk1=200
   # Info --> localvar _SUM
   # Info --> SUM _SUM
   # Info --> symbdump=var local declared SUM [integer]
   # Info --> lgt=8 real=8
   # Info --> var total size=8
   # Info --> stk=200
   # Info --> stk1=208
   # Info --> localvar _I
   # Info --> I _I
   # Info --> symbdump=var local declared I [integer]
   # Info --> lgt=8 real=8
   # Info --> var total size=8
   # Info --> stk=208
   # Info --> stk1=216
   # Info --> localvar _J
   # Info --> J _J
   # Info --> symbdump=var local declared J [integer]
   # Info --> lgt=8 real=8
   # Info --> var total size=8
   # Info --> stk=216
   # Info --> stk1=224
   # Info --> addrof _fb$result+-116 [long]
   # Info --> v1=var fb$result ofs=-116 [long] symbdump=var local funcresult accessed declared implicit fb$result [long]
   # Info --> vr=reg 0 [long ptr]
   # Info --> virtual register =0 real register=r11
   # Info --> marked as used register=r11
#O4lea r11, -116[rbp]
   # Info --> memclear vr0 [long ptr]
   # Info --> v1=reg 0 [long ptr]
   # Info --> v2=imm 4 [integer]
   # Info --> virtual register =0 real register=r11
   # Info --> Release done for register=r11
   # Info --> OPTIMIZATION 4 (lea)
   # Info --> END OF OPTIMIZATION4
   #O4mov DWORD PTR [r11], 0
   mov DWORD PTR -116[rbp], 0 #Optim 4
   # Info --> call fb_Init / mang=fb_Init
   # Info --> vr=<NULL>
   # Info --> level=1
   # Info --> arg ___FB_ARGC__+16 [long]
   # Info --> arg=var __FB_ARGC__ ofs=16 [long] symbdump=var local parambyval accessed declared __FB_ARGC__ [long] vreg=-1
   mov ecx, 16[rbp]
   # Info --> arg ___FB_ARGV__+24 [zstring ptr ptr]
   # Info --> arg=var __FB_ARGV__ ofs=24 [zstring ptr ptr] symbdump=var local parambyval accessed declared argv __FB_ARGV__ [zstring ptr ptr] vreg=-1
   mov rdx, 24[rbp]
   # Info --> arg 0 [long]
   # Info --> arg=imm 0 [long] vreg=-1
   xor r8d, r8d
   call fb_Init
   .Lt_0002: #label not mangled=.Lt_0002
   # -----------------------------------------
   # basic --> dim as integer array(1)
   # -----------------------------------------
   # Info --> addrof _ARRAY+-136 [integer]
   # Info --> v1=var ARRAY ofs=-136 [integer] symbdump=var local accessed declared ARRAY(0 to 1) [integer]
   # Info --> vr=reg 1 [integer ptr]
   # Info --> virtual register =1 real register=r11
   # Info --> marked as used register=r11
#O5lea r11, -136[rbp]
   # Info --> memclear vr1 [integer ptr]
   # Info --> v1=reg 1 [integer ptr]
   # Info --> v2=imm 16 [integer]
   # Info --> virtual register =1 real register=r11
   # Info --> Release done for register=r11
   # Info --> OPTIMIZATION 5 (lea)
   # Info --> END OF OPTIMIZATION5
   #O5mov r10, r11
   lea r10, -136[rbp] #Optim 5
   mov QWORD PTR 0[r10], 0
   mov QWORD PTR 8[r10], 0
   # Info --> addrof _ARRAY+-136 [integer]
   # Info --> v1=var ARRAY ofs=-136 [integer] symbdump=var local accessed declared ARRAY(0 to 1) [integer]
   # Info --> vr=reg 2 [integer ptr]
   # Info --> virtual register =2 real register=r11
   # Info --> marked as used register=r11
   lea r11, -136[rbp]
   # Info --> store _Lt_0004+-200 [integer ptr] := vr2 [integer ptr]
   # Info --> v1=var Lt_0004 ofs=-200 [integer ptr] symbdump=var local descriptor accessed implicit Lt_0004 [struct $FBARRAY1<u7INTEGER>]
   # Info --> v2=reg 2 [integer ptr]
   # Info --> virtual register =2 real register=r11
   # Info --> Release done for register=r11
   mov -200[rbp], r11
   # Info --> addrof _ARRAY+-136 [integer]
   # Info --> v1=var ARRAY ofs=-136 [integer] symbdump=var local accessed declared ARRAY(0 to 1) [integer]
   # Info --> vr=reg 3 [integer ptr]
   # Info --> virtual register =3 real register=r11
   # Info --> marked as used register=r11
   lea r11, -136[rbp]
   # Info --> store _Lt_0004+-192 [integer ptr] := vr3 [integer ptr]
   # Info --> v1=var Lt_0004 ofs=-192 [integer ptr] symbdump=var local descriptor accessed implicit Lt_0004 [struct $FBARRAY1<u7INTEGER>]
   # Info --> v2=reg 3 [integer ptr]
   # Info --> virtual register =3 real register=r11
   # Info --> Release done for register=r11
   mov -192[rbp], r11
   # Info --> store _Lt_0004+-184 [integer] := 16 [integer]
   # Info --> v1=var Lt_0004 ofs=-184 [integer] symbdump=var local descriptor accessed implicit Lt_0004 [struct $FBARRAY1<u7INTEGER>]
   # Info --> v2=imm 16 [integer]
   mov QWORD PTR -184[rbp], 16
   # Info --> store _Lt_0004+-176 [integer] := 8 [integer]
   # Info --> v1=var Lt_0004 ofs=-176 [integer] symbdump=var local descriptor accessed implicit Lt_0004 [struct $FBARRAY1<u7INTEGER>]
   # Info --> v2=imm 8 [integer]
   mov QWORD PTR -176[rbp], 8
   # Info --> store _Lt_0004+-168 [integer] := 1 [integer]
   # Info --> v1=var Lt_0004 ofs=-168 [integer] symbdump=var local descriptor accessed implicit Lt_0004 [struct $FBARRAY1<u7INTEGER>]
   # Info --> v2=imm 1 [integer]
   mov QWORD PTR -168[rbp], 1
   # Info --> store _Lt_0004+-160 [integer] := 2 [integer]
   # Info --> v1=var Lt_0004 ofs=-160 [integer] symbdump=var local descriptor accessed implicit Lt_0004 [struct $FBARRAY1<u7INTEGER>]
   # Info --> v2=imm 2 [integer]
   mov QWORD PTR -160[rbp], 2
   # Info --> store _Lt_0004+-152 [integer] := 0 [integer]
   # Info --> v1=var Lt_0004 ofs=-152 [integer] symbdump=var local descriptor accessed implicit Lt_0004 [struct $FBARRAY1<u7INTEGER>]
   # Info --> v2=imm 0 [integer]
   mov QWORD PTR -152[rbp], 0
   # Info --> store _Lt_0004+-144 [integer] := 1 [integer]
   # Info --> v1=var Lt_0004 ofs=-144 [integer] symbdump=var local descriptor accessed implicit Lt_0004 [struct $FBARRAY1<u7INTEGER>]
   # Info --> v2=imm 1 [integer]
   mov QWORD PTR -144[rbp], 1
   # Info --> registers released
   # -----------------------------------------
   # basic --> dim as integer sum, i, j = 1
   # -----------------------------------------
   # Info --> addrof _SUM+-208 [integer]
   # Info --> v1=var SUM ofs=-208 [integer] symbdump=var local accessed declared SUM [integer]
   # Info --> vr=reg 4 [integer ptr]
   # Info --> virtual register =4 real register=r11
   # Info --> marked as used register=r11
#O4lea r11, -208[rbp]
   # Info --> memclear vr4 [integer ptr]
   # Info --> v1=reg 4 [integer ptr]
   # Info --> v2=imm 8 [integer]
   # Info --> virtual register =4 real register=r11
   # Info --> Release done for register=r11
   # Info --> OPTIMIZATION 4 (lea)
   # Info --> END OF OPTIMIZATION4
   #O4mov QWORD PTR [r11], 0
   mov QWORD PTR -208[rbp], 0 #Optim 4
   # Info --> addrof _I+-216 [integer]
   # Info --> v1=var I ofs=-216 [integer] symbdump=var local accessed declared I [integer]
   # Info --> vr=reg 5 [integer ptr]
   # Info --> virtual register =5 real register=r11
   # Info --> marked as used register=r11
#O4lea r11, -216[rbp]
   # Info --> memclear vr5 [integer ptr]
   # Info --> v1=reg 5 [integer ptr]
   # Info --> v2=imm 8 [integer]
   # Info --> virtual register =5 real register=r11
   # Info --> Release done for register=r11
   # Info --> OPTIMIZATION 4 (lea)
   # Info --> END OF OPTIMIZATION4
   #O4mov QWORD PTR [r11], 0
   mov QWORD PTR -216[rbp], 0 #Optim 4
   # Info --> store _J+-224 [integer] := 1 [integer]
   # Info --> v1=var J ofs=-224 [integer] symbdump=var local accessed declared J [integer]
   # Info --> v2=imm 1 [integer]
   mov QWORD PTR -224[rbp], 1
   # Info --> registers released
   # -----------------------------------------
   # basic --> array(0) = 1
   # -----------------------------------------
   # Info --> store _ARRAY+-136 [integer] := 1 [integer]
   # Info --> v1=var ARRAY ofs=-136 [integer] symbdump=var local accessed declared ARRAY(0 to 1) [integer]
   # Info --> v2=imm 1 [integer]
   mov QWORD PTR -136[rbp], 1
   # Info --> registers released
   # -----------------------------------------
   # basic --> array(1) = 2
   # -----------------------------------------
   # Info --> store _ARRAY+-128 [integer] := 2 [integer]
   # Info --> v1=var ARRAY ofs=-128 [integer] symbdump=var local accessed declared ARRAY(0 to 1) [integer]
   # Info --> v2=imm 2 [integer]
   mov QWORD PTR -128[rbp], 2
   # Info --> registers released
   # -----------------------------------------
   # basic --> print array(i) + array(j)
   # -----------------------------------------
   # Info --> bop _I+-216 [integer] SHL 3 [integer]
   # Info --> v1=var I ofs=-216 [integer] symbdump=var local accessed declared I [integer]
   # Info --> v2=imm 3 [integer]
   # Info --> vr=reg 6 [integer]
   # Info --> Vr<>0 op =>shl
   # Info --> marked as used register=r11
   mov r11, QWORD PTR -216[rbp]
   shl r11, 3
   # Info --> bop _J+-224 [integer] SHL 3 [integer]
   # Info --> v1=var J ofs=-224 [integer] symbdump=var local accessed declared J [integer]
   # Info --> v2=imm 3 [integer]
   # Info --> vr=reg 7 [integer]
   # Info --> Vr<>0 op =>shl
   # Info --> marked as used register=r10
   mov r10, QWORD PTR -224[rbp]
   shl r10, 3
   # Info --> bop _ARRAY+vr6 [integer]+-136 [integer] + _ARRAY+vr7 [integer]+-136 [integer]
   # Info --> v1=idx ARRAY ofs=-136 [integer] vidx=<reg 6 [integer]> symbdump=var local accessed declared ARRAY(0 to 1) [integer]
   # Info --> v2=idx ARRAY ofs=-136 [integer] vidx=<reg 7 [integer]> symbdump=var local accessed declared ARRAY(0 to 1) [integer]
   # Info --> vr=reg 8 [integer]
   # Info --> Vr<>0 op =>add
   # Info --> virtual register =6 real register=r11
   # Info --> virtual register =7 real register=r10
   lea r8, -136[rbp]
   lea r8, -136[rbp]
   # Info --> marked as used register=r8
   # Info --> Release done for register=r11
   mov r8, QWORD PTR [r8+r11]
   add r8, QWORD PTR [r8+r10]
   # Info --> CONVERTING vr9 [longint] := vr8 [integer]
   # Info --> v1=reg 9 [longint] xx 9
   # Info --> v2=reg 8 [integer] xx 8
   # Info --> no convert as exactly same datatype
   # Info --> call fb_PrintLongint / mang=fb_PrintLongint
   # Info --> vr=<NULL>
   # Info --> level=1
   # Info --> arg 0 [long]
   # Info --> arg=imm 0 [long] vreg=-1
   xor ecx, ecx
   # Info --> arg vr8 [integer]
   # Info --> arg=reg 8 [integer] vreg=8
   # Info --> virtual register =8 real register=r8
   # Info --> Release done for register=r8
   mov rdx, r8
   # Info --> arg 1 [long]
   # Info --> arg=imm 1 [long] vreg=-1
   mov r8d, 1
   mov QWORD PTR -72[rbp], r10  #NO_OPTIM
   call fb_PrintLongint
   mov r10, QWORD PTR -72[rbp] #NO_OPTIM
   # Info --> registers released
   # -----------------------------------------
   # basic --> sleep
   # -----------------------------------------
   # Info --> call fb_Sleep / mang=fb_Sleep
   # Info --> vr=<NULL>
   # Info --> level=1
   # Info --> arg -1 [long]
   # Info --> arg=imm -1 [long] vreg=-1
   mov rcx, -1
   call fb_Sleep
   # Info --> registers released
   # -----------------------------------------
   # basic --> end
   # -----------------------------------------
   # Info --> call fb_End / mang=fb_End
   # Info --> vr=<NULL>
   # Info --> level=1
   # Info --> arg 0 [long]
   # Info --> arg=imm 0 [long] vreg=-1
   xor ecx, ecx
   call fb_End
   # Info --> registers released
   .Lt_0003: #label not mangled=.Lt_0003
   # Info --> call fb_End / mang=fb_End
   # Info --> vr=<NULL>
   # Info --> level=1
   # Info --> arg 0 [long]
   # Info --> arg=imm 0 [long] vreg=-1
   xor ecx, ecx
   call fb_End
   # Info --> loadres _fb$result+-116 [long]
   # Info --> v1=var fb$result ofs=-116 [long] symbdump=var local funcresult accessed declared implicit fb$result [long]
   # Info --> vr=reg 10 [long]
   mov eax, -116[rbp]
   # Info --> stk=224
   # Info --> stk5=256

   mov rsp,rbp
   pop rbp
   ret
# Info --> ===== End of proc =====

   # Info -->  __fb_ZTS6Object
   # Info --> symbdump=var shared extern hasalias <unnamed> alias "__fb_ZTS6Object" [struct FB_RTTI$]
   # Info --> Is extern so not defined here
   # Info --> {fbsc} Lt_0000
   # Info --> symbdump=var shared literal const hasalias {fbsc} alias "Lt_0000" [zstring]
   # Info --> Not accessed

The problem is in the line print array(i) + array(j). Isolated that part and removed the info lines.
# -----------------------------------------
# basic --> print array(i) + array(j)
# -----------------------------------------
mov r11, QWORD PTR -216[rbp]
shl r11, 3
mov r10, QWORD PTR -224[rbp]
shl r10, 3
R11 contains i*8, R10 contains j*8 OK.
lea r8, -136[rbp]
R8 now points to the start in memory for array() OK.
lea r8, -136[rbp]
Again.
# Info --> Release done for register=r11
mov r8, QWORD PTR [r8+r11]
R8 now contains the value of array(0) = 1
add r8, QWORD PTR [r8+r10]
Now we have a problem R8 does not point to the start of array() but contains the value 1.
It points to a wrong place in memory. The program crashes (safety feature in processor ???).
Also a release for register R10 can be done at these stage.

The rest is correct.
xor ecx, ecx
mov rdx, r8
mov r8d, 1
mov QWORD PTR -72[rbp], r10 #NO_OPTIM
call fb_PrintLongint
mov r10, QWORD PTR -72[rbp] #NO_OPTIM

What can be done about the lines.
lea r8, -136[rbp]
lea r8, -136[rbp]
mov r8, QWORD PTR [r8+r11]
add r8, QWORD PTR [r8+r10]

You could go for this.
mov r8, QWORD PTR -136[rbp+r11]
add r8, QWORD PTR -136[rbp+r10]

Or even this one wil work.
mov r8, QWORD PTR -136[rbp][r11]
add r8, QWORD PTR -136[rbp][r10]

Tested both solutions and they both work.

Plasma.bas, gives a few error messages.

Code: Select all

' Computer Graphics Tutorial (lodev.org), last example

#Define dist(a, b, c, d) Sqr(((a - c) * (a - c) + (b - d) * (b - d)))

Const As ULong w = 256
Const As ULong h = 256
ScreenRes w, h, 24
WindowTitle ("Plasma effect")

Dim As ULong x, y
Dim As UByte c
Dim As Double time_, value

Do
    time_ += .99
    ScreenLock
    For x = 0 To w -1
        For y = 0 To h -1
            value = Sin(dist(x + time_, y, 128, 128) / 8) _
            + Sin(dist(x, y, 64, 64) / 8) _
            + Sin(dist(x, y + time_ / 7, 192, 64) / 7) _
            + Sin(dist(x, y, 192, 100) / 8) + 4
            ' c = Int(value) * 32
            c = int(value * 32)
            PSet(x, y), RGB(c, c * 2, 255 - c)
        Next
    Next
    ScreenUnLock
    Sleep 1

    If Inkey <> "" Or Inkey = Chr(255) + "k" Then
        End
    End If

Loop

Code: Select all

Plasma effect.a64: Assembler messages:
Plasma effect.a64:820: Error: no such instruction: `found AN ERROR:no free reg use RAX'
Plasma effect.a64:1089: Error: no such instruction: `found AN ERROR:virtual register=64 no real register corresponding,using KREG_XXX'
Plasma effect.a64:1093: Error: bad expression
Plasma effect.a64:1093: Error: junk `X_Q' after expression
assembling failed: 'C:\FBC106win64\bin\win64\as.exe' terminated with exit code 1

A look in the a64 file shows that the compiler runs out of free registers. The problem is that some registers can be freed after use but that does not happen.I have a few other programs that have the same problem even worser than this one.

Regards.
frisian
Posts: 249
Joined: Oct 08, 2009 17:25

Re: Gas64 (no more use of gcc, only gas) :-)

Postby frisian » May 10, 2019 20:43

@SARG
Waiting for more issues I hope not too much :-)

Problem with the latest version, it changes some code that was correct into code that crashes the program.
program hailstone.bas. Works with the version from 1 May, but not with the version from 4 May.

Code: Select all

Function hailstone_fast(number As ULongInt) As ULongInt

    ' faster version
    ' only counts the sequence

    Dim As ULongInt count = 1

    While number <> 1
        If (number And 1) = 1 Then
            number += number Shr 1 + 1  ' 3*n+1 and n/2 in one
            count += 2
        Else
            number Shr= 1 ' divide number by 2
            count += 1
        End If
    Wend

    Return count

End Function

Sub hailstone_print(number As ULongInt)

    ' print the number and sequence

    Dim As ULongInt count = 1

    Print "sequence for number "; number
    Print Using "########"; number;   'starting number

    While number <> 1
        If (number And 1) = 1 Then
            number = number * 3 + 1   ' n * 3 + 1
            count += 1
        Else
            number = number \ 2       ' n \ 2
            count += 1
        End If
        Print Using "########"; number;
    Wend

    Print : Print
    Print "sequence length = "; count
    Print
    Print String(79,"-")

End Sub

Function hailstone(number As ULongInt) As ULongInt

    ' normal version
    ' only counts the sequence

    Dim As ULongInt count = 1

    While number <> 1
        If (number And 1) = 1 Then
            number = number * 3 + 1 ' n * 3 + 1
            count += 1
        End If
        number = number \ 2 ' divide number by 2
        count += 1
    Wend

    Return count

End Function

' ------=< MAIN >=------

Dim As ULongInt number
Dim As UInteger x, max_x, max_seq

hailstone_print(27)
Print

For x As UInteger = 1 To 100000
    number = hailstone(x)
    If number > max_seq Then
        max_x = x
        max_seq = number
    End If
Next

Print  "The longest sequence is for "; max_x; ", it has a sequence length of "; max_seq

' empty keyboard buffer
While Inkey <> "" : Wend
Print : Print : Print "hit any key to end program"
Sleep
End

snippet of a64 file that is working. (1 May)

Code: Select all

   # -----------------------------------------
   # basic --> Print "sequence for number "; number
   # -----------------------------------------
   # Info --> call fb_StrAllocTempDescZEx / mang=fb_StrAllocTempDescZEx
   # Info --> vr=reg 0 [string ptr]
   # Info --> level=2
   # Info --> arg Lt_001F [zstring ptr]
   # Info --> arg=ofs {fbsc}sequence for number  [zstring ptr] symbdump=var shared literal const accessed hasalias {fbsc}sequence for number  alias "Lt_001F" [zstring] vreg=-1
   lea rcx, Lt_001F[rip+0]
   # Info --> arg 20 [integer]
   # Info --> arg=imm 20 [integer] vreg=-1
   mov edx, 20
   call fb_StrAllocTempDescZEx
   # Info --> virtual register =0 real register=r11
   # Info --> marked as used register=r11
   mov r11, rax
   # Info --> call fb_PrintString / mang=fb_PrintString
   # Info --> vr=<NULL>
   # Info --> level=1
   # Info --> arg 0 [long]
   # Info --> arg=imm 0 [long] vreg=-1
   xor ecx, ecx
   # Info --> arg vr0 [string ptr]
   # Info --> arg=reg 0 [string ptr] vreg=0
   # Info --> virtual register =0 real register=r11
   # Info --> Release done for register=r11
   mov rdx, r11
   # Info --> arg 0 [long]
   # Info --> arg=imm 0 [long] vreg=-1
   xor r8d, r8d
   call fb_PrintString
   # Info --> call fb_PrintULongint / mang=fb_PrintULongint
   # Info --> vr=<NULL>
   # Info --> level=1
   # Info --> arg 0 [long]
   # Info --> arg=imm 0 [long] vreg=-1
   xor ecx, ecx
   # Info --> arg NUMBER+16 [ulongint]
   # Info --> arg=var NUMBER ofs=16 [ulongint] symbdump=var local parambyval accessed declared NUMBER [ulongint] vreg=-1
   mov rdx, 16[rbp]
   # Info --> arg 1 [long]
   # Info --> arg=imm 1 [long] vreg=-1
   mov r8d, 1
   call fb_PrintULongint
   # Info --> registers released
   # -----------------------------------------
   # basic --> Print Using "########"; number;   'starting number
   # -----------------------------------------

same part of the code with the incorrect part. (4 May)

Code: Select all

   # -----------------------------------------
   # basic --> Print "sequence for number "; number
   # -----------------------------------------
   # Info --> call fb_StrAllocTempDescZEx / mang=fb_StrAllocTempDescZEx
   # Info --> vr=reg 0 [string ptr]
   # Info --> level=2
   # Info --> arg Lt_001F [zstring ptr]
   # Info --> arg=ofs {fbsc}sequence for number  [zstring ptr] symbdump=var shared literal const accessed hasalias {fbsc}sequence for number  alias "Lt_001F" [zstring] vreg=-1
   lea rcx, Lt_001F[rip+0]
   # Info --> arg 20 [integer]
   # Info --> arg=imm 20 [integer] vreg=-1
   mov edx, 20
   call fb_StrAllocTempDescZEx
   # Info --> virtual register =0 real register=r11
   # Info --> marked as used register=r11
   mov r11, rax
   # Info --> call fb_PrintString / mang=fb_PrintString
   # Info --> vr=<NULL>
   # Info --> level=1
   # Info --> arg 0 [long]
   # Info --> arg=imm 0 [long] vreg=-1
   xor ecx, ecx
   # Info --> arg vr0 [string ptr]
   # Info --> arg=reg 0 [string ptr] vreg=0
   # Info --> taking saved rsi
#O6mov rax, -40[rbp]
   # Info --> OPTIMIZATION 6
   # Info --> END OF OPTIMIZATION6
   #O6mov rdx, rax
   mov rdx, -40[rbp] #Optim 6
   # Info --> arg 0 [long]
   # Info --> arg=imm 0 [long] vreg=-1
   xor r8d, r8d
   mov QWORD PTR -80[rbp], r11  #NO_OPTIM
   call fb_PrintString
   mov r11, QWORD PTR -80[rbp] #NO_OPTIM
   # Info --> call fb_PrintULongint / mang=fb_PrintULongint
   # Info --> vr=<NULL>
   # Info --> level=1
   # Info --> arg 0 [long]
   # Info --> arg=imm 0 [long] vreg=-1
   xor ecx, ecx
   # Info --> arg _NUMBER+16 [ulongint]
   # Info --> arg=var NUMBER ofs=16 [ulongint] symbdump=var local parambyval accessed declared NUMBER [ulongint] vreg=-1
   mov rdx, 16[rbp]
   # Info --> arg 1 [long]
   # Info --> arg=imm 1 [long] vreg=-1
   mov r8d, 1
   mov QWORD PTR -80[rbp], r11  #NO_OPTIM
   call fb_PrintULongint
   mov r11, QWORD PTR -80[rbp] #NO_OPTIM
   # Info --> registers released
   # -----------------------------------------
   # basic --> Print Using "########"; number;   'starting number
   # -----------------------------------------

A few lines of info have been added and the value that is moved into rdx comes from the wrong places. The changed line lets the program crash.

Code: Select all

   # Info --> taking saved rsi
#O6mov rax, -40[rbp]
   # Info --> OPTIMIZATION 6
   # Info --> END OF OPTIMIZATION6
   #O6mov rdx, rax
   mov rdx, -40[rbp] #Optim 6


Other errors/incorrect behaviour.
Escaped string give wrong result, the escaped string is missing.

Code: Select all

print "start"
print !"test\ttest"
print "done"

sleep
end


wrong output.

Code: Select all

start

done


correct output.

Code: Select all

start
test    test
done


redim shared as byte ... does not work, it will result in a crash/exit .

Code: Select all

redim as byte array_1(1111)
print "lowerbound";lbound(array_1),"upperbound";ubound(array_1)

redim shared as integer array_2(2222)
print "lowerbound";lbound(array_2),"upperbound";ubound(array_2)

print "start array_3"
redim shared as byte array_3(3333)
print "done array_3"
print "lowerbound";lbound(array_3),"upperbound";ubound(array_3)

sleep
end

Output

Code: Select all

lowerbound 0  upperbound 1111
lowerbound 0  upperbound 2222
start array_3

Problem is in the ReDim Shared As Byte part.

Code: Select all

'example code from Freebasic manual

#If __FB_LANG__ = "qb"
#Define EXTCHAR Chr(0)
#Else
#Define EXTCHAR Chr(255)
#EndIf

Dim As String k

ScreenRes 640, 400 ' create a second window
Print
Print " Try closing the graphics window with a mouse click on the close window sign [x]"
Print " It will not work. Chr(255) + "; Chr(34, 107, 34); " is not detected."
WindowTitle "Press a key, mouse click on [x], or Escape to end"

Do

    k = InKey

    Select Case k

        Case "A" To "Z", "a" To "z": Print "Letter: " & k
        Case "1" To "9":             Print "Number: " & k

        Case Chr(32): Print "Space"

        Case Chr(27): Print "Escape"

        Case Chr(9): Print "Tab"

        Case Chr(8): Print "Backspace"

        Case Chr(32) To Chr(127)
            Print "Printable character: " & k

        Case EXTCHAR & "G": Print "Up Left / Home"
        Case EXTCHAR & "H": Print "Up"
        Case EXTCHAR & "I": Print "Up Right / PgUp"

        Case EXTCHAR & "K": Print "Left"
        Case EXTCHAR & "L": Print "Center"
        Case EXTCHAR & "M": Print "Right"

        Case EXTCHAR & "O": Print "Down Left / End"
        Case EXTCHAR & "P": Print "Down"
        Case EXTCHAR & "Q": Print "Down Right / PgDn"

        Case EXTCHAR & "R": Print "Insert"
        Case EXTCHAR & "S": Print "Delete"


        Case EXTCHAR & "k": Print "Close window / Alt-F4"

        Case EXTCHAR & Chr(59) To EXTCHAR & Chr(68)
            Print "Function key: F" & Asc(k, 2) - 58

        Case EXTCHAR & Chr(133) To EXTCHAR & Chr(134)
            Print "Function key: F" & Asc(k, 2) - 122

        Case Else
            If Len(k) = 2 Then
                Print Using "Extended character: chr(###, ###)"; Asc(k, 1); Asc(k, 2)
            ElseIf Len(k) = 1 Then
                Print Using "Character chr(###)"; Asc(k)
            End If

    End Select

    If k = Chr(27) Then Exit Do

    Sleep 1, 1

Loop

End


It should only print only print the key pressed or the mouse click made on the close window button [X]
Instead it keeps on printing Up Left / Home when there's no key pressed.
It will print chr(255)+"k" as "Extended character: chr(255, 107)" and not as "Close window / Alt-F4"
Output

Code: Select all

 Try closing the graphics window with a mouse click on the close window sign [x]
 It will not work. Chr(255) + "k" is not detected.
Up Left / Home
Up Left / Home
Up Left / Home
Up Left / Home
Up Left / Home
Up Left / Home
Up Left / Home
Up Left / Home
Up Left / Home
Up Left / Home
Up Left / Home
Up Left / Home
Up Left / Home
Up Left / Home
Up Left / Home
...


Regards.
SARG
Posts: 904
Joined: May 27, 2005 7:15
Location: FRANCE

Re: Gas64 (no more use of gcc, only gas) :-)

Postby SARG » May 14, 2019 23:44

Hi,
new version : http://users.freebasic-portal.de/sarg/fbcgas64.zip

@frisian
Sorry for my late reply, I wanted to fix most of issues.

1/ redim shared as byte issue : fixed (every pointer was byte sized instead integer sized...)
2/ close windows issue : fixed (some escape sequences not well handled)
3/ print "test/ttest" issue : fixed (same as above)
4/ hailstone program issue : fixed (happened with added lines for linux however should be existing before)
5/ incorrect register `r11' used with `w' suffix : fixed. I also found it when looking at the Xusinboy's report.

6/ adding of 2 array elements issue : not fixed, I know why but I'm still thinking how to solve it.
7/ lack of registers issue : not fixed, more time needed to implement register spilling
8/ Header duplicated. Post the file because I still can not reproduce it, "lang "qb" doesn't give this effect.

By the way could you separate clearly the different problems sometimes I don't see well where a new one begins. Otherwise every issue is always well explained :-)

@srvaldez
ioldouble is now working. issue fixed in the previous version.

@Xusinboy Bekchanov
The long time is due to the generation of the asm file 77Mo/1.6 million of lines...... I have not yet tested without all the comments but it should be better.
However some bugs fixed but the spilling of registers is always missing.
Xusinboy Bekchanov
Posts: 72
Joined: Jul 26, 2018 18:28

Re: Gas64 (no more use of gcc, only gas) :-)

Postby Xusinboy Bekchanov » May 15, 2019 4:29

SARG wrote:@Xusinboy Bekchanov
The long time is due to the generation of the asm file 77Mo/1.6 million of lines...... I have not yet tested without all the comments but it should be better.
However some bugs fixed but the spilling of registers is always missing.

Why that standard 32-bit version of the compiler works fast.
Yes, at compile time there are previous errors.
srvaldez
Posts: 2063
Joined: Sep 25, 2005 21:54

Re: Gas64 (no more use of gcc, only gas) :-)

Postby srvaldez » May 16, 2019 0:39

hello SARG
the program posted here viewtopic.php?p=236291#p236291
compiles OK but crashes when run
SARG
Posts: 904
Joined: May 27, 2005 7:15
Location: FRANCE

Re: Gas64 (no more use of gcc, only gas) :-)

Postby SARG » May 24, 2019 17:31

Hi,

New version : http://users.freebasic-portal.de/sarg/fbcgas64.zip
The link in my previous post pointed to an older version, sorry.

@srvaldez
- "complex.bas" issue : fixed (just some forgotten lines...)

@Xusinboy Bekchanov
Compilation times without writing comments (but always generated) are still too long, I have to investigate, maybe removing completly comments could improve the times.
However some bugs fixed (wrong register size with or/and, statics inside scope not defined in memory, optimizations badly handled, typos)
Compilation is now succesfull but execution ??? as I only got 3 windows with chinese characters then the application closes. Why ? My next task.

Other changes:
- missing underscore for variable names used in asm line
- missing underscore for procedure names (label/call)
- And, Xor and Or added for freeing registers.

Still pending register spilling and the adding of 2 array elements issue.
Xusinboy Bekchanov
Posts: 72
Joined: Jul 26, 2018 18:28

Re: Gas64 (no more use of gcc, only gas) :-)

Postby Xusinboy Bekchanov » May 25, 2019 10:42

SARG wrote:Compilation is now succesfull but execution ??? as I only got 3 windows with chinese characters then the application closes. Why ? My next task.

gdb says:
not in executable format: File format not recognized

And also, the compiled file is smaller than a compiled file with a standard 32-bit compiler.
srvaldez
Posts: 2063
Joined: Sep 25, 2005 21:54

Re: Gas64 (no more use of gcc, only gas) :-)

Postby srvaldez » May 26, 2019 16:12

hello SARG :-)
the following code fails to compile, however if you comment-out either sub cadd or sub csub then it compiles and runs OK

Code: Select all

type double_complex
   re as double
   im as double
end type

sub cadd naked cdecl(byref result as double_complex, byref x as double_complex, byref y as double_complex)
   asm
      movsd   xmm0, QWORD PTR [rdx+8]
      movsd   xmm1, QWORD PTR [rdx]
      addsd   xmm0, QWORD PTR [r8+8]
      addsd   xmm1, QWORD PTR [r8]
      movsd   QWORD PTR [rcx+8], xmm0
      movsd   QWORD PTR [rcx], xmm1
      ret
   end asm
end sub

sub csub naked cdecl(byref result as double_complex, byref x as double_complex, byref y as double_complex)
   asm
      movsd   xmm0, QWORD PTR [rdx+8]
      movsd   xmm1, QWORD PTR [rdx]
      subsd   xmm0, QWORD PTR [r8+8]
      subsd   xmm1, QWORD PTR [r8]
      movsd   QWORD PTR [rcx+8], xmm0
      movsd   QWORD PTR [rcx], xmm1
      ret
   end asm
end sub
      
dim as double_complex dx, dy, result

dx.re=0.5
dx.im=0.3
dy.re=.8
dy.im=.9

#ifdef cadd
   cadd(result, dx, dy)
   print result.re, result.im
#endif
#ifdef csub
   csub(result, dx, dy)
   print result.re, result.im
#endif
SARG
Posts: 904
Joined: May 27, 2005 7:15
Location: FRANCE

Re: Gas64 (no more use of gcc, only gas) :-)

Postby SARG » Jun 08, 2019 8:52

Hi all,

New version : http://users.freebasic-portal.de/sarg/fbcgas64.zip

Bugs fixed:
- adding of 2 array elements (frisian)
- crash when using naked procedures (cadd csub). In this case parameter names are not filled so issue to use them... (srvaldez)
- and some other ones

Changed:
- optimizations for memcopy/memclear

Added:
- spilling registers (when there are not enough free registers)

@Xusinboy Bekchanov
Even if -g is used no debug data is included so gdb can't work.
About size don't forget to add the rc file. On my side, even if execution is wrong, the size seems correct 1.6Mo.

Using Gprof (profiling) I try to find why compilation is so long however the result seems strange.

I don't know if it's ok to put -profile for only one module. If someone knows ?

Return to “Projects”

Who is online

Users browsing this forum: No registered users and 5 guests