• 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
Re: AltiVec on OSX in Cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AltiVec on OSX in Cocoa


  • Subject: Re: AltiVec on OSX in Cocoa
  • From: Brendan Younger <email@hidden>
  • Date: Sun, 11 Nov 2001 14:06:14 -0500

On Sunday, November 11, 2001, at 08:47 AM, Charles Jolley wrote:

MrC has really complete support for altivec, unfortunately, gcc is not quite as tailored to it.
The C extensions and the "vector" keyword are both fully supported, but the memory allocation is a little sketchy.
Stack-based vectors will be automatically aligned correctly, but AFAIK, there is no vec_malloc() which will guarantee 16-bit aligned memory blocks. So, you are stuck either rolling your own, or using NewPtr() (from Carbon). However, I have had some difficulties with NewPtr() (more specifically, DisposePtr()). Hence, I suggest using a custom struct which will hold both a pointer to the actual memory allocated and a pointer to the next 16-bit aligned memory address.

You know, the Performance documentation I was reading the other day states that the standard malloc always allocates memory on the heap aligned to 16-byte boundaries. It might be worth just trying with standard malloc first.

See /Developer/Documentation/Essentials/Performance/Performace.pdf, p22 (Understanding Malloc):

... The granularity of the blocks malloc returns is 16 bytes. So if you ask for 4 bytes, malloc consumes 16 bytes, and if you ask for 24 bytes, malloc will consume 32 bytes. ...

Yeah, sorry about that, silly me for reading the man pages . . .
"Malloc and free provide a general-purpose memory alloca-
tion package. Malloc returns a pointer to a block of at
least size bytes beginning on a long boundary."

But hey, if it works, so much the better.

Brendan Younger


  • Follow-Ups:
    • Re: AltiVec on OSX in Cocoa
      • From: Stuart Bryson <email@hidden>
References: 
 >Re: AltiVec on OSX in Cocoa (From: Charles Jolley <email@hidden>)

  • Prev by Date: Re: gcc 3.0.x
  • Next by Date: OT: Objective-C Compiler?
  • Previous by thread: Re: AltiVec on OSX in Cocoa
  • Next by thread: Re: AltiVec on OSX in Cocoa
  • Index(es):
    • Date
    • Thread