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 subtracting an unsigned int from an long long


Note this is a totally different patch and should considered independent from the previous one,
they both have similar shape but preform two different functions.



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


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

Currently it produces with -O3:
_a:
        mr r6,r5
        li r5,0
        subfc r4,r4,r6
        subfe r3,r3,r5
        blr
[omni:cmp0/one/te

With the Patch it produces:

_a:
        subf r4,r5,r4
        subfze 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 subtracting an unsigned int
from an long long. (*adddi3_noppc64_disi): New insn for
subtracting an unsigned int from an long long.


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]