RE: performance issues in simple arithmetic code

2011-04-28 Thread Simon Peyton-Jones
| cmm/CmmLex.x) to understand textual C--. Note that there is also a "new" C-- | representation hanging around that is not too interesting for you, since we don't | use it at all without the flag -fnew-codegen. Although ultimately we hope to move to the new rep and abandon the old one. Simon

Re: performance issues in simple arithmetic code

2011-04-28 Thread Edward Z. Yang
Excerpts from Denys Rtveliashvili's message of Thu Apr 28 04:41:48 -0400 2011: > Well.. I found some places in C-- compiler which are supposed to convert > division and multiplication by 2^n into shifts. And I believe these work > sometimes. > > However in this case I am a bit puzzled because eve

Re: performance issues in simple arithmetic code

2011-04-28 Thread Denys Rtveliashvili
Hi David, --- Question: can't it use cheap multiplication and shift instead of expensive division here? I know that such optimisation is implemented at least to some extent for C--. I suppose it also won't do anything smart for expressions like a*4 or a/4 for the same reason. T

Re: performance issues in simple arithmetic code

2011-04-28 Thread David Terei
On 27 April 2011 20:01, Denys Rtveliashvili wrote: > The lack of expected magic is in the assembler code: > --- > >     addq $16,%r12 >     cmpq 144(%r13),%r12 >     ja .Lcz1 >     movl $1117,%ecx >     movl $1113,%r10d >     movl $,%r11d >     movq 7(%rbx),%rax >     cqto >   

Re: performance issues in simple arithmetic code

2011-04-27 Thread Tyson Whitehead
On April 27, 2011 23:01:50 Denys Rtveliashvili wrote: > Question 1: what is the meaning of those magic numbers > -9223372036854775808, -6677706553, -7418931981405, -8257271295304186? > Question 2: under which circumstances those strange branches of > execution will be used and what those results wo

performance issues in simple arithmetic code

2011-04-27 Thread Denys Rtveliashvili
Hi, While trying to figure out why some of my code is very slow I have found that it is something related to division. Digging a bit deeper I found an example which shows some unexpected magic and a lack of the expected one. Before raising any tickets in trac I would like to consult with you r