[PATCH RS6000 (non ppc64)] add peephole for adding an unsigned int and an long long together

Andrew Pinski pinskia@physics.uc.edu
Tue May 13 00:26:00 GMT 2003


Here is a patch which adds a peephole for adding an unsigned int and an 
long long together on PPC (without -mpowerpc64):

long long a(long long i, unsigned int j)
{
	return i+j;
}

Currently it produces with -O3:
_a:
         mr r6,r5
         li r5,0
         addc r4,r4,r6
         adde r3,r3,r5
         blr

With the Patch it produces:

_a:
         addc r4,r5,r4
         addze r3,r3
         blr

Which is shorter and faster, since it is two instructions instead of 
four.
Note I have only done the WORDS_BIG_ENDIAN version as I have to check 
that
the registers do not overlap.

This has been bootstrapped on ppc-darwin, not tested because of a 
kernel bug in
Mac OS X (I soon will be able to test my changes on ppc-linux-gnu on an 
xersve).


ChangeLog:

2003-05-12  Andrew Pinski  <pinskia@physics.uc.edu>
	* config/rs6000/rs6000.md: New peephole2 for adding unsigned int
	and long long together. (*adddi3_noppc64_disi): New insn for
	adding unsigned int and long long together.

Patch:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: temp.diff
Type: application/octet-stream
Size: 1655 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20030513/7286fca5/attachment.obj>
-------------- next part --------------


Thanks,
Andrew Pinski


More information about the Gcc-patches mailing list