Article View: comp.sys.mac.programmer.help
Article #67Re: [Altivec Newbie] optimizing current code?
From: Darrin Cardani
Date: Wed, 17 Jan 2001 23:31
Date: Wed, 17 Jan 2001 23:31
52 lines
3374 bytes
3374 bytes
In article <943r3l$hn2$1@nnrp1.deja.com>, petrock <petrock00@my-deja.com> wrote: > Can I simply enable the Altivec compile settings in my existing code and > recompile and it will have Altivec optimizations (At least the MacOS > functions)? like it kind of was with the 68k to PPC transition... Metrowerks compiler does not do this. If you check out <http://www.psrv.com/>, they make a vectorizing compiler for C, and they say that C++ and Fortran are on the way. I've never used it, so I don't know how well it works. > Are there any tutorials or good books on Altivec programming? You might search the MacHack web site or CDs to see if Doug Clarke's presentations about AltiVec are there. Everything I know about AltiVec I learned from Doug. Well, that and by making numerous mistakes on my own. :-) You can also get on the AltiVec list at www.altivec.org. > it seems to me that Altivec code is very close to Assembly. Assembly > isn't that easy to code with. Are their any libraries I can use to do > alot of the work for me? It's not that bad, really. You can even do crazy things like: v1 = vec_add (vec_sub(v1,v2), vec_add (v3,v4)); That's equivalent to v1 = (v1 - v2) + (v3 + v4); Personally, I try to keep things to one AltiVec instruction per line. It helps me optimize later, but there's no reason you have to do it that way. As others have said, there are various libraries available. Be careful of vMathLib, though, as the trig functions are wacked. They are either very buggy, or I'm using them in some unintended way. For example, the sin and cos functions will return values outside of the -1 to 1 range. It's always repeatable, and always the same result, but it's wrong, as far as I can tell. Hope that helps, Darrin -- Darrin Cardani Buena Software, Inc. - Macintosh Video, Graphics and Audio Contract Development http://www.buena.com/ dcardani@buena.com
Technical Details
Message-ID:
<170120011731277716%dcardani@buena.spamfree.com>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!isdnet!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!feed2.onemain.com!feed1.onemain.com!news-out.usenetserver.com!cyclone1.usenetserver.com!cyclone-pass-sjo.usenetserver.com!e420r-atl2.usenetserver.com.POSTED!dcardaniReferences:
<943r3l$hn2$1@nnrp1.deja.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 101ec9,a6671d8e4f3ed02f X-Google-Attributes: gid101ec9,public X-Google-Thread: 10bcce,a6671d8e4f3ed02f X-Google-Attributes: gid10bcce,public X-Google-Thread: f635e,a6671d8e4f3ed02f X-Google-Attributes: gidf635e,public X-Google-ArrivalTime: 2001-01-17 15:31:53 PST Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!isdnet!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!feed2.onemain.com!feed1.onemain.com!news-out.usenetserver.com!cyclone1.usenetserver.com!cyclone-pass-sjo.usenetserver.com!e420r-atl2.usenetserver.com.POSTED!dcardani Subject: Re: [Altivec Newbie] optimizing current code? From: Darrin Cardani <dcardani@buena.spamfree.com> Newsgroups: comp.sys.mac.programmer.help,comp.sys.mac.programmer.codewarrior,codewarrior.mac Message-ID: <170120011731277716%dcardani@buena.spamfree.com> References: <943r3l$hn2$1@nnrp1.deja.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-transfer-encoding: 8bit User-Agent: YA-NewsWatcher/5.0.1 Lines: 52 X-Complaints-To: abuse@usenetserver.com X-Abuse-Info: Please be sure to forward a copy of ALL headers X-Abuse-Info: Otherwise we will be unable to process your complaint properly. NNTP-Posting-Date: Wed, 17 Jan 2001 18:30:49 EST Organization: WebUseNet Corp http://www.usenetserver.com - Home of the fastest NNTP servers on the Net. Date: Wed, 17 Jan 2001 17:31:27 -0600