Advice needed how to avoid generation of extra sign_extends in .md file

Igor Shevlyakov igor@microunity.com
Thu Oct 3 18:07:00 GMT 2002


Hi everybody,

I wonder if somebody know how to make back-end generate better code
under following conditions:

- 32 bit opearations always sign extend their result into whole 64-bit
result registers.
- conditional branches work only on 64-bit registers
- loads are always sign-extending.

now if we have

int64 a, b;
int32 c, d, f;

c = d + f;
a = b + c;


How to avoid sign_extend before second plus since result of 'addsi3' was
already extended?

Even worse:

int16 *pi, j;
int64 a,b;


j = *pi + 3;
a = b + j;

Doesn't really requires any extensions since *pi already sign extended
target register and we could use same instruction to add 16-bits as for
add 32-bits and result will be 64-bit sign extended in that case.
But I couldn't come up with idea how to teach .md file all that.

Thanks a lot
Igor



More information about the Gcc-help mailing list