Welcome, Guest. Please login or register.

Author Topic: Opinion Article : Amiga DE a Good Idea, Poor Execution  (Read 14571 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline olegil

  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 955
    • Show all replies
You're still wrong about needing to use assembly to get higher performance. The thing is, GCC creates assembly, then proceeds to _optimize_ that assembly code, before finally calling a separate program (which isn't part of GCC, it's part of the binutils package) called "as", which is an assembler. The part where assembly is needed is for things like:
direct IO access on x86 processors (need to call special instructions because it's not a memory address, it's an IO address etc)
timing loops (4 NOP instructions etc)

If it's the need for speed GCC can usually do it better. Or you can take the assembly output of GCC, go through it manually and tweak it, then save this as the basis for future compiles or work. But usually it's going to be very good.

What you should aim for is to understand how C gets translated into assembly, and avoid the pitfalls. And if you don't like to use stack much in assembly, why would you use it in C? That sort of things. I mean, a for-loop in C can be translated into a "decrease and branch on not zero" in assembly, which takes 2 instructions (one on m68k), plus a third (second) for initialising the value. Could you do a loop with less instructions if you were writing in assembly?