Welcome, Guest. Please login or register.

Author Topic: OT - assembler versus C for Amiga development  (Read 10565 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline SamuraiCrow

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2281
  • Country: us
  • Gender: Male
    • Show all replies
Re: Intuition questions...
« on: August 29, 2011, 05:23:25 PM »
Quote from: Franko;656712
@ Jose @ Golem

Afraid C is not the programming language for me for the simple reason that Golem said the generated code is waaay bigger (normally increasing the size by a third at least) and it's a lot slower and highly inefficient... :(


That's not a problem with the language, that is a problem with the compiler.  If Sidewinder and I can get Clang to work on AROS 68k, we'll have a bit newer compiler technology and maybe we'll get closer to parity with Assembly developers.

One example is that sometimes assembly programmers could pack 2 words in a long variable to get better register loading.  Clang does this if you use the PBQP register allocator.  I don't know of any existing Amiga compilers that do this.
 

Offline SamuraiCrow

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2281
  • Country: us
  • Gender: Male
    • Show all replies
Re: Intuition questions...
« Reply #1 on: August 29, 2011, 07:13:34 PM »
@Karlos

Could you split from post 11 onward into a separate thread?  I'd like to continue this discussion without going off-topic.
 

Offline SamuraiCrow

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2281
  • Country: us
  • Gender: Male
    • Show all replies
Re: Intuition questions...
« Reply #2 on: August 29, 2011, 07:43:47 PM »
Most of the reason you write C code isn't for performance but maintainability.

I've rewritten the hash function of my AmigaE hash table class in Assembly.  It cut out a lot of cruft but mostly the cruft was the result of E not supporting bit rotations.

In order to run it on a non-Classic Amiga, such as an AROS system, I had to also write the code in PortablE and it generated some hacky-looking C++ code but the GCC compiler knows how to convert a couple of shifts, and an OR to a rotate internally.  Now suddenly I don't have to worry about writing in a new Assembly code for my x86 AROS hosted environment for the Mac, nor for PPC AROS, nor anything else.

It's a tradeoff that's becoming increasingly biased against hand-optimized code beyond what C can offer.
 

Offline SamuraiCrow

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2281
  • Country: us
  • Gender: Male
    • Show all replies
Re: Intuition questions...
« Reply #3 on: August 29, 2011, 08:50:56 PM »
@CommodoreJohn

VBCC is largely C99 compliant.
 

Offline SamuraiCrow

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2281
  • Country: us
  • Gender: Male
    • Show all replies
Re: OT - assembler versus C for Amiga development
« Reply #4 on: August 29, 2011, 09:04:21 PM »
Quote from: Karlos;656774
Quite a few. If you can find it, DevPac was great. As I'm only writing subcomponents of code in assembler these days, I tend to use PhxAss. Failing that, I just inject assembler directly into C code when using gcc.


The author of PhxAss has written a newer Assembler that is more flexible.  See VAsm for details.
 

Offline SamuraiCrow

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2281
  • Country: us
  • Gender: Male
    • Show all replies
Re: Intuition questions...
« Reply #5 on: August 29, 2011, 10:12:43 PM »
Quote from: commodorejohn;656782
Hmm. How's the code quality?


Better than GCC.