This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Advice needed how to avoid generation of extra sign_extends in .md file
- From: "Igor Shevlyakov" <igor at microunity dot com>
- To: <gcc at gcc dot gnu dot org>, <gcc-help at gcc dot gnu dot org>
- Date: Thu, 3 Oct 2002 18:09:21 -0700
- Subject: Advice needed how to avoid generation of extra sign_extends in .md file
- Organization: Microunity
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