[llvm-dev] array fill idioms

Robinson, Paul via llvm-dev llvm-dev at lists.llvm.org
Thu Nov 10 15:02:34 PST 2016


Right, not memcpy/memmove, sorry I should be more careful about that stuff.
REP MOVS looks like the right thing though.  Does LLVM know how to produce that?
Thanks,
--paulr

From: scanon at apple.com [mailto:scanon at apple.com]
Sent: Thursday, November 10, 2016 2:24 PM
To: Robinson, Paul
Cc: Ryan Taylor; Bagel; llvm-dev at lists.llvm.org
Subject: Re: [llvm-dev] array fill idioms

On Nov 10, 2016, at 5:15 PM, Robinson, Paul via llvm-dev <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>> wrote:

Back in the day, we called this a BLT (block transfer, pronouced 'blit') for the PDP-10 instruction of that name.

On x86, there is REP MOVS.


You can do this by assigning the first value, then do an overlapping memcpy to fill in the rest.

This is undefined behavior, and really doesn’t work with most modern memcpy( ) implementations (the most common thing these days is to simply implement memmove( ) semantics for memcpy, which will very much not do what you want).

– Steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20161110/2658be74/attachment.html>


More information about the llvm-dev mailing list