Recent

Author Topic: assembler  (Read 3191 times)

Curt Carpenter

  • Hero Member
  • *****
  • Posts: 566
Re: assembler
« Reply #15 on: July 17, 2024, 05:28:09 pm »
For an example of ASM use in FPC, see /fpcsrc/rtl/i386/i386.inc

Thaddy

  • Hero Member
  • *****
  • Posts: 16196
  • Censorship about opinions does not belong here.
Re: assembler
« Reply #16 on: July 17, 2024, 05:33:31 pm »
Curt,
Fred is a seasoned programmer.
If he has a problem it is not about using assembler at all.
The problem he has is the tool chain. IOW the correct assembler and linker for the FreeBSD platform.

Maybe Marcov can help him, he is more versed in the BSD stuff, which I only run for tests in VM's.
If I smell bad code it usually is bad code and that includes my own code.

Fred vS

  • Hero Member
  • *****
  • Posts: 3414
    • StrumPract is the musicians best friend
Re: assembler
« Reply #17 on: July 17, 2024, 05:52:53 pm »
Thanks Thaddy for the adjective!

The problem is in the assembler code of system.ppu.
When cross-compiling fpc himself from Linux arm64 to FreeBSD aarch64, using the info of Pierre from there:
https://downloads.freepascal.org/fpc/snapshot/trunk/aarch64-freebsd/README-fpc-3.3.1.aarch64-freebsd.built.on.x86_64-linux

No problem, the cross-assembler works and assemble system.ppu.
But strangely on a real aarch64 FreeBSD (Rpi3 b) the compilation fails because unknown operand for the "official" as assembler.
See picture of previous post: https://forum.lazarus.freepascal.org/index.php/topic,67915.msg523881.html#msg523881

To resume: fpc 3.3.1 source to binary can be done by cross-compilation but not by direct-compilation.
It is not a big problem only if you want to recompile fpc using your Rpi.

 
« Last Edit: July 17, 2024, 06:19:35 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Curt Carpenter

  • Hero Member
  • *****
  • Posts: 566
Re: assembler
« Reply #18 on: July 17, 2024, 06:03:52 pm »
Curt,
Fred is a seasoned programmer.
If he has a problem it is not about using assembler at all.
The problem he has is the tool chain. IOW the correct assembler and linker for the FreeBSD platform.

Maybe Marcov can help him, he is more versed in the BSD stuff, which I only run for tests in VM's.

I understand that.  I was trying to update the info. I offered the OP Weiss yesterday.  Sorry for the confusion.

Fred vS

  • Hero Member
  • *****
  • Posts: 3414
    • StrumPract is the musicians best friend
Re: assembler
« Reply #19 on: July 17, 2024, 06:10:28 pm »
Hello Curt.

My fault, I shouldn't divert the OP subject. Excuse me.
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

Weiss

  • Full Member
  • ***
  • Posts: 187
Re: assembler
« Reply #20 on: July 18, 2024, 07:38:05 am »
gents, I totally took Curt's comment as directed to me, no confusion here. I also have no problem when my thread is stolen, unless we begin discussing politics or religion. Babes and motorcycles ok.

Seenkao

  • Hero Member
  • *****
  • Posts: 613
    • New ZenGL.
Re: assembler
« Reply #21 on: July 18, 2024, 08:22:19 am »
The compiler is pretty good at optimizing generated code and while it might have been fruitful to count cycles for old processors it is pretty much undoable to optimize for modern processors to such an extent that is becomes noticeable. Ofc for your particular use-case and setup you might be able to optimize the crap out of things but that doesn't guarantee for the same code to run as smooth on another setup or other use-case.
Компилятор FPC, к сожаленью, не очень хорош в оптимизации кода. Особенно это видно для ARM32/ARM64 архитектруры. Я скидывал проблемы с кодом в багтрекер, его ни кто не рассматривал. Не хотите это исправлять, значит не надо. (да, я знаю что это не просто всё исправить, и вполне возможно показанные мной проблемы взяли отметили для исправления в будущем).

Извиняюсь за оффтоп.


------------------------------------------------------
Google translate:
The compiler is pretty good at optimizing generated code and while it might have been fruitful to count cycles for old processors it is pretty much undoable to optimize for modern processors to such an extent that is becomes noticeable. Ofc for your particular use-case and setup you might be able to optimize the crap out of things but that doesn't guarantee for the same code to run as smooth on another setup or other use-case.
The FPC compiler, unfortunately, is not very good at optimizing code. This is especially noticeable for the ARM32/ARM64 architecture. I posted problems with the code in the bug tracker, but no one looked at it. If you don't want to fix it, then you don't have to. (yes, I know that it’s not easy to fix everything, and it’s quite possible that the problems I showed were taken and noted for correction in the future).

Sorry for the offtopic.
Rus: Стремлюсь к созданию минимальных и достаточно быстрых приложений.

Eng: I strive to create applications that are minimal and reasonably fast.
Working on ZenGL

TRon

  • Hero Member
  • *****
  • Posts: 3647
Re: assembler
« Reply #22 on: July 18, 2024, 08:31:25 am »
The FPC compiler, unfortunately, is not very good at optimizing code. This is especially noticeable for the ARM32/ARM64 architecture. I posted problems with the code in the bug tracker, but no one looked at it. If you don't want to fix it, then you don't have to. (yes, I know that it’s not easy to fix everything, and it’s quite possible that the problems I showed were taken and noted for correction in the future).
I am aware that FPC does not always produce the most efficient code, especially not for newly added cpu's/platforms. It is a lot of work and requires a special skill set e.g. not many people are proficient with optimizing generated assembler (for a particular CPU). It is getting better of the years though.

I don't consider it to be off-topic because one of the arguments used to to start writing (your own) assembler is because the compiler does such a shitty job (not my words).
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

 

TinyPortal © 2005-2018