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]

Re: [Committed] S/390: Remove mem->mem alternative from int mode move patterns


On Dec  9, 2008, "Andrew Pinski" <pinskia@gmail.com> wrote:

> On Tue, Dec 9, 2008 at 1:11 AM, Andreas Krebbel
> <krebbel@linux.vnet.ibm.com> wrote:
>> This never has been a problem so far.  As discussed in the GCC irc
>> channel this is not correct since e.g. a movsi pattern is expected to
>> completely read the source operand before writing anything into the
>> target operand.  This leads to problems when the two operands are
>> overlapping memory locations.  In this case it is incorrect to
>> implement the move with a memcpy instruction copying byte after byte.

> Well memcpy is undefined if the two memory locations overlap.  Only
> memmove is defined if they overlap.  So I don't understand the need
> for change here.

movM is well-defined for overlapping regions, memcpy isn't, so it's
not a good idea to use memcpy to implement movM, unless you know
you're in one of the well-defined cases.

-- 
Alexandre Oliva           http://www.lsd.ic.unicamp.br/~oliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer


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