This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]