Usenet.com

www.Usenet.com

Group Index

Comp Thread Archive from Usenet.com

<-- __Chronological__ --> <-- __Thread__ -->

Re: Intel compilers performance over itanium 2 (madison)



David Gay wrote:

"xpuente" <[EMAIL PROTECTED]> writes:


Ok... Is just a example. A real situation is a method like:

Boolean isChannelValid(unsigned ch) const

{return ( ((ch>=1)&&(ch<=m_SizeCV)) ? true : false ); }


What do you get for the functionally identical

{return (ch>=1)&&(ch<=m_SizeCV); }

? (wondering if the compiler writers didn't handle some unexpected
constructions very well)

That's a possibility (compilation as a pattern-matching problem).


The code should still be very short, even without using the predicate logic operations to merge the two tests.

(One of my favourite tricks when faced with logic like yours is to subtract the lower limit, and then do an unsigned comparison. This is always safe as long as the possible range is less than maximal.)

On IA64 the two range tests can be handled in parallel, while setting up the return values, then either merge the predicates, or do a logic AND on the two result halves.

I'd love to see the generated IA64 asm!

Terje

--
- <[EMAIL PROTECTED]>
"almost all programming can be viewed as an exercise in caching"




<-- __Chronological__ --> <-- __Thread__ -->


Usenet.com



Please check out one of the premium Usenet Newsgroup Service Providers below for access to Usenet.