Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: interesting Paper on common macros for SSE/Altivec/Trimedia
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: interesting Paper on common macros for SSE/Altivec/Trimedia



hi,

I would love a more "standard" approach for this.
I would aslo love to see the list of other headers that you have found I only saw 1 one of them. (not counting macstl c++ template approach)


• I'm not an expert on the matter and maybe I only once a year I write this (or any assembler) kind of code, and it always takes me while to get used to the SIMD coding style and to remember the consequence of 15-bit multiplication with a 16bit multiplication etc.. (the vec_mradds discussion..) etc..

• Also some of these kind of headers try to generalize, but it would good to mention different sets that work maybe better on SSE and other better altivec.

For example today I looked at:

vSInt16 = vec_sl(vSInt16,vSInt16) translating to SSE
and I notice that it would be better to use

vSInt16 = _mm_slli_epi16(vSInt16, int)

So no vector at the end but an integer that shifts all the 8 SInt16 numbers with the same value.

So I created 2 macros:

#ifdef simd_SSE
	#define SHIFT_LEFT_vSInt16(theResult,theVec1,theVec2) \
		theResult = _mm_sll_epi16(theVec1,theVec2)
#else
	#define SHIFT_LEFT_vSInt16(theResult,theVec1,theVec2) \
		theResult = vec_sl(theVec1,theVec2))
#endif

#ifdef simd_SSE
	#define SHIFT_LEFT_ALL_vSInt16(theResult,theVar1,theShiftCount) \
		theResult = _mm_slli_epi16(theVar1,theShiftCount)
#else
	#define SHIFT_LEFT_ALL_vSInt16(theResult,theVar1,theShiftCount) \
		theResult = vec_sl(theVar1,(vSInt16)(theShiftCount))
#endif

of course static inline functions would be better for type checking but currently doing the quick and dirty way...


So it would be helpful to have some kind of wiki Doc kind of website that everybody could add some notes because the documentation that I found online (microsoft and intel) is very rudimentary and if you don't do these kind of things every day it takes you about 3 hours for one line of code. So in my case I would have added some extra notes to the wiki doc that in some case it is also good to consider _mm_slli_epi16 in certain cases)


Because I believe more clearer documentation could make it easier for people that aren't used to this, to consider using it.

so a s



On 23 Nov 2006, at 03:16, Ian Ollmann wrote:


It is probably worth having some sort of discussion on putting together a collaborative group of some kind on this problem. I've seen a couple of these headers now from multiple sources. They each seem to excel in some areas, but none seems to have arrived at the optimum translation for every instruction, so while one clearly this problem is one that needs a single solution, there doesn't seem to be one publicly available yet that does everything well.


Ultimately, the best place for something like this is probably gcc, provided they are interested, but some other distribution mechanism might work fine too.


_______________________________________________
Do not post admin requests to the list. They will be ignored.
PerfOptimization-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >interesting Paper on common macros for SSE/Altivec/Trimedia (From: Marc Van Olmen <email@hidden>)
 >Re: interesting Paper on common macros for SSE/Altivec/Trimedia (From: Glen Low <email@hidden>)
 >Re: interesting Paper on common macros for SSE/Altivec/Trimedia (From: Ian Ollmann <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.