This is the mail archive of the gcc-patches@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]

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


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:

Attachment: temp.diff
Description: Binary data



Thanks,
Andrew Pinski

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