Exploiting dual mode operation

Mircea Namolaru NAMOLARU@il.ibm.com
Mon Apr 26 16:41:00 GMT 2004


Hello,

1. Trying to solve the sign extension removal problem using the live 
highpart 
information has some limitations. For instance in the following case 
(which
appears during computation of array addresses):

i = sign extension i1;
....
index = 64-bit shift of i  // the target and the source are 64 bits 

In some architectures we may get the same result without using an explicit 
sign
extension. As we understand it, your algorithm will found that the 
highpart  of 
"i" is live and the sign extension will not be discarded.

Another example is:
 
int i, s;
for (i = 0; i < N; i++)
{
   s1 = s + i;
   s = sign extend s1;
}
return s;
The sign extension is required for the return only, so the sign extension 
can be 
removed from the loop and placed before the return. The highpart of "s" is 
live,
but this information alone will not help to improve the code. 

2. To exploit the dual mode operation, for instructions that uses the 
result of 
explicit sign extensions we need to found if it is possible to get the 
same result 
via an instruction that doesn't require explicit sign extensions. 
Basically we 
need to found if: 

s1 = sign extend s
t1 = sign extend  t
result = inst s1, t1 

can be replaced by an instruction inst1:

result = inst1 s, t.

But this seems similar with what combine does, so the information 
from the description file should suffice.

3. One possible way for implementation is to use reaching definitions
to propagate the sign extensions forward right before the uses. This will 
create 
opportunities for combine and gcse to do the rest of the work afterward.

Another possible way is to extend gcse (but there are some issues that 
we still need to clarify).

Maybe there is a way to use your code (or part of it) ? 

Mircea and Leehod 




More information about the Gcc mailing list