• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
CodeWarrior-style inline assembly help...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CodeWarrior-style inline assembly help...


  • Subject: CodeWarrior-style inline assembly help...
  • From: Dave Thorup <email@hidden>
  • Date: Thu, 4 Aug 2005 11:10:00 -0400

OK, my problem is that we have an old file that has a large amount of assembly code (both vector code and scalar code) in it that was written using CodeWarrior-style inline assembly. The problem is that GCC chokes on it even though CodeWarrio-Style Inline Assembly is enabled for the target. GCC 3.3 is the worst, I get the following error message when it tries to compile the file:

internal compiler error: in emit_move_insn, at expr.c:3156

I thought I'd just have to rewrite the assembly using either intrinsics for the vector code or using just straight assembly in a .s file. Then I thought I'd try compiling it with GCC 4.0 and found that it almost compiles. There were a few problems that were easy to correct and now I'm down to just one compile error that shows up in three places.

The problem with GCC 4.0 is that it only supports Mac OS X 10.3.9 and later and we need to support 10.2. My understanding though is that the 10.3.9 and later requirment only applies to C++ code. If you compile straight C code (or Objective-C code) with no C++ then you should still be able to run on 10.2. Is this correct?

Since these assembly functions are just C functions then I thought that I could just make a library for them that is built with GCC 4.0 and then include that library into my target. Or, if there were a way to specify that only this file is compiled with GCC 4.0 and the rest of the target is compiled with GCC 3.3 then that would work too. Does anyone know of a way to do that?

Now to the problem I'm having with GCC 4.0. The main problem is that I haven't written any assembly in a long long time. I read a lot of it, I just don't write it. Here's the error that I get:

373:Parameter error: expression must be absolute (parameter 2)

Here's the code:

373:   lwz        r4,_usm_constants(RTOC)  // <== Error here
374:   li         r3,0                     // r3 = 0
375:   lfd        fp0,0(r4)                // fp0 = 0.0
376:   lfd        fp3,8(r4)                // fp3 = 2**32
377:   lfd        fp4,16(r4)               // fp4 = 2**31

_usm_constants is declared as:

static const unsigned long _usm_constants[] = {
        0x00000000, 0x00000000,        // 0.0
        0x41F00000, 0x00000000,        // 2**32
        0x41E00000, 0x00000000,        // 2**31
        0x43300000, 0x00000000,        //
};

So basically all the code is doing is loading some double-precision floating point constants. GCC doesn't seem to like the _usm_constants (RTOC) part of line 373. Does anyone know of a better way to load constants into floating point registers? Or does anyone know how to get this to work as it is? If there's a better way then I'd rather use that, but I'd just like to get it working.

Thanks!
_____________________________

Dave Thorup
Software Engineer
email@hidden

http://www.kuwan.net
Defaults Manager - The premier editor for Mac OS X's User Defaults / Preferences database.



_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: CodeWarrior-style inline assembly help...
      • From: Jeremy Sagan <email@hidden>
  • Prev by Date: Re: Template Problems
  • Next by Date: Re: dynamic_cast between modules
  • Previous by thread: Re: dynamic_cast between modules
  • Next by thread: Re: CodeWarrior-style inline assembly help...
  • Index(es):
    • Date
    • Thread